diff --git a/cats.txt b/cats.txt deleted file mode 100644 index 013fcc1..0000000 --- a/cats.txt +++ /dev/null @@ -1,47 +0,0 @@ -Audio - Lossless - Lossy - Audiobooks - Other - -Video - Movies 3D - Movies HD - Movies SD - Series HD - Series SD - Clips - Other - -Porn - Movies 3D - Movies HD - Movies SD - Series HD - Series SD - Clips - Pictures - Other - -Games - PC - MAC - iOS - Android - Consoles - Other - -Applications - Windows - Mac - *nix - iOS - Android - Other - -Other - E-Books - Comics - Pictures - Other - diff --git a/indexer.py b/indexer.py index af4522e..c302593 100644 --- a/indexer.py +++ b/indexer.py @@ -1,53 +1,23 @@ #!/usr/bin/python3 -# vim:ts=2 sw=2 sts=2 noexpandtab -import json, os +#/* vim:set ts=2 set noexpandtab */ from flask import Flask, render_template, url_for, request -from werkzeug import secure_filename - -uploadFolder = "upload" - app = Flask(__name__) -app.config['UPLOAD_FOLDER'] = uploadFolder - -strings = None -settings = None @app.route("/") def index(): - return render_template("search.html", strings=strings) + return render_template("search.html") -@app.route("/categories") +@app.route("/categorys") def categorys(): - return render_template("categories.html", strings=strings) + return render_template("categorys.html") @app.route("/create") def create(): - return render_template("create.html", categories=settings["categories"], strings=strings) + return render_template("create.html") @app.route("/search", methods=['GET']) def search(): - return render_template("result.html", results=request.args.get("q", ""), strings=strings) - -def getLocalString(language, descriptor): - if language in strings.keys(): - if descriptor in strings[language].keys(): - return strings[language][descriptor] - else: - return None - else: - return None - -def init(): - global strings - global settings - with open("strings.json", "r") as strings: - strings = json.load(strings) - with open("settings.json", "r") as settings: - settings = json.load(settings) + return render_template("result.html", results=request.args.get("q", "")) if __name__ == "__main__": - app.jinja_env.globals.update(getLocalString=getLocalString) - app.jinja_env.globals.update(json=json) - init() - print(settings["categories"].keys()) - app.run(debug=True) + app.run(debug=True) diff --git a/settings.json b/settings.json deleted file mode 100644 index dd9b7a3..0000000 --- a/settings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "categories": { - "audio" : [ "lossless", "lossy", "audiobooks", "other" ], - "video" : [ "movies_3d", "movies_4k", "movies_hd", "movies_sd", "series_hd", "series_sd", "clips", "other" ], - "porn" : [ "movies_3d", "movies_4k", "movies_hd", "movies_sd", "series_hd", "series_sd", "clips", "pictures", "other" ], - "games" : [ "pc", "mac", "ios", "android", "consoles", "other" ], - "applications" : [ "windows", "mac", "unix", "ios", "android", "other" ], - "other" : [ "ebooks", "comics", "pictures", "other" ] - } -} diff --git a/static/css/bootstrapshit/bootstrap.css b/static/css/bootstrap.css similarity index 100% rename from static/css/bootstrapshit/bootstrap.css rename to static/css/bootstrap.css diff --git a/static/css/bootstrapshit/style.css b/static/css/bootstrapshit/style.css deleted file mode 100644 index 793b568..0000000 --- a/static/css/bootstrapshit/style.css +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Globals - */ - -/* Links */ -a, -a:focus, -a:hover { - color: #fff; -} - -/* Custom default button */ -.btn-default, -.btn-default:hover, -.btn-default:focus { - color: #333; - text-shadow: none; /* Prevent inheritence from `body` */ - background-color: #fff; - border: 1px solid #fff; -} - - -/* - * Base structure - */ - -html, -body { - height: 100%; - background-color: #333; -} -body { - color: #fff; - text-align: center; - text-shadow: 0 1px 3px rgba(0,0,0,.5); -} - -/* Extra markup and styles for table-esque vertical and horizontal centering */ -.site-wrapper { - display: table; - width: 100%; - height: 100%; /* For at least Firefox */ - min-height: 100%; - -webkit-box-shadow: inset 0 0 100px rgba(0,0,0,.5); - box-shadow: inset 0 0 100px rgba(0,0,0,.5); -} -.site-wrapper-inner { - display: table-cell; - vertical-align: top; -} -.cover-container { - margin-right: auto; - margin-left: auto; -} - -/* Padding for spacing */ -.inner { - padding: 30px; -} - - -/* - * Header - */ -.masthead-brand { - margin-top: 10px; - margin-bottom: 10px; -} - -.masthead-nav > li { - display: inline-block; -} -.masthead-nav > li + li { - margin-left: 20px; -} -.masthead-nav > li > a { - padding-right: 0; - padding-left: 0; - font-size: 16px; - font-weight: bold; - color: #fff; /* IE8 proofing */ - color: rgba(255,255,255,.75); - border-bottom: 2px solid transparent; -} -.masthead-nav > li > a:hover, -.masthead-nav > li > a:focus { - background-color: transparent; - border-bottom-color: #a9a9a9; - border-bottom-color: rgba(255,255,255,.25); -} -.masthead-nav > .active > a, -.masthead-nav > .active > a:hover, -.masthead-nav > .active > a:focus { - color: #fff; - border-bottom-color: #fff; -} - -@media (min-width: 768px) { - .masthead-brand { - float: left; - } - .masthead-nav { - float: right; - } -} - - -/* - * Cover - */ - -.cover { - padding: 20px; -} -.cover .btn-lg { - padding: 10px 20px; - font-weight: bold; -} - - -/* - * Footer - */ - -.mastfoot { - color: #999; /* IE8 proofing */ - color: rgba(255,255,255,.5); -} - - -/* - * Affix and center - */ - -@media (min-width: 768px) { - /* Pull out the header and footer */ - .masthead { - /*position: fixed;*/ - top: 0; - } - .mastfoot { - position: fixed; - bottom: 0; - } - /* Start the vertical centering */ - .site-wrapper-inner { - /*vertical-align: middle;*/ - } - /* Handle the widths */ - .masthead, - .mastfoot, - .cover-container { - width: 100%; /* Must be percentage or pixels for horizontal alignment */ - } -} - -@media (min-width: 992px) { - .masthead, - .mastfoot, - .cover-container { - width: 700px; - } -} - - -.list-group-item { - background-color: #212121; - border: 1px solid #717171; -} diff --git a/static/css/bootstrapshit/search.css b/static/css/search.css similarity index 100% rename from static/css/bootstrapshit/search.css rename to static/css/search.css diff --git a/static/css/style.css b/static/css/style.css index e69de29..2c3df37 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -0,0 +1,163 @@ +/* + * Globals + */ + +/* Links */ +a, +a:focus, +a:hover { + color: #fff; +} + +/* Custom default button */ +.btn-default, +.btn-default:hover, +.btn-default:focus { + color: #333; + text-shadow: none; /* Prevent inheritence from `body` */ + background-color: #fff; + border: 1px solid #fff; +} + + +/* + * Base structure + */ + +html, +body { + height: 100%; + background-color: #333; +} +body { + color: #fff; + text-align: center; + text-shadow: 0 1px 3px rgba(0,0,0,.5); +} + +/* Extra markup and styles for table-esque vertical and horizontal centering */ +.site-wrapper { + display: table; + width: 100%; + height: 100%; /* For at least Firefox */ + min-height: 100%; + -webkit-box-shadow: inset 0 0 100px rgba(0,0,0,.5); + box-shadow: inset 0 0 100px rgba(0,0,0,.5); +} +.site-wrapper-inner { + display: table-cell; + vertical-align: top; +} +.cover-container { + margin-right: auto; + margin-left: auto; +} + +/* Padding for spacing */ +.inner { + padding: 30px; +} + + +/* + * Header + */ +.masthead-brand { + margin-top: 10px; + margin-bottom: 10px; +} + +.masthead-nav > li { + display: inline-block; +} +.masthead-nav > li + li { + margin-left: 20px; +} +.masthead-nav > li > a { + padding-right: 0; + padding-left: 0; + font-size: 16px; + font-weight: bold; + color: #fff; /* IE8 proofing */ + color: rgba(255,255,255,.75); + border-bottom: 2px solid transparent; +} +.masthead-nav > li > a:hover, +.masthead-nav > li > a:focus { + background-color: transparent; + border-bottom-color: #a9a9a9; + border-bottom-color: rgba(255,255,255,.25); +} +.masthead-nav > .active > a, +.masthead-nav > .active > a:hover, +.masthead-nav > .active > a:focus { + color: #fff; + border-bottom-color: #fff; +} + +@media (min-width: 768px) { + .masthead-brand { + float: left; + } + .masthead-nav { + float: right; + } +} + + +/* + * Cover + */ + +.cover { + padding: 20px; +} +.cover .btn-lg { + padding: 10px 20px; + font-weight: bold; +} + + +/* + * Footer + */ + +.mastfoot { + color: #999; /* IE8 proofing */ + color: rgba(255,255,255,.5); +} + + +/* + * Affix and center + */ + +@media (min-width: 768px) { + /* Pull out the header and footer */ + .masthead { + /*position: fixed;*/ + top: 0; + } + .mastfoot { + position: fixed; + bottom: 0; + } + /* Start the vertical centering */ + .site-wrapper-inner { + /*vertical-align: middle;*/ + } + /* Handle the widths */ + .masthead, + .mastfoot, + .cover-container { + width: 100%; /* Must be percentage or pixels for horizontal alignment */ + } +} + +@media (min-width: 992px) { + .masthead, + .mastfoot, + .cover-container { + width: 700px; + } +} diff --git a/static/js/create.js b/static/js/create.js deleted file mode 100644 index 18f3f57..0000000 --- a/static/js/create.js +++ /dev/null @@ -1,50 +0,0 @@ -window.onload = function () { - catList = document.getElementById("categories_list") - categories = sortCategories(global_categories) - for(var key in categories) { - var a = document.createElement("a") - var li = document.createElement("li") - li.setAttribute("role", "presentation") - li.addEventListener("click", function(){fillSubCategorie(this.children[0].text); setDropdownText(this)}) - a.setAttribute("role", "menuitem") - a.tabIndex = "-1" - a.href = "#" - a.innerHTML = getLocalString("english", categories[key]) - li.appendChild(a) - catList.appendChild(li) - a = undefined - li = undefined - } -} - -function sortCategories(categories) { - var sortedCategories = [] - for(var key in categories) { - sortedCategories.push(key) - } - sortedCategories.sort() - return sortedCategories -} - -function setDropdownText(liElement) { - liElement.parentNode.parentNode.childNodes[1].childNodes[0].textContent = liElement.children[0].text + " " -} - -function fillSubCategorie(categorie) { - subCategory = getDescriptorByLocalString("english", categorie) - catList = document.getElementById("subcategory_list") - catList.innerHTML = "" - categories = global_categories[subCategory].sort() - for(var key in categories) { - var a = document.createElement("a") - var li = document.createElement("li") - li.setAttribute("role", "presentation") - li.addEventListener("click", function(){setDropdownText(this)}) - a.setAttribute("role", "menuitem") - a.tabIndex = "-1" - a.href = "#" - a.innerHTML = getLocalString("english", categories[key]) - li.appendChild(a) - catList.appendChild(li) - } -} diff --git a/static/js/main.js b/static/js/main.js deleted file mode 100644 index 0998134..0000000 --- a/static/js/main.js +++ /dev/null @@ -1,16 +0,0 @@ -function getLocalString(language, descriptor){ - if(global_strings[language]){ - return global_strings[language][descriptor] || global_strings["english"][descriptor] || descriptor - } else { - return descriptor - } -} - -function getDescriptorByLocalString(language, localString){ - for(string in global_strings[language]){ - if(global_strings[language][string] == localString){ - return string - } - } - return localString -} diff --git a/strings.json b/strings.json deleted file mode 100644 index 5966f1d..0000000 --- a/strings.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "english" : { - "audio" : "Audio", - "lossless" : "Lossless", - "lossy" : "Lossy", - "audiobooks" : "Audiobooks", - "other" : "Other", - "video" : "Video", - "movies_3d" : "Movies 3D", - "movies_4k" : "Movies 4K", - "movies_hd" : "Movies HD", - "movies_sd" : "Movies SD", - "series_hd" : "Series HD", - "series_sd" : "Series SD", - "clips" : "Clips", - "other" : "Other", - "porn" : "Porn", - "pictures" : "Pictures", - "games" : "Games", - "pc" : "PC", - "mac" : "Mac", - "ios" : "iOS", - "android" : "Android", - "consoles" : "Consoles", - "applications" : "Applications", - "windows" : "Windows", - "unix" : "*nix", - "ebooks" : "E-Books", - "comics" : "Comics", - "please_choose" : "Please choose…", - "search" : "Search", - "categories" : "Categories", - "create" : "Create" - } -} diff --git a/templates/bootstrapshit/create.html b/templates/bootstrapshit/create.html deleted file mode 100644 index 1c5ef4b..0000000 --- a/templates/bootstrapshit/create.html +++ /dev/null @@ -1,44 +0,0 @@ - -{% extends "index.html" %} -{% block title %}{{ super() }} - Create{% endblock%} -{% set active_page = "create" %} -{% block content %} - - -
{{results}}
-{% endblock content%} diff --git a/templates/bootstrapshit/search.html b/templates/bootstrapshit/search.html deleted file mode 100644 index 2ad9088..0000000 --- a/templates/bootstrapshit/search.html +++ /dev/null @@ -1,26 +0,0 @@ - -{% extends "index.html" %} -{% block title %}{{ super() }} - Search{% endblock%} -{% set active_page = "search" %} -{% block content %} - - -CATEGORYS
{% endblock content%} diff --git a/templates/create.html b/templates/create.html index ac15907..22e3c31 100644 --- a/templates/create.html +++ b/templates/create.html @@ -2,12 +2,8 @@ vim: ts=2 noexpandtab --> {% extends "index.html" %} -{% block title %}{{ super() }} - Search{% endblock%} -{% set active_page = "search" %} +{% block title %}{{ super() }} - Create{% endblock%} +{% set active_page = "create" %} {% block content %} - - +CREATE
{% endblock content%} diff --git a/templates/index.html b/templates/index.html index 2e36aad..c456606 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,9 +1,10 @@ -{% set language = "english" -%} - + {% set navigation_bar = [ -("/", "search", getLocalString(language, "search")), - ("/categories", "categories", "Categories"), - ("/create", "create", "Create") + ("/", "search", "Search", "glyphicon-search"), + ("/categorys", "categorys", "Categorys", "glyphicon-th"), + ("/create", "create", "Create", "glyphicon-plus") ] -%} @@ -12,25 +13,41 @@ + +