From 94ba7485c6d47a44ea70361bd24da622287f34e4 Mon Sep 17 00:00:00 2001 From: sqozz Date: Thu, 12 Feb 2015 22:06:31 +0100 Subject: [PATCH] Revert to 71858c6020d75f57d5d10f6617ab610b3846105a --- cats.txt | 47 ----- indexer.py | 44 +---- settings.json | 10 -- static/css/{bootstrapshit => }/bootstrap.css | 0 static/css/bootstrapshit/style.css | 169 ------------------ static/css/{bootstrapshit => }/search.css | 0 static/css/style.css | 163 +++++++++++++++++ static/js/create.js | 50 ------ static/js/main.js | 16 -- strings.json | 35 ---- templates/bootstrapshit/create.html | 44 ----- templates/bootstrapshit/index.html | 57 ------ templates/bootstrapshit/result.html | 9 - templates/bootstrapshit/search.html | 26 --- .../categories.html => categorys.html} | 4 +- templates/create.html | 10 +- templates/index.html | 55 ++++-- templates/result.html | 5 +- templates/search.html | 17 +- 19 files changed, 227 insertions(+), 534 deletions(-) delete mode 100644 cats.txt delete mode 100644 settings.json rename static/css/{bootstrapshit => }/bootstrap.css (100%) delete mode 100644 static/css/bootstrapshit/style.css rename static/css/{bootstrapshit => }/search.css (100%) delete mode 100644 static/js/create.js delete mode 100644 static/js/main.js delete mode 100644 strings.json delete mode 100644 templates/bootstrapshit/create.html delete mode 100644 templates/bootstrapshit/index.html delete mode 100644 templates/bootstrapshit/result.html delete mode 100644 templates/bootstrapshit/search.html rename templates/{bootstrapshit/categories.html => categorys.html} (55%) 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 %} - - -
-

Add new torrent

- -
-{% endblock content%} - diff --git a/templates/bootstrapshit/index.html b/templates/bootstrapshit/index.html deleted file mode 100644 index 7dde050..0000000 --- a/templates/bootstrapshit/index.html +++ /dev/null @@ -1,57 +0,0 @@ - -{% set navigation_bar = [ - ("/", "search", "Search", "glyphicon-search"), - ("/categories", "categories", "Categories", "glyphicon-th"), - ("/create", "create", "Create", "glyphicon-plus") -] -%} - - - - - - - - - - {% block title %}TorrentIndexer{% endblock %} - - - - - - - -
-
-
-
-
-

TorrentIndexer

- -
-
-
- {% block content %}{% endblock %} -
-
-
-
- - - - - diff --git a/templates/bootstrapshit/result.html b/templates/bootstrapshit/result.html deleted file mode 100644 index dbccc72..0000000 --- a/templates/bootstrapshit/result.html +++ /dev/null @@ -1,9 +0,0 @@ - -{% extends "index.html" %} -{% block title %}{{ super() }} - Results{% endblock%} -{% set active_page = "search" %} -{% 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 %} - - -
- -
-
- -
-
-
-{% endblock content%} diff --git a/templates/bootstrapshit/categories.html b/templates/categorys.html similarity index 55% rename from templates/bootstrapshit/categories.html rename to templates/categorys.html index c152e77..3200c46 100644 --- a/templates/bootstrapshit/categories.html +++ b/templates/categorys.html @@ -2,8 +2,8 @@ vim: ts=2 noexpandtab --> {% extends "index.html" %} -{% block title %}{{ super() }} - Categories{% endblock%} -{% set active_page = "categories" %} +{% block title %}{{ super() }} - Categorys{% endblock%} +{% set active_page = "categorys" %} {% 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 @@ + + {% block title %}TorrentIndexer{% endblock %} + - - -
- {% for href, id, caption in navigation_bar %} - {{ caption }} - {% endfor %} +
+
+
+
+
+

TorrentIndexer

+ +
+
+
+ {% block content %}{% endblock %} +
+
+
- {% block content %} - - INDEX - {% endblock %} + + + diff --git a/templates/result.html b/templates/result.html index ccaf287..dbccc72 100644 --- a/templates/result.html +++ b/templates/result.html @@ -2,9 +2,8 @@ vim: ts=2 noexpandtab --> {% extends "index.html" %} -{% block title %}{{ super() }} - Search{% endblock%} +{% block title %}{{ super() }} - Results{% endblock%} {% set active_page = "search" %} {% block content %} - -{{results}} +

{{results}}

{% endblock content%} diff --git a/templates/search.html b/templates/search.html index d8d051d..2ad9088 100644 --- a/templates/search.html +++ b/templates/search.html @@ -7,9 +7,20 @@ vim: ts=2 noexpandtab {% block content %} +
-
- - + +
+ +
+
{% endblock content%}