├── public ├── images │ ├── exit.png │ ├── favicon.ico │ ├── imgnotfound.png │ └── logos │ │ ├── logo.png │ │ ├── logo-comic.png │ │ ├── solid │ │ ├── logo-blue.png │ │ ├── logo-pink.png │ │ ├── logo-red.png │ │ ├── logo-black.png │ │ ├── logo-green.png │ │ ├── logo-purple.png │ │ ├── logo-white.png │ │ └── logo-yellow.png │ │ ├── red │ │ ├── logo-red-blue.png │ │ ├── logo-red-pink.png │ │ ├── logo-red-black.png │ │ ├── logo-red-green.png │ │ ├── logo-red-purple.png │ │ ├── logo-red-white.png │ │ └── logo-red-yellow.png │ │ ├── black │ │ ├── logo-black-red.png │ │ ├── logo-black-blue.png │ │ ├── logo-black-green.png │ │ ├── logo-black-pink.png │ │ ├── logo-black-white.png │ │ ├── logo-black-purple.png │ │ └── logo-black-yellow.png │ │ ├── blue │ │ ├── logo-blue-black.png │ │ ├── logo-blue-green.png │ │ ├── logo-blue-pink.png │ │ ├── logo-blue-red.png │ │ ├── logo-blue-white.png │ │ ├── logo-blue-purple.png │ │ └── logo-blue-yellow.png │ │ ├── green │ │ ├── logo-green-red.png │ │ ├── logo-green-black.png │ │ ├── logo-green-blue.png │ │ ├── logo-green-pink.png │ │ ├── logo-green-white.png │ │ ├── logo-green-purple.png │ │ └── logo-green-yellow.png │ │ ├── pink │ │ ├── logo-pink-black.png │ │ ├── logo-pink-blue.png │ │ ├── logo-pink-green.png │ │ ├── logo-pink-red.png │ │ ├── logo-pink-white.png │ │ ├── logo-pink-purple.png │ │ └── logo-pink-yellow.png │ │ ├── white │ │ ├── logo-white-red.png │ │ ├── logo-white-black.png │ │ ├── logo-white-blue.png │ │ ├── logo-white-green.png │ │ ├── logo-white-pink.png │ │ ├── logo-white-purple.png │ │ └── logo-white-yellow.png │ │ ├── purple │ │ ├── logo-purple-red.png │ │ ├── logo-purple-black.png │ │ ├── logo-purple-blue.png │ │ ├── logo-purple-green.png │ │ ├── logo-purple-pink.png │ │ ├── logo-purple-white.png │ │ └── logo-purple-yellow.png │ │ └── yellow │ │ ├── logo-yellow-red.png │ │ ├── logo-yellow-black.png │ │ ├── logo-yellow-blue.png │ │ ├── logo-yellow-green.png │ │ ├── logo-yellow-pink.png │ │ ├── logo-yellow-purple.png │ │ └── logo-yellow-white.png ├── html │ ├── header.html │ ├── index.html │ ├── read.html │ ├── search.html │ ├── library.html │ └── settings.html ├── css │ └── style.css └── js │ └── jscolor.min.js ├── requirements.txt ├── .gitignore ├── .travis.yml ├── .github ├── ISSUE_TEMPLATE.md └── CONTRIBUTING.md ├── gazee ├── log.py ├── __init__.py ├── versioning.py ├── config.py ├── db.py ├── authmech.py ├── filenameparser.py ├── comicscan.py └── gazee.py ├── README.md ├── Gazee.py └── LICENSE.md /public/images/exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/exit.png -------------------------------------------------------------------------------- /public/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/favicon.ico -------------------------------------------------------------------------------- /public/images/imgnotfound.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/imgnotfound.png -------------------------------------------------------------------------------- /public/images/logos/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/logo.png -------------------------------------------------------------------------------- /public/images/logos/logo-comic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/logo-comic.png -------------------------------------------------------------------------------- /public/images/logos/solid/logo-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/solid/logo-blue.png -------------------------------------------------------------------------------- /public/images/logos/solid/logo-pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/solid/logo-pink.png -------------------------------------------------------------------------------- /public/images/logos/solid/logo-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/solid/logo-red.png -------------------------------------------------------------------------------- /public/images/logos/red/logo-red-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/red/logo-red-blue.png -------------------------------------------------------------------------------- /public/images/logos/red/logo-red-pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/red/logo-red-pink.png -------------------------------------------------------------------------------- /public/images/logos/solid/logo-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/solid/logo-black.png -------------------------------------------------------------------------------- /public/images/logos/solid/logo-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/solid/logo-green.png -------------------------------------------------------------------------------- /public/images/logos/solid/logo-purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/solid/logo-purple.png -------------------------------------------------------------------------------- /public/images/logos/solid/logo-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/solid/logo-white.png -------------------------------------------------------------------------------- /public/images/logos/solid/logo-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/solid/logo-yellow.png -------------------------------------------------------------------------------- /public/images/logos/black/logo-black-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/black/logo-black-red.png -------------------------------------------------------------------------------- /public/images/logos/blue/logo-blue-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/blue/logo-blue-black.png -------------------------------------------------------------------------------- /public/images/logos/blue/logo-blue-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/blue/logo-blue-green.png -------------------------------------------------------------------------------- /public/images/logos/blue/logo-blue-pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/blue/logo-blue-pink.png -------------------------------------------------------------------------------- /public/images/logos/blue/logo-blue-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/blue/logo-blue-red.png -------------------------------------------------------------------------------- /public/images/logos/blue/logo-blue-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/blue/logo-blue-white.png -------------------------------------------------------------------------------- /public/images/logos/green/logo-green-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/green/logo-green-red.png -------------------------------------------------------------------------------- /public/images/logos/pink/logo-pink-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/pink/logo-pink-black.png -------------------------------------------------------------------------------- /public/images/logos/pink/logo-pink-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/pink/logo-pink-blue.png -------------------------------------------------------------------------------- /public/images/logos/pink/logo-pink-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/pink/logo-pink-green.png -------------------------------------------------------------------------------- /public/images/logos/pink/logo-pink-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/pink/logo-pink-red.png -------------------------------------------------------------------------------- /public/images/logos/pink/logo-pink-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/pink/logo-pink-white.png -------------------------------------------------------------------------------- /public/images/logos/red/logo-red-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/red/logo-red-black.png -------------------------------------------------------------------------------- /public/images/logos/red/logo-red-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/red/logo-red-green.png -------------------------------------------------------------------------------- /public/images/logos/red/logo-red-purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/red/logo-red-purple.png -------------------------------------------------------------------------------- /public/images/logos/red/logo-red-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/red/logo-red-white.png -------------------------------------------------------------------------------- /public/images/logos/red/logo-red-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/red/logo-red-yellow.png -------------------------------------------------------------------------------- /public/images/logos/white/logo-white-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/white/logo-white-red.png -------------------------------------------------------------------------------- /public/images/logos/black/logo-black-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/black/logo-black-blue.png -------------------------------------------------------------------------------- /public/images/logos/black/logo-black-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/black/logo-black-green.png -------------------------------------------------------------------------------- /public/images/logos/black/logo-black-pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/black/logo-black-pink.png -------------------------------------------------------------------------------- /public/images/logos/black/logo-black-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/black/logo-black-white.png -------------------------------------------------------------------------------- /public/images/logos/blue/logo-blue-purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/blue/logo-blue-purple.png -------------------------------------------------------------------------------- /public/images/logos/blue/logo-blue-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/blue/logo-blue-yellow.png -------------------------------------------------------------------------------- /public/images/logos/green/logo-green-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/green/logo-green-black.png -------------------------------------------------------------------------------- /public/images/logos/green/logo-green-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/green/logo-green-blue.png -------------------------------------------------------------------------------- /public/images/logos/green/logo-green-pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/green/logo-green-pink.png -------------------------------------------------------------------------------- /public/images/logos/green/logo-green-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/green/logo-green-white.png -------------------------------------------------------------------------------- /public/images/logos/pink/logo-pink-purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/pink/logo-pink-purple.png -------------------------------------------------------------------------------- /public/images/logos/pink/logo-pink-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/pink/logo-pink-yellow.png -------------------------------------------------------------------------------- /public/images/logos/purple/logo-purple-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/purple/logo-purple-red.png -------------------------------------------------------------------------------- /public/images/logos/white/logo-white-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/white/logo-white-black.png -------------------------------------------------------------------------------- /public/images/logos/white/logo-white-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/white/logo-white-blue.png -------------------------------------------------------------------------------- /public/images/logos/white/logo-white-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/white/logo-white-green.png -------------------------------------------------------------------------------- /public/images/logos/white/logo-white-pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/white/logo-white-pink.png -------------------------------------------------------------------------------- /public/images/logos/yellow/logo-yellow-red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/yellow/logo-yellow-red.png -------------------------------------------------------------------------------- /public/images/logos/black/logo-black-purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/black/logo-black-purple.png -------------------------------------------------------------------------------- /public/images/logos/black/logo-black-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/black/logo-black-yellow.png -------------------------------------------------------------------------------- /public/images/logos/green/logo-green-purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/green/logo-green-purple.png -------------------------------------------------------------------------------- /public/images/logos/green/logo-green-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/green/logo-green-yellow.png -------------------------------------------------------------------------------- /public/images/logos/purple/logo-purple-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/purple/logo-purple-black.png -------------------------------------------------------------------------------- /public/images/logos/purple/logo-purple-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/purple/logo-purple-blue.png -------------------------------------------------------------------------------- /public/images/logos/purple/logo-purple-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/purple/logo-purple-green.png -------------------------------------------------------------------------------- /public/images/logos/purple/logo-purple-pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/purple/logo-purple-pink.png -------------------------------------------------------------------------------- /public/images/logos/purple/logo-purple-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/purple/logo-purple-white.png -------------------------------------------------------------------------------- /public/images/logos/purple/logo-purple-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/purple/logo-purple-yellow.png -------------------------------------------------------------------------------- /public/images/logos/white/logo-white-purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/white/logo-white-purple.png -------------------------------------------------------------------------------- /public/images/logos/white/logo-white-yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/white/logo-white-yellow.png -------------------------------------------------------------------------------- /public/images/logos/yellow/logo-yellow-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/yellow/logo-yellow-black.png -------------------------------------------------------------------------------- /public/images/logos/yellow/logo-yellow-blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/yellow/logo-yellow-blue.png -------------------------------------------------------------------------------- /public/images/logos/yellow/logo-yellow-green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/yellow/logo-yellow-green.png -------------------------------------------------------------------------------- /public/images/logos/yellow/logo-yellow-pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/yellow/logo-yellow-pink.png -------------------------------------------------------------------------------- /public/images/logos/yellow/logo-yellow-purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/yellow/logo-yellow-purple.png -------------------------------------------------------------------------------- /public/images/logos/yellow/logo-yellow-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hubbcaps/gazee/HEAD/public/images/logos/yellow/logo-yellow-white.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | CherryPy==11.0.0 2 | Mako==1.0.7 3 | patool==1.12 4 | Pillow==4.2.1 5 | xmltodict==0.11.0 6 | rarfile==3.0 7 | GitPython==2.1.5 8 | portend 9 | cheroot 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | data/* 2 | data/comics/* 3 | data/cache/* 4 | data/sessions/* 5 | data/ssl/* 6 | data/gazee.db 7 | data/gazee.log 8 | data/mylar.db 9 | data/app.bk 10 | data/app.ini 11 | tmp/* 12 | __pycache__/* 13 | *.pyc 14 | ~* 15 | *.swp 16 | .devnotes 17 | .idea/ 18 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: true 2 | dist: trusty 3 | language: python 4 | python: 5 | - 3.4 6 | - 3.5 7 | - 3.6 8 | 9 | install: 10 | - pip install -r requirements.txt 11 | 12 | script: 13 | - python Gazee.py --daemon 14 | 15 | notifications: 16 | irc: "chat.freenode.net#gazee" 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | #### Bug Report 2 | 3 | Browser: What browser are you using to view Gazee? 4 | OS: What OS are you running Gazee on? 5 | Are you on the latest commit version? 6 | 7 | What is the issue and how do you produce it? 8 | 9 | #### Feature Request 10 | 11 | What would you like to see implemented in Gazee? 12 | 13 | Do you have a concrete example of this somewhere else? If so, please link to it. 14 | 15 | #### General Support 16 | 17 | Please explain the issue you might be having or ask a general question on Gazee. 18 | 19 | Browser/OS can be helpful when discussing general issues. 20 | -------------------------------------------------------------------------------- /gazee/log.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import logging.handlers 3 | import os 4 | 5 | 6 | def start(path, verboseon): 7 | 8 | if not os.path.exists(path): 9 | os.makedirs(path) 10 | 11 | logfile = os.path.join(path, 'gazee.log') 12 | number_of_logs = 5 13 | if verboseon: 14 | logging_level = logging.DEBUG 15 | else: 16 | logging_level = logging.INFO 17 | 18 | formatter = logging.Formatter('%(levelname)s %(asctime)s %(name)s.%(funcName)s: %(message)s') 19 | handler = logging.handlers.RotatingFileHandler(logfile, maxBytes=5000000, backupCount=number_of_logs, encoding='utf-8') 20 | handler.setFormatter(formatter) 21 | logger = logging.getLogger() 22 | logger.addHandler(handler) 23 | logger.setLevel(logging_level) 24 | 25 | return 26 | -------------------------------------------------------------------------------- /public/html/header.html: -------------------------------------------------------------------------------- 1 | <%page args="jscolor=False"/> 2 | 3 | Gazee 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | % if jscolor is True: 15 | 16 | % endif 17 | 18 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ### Contributing to Gazee 2 | 3 | There's a not a lot of rules currently. 4 | 5 | 1. If you can make it better, do it. 6 | 7 | This is my first real project, and as such, I'm sure it's currently full of wonkiness and very unpythonic things. If you can do it better, please do so. All contributions, no matter how small are super appreciated. 8 | 9 | 2. Style kind of matters. 10 | 11 | I'd like to adhere to PEP8 as much as possible. I know I'm violating it currently with my constant jumping of styles for variable/function names, but I will eventually sort this to adhere to the guidelines and I expect any new code coming in to adhere to the guidelines. Particularly so my style checker doesn't annoy me as I go to save each file. 12 | 13 | 3. Be nice to other contribuiters. 14 | 15 | If someone else gets to your feature idea fix first or cleans something up you were working on, don't berate them in their PR or issue thread. We're all working for the betterment of the project and for Open Source as a whole. Let's act as a community and support each other. Perhaps your dialogue can reach a better soultion with all of your minds working towards the end goal rather than the means of getting there. 16 | 17 | So far that's it. Pretty simple right? Happy Hacking, and Happy Reading! 18 | -------------------------------------------------------------------------------- /gazee/__init__.py: -------------------------------------------------------------------------------- 1 | # This file is part of Gazee. 2 | # 3 | # Gazee is free software: you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation, either version 3 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # Gazee is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with Gazee. If not, see . 15 | 16 | from gazee.gazee import Gazee 17 | from gazee.comicscan import ComicScanner 18 | import gazee.authmech 19 | import gazee.db 20 | import gazee.config 21 | 22 | __version__ = '0.0.1' 23 | __all__ = ['Gazee', 'ComicScanner'] 24 | 25 | FULL_PATH = "" 26 | DB_NAME = 'gazee.db' 27 | DATA_DIR = 'data' 28 | TEMP_DIR = 'tmp' 29 | PIDFILE = '/tmp/gazee.pid' 30 | 31 | PORT = 4242 32 | COMIC_PATH = '' 33 | COMIC_SCAN_INTERVAL = 60 34 | COMICS_PER_PAGE = 15 35 | MYLAR_DB = '' 36 | SSL_KEY = '' 37 | SSL_CERT = '' 38 | WEB_TEXT_COLOR = 'FFFFFF' 39 | MAIN_COLOR = '757575' 40 | ACCENT_COLOR = 'BDBDBD' 41 | LOGO = 'static/images/logos/red/logo-red-yellow.png' 42 | THUMB_SIZE = 400, 300 43 | LOG_LEVEL = 'logging.INFO' 44 | ARGS = [] 45 | 46 | # Declare DB variables, such as table names and field names 47 | # This is mostly so the names are in a central area for later reference. 48 | 49 | # Directories table, holds all actual directories full paths. We iterate over these in comicscan for their contents and add those to the below Directory Names table with the associated key. 50 | ALL_DIRS = "all_directories" 51 | FULL_DIR_PATH = "full_dir_path" 52 | KEY = "key" 53 | 54 | # Directory Names. This will hold the actual names of directories and their associated parent keys. 55 | DIR_NAMES = "dir_names" 56 | NICE_NAME = "nice_name" 57 | DIR_IMAGE = "dir_image" 58 | PARENT_KEY = "parent_key" 59 | 60 | # Comics table and various attributes we associate with them. 61 | ALL_COMICS = "all_comics" 62 | COMIC_IMAGE = "image" 63 | COMIC_NAME = "name" 64 | COMIC_NUMBER = "issue" 65 | COMIC_VOLUME = "volume" 66 | COMIC_SUMMARY = "summary" 67 | COMIC_FULL_PATH = "path" 68 | INSERT_DATE = "date" 69 | 70 | # Users Table and various attributes. 71 | USERS = "USERS" 72 | USERNAME = "username" 73 | PASSWORD = "password" 74 | TYPE = "type" 75 | -------------------------------------------------------------------------------- /gazee/versioning.py: -------------------------------------------------------------------------------- 1 | # This file is part of Gazee. 2 | # 3 | # Gazee is free software: you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation, either version 3 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # Gazee is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with Gazee. If not, see . 15 | 16 | import os 17 | import logging 18 | import git 19 | 20 | import gazee 21 | 22 | logging = logging.getLogger(__name__) 23 | 24 | 25 | def current_version(): 26 | repo = git.Repo(os.path.dirname(gazee.FULL_PATH)) 27 | local_commit = repo.commit() 28 | return local_commit.hexsha 29 | 30 | 31 | def latest_version(): 32 | repo = git.Repo(os.path.dirname(gazee.FULL_PATH)) 33 | remote = repo.remotes.origin 34 | try: 35 | info = remote.fetch()[0] 36 | remote_commit = info.commit 37 | return remote_commit.hexsha 38 | except git.exc.GitCommandError: 39 | return 'Unknown' 40 | 41 | def update_app(): 42 | current_commit = current_version() 43 | latest_commit = latest_version() 44 | 45 | if current_commit == latest_commit: 46 | logging.info("No update needed") 47 | return False 48 | 49 | if current_commit != latest_commit: 50 | logging.info("Updated Needed") 51 | 52 | os.rename('public/css/style.css', 'public/css/style.css.bak') 53 | 54 | repo = git.Repo(os.path.dirname(gazee.FULL_PATH)) 55 | o = repo.remotes.origin 56 | try: 57 | o.pull() 58 | except git.exc.GitCommandError: 59 | logging.exception('Failed to pull version') 60 | os.rename('public/css/style.css.bak', 'public/css/style.css') 61 | return False 62 | 63 | if os.path.exists('public/css/style.css'): 64 | with open('public/css/style.css', 'r+') as f: 65 | style = f.read() 66 | f.seek(0) 67 | style = style.replace("757575", gazee.MAIN_COLOR) 68 | style = style.replace("BDBDBD", gazee.ACCENT_COLOR) 69 | style = style.replace("FFFFFF", gazee.WEB_TEXT_COLOR) 70 | f.write(style) 71 | f.truncate() 72 | 73 | os.remove('public/css/style.css.bak') 74 | else: 75 | os.rename('public/css/style.css.bak', 'public/css/style.css') 76 | 77 | logging.info("Update Pulled") 78 | return True 79 | -------------------------------------------------------------------------------- /gazee/config.py: -------------------------------------------------------------------------------- 1 | import os 2 | import configparser 3 | 4 | import gazee 5 | 6 | 7 | def config_read(): 8 | if not os.path.exists(os.path.join(gazee.DATA_DIR, 'app.ini')): 9 | with open(os.path.join(gazee.DATA_DIR, 'app.ini'), 'a') as cf: 10 | cf.write("[GLOBAL]\n") 11 | cf.write("port = 4242\n") 12 | cf.write("comic_path =\n") 13 | cf.write("comic_scan_interval = 60\n") 14 | cf.write("comics_per_page = 15\n") 15 | cf.write("mylar_db =\n") 16 | cf.write("ssl_key =\n") 17 | cf.write("ssl_cert =\n") 18 | cf.write("web_text_color = FFFFFF\n") 19 | cf.write("main_color = 757575\n") 20 | cf.write("accent_color = BDBDBD\n") 21 | cf.write("logo = static/images/logos/red/logo-red-yellow.png\n") 22 | 23 | config = configparser.ConfigParser() 24 | config.read(os.path.join(gazee.DATA_DIR, 'app.ini')) 25 | 26 | config_errors = [] 27 | try: 28 | gazee.PORT = int(config['GLOBAL']['PORT']) 29 | except: 30 | config_errors.append("port = 4242") 31 | 32 | try: 33 | gazee.COMIC_PATH = config['GLOBAL']['COMIC_PATH'] 34 | except: 35 | config_errors.append("comic_path =") 36 | 37 | try: 38 | gazee.COMIC_SCAN_INTERVAL = config['GLOBAL']['COMIC_SCAN_INTERVAL'] 39 | except: 40 | config_errors.append("comic_scan_interval = 60") 41 | 42 | try: 43 | gazee.COMICS_PER_PAGE = int(config['GLOBAL']['COMICS_PER_PAGE']) 44 | except: 45 | config_errors.append("comics_per_page = 15") 46 | 47 | try: 48 | gazee.MYLAR_DB = config['GLOBAL']['MYLAR_DB'] 49 | except: 50 | config_errors.append("mylar_db =") 51 | 52 | try: 53 | gazee.SSL_KEY = config['GLOBAL']['SSL_KEY'] 54 | except: 55 | config_errors.append("ssl_key =") 56 | 57 | try: 58 | gazee.SSL_CERT = config['GLOBAL']['SSL_CERT'] 59 | except: 60 | config_errors.append("ssl_cert =") 61 | 62 | try: 63 | gazee.WEB_TEXT_COLOR = config['GLOBAL']['WEB_TEXT_COLOR'] 64 | except: 65 | config_errors.append("web_text_color = FFFFFF") 66 | 67 | try: 68 | gazee.MAIN_COLOR = config['GLOBAL']['MAIN_COLOR'] 69 | except: 70 | config_errors.append("main_color = 757575") 71 | 72 | try: 73 | gazee.ACCENT_COLOR = config['GLOBAL']['ACCENT_COLOR'] 74 | except: 75 | config_errors.append("accent_color = BDBDBD") 76 | 77 | try: 78 | gazee.LOGO = config['GLOBAL']['LOGO'] 79 | except: 80 | config_errors.append("logo = static/images/logos/red/logo-red-yellow.png") 81 | 82 | if len(config_errors) > 0: 83 | with open(os.path.join(gazee.DATA_DIR, 'app.ini'), 'a') as cf: 84 | cf.write("\n".join(config_errors) + "\n") 85 | 86 | return 87 | -------------------------------------------------------------------------------- /gazee/db.py: -------------------------------------------------------------------------------- 1 | import os 2 | import logging 3 | import sqlite3 4 | 5 | import gazee 6 | 7 | from pathlib import Path 8 | 9 | logging = logging.getLogger(__name__) 10 | 11 | 12 | def db_creation(): 13 | 14 | # Create DB if it doesn't already exist. 15 | db = Path(os.path.join(gazee.DATA_DIR, gazee.DB_NAME)) 16 | if not db.is_file(): 17 | connection = sqlite3.connect(str(db)) 18 | c = connection.cursor() 19 | 20 | # Create the Directories table. 21 | c.execute('CREATE TABLE {tn} ({nf} {ft} PRIMARY KEY)'.format(tn=gazee.ALL_DIRS, nf=gazee.KEY, ft="INTEGER")) 22 | c.execute("ALTER TABLE {tn} ADD COLUMN '{cn}' {ft}".format(tn=gazee.ALL_DIRS, cn=gazee.FULL_DIR_PATH, ft="TEXT")) 23 | 24 | # Create the Directory table. 25 | c.execute('CREATE TABLE {tn} ({nf} {ft})'.format(tn=gazee.DIR_NAMES, nf=gazee.NICE_NAME, ft="TEXT")) 26 | c.execute("ALTER TABLE {tn} ADD COLUMN '{cn}' {ft}".format(tn=gazee.DIR_NAMES, cn=gazee.DIR_IMAGE, ft="TEXT")) 27 | c.execute("ALTER TABLE {tn} ADD COLUMN '{cn}' {ft}".format(tn=gazee.DIR_NAMES, cn=gazee.PARENT_KEY, ft="INTEGER")) 28 | 29 | # Create Comics table and necessary columns. 30 | c.execute('CREATE TABLE {tn} ({nf} {ft} PRIMARY KEY)'.format(tn=gazee.ALL_COMICS, nf=gazee.KEY, ft="INTEGER")) 31 | c.execute("ALTER TABLE {tn} ADD COLUMN '{cn}' {ft}".format(tn=gazee.ALL_COMICS, cn=gazee.COMIC_NAME, ft="TEXT")) 32 | c.execute("ALTER TABLE {tn} ADD COLUMN '{cn}' {ft}".format(tn=gazee.ALL_COMICS, cn=gazee.COMIC_IMAGE, ft="TEXT")) 33 | c.execute("ALTER TABLE {tn} ADD COLUMN '{cn}' {ft}".format(tn=gazee.ALL_COMICS, cn=gazee.COMIC_NUMBER, ft="INTEGER")) 34 | c.execute("ALTER TABLE {tn} ADD COLUMN '{cn}' {ft}".format(tn=gazee.ALL_COMICS, cn=gazee.COMIC_VOLUME, ft="INTEGER")) 35 | c.execute("ALTER TABLE {tn} ADD COLUMN '{cn}' {ft}".format(tn=gazee.ALL_COMICS, cn=gazee.COMIC_SUMMARY, ft="TEXT")) 36 | c.execute("ALTER TABLE {tn} ADD COLUMN '{cn}' {ft}".format(tn=gazee.ALL_COMICS, cn=gazee.COMIC_FULL_PATH, ft="TEXT")) 37 | c.execute("ALTER TABLE {tn} ADD COLUMN '{cn}' {ft}".format(tn=gazee.ALL_COMICS, cn=gazee.PARENT_KEY, ft="INTEGER")) 38 | c.execute("ALTER TABLE {tn} ADD COLUMN '{cn}'".format(tn=gazee.ALL_COMICS, cn=gazee.INSERT_DATE)) 39 | 40 | # Create Users colume and necessary columns. 41 | c.execute('CREATE TABLE {tn} ({nf} {ft} PRIMARY KEY)'.format(tn=gazee.USERS, nf=gazee.USERNAME, ft="TEXT")) 42 | c.execute("ALTER TABLE {tn} ADD COLUMN '{cn}' {ft}".format(tn=gazee.USERS, cn=gazee.PASSWORD, ft="TEXT")) 43 | c.execute("ALTER TABLE {tn} ADD COLUMN '{cn}' {ft}".format(tn=gazee.USERS, cn=gazee.TYPE, ft="TEXT")) 44 | 45 | connection.commit() 46 | connection.close() 47 | logging.info("DB Schema Created") 48 | 49 | # Insert Admin user into DB if they aren't already there. 50 | connection = sqlite3.connect(str(db)) 51 | c = connection.cursor() 52 | 53 | c.execute('SELECT ({cn}) FROM {tn}'.format(cn=gazee.USERNAME, tn=gazee.USERS)) 54 | all_users = c.fetchall() 55 | 56 | # Since queries return lists of tuples, we have to iterate those. We can use list comprehension here to iterate through the items in the first element of each tuple in the list. If the adminCheck variable is larger than 0, the admin has already been created, or something has gone horribly wrong. 57 | adminCheck = [tup[0] for tup in all_users] 58 | 59 | if len(adminCheck) == 0: 60 | c.execute('INSERT INTO {tn} ({cn1}, {cn2}, {cn3}) VALUES ("admin", "87f69abe62021d9ab8497e052c65ee79ca6705169916b930ea3e6979a0555c4d", "admin")'.format(tn=gazee.USERS, cn1=gazee.USERNAME, cn2=gazee.PASSWORD, cn3=gazee.TYPE)) 61 | logging.info("Admin inserted into DB") 62 | 63 | connection.commit() 64 | connection.close() 65 | return 66 | -------------------------------------------------------------------------------- /gazee/authmech.py: -------------------------------------------------------------------------------- 1 | # This file is part of Gazee. 2 | # 3 | # Gazee is free software: you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation, either version 3 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # Gazee is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with Gazee. If not, see . 15 | 16 | import os 17 | import sqlite3 18 | import hashlib 19 | import logging 20 | 21 | from pathlib import Path 22 | 23 | import gazee 24 | 25 | logging = logging.getLogger(__name__) 26 | 27 | 28 | # This is the function called when a user logs in, it's given a realm (Gazee) and the user inputted username and password 29 | # We get the hashed password from the DB for username and then check that against the hashed version of the inputted password 30 | def check_password(realm, username, password): 31 | 32 | userstring = str(username) 33 | 34 | # Here we set the db file path. 35 | db = Path(os.path.join(gazee.DATA_DIR, gazee.DB_NAME)) 36 | 37 | # Here we make the inital DB connection that we will be using throughout this function. 38 | connection = sqlite3.connect(str(db)) 39 | c = connection.cursor() 40 | 41 | c.execute('SELECT {pw} FROM {tn} WHERE {un}=?'.format(pw=gazee.PASSWORD, tn=gazee.USERS, un=gazee.USERNAME), (userstring,)) 42 | passinit = c.fetchone() 43 | if passinit is None: 44 | return False 45 | 46 | db_password = passinit[0] 47 | connection.commit() 48 | connection.close() 49 | 50 | return db_password == hash_pass(password) 51 | 52 | 53 | def get_user_level(username): 54 | 55 | db = Path(os.path.join(gazee.DATA_DIR, gazee.DB_NAME)) 56 | 57 | # Here we make the inital DB connection that we will be using throughout this function. 58 | connection = sqlite3.connect(str(db)) 59 | c = connection.cursor() 60 | 61 | c.execute('SELECT {ut} FROM {tn} WHERE {un}=?'.format(ut=gazee.TYPE, tn=gazee.USERS, un=gazee.USERNAME), (username,)) 62 | levelinit = c.fetchone() 63 | 64 | if levelinit is not None: 65 | userlevel = levelinit[0] 66 | else: 67 | userlevel = 'user' 68 | 69 | connection.commit() 70 | connection.close() 71 | 72 | return userlevel 73 | 74 | 75 | def hash_pass(password): 76 | hashed_pass = hashlib.sha256(bytes(password, encoding='utf-8')).hexdigest() 77 | return hashed_pass 78 | 79 | 80 | # This simply updates the currently logged in users password in the DB to their set and hashed password. 81 | def change_pass(user, password): 82 | hashed_pass = hash_pass(password) 83 | 84 | # Here we set the db file path. 85 | db = Path(os.path.join(gazee.DATA_DIR, gazee.DB_NAME)) 86 | 87 | # Here we make the inital DB connection that we will be using throughout this function. 88 | connection = sqlite3.connect(str(db)) 89 | c = connection.cursor() 90 | 91 | c.execute('UPDATE {tn} SET {pw}=? WHERE {un}=?'.format(tn=gazee.USERS, pw=gazee.PASSWORD, un=gazee.USERNAME), (hashed_pass, user,)) 92 | 93 | connection.commit() 94 | connection.close() 95 | 96 | logging.info("Password Updated") 97 | return 98 | 99 | 100 | def add_user(user, password, ut): 101 | hashed_pass = hash_pass(password) 102 | 103 | # Here we set the db file path. 104 | db = Path(os.path.join(gazee.DATA_DIR, gazee.DB_NAME)) 105 | 106 | # Here we make the inital DB connection that we will be using throughout this function. 107 | connection = sqlite3.connect(str(db)) 108 | c = connection.cursor() 109 | try: 110 | c.execute('INSERT INTO {tn} ({un}, {pw}, {ut}) VALUES (?,?,?)'.format(tn=gazee.USERS, un=gazee.USERNAME, pw=gazee.PASSWORD, ut=gazee.TYPE), (user, hashed_pass, ut,)) 111 | except sqlite3.IntegrityError: 112 | logging.info("User %s Already Exists" % user) 113 | return False 114 | finally: 115 | connection.commit() 116 | connection.close() 117 | 118 | logging.info("User %s Added" % (user)) 119 | return True 120 | -------------------------------------------------------------------------------- /public/html/index.html: -------------------------------------------------------------------------------- 1 | <%! 2 | import gazee, os 3 | %> 4 | 5 | 6 | <%include file="header.html"/> 7 | 8 | 9 |
10 | 15 | 36 |
37 | 38 |
39 | % if num_of_pages != 1: 40 | 50 | % endif 51 |

Recent Comics

52 |
53 | % for comic in comics: 54 |
55 |
56 |
57 | 58 |
59 |
60 | ${comic['ComicName']} ${comic['ComicIssue']} 61 |
62 |
63 |
64 | info 65 | file_download 66 |
67 |
68 |
69 | 70 | close 71 | 72 |

${comic['ComicSummary']}

73 |
74 |
75 |
76 | % endfor 77 |
78 | % if num_of_pages != 1: 79 | 89 | % endif 90 |
91 | 92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 | 101 | 109 | 110 | 111 | 112 | -------------------------------------------------------------------------------- /public/html/read.html: -------------------------------------------------------------------------------- 1 | <%! 2 | import gazee 3 | %> 4 | <% 5 | now_page = pages[current_page] 6 | %> 7 | 8 | 9 | <%include file="header.html" /> 10 | 11 | 12 |
13 | % if (current_page + 1) == 1: 14 | help_outline 15 | % endif 16 |
17 |
18 |
19 | 20 | 23 | 24 |
25 |
26 | 27 | 45 | 46 |
47 |
48 | 49 | 50 | 51 |
52 |
53 |
54 |
55 | % if size == "wide": 56 | 57 | % elif size == "high": 58 | 59 | % elif size == "norm": 60 | 61 | % else: 62 | 63 | % endif: 64 |
65 |
66 | 67 | 68 | 115 | 116 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Gazee](/public/images/logos/red/logo-red-yellow.png) 2 | 3 | [![Build Status](https://travis-ci.org/hubbcaps/gazee.svg?branch=master)](https://travis-ci.org/hubbcaps/gazee) 4 | 5 | # This Project is currently no longer in development. Life took over and I didn't have the motivation to continue. 6 | # If you'd like to take over development, feel free to fork and run with it. 7 | # The main thing it needs currently is an ORM to replace all the hardcoded DB interactions. 8 | 9 | # I highly suggest taking a look at [Codex](https://github.com/ajslater/codex), this application is in current development and does everything I wanted Gazee to be and more. 10 | 11 | Gazee is a comic viewer for the web browser. 12 | 13 | Read and reach your favorite digital comics from almost any web connected device. 14 | 15 | Works great with [Mylar](https://github.com/evilhero/mylar) comic book management, but not needed. 16 | 17 | Check out [the Wiki](https://github.com/hubbcaps/gazee/wiki) for detailed instructions on setup if you need them. 18 | 19 | Questions can also be asked in the #gazee channel on Freenode 20 | 21 | ## Features 22 | 23 | Recent Comics 24 | ![screen01](https://i.imgur.com/WiqlTSV.png) 25 | 26 | Exposes your sorting structure in a library view 27 | ![screen02](https://i.imgur.com/NNn17XR.png) 28 | Download your issue if you have a preferred reader outside of Gazee and read a summary of the issue in line if available with your archive 29 | ![screen03](https://i.imgur.com/EbnpMZS.png) 30 | 31 | Make Gazee yours and change up the color scheme 32 | ![screen04](https://i.imgur.com/OyFsZqE.png) 33 | ![screen05](https://i.imgur.com/VkhRvid.png) 34 | 35 | Now with logo changer 36 | ![screen06](http://i.imgur.com/iIoyalA.gif) 37 | 38 | Settings overlay to make the comic feel how you want it. 39 | ![screen06](https://i.imgur.com/nE3k7j8.png) 40 | 41 | HTTPS Support 42 | 43 | Bookmarks remember where you left off as you read. 44 | 45 | Multiple Users and Admins 46 | 47 | Much more to come! 48 | 49 | ## Requirements 50 | * Python 3.4+ 51 | * CherryPy 52 | * Mako 53 | * xmltodict 54 | * Pillow 55 | * rarfile 56 | * GitPython 57 | 58 | Requirements can be installed easily in the setup section below. 59 | 60 | #### Unrar Downloads 61 | 62 | Unrar needs to be installed and visible in the path of the user Gazee is running under to be able to properly extract all CBRs. 63 | 64 | Double check this on Windows, different systems have different requirements for making sure you have unrar visbile in your users path. 65 | 66 | [Unrar for Windows](http://www.rarlab.com/rar_add.htm), windows also needs command line accessible Git installed, gone over in the [install guide on the wiki](https://github.com/hubbcaps/gazee/wiki/Windows-Install-Guide) 67 | 68 | [Centos](https://www.rpmfind.net/linux/rpm2html/search.php?query=unrar) needs Unrar from RPMFusion, not Offical/EPEL unar application. unar is out of date and will fail with certain types of cbrs and other rar archives. 69 | 70 | [Debian](https://packages.debian.org/jessie/unrar) 71 | 72 | ## Setup 73 | 74 | **Step 1: Clone the repository and install python dependencies** 75 | 76 | cd 77 | git clone https://github.com/hubbcaps/gazee.git 78 | cd gazee 79 | sudo pip install -r requirements.txt 80 | python Gazee.py 81 | 82 | **Note** 83 | If you see an error similar to the following 84 | 85 | $ python Gazee.py 86 | File "Gazee.py", line 194 87 | cherrypy.engine.timeout_monitor.on: False 88 | ^ 89 | SyntaxError: invalid syntax 90 | 91 | This likely means your systems default version of python is 2.x. Verify you have python 3.4+ installed and call it explicitly with python3 or python3.x 92 | 93 | python3 Gazee.py 94 | 95 | **Step 2: Logon to Gazee's Web UI**) 96 | 97 | Go to **http://your-ip:4242** 98 | 99 | Default username and password for the web interface: 100 | 101 | * **Username:** `admin` 102 | * **Password:** `gazee` 103 | 104 | Proceed to the settings page and change your admin pass, and enter the path to your comic library and optionally your Mylar DB for better comic info extraction. 105 | 106 | ### Daemonize (Linux only) 107 | 108 | You can easily run the program in Daemon mode by using the -d flag 109 | 110 | python Gazee.py -d 111 | 112 | ## Docker Container 113 | 114 | Alternatively, instead of doing a local install, you can install the docker container. 115 | 116 | The docket container can be pulled from [here](https://github.com/hubbcaps/docker-gazee) or from [dockerhub](https://hub.docker.com/r/hubcapps/gazee/). 117 | 118 | ### QOL Features on the Roadmap 119 | 120 | These are features that will make Gazee better and more up to par in what should be expected of a modern comic reader, but aren't needed for actual usability. 121 | 122 | - [ ] Random First Issue of a series in library. 123 | - [ ] OPDS Support. 124 | - [ ] User set image sizes. 125 | - [ ] Notifications on new comics 126 | - [ ] Reports on various stats of your library; number of bad archives, comics without metadata, etc etc 127 | -------------------------------------------------------------------------------- /public/html/search.html: -------------------------------------------------------------------------------- 1 | <%! 2 | import gazee, os 3 | %> 4 | 5 | 6 | 7 | <%include file="header.html"/> 8 | 9 | 10 | 11 |
12 | 17 | 38 |
39 | 40 |
41 | % if num_of_pages != 1: 42 | 52 | % endif 53 |

    Search Results

54 |
55 | % for comic in comics: 56 |
57 |
58 |
59 | 60 |
61 |
62 |

${comic['ComicName']} ${comic['ComicIssue']}

63 |
64 |
65 |
66 | info 67 | file_download 68 |
69 |
70 |
71 | 72 | close 73 | 74 |

${comic['ComicSummary']}

75 |
76 |
77 |
78 | % endfor 79 |
80 | 81 | % if num_of_pages != 1: 82 | 92 | % endif 93 |
94 | 95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 | 104 | 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /public/html/library.html: -------------------------------------------------------------------------------- 1 | <%! 2 | import gazee, os 3 | %> 4 | 5 | 6 | <%include file="header.html"/> 7 | 8 | 9 |
10 | 15 | 16 | 36 | 37 |
38 | 39 |
40 | % if num_of_pages != 1: 41 | 51 | % endif 52 |

    Library

53 |
54 |
55 | Comics 56 | %if parent_dir != '': 57 | ${parent_dir} 58 | %endif 59 | %if current_dir != gazee.COMIC_PATH: 60 | ${current_dir} 61 | %endif 62 |
63 |
64 |
65 | % if current_page == 1: 66 | % for directory in directories: 67 |
68 |
69 |
70 | 71 |
72 | 75 |
76 |
77 | % endfor 78 | % endif 79 | % for comic in comics: 80 |
81 |
82 |
83 | 84 |
85 |
86 |

${comic['ComicName']} ${comic['ComicIssue']} 87 |

88 |
89 |
90 | info 91 | file_download 92 |
93 |
94 |
95 | 96 | close 97 | 98 |

${comic['ComicSummary']}

99 |
100 |
101 |
102 | % endfor 103 |
104 | 105 | % if num_of_pages != 1: 106 | 116 | % endif 117 |
118 | 119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 | 128 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /public/css/style.css: -------------------------------------------------------------------------------- 1 | html { 2 | } 3 | header, 4 | main, 5 | footer { 6 | background: #757575; 7 | } 8 | body { 9 | color: #FFFFFF; 10 | background: #757575; 11 | } 12 | #breadcrumbs { 13 | top: 0; 14 | background: #BDBDBD; 15 | } 16 | #comic-info { 17 | display: inline; 18 | } 19 | #dash_dashboard { 20 | padding-left: 8px; 21 | display: inline-block; 22 | } 23 | #dash_library { 24 | padding-left: 8px; 25 | display: inline-block; 26 | } 27 | #dash_settings { 28 | padding-left: 8px; 29 | display: inline-block; 30 | } 31 | #directory-card-content { 32 | display:flex; 33 | color: #FFFFFF; 34 | background-color: #BDBDBD; 35 | text-position: center; 36 | } 37 | #footer { 38 | background: #757575; 39 | } 40 | #theme-settings .dropdown-content li>a, .dropdown-content li>span, .select-dropdown li.disabled, .select-dropdown li.disabled>span, .select-dropdown li.optgroup { 41 | background: #757575; 42 | color: #FFFFFF; 43 | } 44 | #log-modal { 45 | background: #BDBDBD; 46 | color: #FFFFFF; 47 | width: 100%; 48 | height: 100%; 49 | } 50 | #logo-wrapper { 51 | background: #757575; 52 | } 53 | i { 54 | color: #FFFFFF; 55 | } 56 | #nav-dropdown { 57 | background-color: #BDBDBD; 58 | } 59 | #nav-dropdown a { 60 | color: #FFFFFF; 61 | } 62 | #page-settings-text { 63 | color: #FFFFFF; 64 | } 65 | #page-settings-right-text i { 66 | color: #FFFFFF; 67 | } 68 | #page-settings-left-text i { 69 | color: #FFFFFF; 70 | } 71 | #pagination-num a { 72 | color: #FFFFFF; 73 | } 74 | #pagination-num.active { 75 | background-color: #BDBDBD; 76 | } 77 | #read-link { 78 | color: #FFFFFF; 79 | } 80 | #search-modal { 81 | background: #BDBDBD; 82 | color: #FFFFFF; 83 | } 84 | #search-modal input { 85 | margin: 0 auto; 86 | } 87 | #settings-arrow { 88 | color: #BDBDBD; 89 | } 90 | #settings-button { 91 | background: #BDBDBD; 92 | color: #FFFFFF; 93 | } 94 | #settings-help { 95 | position: absolute; 96 | z-index:5000; 97 | color: #FFFFFF; 98 | background: #BDBDBD; 99 | } 100 | #size-height-button { 101 | background: #BDBDBD; 102 | color: #FFFFFF; 103 | } 104 | #size-width-button { 105 | background: #BDBDBD; 106 | color: #FFFFFF; 107 | } 108 | #size-normal-button { 109 | background: #BDBDBD; 110 | color: #FFFFFF; 111 | } 112 | #summary-pane { 113 | background: #BDBDBD; 114 | color: #FFFFFF; 115 | } 116 | #tab-row { 117 | background: #757575; 118 | color: #FFFFFF; 119 | } 120 | .btn-flat { 121 | background: #BDBDBD; 122 | color: #FFFFFF; 123 | } 124 | .card { 125 | position: relative; 126 | background-color: #BDBDBD; 127 | box-shadow: 1px 1px 10px 1px rgba(0, 0, 0, 0.7); 128 | } 129 | .card-image { 130 | position: relative; 131 | height: 350px; 132 | overflow: hidden; 133 | } 134 | .card-image img { 135 | position: absolute; 136 | height: 100%; 137 | width: 100%; 138 | top: 0; 139 | bottom: 0; 140 | left: 0; 141 | right: 0; 142 | } 143 | .card-content { 144 | height: auto; 145 | background: #BDBDBD; 146 | color: #FFFFFF; 147 | text-align: center; 148 | } 149 | .card-content a { 150 | color: #FFFFFF; 151 | } 152 | .center-cols > .col { 153 | float:none; /* disable the float */ 154 | display: inline-block; /* make blocks inline-block */ 155 | text-align: initial; /* restore text-align to default */ 156 | vertical-align: top; 157 | } 158 | .dimmed { 159 | background-color: rgba(0, 0, 0, 0.7); 160 | } 161 | .dropdown-button { 162 | background-color: #BDBDBD; 163 | color: #FFFFFF; 164 | } 165 | .input-field { 166 | color: #FFFFFF; 167 | } 168 | .input-field label { 169 | color: #FFFFFF; 170 | } 171 | .input-field input[type=text]:focus + label { 172 | color: #FFFFFF; 173 | } 174 | .input-field input[type=text]:focus { 175 | border-bottom: 1px solid #FFFFFF; 176 | box-shadow: 0 1px 0 0 #FFFFFF; 177 | } 178 | .input-field input[type=password]:focus + label { 179 | color: #FFFFFF; 180 | } 181 | .input-field input[type=password]:focus { 182 | border-bottom: 1px solid #FFFFFF; 183 | box-shadow: 0 1px 0 0 #FFFFFF; 184 | } 185 | .nav-wrapper .input-field input[type="search"] { 186 | height: auto; 187 | color: #FFFFFF; 188 | background: #BDBDBD; 189 | } 190 | .nav-wrapper .input-field input[type="search"]:focus { 191 | background: #BDBDBD; 192 | color: #FFFFFF; 193 | box-shadow: 0 1px 0 0 #BDBDBD; 194 | } 195 | .nav-wrapper .input-field input[type="search"]:focus ~ .material-icons.icon-close { 196 | right: 2rem; 197 | } 198 | .nav-wrapper .dropdown-button { 199 | position:absolute; 200 | left: 0; 201 | top: 0; 202 | } 203 | .overlay-settings { 204 | position: fixed; 205 | width: 100%; 206 | background-color: rgba(0, 0, 0, 0); 207 | color: #000; 208 | z-index:4000; 209 | min-height: 1px; 210 | } 211 | .overlay-settings-text { 212 | color: #FFFFFF; 213 | height: 900px; 214 | line-height: 900px; 215 | text-align: center; 216 | } 217 | .page-left { 218 | position: fixed; 219 | left: 0px; 220 | top: 0px; 221 | height: 100%; 222 | width: 33.33%; 223 | } 224 | .page-settings { 225 | position: fixed; 226 | left: 33.33%; 227 | top: 0px; 228 | height: 100%; 229 | width: 33.33%; 230 | } 231 | .page-right { 232 | position: fixed; 233 | right: 0px; 234 | top: 0px; 235 | height: 100%; 236 | width: 33.33%; 237 | } 238 | .reader-overlay { 239 | position: absolute; 240 | background-color:#757575; 241 | width:100%; 242 | height:100%; 243 | top:0px; 244 | left:0px; 245 | z-index:1000; 246 | max-width:100%; 247 | } 248 | .reader-page-wide { 249 | width:100%; 250 | } 251 | .reader-page-high { 252 | position: absolute; 253 | margin: auto; 254 | top: 0px; 255 | bottom: 0px; 256 | left: 0; 257 | right: 0; 258 | height: 100%; 259 | max-width:100%; 260 | } 261 | .reader-page-norm { 262 | position: absolute; 263 | margin-left: auto; 264 | margin-right: auto; 265 | top: 0px; 266 | bottom: 0px; 267 | left: 0; 268 | right: 0; 269 | max-width:100%; 270 | } 271 | .settings-span-left { 272 | display: inline-block; 273 | left: 0px; 274 | vertical-align: middle; 275 | line-height: normal; 276 | } 277 | .settings-span-center { 278 | display: inline-block; 279 | text-align: center; 280 | vertical-align: middle; 281 | line-height: normal; 282 | } 283 | .settings-span-right { 284 | display: inline-block; 285 | right: 0px; 286 | vertical-align: middle; 287 | line-height: normal; 288 | } 289 | .tabs .tab a { 290 | background: #757575; 291 | color: #FFFFFF; 292 | } 293 | .tabs .tab a:hover { 294 | color: #BDBDBD; 295 | } 296 | .tabs .indicator { 297 | background-color: #FFFFFF; 298 | } 299 | 300 | @media only screen and (min-width : 601px) and (max-width : 1260px) { 301 | .toast { 302 | border-radius: 0; 303 | } 304 | } 305 | 306 | @media only screen and (min-width : 1261px) { 307 | .toast { 308 | border-radius: 0; 309 | } 310 | } 311 | 312 | @media only screen and (min-width : 601px) and (max-width : 1260px) { 313 | #toast-container { 314 | bottom: 0; 315 | top: 90%; 316 | right: 50%; 317 | transform: translate(50%, 0); 318 | white-space: nowrap; 319 | } 320 | } 321 | 322 | @media only screen and (min-width : 1261px) { 323 | #toast-container { 324 | bottom: 0; 325 | top: 90%; 326 | right: 50%; 327 | transform: translate(50%, 0); 328 | white-space: nowrap; 329 | } 330 | } 331 | -------------------------------------------------------------------------------- /Gazee.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # This file is part of Gazee. 3 | # 4 | # Gazee is free software: you can redistribute it and/or modify 5 | # it under the terms of the GNU General Public License as published by 6 | # the Free Software Foundation, either version 3 of the License, or 7 | # (at your option) any later version. 8 | # 9 | # Gazee is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with Gazee. If not, see . 15 | 16 | import os 17 | import sys 18 | import argparse 19 | import logging 20 | 21 | import cherrypy 22 | from cherrypy.process.plugins import Daemonizer, PIDFile 23 | 24 | import gazee 25 | from gazee import Gazee, ComicScanner 26 | 27 | logging = logging.getLogger(__name__) 28 | 29 | gazee.FULL_PATH = os.path.abspath(__file__) 30 | # Verify our app is working out of the install directory 31 | os.chdir(os.path.dirname(os.path.abspath(__file__))) 32 | 33 | if (sys.platform == 'win32' and sys.executable.split('\\')[-1] == 'pythonw.exe'): 34 | sys.stdout = open(os.devnull, "w") 35 | sys.stderr = open(os.devnull, "w") 36 | 37 | 38 | def main(): 39 | parser = argparse.ArgumentParser(description='Gazee - Open Comic Book Reader') 40 | 41 | parser.add_argument('-d', '--daemon', action='store_true', help='Run as a daemon') 42 | parser.add_argument('-c', '--datadir', help='Set data directory') 43 | parser.add_argument('-l', '--logdir', help='Set log directory') 44 | parser.add_argument('-v', '--verbose', action='store_true', help='Set log level to debug') 45 | 46 | args = parser.parse_args() 47 | 48 | if args.datadir: 49 | gazee.DATA_DIR = args.datadir 50 | gazee.TEMP_DIR = os.path.join(args.datadir, 'tmp') 51 | 52 | if not os.path.exists(gazee.DATA_DIR): 53 | os.makedirs(os.path.abspath(gazee.DATA_DIR)) 54 | 55 | if not os.path.exists(os.path.join(gazee.DATA_DIR, 'sessions')): 56 | os.makedirs(os.path.abspath(os.path.join(gazee.DATA_DIR, 'sessions'))) 57 | 58 | if not os.path.exists(gazee.TEMP_DIR): 59 | os.makedirs(os.path.abspath(gazee.TEMP_DIR)) 60 | 61 | from gazee import log 62 | if args.logdir: 63 | gazee.LOG_DIR = args.logdir 64 | gazee.ARGS += ["-l", gazee.LOG_DIR] 65 | else: 66 | gazee.LOG_DIR = gazee.DATA_DIR 67 | if args.verbose: 68 | log.start(gazee.LOG_DIR, True) 69 | gazee.ARGS += ["-v"] 70 | else: 71 | log.start(gazee.LOG_DIR, False) 72 | cherrypy.log.error_log.propagate = True 73 | cherrypy.log.access_log.propagate = False 74 | 75 | gazee.db.db_creation() 76 | gazee.config.config_read() 77 | 78 | if args.daemon: 79 | if sys.platform == 'win32': 80 | logging.info("Daemonize not supported under Windows, starting normally") 81 | else: 82 | # If the pidfile already exists, Gazee may still be running, so exit 83 | if os.path.exists(gazee.PIDFILE): 84 | sys.exit("PID file '" + gazee.PIDFILE + "' already exists. Exiting.") 85 | 86 | # The pidfile is only useful in daemon mode, make sure we can write the file properly 87 | try: 88 | PIDFile(cherrypy.engine, gazee.PIDFILE).subscribe() 89 | except IOError as e: 90 | raise SystemExit("Unable to write PID file: %s [%d]" % (e.strerror, e.errno)) 91 | if gazee.DATA_DIR is not 'data': 92 | gazee.ARGS += ["-c", gazee.DATA_DIR] 93 | gazee.ARGS += ["-d"] 94 | Daemonizer(cherrypy.engine).subscribe() 95 | 96 | # This verifies the color scheme stays between automated updates as what the user set. 97 | if os.path.exists('public/css/style.css'): 98 | with open('public/css/style.css') as f: 99 | style = f.read() 100 | 101 | with open('public/css/style.css', "w") as f: 102 | style = style.replace("757575", gazee.MAIN_COLOR) 103 | style = style.replace("BDBDBD", gazee.ACCENT_COLOR) 104 | style = style.replace("FFFFFF", gazee.WEB_TEXT_COLOR) 105 | f.write(style) 106 | 107 | if gazee.DATA_DIR is not 'data': 108 | conf = { 109 | '/': { 110 | 'tools.gzip.on': True, 111 | 'tools.gzip.mime_types': ['text/*', 'application/*', 'image/*'], 112 | 'tools.sessions.on': True, 113 | 'tools.sessions.timeout': 1440, 114 | 'tools.sessions.storage_class': cherrypy.lib.sessions.FileSession, 115 | 'tools.sessions.storage_path': os.path.join(gazee.DATA_DIR, "sessions"), 116 | 'tools.auth_basic.on': True, 117 | 'tools.auth_basic.realm': 'Gazee', 118 | 'tools.auth_basic.checkpassword': gazee.authmech.check_password, 119 | 'request.show_tracebacks': False 120 | }, 121 | '/static': { 122 | 'tools.staticdir.on': True, 123 | 'tools.staticdir.root': os.path.abspath(os.getcwd()), 124 | 'tools.staticdir.dir': "public" 125 | }, 126 | '/data': { 127 | 'tools.staticdir.on': True, 128 | 'tools.staticdir.dir': gazee.DATA_DIR 129 | }, 130 | '/tmp': { 131 | 'tools.staticdir.on': True, 132 | 'tools.staticdir.dir': gazee.TEMP_DIR 133 | }, 134 | '/favicon.ico': { 135 | 'tools.staticfile.on': True, 136 | 'tools.staticfile.filename': os.path.join(os.getcwd(), "public/images/favicon.ico") 137 | } 138 | } 139 | else: 140 | conf = { 141 | '/': { 142 | 'tools.gzip.on': True, 143 | 'tools.gzip.mime_types': ['text/*', 'application/*', 'image/*'], 144 | 'tools.staticdir.root': os.path.abspath(os.getcwd()), 145 | 'tools.sessions.on': True, 146 | 'tools.sessions.timeout': 1440, 147 | 'tools.sessions.storage_class': cherrypy.lib.sessions.FileSession, 148 | 'tools.sessions.storage_path': os.path.join(gazee.DATA_DIR, "sessions"), 149 | 'tools.auth_basic.on': True, 150 | 'tools.auth_basic.realm': 'Gazee', 151 | 'tools.auth_basic.checkpassword': gazee.authmech.check_password, 152 | 'request.show_tracebacks': False 153 | }, 154 | '/static': { 155 | 'tools.staticdir.on': True, 156 | 'tools.staticdir.dir': "public" 157 | }, 158 | '/data': { 159 | 'tools.staticdir.on': True, 160 | 'tools.staticdir.dir': gazee.DATA_DIR 161 | }, 162 | '/tmp': { 163 | 'tools.staticdir.on': True, 164 | 'tools.staticdir.dir': gazee.TEMP_DIR 165 | }, 166 | '/favicon.ico': { 167 | 'tools.staticfile.on': True, 168 | 'tools.staticfile.filename': os.path.join(os.getcwd(), "public/images/favicon.ico") 169 | } 170 | } 171 | 172 | if (gazee.SSL_KEY == '') and (gazee.SSL_CERT == ''): 173 | options_dict = { 174 | 'server.socket_port': gazee.PORT, 175 | 'server.socket_host': '0.0.0.0', 176 | 'server.thread_pool': 30, 177 | 'log.screen': False, 178 | 'engine.autoreload.on': False, 179 | } 180 | else: 181 | options_dict = { 182 | 'server.socket_port': gazee.PORT, 183 | 'server.socket_host': '0.0.0.0', 184 | 'server.thread_pool': 30, 185 | 'server.ssl_module': 'builtin', 186 | 'server.ssl_certificate': gazee.SSL_CERT, 187 | 'server.ssl_private_key': gazee.SSL_KEY, 188 | 'log.screen': False, 189 | 'engine.autoreload.on': False, 190 | } 191 | 192 | cherrypy.config.update(options_dict) 193 | cherrypy.engine.signals.subscribe() 194 | cherrypy.engine.timeout_monitor.unsubscribe() 195 | cherrypy.tree.mount(Gazee(), '/', config=conf) 196 | 197 | logging.info("Gazee Started") 198 | 199 | cherrypy.engine.start() 200 | print("Gazee has started") 201 | scanner = ComicScanner() 202 | scanner.rescan_db() 203 | cherrypy.engine.block() 204 | 205 | 206 | if __name__ == '__main__': 207 | main() 208 | -------------------------------------------------------------------------------- /gazee/filenameparser.py: -------------------------------------------------------------------------------- 1 | """Functions for parsing comic info from filename 2 | This should probably be re-written, but, well, it mostly works! 3 | """ 4 | 5 | # Copyright 2012-2014 Anthony Beville 6 | 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # Some portions of this code were modified from pyComicMetaThis project 20 | # http://code.google.com/p/pycomicmetathis/ 21 | 22 | # Included in Gazee by Jessi Moss / Hubcaps with the following changes: 23 | # urllib import changed for python 3 version 24 | # Added Gazee specific logging throughout for debuging purposes 25 | # Added return value to parseFilename function to provide needed info to Gazee ComicInfoParse function 26 | # Original code hosted at https://github.com/davide-romanini/comictagger/ 27 | 28 | import re 29 | import os 30 | from urllib.parse import unquote 31 | 32 | import logging 33 | 34 | logging = logging.getLogger(__name__) 35 | 36 | 37 | class FileNameParser: 38 | 39 | def repl(self, m): 40 | logging.debug("repl requested") 41 | return ' ' * len(m.group()) 42 | 43 | def fixSpaces(self, string, remove_dashes=True): 44 | logging.debug("Fix Spaces Requested") 45 | if remove_dashes: 46 | placeholders = ['[-_]', ' +'] 47 | else: 48 | placeholders = ['[_]', ' +'] 49 | for ph in placeholders: 50 | string = re.sub(ph, self.repl, string) 51 | return string # .strip() 52 | 53 | def getIssueCount(self, filename, issue_end): 54 | logging.debug("Issue Count Requested") 55 | count = "" 56 | filename = filename[issue_end:] 57 | 58 | # replace any name separators with spaces 59 | tmpstr = self.fixSpaces(filename) 60 | found = False 61 | 62 | match = re.search('(?<=\sof\s)\d+(?=\s)', tmpstr, re.IGNORECASE) 63 | if match: 64 | count = match.group() 65 | found = True 66 | 67 | if not found: 68 | match = re.search('(?<=\(of\s)\d+(?=\))', tmpstr, re.IGNORECASE) 69 | if match: 70 | count = match.group() 71 | found = True 72 | 73 | count = count.lstrip("0") 74 | 75 | return count 76 | 77 | def getIssueNumber(self, filename): 78 | logging.debug("Issue Number Requested") 79 | """Returns a tuple of issue number string, and start and end indexes in the filename 80 | (The indexes will be used to split the string up for further parsing) 81 | """ 82 | 83 | found = False 84 | issue = '' 85 | start = 0 86 | end = 0 87 | 88 | # first, look for multiple "--", this means it's formatted differently 89 | # from most: 90 | if "--" in filename: 91 | # the pattern seems to be that anything to left of the first "--" 92 | # is the series name followed by issue 93 | filename = re.sub("--.*", self.repl, filename) 94 | 95 | elif "__" in filename: 96 | # the pattern seems to be that anything to left of the first "__" 97 | # is the series name followed by issue 98 | filename = re.sub("__.*", self.repl, filename) 99 | 100 | filename = filename.replace("+", " ") 101 | 102 | # replace parenthetical phrases with spaces 103 | filename = re.sub("\(.*?\)", self.repl, filename) 104 | filename = re.sub("\[.*?\]", self.repl, filename) 105 | 106 | # replace any name separators with spaces 107 | filename = self.fixSpaces(filename) 108 | 109 | # remove any "of NN" phrase with spaces (problem: this could break on 110 | # some titles) 111 | filename = re.sub("of [\d]+", self.repl, filename) 112 | 113 | # print u"[{0}]".format(filename) 114 | 115 | # we should now have a cleaned up filename version with all the words in 116 | # the same positions as original filename 117 | 118 | # make a list of each word and its position 119 | word_list = list() 120 | for m in re.finditer("\S+", filename): 121 | word_list.append((m.group(0), m.start(), m.end())) 122 | 123 | # remove the first word, since it can't be the issue number 124 | if len(word_list) > 1: 125 | word_list = word_list[1:] 126 | else: 127 | # only one word?? just bail. 128 | return issue, start, end 129 | 130 | # Now try to search for the likely issue number word in the list 131 | 132 | # first look for a word with "#" followed by digits with optional suffix 133 | # this is almost certainly the issue number 134 | for w in reversed(word_list): 135 | if re.match("#[-]?(([0-9]*\.[0-9]+|[0-9]+)(\w*))", w[0]): 136 | found = True 137 | break 138 | 139 | # same as above but w/o a '#', and only look at the last word in the 140 | # list 141 | if not found: 142 | w = word_list[-1] 143 | if re.match("[-]?(([0-9]*\.[0-9]+|[0-9]+)(\w*))", w[0]): 144 | found = True 145 | 146 | # now try to look for a # followed by any characters 147 | if not found: 148 | for w in reversed(word_list): 149 | if re.match("#\S+", w[0]): 150 | found = True 151 | break 152 | 153 | if found: 154 | issue = w[0] 155 | start = w[1] 156 | end = w[2] 157 | if issue[0] == '#': 158 | issue = issue[1:] 159 | 160 | return issue, start, end 161 | 162 | def getSeriesName(self, filename, issue_start): 163 | logging.debug("Series Name Requested") 164 | """Use the issue number string index to split the filename string""" 165 | 166 | if issue_start != 0: 167 | filename = filename[:issue_start] 168 | 169 | # in case there is no issue number, remove some obvious stuff 170 | if "--" in filename: 171 | # the pattern seems to be that anything to left of the first "--" 172 | # is the series name followed by issue 173 | filename = re.sub("--.*", self.repl, filename) 174 | 175 | elif "__" in filename: 176 | # the pattern seems to be that anything to left of the first "__" 177 | # is the series name followed by issue 178 | filename = re.sub("__.*", self.repl, filename) 179 | 180 | filename = filename.replace("+", " ") 181 | tmpstr = self.fixSpaces(filename, remove_dashes=False) 182 | 183 | series = tmpstr 184 | volume = "" 185 | 186 | # save the last word 187 | try: 188 | last_word = series.split()[-1] 189 | except: 190 | last_word = "" 191 | 192 | # remove any parenthetical phrases 193 | series = re.sub("\(.*?\)", "", series) 194 | 195 | # search for volume number 196 | match = re.search('(.+)([vV]|[Vv][oO][Ll]\.?\s?)(\d+)\s*$', series) 197 | if match: 198 | series = match.group(1) 199 | volume = match.group(3) 200 | 201 | # if a volume wasn't found, see if the last word is a year in parentheses 202 | # since that's a common way to designate the volume 203 | if volume == "": 204 | # match either (YEAR), (YEAR-), or (YEAR-YEAR2) 205 | match = re.search("(\()(\d{4})(-(\d{4}|)|)(\))", last_word) 206 | if match: 207 | volume = match.group(2) 208 | 209 | series = series.strip() 210 | 211 | # if we don't have an issue number (issue_start==0), look 212 | # for hints i.e. "TPB", "one-shot", "OS", "OGN", etc that might 213 | # be removed to help search online 214 | if issue_start == 0: 215 | one_shot_words = ["tpb", "os", "one-shot", "ogn", "gn"] 216 | try: 217 | last_word = series.split()[-1] 218 | if last_word.lower() in one_shot_words: 219 | series = series.rsplit(' ', 1)[0] 220 | except: 221 | pass 222 | 223 | return series, volume.strip() 224 | 225 | def getYear(self, filename, issue_end): 226 | logging.debug("Year Requested") 227 | 228 | filename = filename[issue_end:] 229 | 230 | year = "" 231 | # look for four digit number with "(" ")" or "--" around it 232 | match = re.search('(\(\d\d\d\d\))|(--\d\d\d\d--)', filename) 233 | if match: 234 | year = match.group() 235 | # remove non-digits 236 | year = re.sub("[^0-9]", "", year) 237 | return year 238 | 239 | def getRemainder(self, filename, year, count, volume, issue_end): 240 | logging.debug("Remainder Requested") 241 | """Make a guess at where the the non-interesting stuff begins""" 242 | 243 | remainder = "" 244 | 245 | if "--" in filename: 246 | remainder = filename.split("--", 1)[1] 247 | elif "__" in filename: 248 | remainder = filename.split("__", 1)[1] 249 | elif issue_end != 0: 250 | remainder = filename[issue_end:] 251 | 252 | remainder = self.fixSpaces(remainder, remove_dashes=False) 253 | if volume != "": 254 | remainder = remainder.replace("Vol." + volume, "", 1) 255 | if year != "": 256 | remainder = remainder.replace(year, "", 1) 257 | if count != "": 258 | remainder = remainder.replace("of " + count, "", 1) 259 | 260 | remainder = remainder.replace("()", "") 261 | remainder = remainder.replace( 262 | " ", 263 | " ") # cleans some whitespace mess 264 | 265 | return remainder.strip() 266 | 267 | def parseFilename(self, filename): 268 | logging.debug("File Name Parse Requested") 269 | 270 | # remove the path 271 | filename = os.path.basename(filename) 272 | 273 | # remove the extension 274 | filename = os.path.splitext(filename)[0] 275 | 276 | # url decode, just in case 277 | filename = unquote(filename) 278 | 279 | # sometimes archives get messed up names from too many decodes 280 | # often url encodings will break and leave "_28" and "_29" in place 281 | # of "(" and ")" see if there are a number of these, and replace them 282 | if filename.count("_28") > 1 and filename.count("_29") > 1: 283 | filename = filename.replace("_28", "(") 284 | filename = filename.replace("_29", ")") 285 | logging.debug("Url Encoding Fixed") 286 | logging.debug(filename) 287 | 288 | self.issue, issue_start, issue_end = self.getIssueNumber(filename) 289 | self.series, self.volume = self.getSeriesName(filename, issue_start) 290 | logging.debug("Series and Issue Return") 291 | logging.debug(self.series + " " + self.issue) 292 | 293 | # provides proper value when the filename doesn't have a issue number 294 | if issue_end == 0: 295 | issue_end = len(self.series) 296 | 297 | self.year = self.getYear(filename, issue_end) 298 | logging.debug("Year Returned") 299 | logging.debug(self.year) 300 | self.issue_count = self.getIssueCount(filename, issue_end) 301 | logging.debug("Issue Count Returned") 302 | logging.debug(self.issue_count) 303 | self.remainder = self.getRemainder( 304 | filename, 305 | self.year, 306 | self.issue_count, 307 | self.volume, 308 | issue_end) 309 | logging.debug("Remained Returned") 310 | logging.debug(self.remainder) 311 | 312 | if self.issue != "": 313 | # strip off leading zeros 314 | self.issue = self.issue.lstrip("0") 315 | if self.issue == "": 316 | self.issue = "0" 317 | if self.issue[0] == ".": 318 | self.issue = "0" + self.issue 319 | return {'series': self.series, 'issue': self.issue, 'volume': self.issue, 'remainder': self.remainder, 'year': self.year} 320 | -------------------------------------------------------------------------------- /public/html/settings.html: -------------------------------------------------------------------------------- 1 | <%! 2 | import gazee, os 3 | %> 4 | %if user_level == 'admin': 5 | 6 | 7 | <%include file="header.html" args="jscolor=True"/> 8 | 9 | 14 | 32 | 33 | 34 |
35 |
36 |
37 | 43 |
44 |
45 |
46 |
47 |
48 |
49 | 50 | 51 |
52 |
53 |
54 |
55 | 56 | 57 |
58 |
59 |
60 |
61 | 62 | 63 |
64 |
65 |
66 |
67 | 68 | 69 |
70 |
71 |
72 |
73 | 74 | 75 |
76 |
77 |
78 |
79 | 80 | 81 |
82 |
83 |
84 |
85 | 86 | 87 |
88 |
89 | 92 |
93 |
94 |
95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 |
Scan StatusScan LengthNumber of Comics
${"In Progress" if sip else "Not Running"}${scantime}${noc}
111 |
112 |
113 |
114 | 117 |
118 | 119 |
120 |
121 |
122 |
123 | 124 | 125 |
126 |
127 | 128 | 129 |
130 |
131 |
132 | Change Password 133 |
134 |
135 |
136 |
137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | % for u in users: 146 | 147 | 148 | 149 | 150 | % endfor 151 | 152 |
UserUser Type
${u['User']}${u['Type']}
153 |
154 |
155 |
156 |
157 |
158 | 159 | 160 |
161 |
162 |
163 | Delete User 164 |
165 |
166 |
167 |
168 |
169 | 170 | 171 |
172 |
173 |
174 |
175 | 176 | 177 |
178 |
179 |
180 |
181 | 182 | 183 | 184 | 185 |
186 |
187 |
188 | Add New User 189 |
190 |
191 |
192 | 193 |
194 |
195 |
196 |
197 | 203 | 204 |
205 |
206 |
207 |
208 | 209 | 210 |
211 |
212 |
213 |
214 | 215 | 216 |
217 |
218 |
219 |
220 | 221 | 222 |
223 |
224 |
225 | Change Theme 226 |
227 |
228 |
229 | 230 |
231 |
232 | Current Version: ${gazee_version}
233 | Latest Version: ${latest_version}
234 | Python Version: ${'.'.join(map(str,python_version[:3]))} 235 |
236 |
237 | Shutdown Server 238 |
239 |
240 | Restart Server 241 |
242 |
243 | Update Server 244 |
245 |
246 |
247 | 252 | 253 | 254 | pageview 255 | 256 |
257 | 258 | 261 |
262 |
263 |
264 | 265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 | 274 | 397 | 398 | 399 | %endif 400 | -------------------------------------------------------------------------------- /gazee/comicscan.py: -------------------------------------------------------------------------------- 1 | # This file is part of Gazee. 2 | # 3 | # Gazee is free software: you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation, either version 3 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # Gazee is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with Gazee. If not, see . 15 | 16 | import os 17 | import stat 18 | import sqlite3 19 | import zipfile 20 | import rarfile 21 | import zlib 22 | import xmltodict 23 | import logging 24 | import threading 25 | import hashlib 26 | 27 | from pathlib import Path 28 | from PIL import Image 29 | 30 | import gazee 31 | from gazee.filenameparser import FileNameParser 32 | 33 | logging = logging.getLogger(__name__) 34 | 35 | 36 | # This class will hold the various methods needed to fill out the Directory Table and the Comics table in the DB. 37 | class ComicScanner(object): 38 | 39 | # This method will handle scanning the directories and returning a list of them all. 40 | def dir_scan(self): 41 | logging.debug("Dir Scan Requested") 42 | full_paths = [] 43 | full_paths.append(gazee.COMIC_PATH) 44 | for root, dirs, files in os.walk(gazee.COMIC_PATH): 45 | full_paths.extend(os.path.join(root, d) for d in dirs) 46 | 47 | logging.info("Dir Scan Completed") 48 | logging.info("%i Dirs Found" % (len(full_paths))) 49 | return full_paths 50 | 51 | # This method will handle scanning the comics and returning a list of them all. 52 | def comic_scan(self): 53 | logging.debug("Comic Scan Requested") 54 | full_paths = [] 55 | for root, dirs, files in os.walk(gazee.COMIC_PATH): 56 | for f in files: 57 | if f.endswith((".cbz", ".cbr")): 58 | full_paths.append(os.path.join(root, f)) 59 | 60 | logging.info("Comic Scan Completed") 61 | logging.info("%i Comics Found" % (len(full_paths))) 62 | return full_paths 63 | 64 | # This method takes an argument of the full comic path and will simply unpack the requested comic into the temp directory. It first checks if there are already files in the temp directory. If so, it removes all of them and then unpacks the comic. It doesn't return anything currently, and will be used for both scanning and reading comics. 65 | def build_unpack_comic(self, comic_path): 66 | logging.info("%s unpack requested" % comic_path) 67 | for root, dirs, files in os.walk(os.path.join(gazee.TEMP_DIR, "build"), topdown=False): 68 | for f in files: 69 | os.chmod(os.path.join(root, f), stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) # 0777 70 | os.remove(os.path.join(root, f)) 71 | for root, dirs, files in os.walk(os.path.join(gazee.TEMP_DIR, "build"), topdown=False): 72 | for d in dirs: 73 | os.chmod(os.path.join(root, d), stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) # 0777 74 | os.rmdir(os.path.join(root, d)) 75 | if comic_path.endswith(".cbr"): 76 | opened_rar = rarfile.RarFile(comic_path) 77 | opened_rar.extractall(os.path.join(gazee.TEMP_DIR, "build")) 78 | elif comic_path.endswith(".cbz"): 79 | opened_zip = zipfile.ZipFile(comic_path) 80 | opened_zip.extractall(os.path.join(gazee.TEMP_DIR, "build")) 81 | return 82 | 83 | def user_unpack_comic(self, comic_path, user): 84 | logging.info("%s unpack requested" % comic_path) 85 | for root, dirs, files in os.walk(os.path.join(gazee.TEMP_DIR, user), topdown=False): 86 | for f in files: 87 | os.chmod(os.path.join(root, f), stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) # 0777 88 | os.remove(os.path.join(root, f)) 89 | for root, dirs, files in os.walk(os.path.join(gazee.TEMP_DIR, user), topdown=False): 90 | for d in dirs: 91 | os.chmod(os.path.join(root, d), stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) # 0777 92 | os.rmdir(os.path.join(root, d)) 93 | if comic_path.endswith(".cbr"): 94 | opened_rar = rarfile.RarFile(comic_path) 95 | opened_rar.extractall(os.path.join(gazee.TEMP_DIR, user)) 96 | elif comic_path.endswith(".cbz"): 97 | opened_zip = zipfile.ZipFile(comic_path) 98 | opened_zip.extractall(os.path.join(gazee.TEMP_DIR, user)) 99 | return 100 | 101 | # This method will return a list of .jpg files in their numberical order to be fed into the reading view. 102 | def reading_images(self, user): 103 | logging.debug("Image List Requested") 104 | image_list = [] 105 | for root, dirs, files in os.walk(os.path.join(gazee.TEMP_DIR, user)): 106 | for f in files: 107 | if f.endswith((".png", ".gif", ".bmp", ".dib", ".jpg", ".jpeg", ".jpe", ".jif", ".jfif", ".jfi", ".tiff", ".tif")): 108 | image_list.append(os.path.join(root, f).replace(gazee.DATA_DIR, "")) 109 | image_list.sort() 110 | logging.debug("Image List Created") 111 | return image_list 112 | 113 | # This method takes an argument of the comic name, it then looks in the temp directory after comic has been upacked for an image with 000, 001 and an image extnesion in the name. This image name and it's path are stored in variables, then makes directory named after them, and pushes the file into that directory. It then returns the path to that file to be inserted into the DB as the comics image in the library and recent comic views. 114 | def image_move(self, comic_name, volume_number, issue_number): 115 | logging.debug("Thumbnail Requested") 116 | image_temp_path = [] 117 | image = [] 118 | sorted_files = [] 119 | 120 | for root, dirs, files in os.walk(os.path.join(gazee.TEMP_DIR, "build")): 121 | sorted_files.extend(os.path.join(root, usf) for usf in files) 122 | 123 | sorted_files.sort() 124 | 125 | for f in sorted_files: 126 | if f.endswith((".png", ".gif", ".bmp", ".dib", ".jpg", ".jpeg", ".jpe", ".jif", ".jfif", ".jfi", ".tiff", ".tif")): 127 | image_temp_path = f 128 | image_split = os.path.split(f) 129 | image = image_split[-1] 130 | break 131 | 132 | cname = hashlib.md5(bytes(comic_name, encoding='utf-8')).hexdigest() 133 | 134 | absPath = os.path.abspath(os.path.join(gazee.DATA_DIR, "cache", cname, volume_number, issue_number)) 135 | 136 | if not os.path.exists(absPath): 137 | os.makedirs(absPath) 138 | 139 | if len(image) == 0: 140 | logging.debug("Image Not Found") 141 | real_dest = 'static/images/imgnotfound.png' 142 | else: 143 | image_dest = os.path.join(gazee.DATA_DIR, "cache", cname, volume_number, issue_number, image) 144 | 145 | if not os.path.exists(image_dest): 146 | try: 147 | im = Image.open(image_temp_path) 148 | im.thumbnail(gazee.THUMB_SIZE) 149 | im.save(image_dest) 150 | logging.debug("Thumbnail Saved") 151 | except IOError: 152 | logging.debug("Thumbnail Generation failed") 153 | image_dest = 'static/images/imgnotfound.png' 154 | real_dest = os.path.join("data", "cache", cname, volume_number, issue_number, image) 155 | 156 | logging.debug("Thumbnail Generated") 157 | return real_dest 158 | 159 | # This method will parse the XML for our values we'll insert into the DB for the comics info such as name, issue number, volume number and summary. 160 | def comic_info_parse(self, comicpath): 161 | logging.info("Comic Info Requested") 162 | comic_name = "Not Available" 163 | comic_issue = "Not Available" 164 | comic_volume = "Not Available" 165 | comic_summary = "Not Available" 166 | 167 | unpackedFiles = [] 168 | comic_attributes = {} 169 | 170 | for root, dirs, files in os.walk(os.path.join(gazee.TEMP_DIR, "build")): 171 | unpackedFiles.extend(os.path.join(root, f) for f in files) 172 | logging.info("%i unpacked files found" % (len(unpackedFiles))) 173 | 174 | for f in unpackedFiles: 175 | if any(x in f for x in ("ComicInfo", "Comicinfo" "comicInfo", "comicinfo", ".xml")): 176 | logging.info("ComicInfo File Found") 177 | with open(f) as fd: 178 | try: 179 | comic_attributes = xmltodict.parse(fd.read()) 180 | logging.debug("ComicInfo Parsed") 181 | except: 182 | logging.warning("ComicInfo Parsing Failed") 183 | break 184 | try: 185 | comic_name = comic_attributes['ComicInfo']['Series'] 186 | logging.debug("Comic Name Assigned") 187 | except: 188 | comic_name = "Not Available" 189 | logging.debug("Comic Name Not Available") 190 | try: 191 | comic_issue = comic_attributes['ComicInfo']['Number'] 192 | logging.debug("Comic Issue Assigned") 193 | except: 194 | comic_issue = "Not Available" 195 | logging.debug("Comic Issue Not Available") 196 | try: 197 | comic_volume = comic_attributes['ComicInfo']['Volume'] 198 | logging.debug("Comic Volume Assigned") 199 | except: 200 | comic_volume = "Not Available" 201 | logging.debug("Comic Volume Not Available") 202 | try: 203 | comic_summary = comic_attributes['ComicInfo']['Summary'] 204 | logging.debug("Comic Summary Assigned") 205 | except: 206 | comic_summary = "Not Available" 207 | logging.debug("Comic Summary Not Available") 208 | break 209 | 210 | if not gazee.MYLAR_DB == "": 211 | try: 212 | location = os.path.basename(comicpath) 213 | connection = sqlite3.connect(gazee.MYLAR_DB) 214 | c = connection.cursor() 215 | 216 | c.execute('SELECT * FROM issues WHERE location=?', (location,)) 217 | comic_attributes = c.fetchone() 218 | 219 | if comic_attributes is not None: 220 | if comic_name == "Not Available": 221 | logging.info("Mylar DB Found and Being Used") 222 | comic_name = comic_attributes[1] 223 | comic_issue = comic_attributes[3] 224 | 225 | connection.close() 226 | except: 227 | logging.warning("Mylar DB is locked or doesn't exist") 228 | 229 | if comic_name is "Not Available": 230 | logging.info("No Mylar DB and No Comic Info, Parsing File Name.") 231 | comicinfo = FileNameParser().parseFilename(comicpath) 232 | comic_name = comicinfo['series'] 233 | comic_issue = comicinfo['issue'] 234 | comic_volume = comicinfo['volume'] 235 | comic_summary = comicinfo['remainder'] 236 | 237 | logging.info("ComicInfo Being Returned") 238 | return {'name': comic_name, 'issue': comic_issue, 'volume': comic_volume, 'summary': comic_summary} 239 | 240 | # This method is where the magic actually happens. This will use all the previous functions to build out our two DB tables, Directories and Comics respectively. 241 | def db_builder(self): 242 | 243 | if os.path.exists(os.path.join(gazee.DATA_DIR, "db.lock")): 244 | logging.info("Comic Scan Already Running, Skipping this run") 245 | return 246 | elif gazee.COMIC_PATH == "": 247 | logging.info("No Comic Path Set") 248 | return 249 | else: 250 | with open(os.path.join(gazee.DATA_DIR, "db.lock"), 'w') as f: 251 | f.write("locked") 252 | f.close() 253 | 254 | print("Comic Scan Started") 255 | logging.info("DB Build Requested") 256 | logging.info("Begining Full Directory and Comic Scan") 257 | # Here we set the db file path. 258 | db = Path(os.path.join(gazee.DATA_DIR, gazee.DB_NAME)) 259 | 260 | # Here we make the inital DB connection that we will be using throughout this function. 261 | connection = sqlite3.connect(str(db)) 262 | c = connection.cursor() 263 | 264 | # Here we define some variables we will use to check for existing directories and directories that need to be removed from the db. 265 | c.execute('SELECT * FROM {tn}'.format(tn=gazee.ALL_DIRS)) 266 | paths_in_db = c.fetchall() 267 | dict_of_parents = [] 268 | key_names = ['ParentKey', 'Path'] 269 | # Convert tuple to list 270 | dict_of_parents = [dict(zip(key_names, tup)) for tup in paths_in_db] 271 | logging.debug("Grabbed Directories Currently in DB") 272 | 273 | # Here we call the dir_scan directory to get a list of all the directories under the set comic directory. 274 | logging.debug("Requesting Directory Scan") 275 | directories = self.dir_scan() 276 | logging.debug("Directory Scan Returned") 277 | 278 | # Here we check if the Directory listings in the DB still exists on disk, if not, we remove them and their children from the db. 279 | for d in dict_of_parents: 280 | for key, value in d.items(): 281 | if key == 'Path': 282 | if value not in directories: 283 | logging.info("Removing Directories No Longer on Disk.") 284 | c.execute('DELETE FROM {tn} WHERE {cn}=?'.format(tn=gazee.ALL_DIRS, cn=gazee.FULL_DIR_PATH), (d['Path'],)) 285 | c.execute('DELETE FROM {tn} WHERE {cn}=?'.format(tn=gazee.DIR_NAMES, cn=gazee.PARENT_KEY), (d['ParentKey'],)) 286 | 287 | # Here we iterate over the scanned directories and check if any match any of the earlier returned paths. If they do, we skip to the next scanned directory, otherwise we insert them. 288 | for d in directories: 289 | if d in [dic['Path'] for dic in dict_of_parents]: 290 | logging.debug("Directory exists in DB, Skipping") 291 | continue 292 | else: 293 | logging.info("Adding Directory %s to DB" % (d)) 294 | c.execute('INSERT INTO {tn} ({cn1}) VALUES (?)'.format(tn=gazee.ALL_DIRS, cn1=gazee.FULL_DIR_PATH), (d,)) 295 | 296 | # Here we commit real quick to make sure our main Dir table is up to date for associating the proper parent keys to their child contents in the regular directory table. 297 | # We also reset our parent dictionary. 298 | connection.commit() 299 | 300 | c.execute('SELECT * FROM {tn}'.format(tn=gazee.ALL_DIRS)) 301 | paths_in_db = c.fetchall() 302 | dict_of_parents = [] 303 | key_names = ['ParentKey', 'Path'] 304 | # Convert tuple to list 305 | dict_of_parents = [dict(zip(key_names, tup)) for tup in paths_in_db] 306 | 307 | c.execute('SELECT * FROM {tn}'.format(tn=gazee.DIR_NAMES)) 308 | names_in_db = c.fetchall() 309 | names_of_dirs = [] 310 | # Convert tuple to list 311 | names_of_dirs = [tup[0] for tup in names_in_db] 312 | 313 | for d in dict_of_parents: 314 | dir_contents = os.listdir(d['Path']) 315 | for dc in dir_contents: 316 | if dc in names_of_dirs: 317 | logging.debug("Dir Name exists, skipping") 318 | continue 319 | elif os.path.isdir(os.path.join(d['Path'], dc)): 320 | logging.debug("Dir name %s being added to DB" % (dc)) 321 | c.execute('INSERT INTO {tn} ({cn1}, {cn2}) VALUES (?,?)'.format(tn=gazee.DIR_NAMES, cn1=gazee.NICE_NAME, cn2=gazee.PARENT_KEY), (dc, d['ParentKey'])) 322 | else: 323 | continue 324 | 325 | connection.commit() 326 | 327 | # Here we define some variables we will use to check for existing comics and comics that need to be removed from the db. 328 | logging.info("Gathering all Comics in DB") 329 | c.execute('SELECT ({col}) FROM {tn}'.format(col=gazee.COMIC_FULL_PATH, tn=gazee.ALL_COMICS)) 330 | comic_paths_in_db = c.fetchall() 331 | list_of_comic_paths = [] 332 | # Convert tuple to list 333 | list_of_comic_paths = [tup[0] for tup in comic_paths_in_db] 334 | 335 | # Here we call comic scan and get the paths of all comics to iterate over. 336 | logging.debug("Comic Scan Requested") 337 | all_comics = self.comic_scan() 338 | logging.debug("Comic Scan Returned") 339 | 340 | # Here we check if the Directory listings in the DB still exists on disk, if not, we remove them from the db. 341 | for f in list_of_comic_paths: 342 | if f not in all_comics: 343 | logging.info("Comic Being Removed from DB") 344 | c.execute('DELETE FROM {tn} WHERE {cn}=?'.format(tn=gazee.ALL_COMICS, cn=gazee.COMIC_FULL_PATH), (f,)) 345 | 346 | # Here we start iterating, inside we'll call the rest of the functions, gather the rest of the info and then insert it a row at a time into the DB. 347 | for f in all_comics: 348 | if f in list_of_comic_paths: 349 | logging.debug("Comic exists in DB, Skipping") 350 | continue 351 | else: 352 | try: 353 | logging.debug("Unpacking Comic") 354 | self.build_unpack_comic(f) 355 | logging.debug("Unpacking Successful") 356 | except (zipfile.BadZipFile, rarfile.RarWarning, zlib.error, rarfile.BadRarFile, rarfile.RarCRCError, rarfile.RarCreateError, OSError) as e: 357 | logging.warning("Unpacking %s Failed" % f) 358 | logging.warning(str(e)) 359 | continue 360 | 361 | logging.debug("Comic Info being requested") 362 | info = self.comic_info_parse(f) 363 | logging.debug("Comic Info Successfully returned") 364 | # After unpacking the comic, we now assign the values returned to variables we can use in our insert statement. 365 | name = info['name'] 366 | issue = info['issue'] 367 | volume = info['volume'] 368 | summary = info['summary'] 369 | 370 | # Here we call the image move method with the previously retrieved comic name as its argument. This returns the image path to be stored in the coming insert function. 371 | image = self.image_move(name, volume, issue) 372 | 373 | pk = 1 374 | bp = os.path.split(f) 375 | parent = bp[0] 376 | for d in dict_of_parents: 377 | if parent == d['Path']: 378 | pk = d['ParentKey'] 379 | 380 | logging.debug("Comic %s %s Being Inserted into DB" % (name, issue)) 381 | c.execute('INSERT INTO {tn} ({cn}, {ci}, {cv}, {cs}, {cimg}, {cp}, {pk}, {it}) VALUES (?, ?, ?, ?, ?, ?, ?, DATE("now"))'.format(tn=gazee.ALL_COMICS, cn=gazee.COMIC_NAME, ci=gazee.COMIC_NUMBER, cv=gazee.COMIC_VOLUME, cs=gazee.COMIC_SUMMARY, cimg=gazee.COMIC_IMAGE, cp=gazee.COMIC_FULL_PATH, pk=gazee.PARENT_KEY, it=gazee.INSERT_DATE), (name, issue, volume, summary, image, f, pk)) 382 | connection.commit() 383 | logging.info("Comic %s %s Inserted into DB Successfully" % (name, issue)) 384 | 385 | # Now that we have comic images moved and created, we're going to rebreak down the Directories and pick their images from an alphabet breakdown of their contained comics. 386 | logging.info("Creating Directory Images, this can take a while") 387 | c.execute("SELECT {cn} FROM {tn}".format(cn=gazee.NICE_NAME, tn=gazee.DIR_NAMES)) 388 | nninit = c.fetchall() 389 | nice_names = [tup[0] for tup in nninit] 390 | logging.debug("Nice Names Returned") 391 | last_name = "" 392 | last_counter = 0 393 | 394 | nice_names.sort() 395 | 396 | for f in nice_names: 397 | if last_name == f: 398 | logging.debug("Same Nice Name") 399 | c.execute("SELECT {ci} FROM {tn} WHERE {pa} LIKE ? ORDER BY {cn} ASC, {cin} ASC LIMIT 1 OFFSET ?".format(ci=gazee.COMIC_IMAGE, tn=gazee.ALL_COMICS, pa=gazee.COMIC_FULL_PATH, cn=gazee.COMIC_NAME, cin=gazee.COMIC_NUMBER), ('%' + f + '%', last_counter,)) 400 | cinit = c.fetchall() 401 | c_image = [tup[0] for tup in cinit] 402 | if len(c_image) == 0: 403 | logging.debug("Comic Image Not Returned") 404 | c_image = "static/images/imgnotfound.png" 405 | c.execute("UPDATE {tn} SET {di}=? WHERE {nn}=?".format(tn=gazee.DIR_NAMES, di=gazee.DIR_IMAGE, nn=gazee.NICE_NAME), (c_image, f,)) 406 | else: 407 | logging.debug("Comic Image Returned") 408 | c.execute("UPDATE {tn} SET {di}=? WHERE {nn}=?".format(tn=gazee.DIR_NAMES, di=gazee.DIR_IMAGE, nn=gazee.NICE_NAME), (c_image[0], f,)) 409 | logging.debug("Dir Image Added") 410 | connection.commit() 411 | last_counter += 1 412 | last_name = f 413 | else: 414 | logging.debug("New Nice Name") 415 | c.execute("SELECT {ci} FROM {tn} WHERE {pa} LIKE ? ORDER BY {cn} ASC, {cin} ASC LIMIT 1".format(ci=gazee.COMIC_IMAGE, tn=gazee.ALL_COMICS, pa=gazee.COMIC_FULL_PATH, cn=gazee.COMIC_NAME, cin=gazee.COMIC_NUMBER), ('%' + f + '%',)) 416 | cinit = c.fetchall() 417 | c_image = [tup[0] for tup in cinit] 418 | if len(c_image) == 0: 419 | logging.debug("Comic Image Not Returned") 420 | c_image = "static/images/imgnotfound.png" 421 | c.execute("UPDATE {tn} SET {di}=? WHERE {nn}=?".format(tn=gazee.DIR_NAMES, di=gazee.DIR_IMAGE, nn=gazee.NICE_NAME), (c_image, f,)) 422 | else: 423 | logging.debug("Comic Image Returned") 424 | c.execute("UPDATE {tn} SET {di}=? WHERE {nn}=?".format(tn=gazee.DIR_NAMES, di=gazee.DIR_IMAGE, nn=gazee.NICE_NAME), (c_image[0], f,)) 425 | logging.debug("Dir Image Added") 426 | connection.commit() 427 | last_counter = 0 428 | last_name = f 429 | 430 | connection.commit() 431 | connection.close() 432 | 433 | os.remove(os.path.join(gazee.DATA_DIR, "db.lock")) 434 | 435 | print("Comic Scan Finished") 436 | logging.info("DB Build succesful") 437 | return 438 | 439 | def rescan_db(self): 440 | 441 | self.db_builder() 442 | threading.Timer((int(gazee.COMIC_SCAN_INTERVAL) * 60), self.rescan_db).start() 443 | -------------------------------------------------------------------------------- /gazee/gazee.py: -------------------------------------------------------------------------------- 1 | # This file is part of Gazee. 2 | # 3 | # Gazee is free software: you can redistribute it and/or modify 4 | # it under the terms of the GNU General Public License as published by 5 | # the Free Software Foundation, either version 3 of the License, or 6 | # (at your option) any later version. 7 | # 8 | # Gazee is distributed in the hope that it will be useful, 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | # GNU General Public License for more details. 12 | # 13 | # You should have received a copy of the GNU General Public License 14 | # along with Gazee. If not, see . 15 | 16 | import json 17 | import os 18 | import re 19 | import sys 20 | import time 21 | import subprocess 22 | import cherrypy 23 | import sqlite3 24 | import configparser 25 | import logging 26 | import threading 27 | 28 | from pathlib import Path 29 | 30 | from mako.lookup import TemplateLookup 31 | from mako import exceptions 32 | 33 | import gazee 34 | import gazee.versioning 35 | from gazee.comicscan import ComicScanner 36 | 37 | logging = logging.getLogger(__name__) 38 | 39 | """ 40 | This initializes our mako template serving directory and allows us to return it's compiled embeded html pages rather than the default return of a static html page. 41 | """ 42 | 43 | 44 | def serve_template(templatename, **kwargs): 45 | html_dir = 'public/html/' 46 | _hplookup = TemplateLookup(directories=[html_dir]) 47 | try: 48 | template = _hplookup.get_template(templatename) 49 | return template.render(**kwargs) 50 | except: 51 | return exceptions.html_error_template().render() 52 | 53 | 54 | """ 55 | Web Pages/Views methods that are exposed for API like url calling. 56 | """ 57 | 58 | 59 | class Gazee(object): 60 | 61 | """ 62 | Index Page 63 | This returns the html template for the recents div. 64 | The recents div is by default the the last twenty comics added to the DB in the last 7 days. 65 | """ 66 | @cherrypy.expose 67 | def index(self, page_num=1): 68 | cherrypy.session.load() 69 | if 'sizepref' not in cherrypy.session: 70 | cherrypy.session['sizepref'] = 'wide' 71 | logging.debug("Index Requested") 72 | # Here we set the db file path. 73 | db = Path(os.path.join(gazee.DATA_DIR, gazee.DB_NAME)) 74 | 75 | # Here we make the inital DB connection that we will be using throughout this function. 76 | connection = sqlite3.connect(str(db)) 77 | c = connection.cursor() 78 | 79 | c.execute("SELECT COUNT(*) FROM {tn} WHERE DATE('now') - {it} <= 7".format(tn=gazee.ALL_COMICS, it=gazee.INSERT_DATE)) 80 | numcinit = c.fetchone() 81 | num_of_comics = numcinit[0] 82 | num_of_pages = 0 83 | while num_of_comics >= 0: 84 | num_of_comics -= gazee.COMICS_PER_PAGE 85 | num_of_pages += 1 86 | 87 | if page_num == 1: 88 | PAGE_OFFSET = 0 89 | else: 90 | PAGE_OFFSET = gazee.COMICS_PER_PAGE * (int(page_num) - 1) 91 | 92 | c.execute("SELECT * FROM {tn} WHERE DATE('now') - {it} <= 7 ORDER BY date DESC, issue ASC LIMIT {nc} OFFSET {pn}".format(tn=gazee.ALL_COMICS, it=gazee.INSERT_DATE, cn=gazee.COMIC_NAME, ci=gazee.COMIC_NUMBER, nc=gazee.COMICS_PER_PAGE, pn=PAGE_OFFSET)) 93 | # DB Always returns a tuple of lists. After fetching it, we then iterate over its various lists to assign their values to a dictionary. 94 | all_recent_comics_tup = c.fetchall() 95 | comics = [] 96 | for f in all_recent_comics_tup: 97 | comics.append({"Key": f[0], 98 | "ComicName": f[1], 99 | "ComicImage": f[2], 100 | "ComicIssue": f[3], 101 | "ComicVolume": f[4], 102 | "ComicSummary": f[5], 103 | "ComicPath": f[6], 104 | "DateAdded": f[7]}) 105 | 106 | connection.commit() 107 | connection.close() 108 | 109 | user = cherrypy.request.login 110 | user_level = gazee.authmech.get_user_level(user) 111 | 112 | logging.info("Index Served") 113 | 114 | return serve_template(templatename="index.html", comics=comics, num_of_pages=num_of_pages, current_page=int(page_num), user_level=user_level) 115 | 116 | @cherrypy.expose 117 | def search(self, page_num=1, search_string=''): 118 | cherrypy.session.load() 119 | if 'sizepref' not in cherrypy.session: 120 | cherrypy.session['sizepref'] = 'wide' 121 | logging.debug("Search Requested") 122 | # Here we set the db file path. 123 | db = Path(os.path.join(gazee.DATA_DIR, gazee.DB_NAME)) 124 | 125 | # Here we make the inital DB connection that we will be using throughout this function. 126 | connection = sqlite3.connect(str(db)) 127 | c = connection.cursor() 128 | 129 | c.execute("CREATE VIRTUAL TABLE ComicSearch USING fts4(key, name, image, issue, volume, summary, path, parent_key, date)") 130 | c.execute("INSERT INTO ComicSearch SELECT key, name, image, issue, volume, summary, path, parent_key, date from all_comics") 131 | 132 | c.execute("SELECT COUNT(*) FROM ComicSearch WHERE ComicSearch MATCH ?", (search_string,)) 133 | numcinit = c.fetchone() 134 | num_of_comics = numcinit[0] 135 | num_of_pages = 0 136 | while num_of_comics >= 0: 137 | num_of_comics -= gazee.COMICS_PER_PAGE 138 | num_of_pages += 1 139 | 140 | if page_num == 1: 141 | PAGE_OFFSET = 0 142 | else: 143 | PAGE_OFFSET = gazee.COMICS_PER_PAGE * (int(page_num) - 1) 144 | 145 | c.execute("SELECT * FROM ComicSearch WHERE ComicSearch MATCH ? ORDER BY name ASC, issue ASC LIMIT {nc} OFFSET {pn}".format(nc=gazee.COMICS_PER_PAGE, pn=PAGE_OFFSET), (search_string,)) 146 | # DB Always returns a tuple of lists. After fetching it, we then iterate over its various lists to assign their values to a dictionary. 147 | all_recent_comics_tup = c.fetchall() 148 | comics = [] 149 | for f in all_recent_comics_tup: 150 | comics.append({"Key": f[0], 151 | "ComicName": f[1], 152 | "ComicImage": f[2], 153 | "ComicIssue": f[3], 154 | "ComicVolume": f[4], 155 | "ComicSummary": f[5], 156 | "ComicPath": f[6], 157 | "DateAdded": f[7]}) 158 | 159 | c.execute("DROP TABLE ComicSearch") 160 | connection.commit() 161 | connection.close() 162 | 163 | user = cherrypy.request.login 164 | user_level = gazee.authmech.get_user_level(user) 165 | 166 | logging.info("Search Served") 167 | 168 | return serve_template(templatename="search.html", comics=comics, num_of_pages=num_of_pages, current_page=int(page_num), user_level=user_level, search_string=search_string) 169 | 170 | """ 171 | This returns the library view starting with the root library directory. 172 | """ 173 | # Library Page 174 | @cherrypy.expose 175 | def library(self, parent, directory, page_num=1): 176 | cherrypy.session.load() 177 | if 'sizepref' not in cherrypy.session: 178 | cherrypy.session['sizepref'] = 'wide' 179 | logging.debug("Library Requested") 180 | # Here we set the db file path. 181 | db = Path(os.path.join(gazee.DATA_DIR, gazee.DB_NAME)) 182 | 183 | # Here we make the inital DB connection that we will be using throughout this function. 184 | connection = sqlite3.connect(str(db)) 185 | c = connection.cursor() 186 | 187 | # Here we get the Primary Key of the selected directory 188 | if directory == gazee.COMIC_PATH: 189 | c.execute("SELECT {prk} FROM {tn} WHERE {fp}=?".format(prk=gazee.KEY, tn=gazee.ALL_DIRS, fp=gazee.FULL_DIR_PATH), (directory,)) 190 | parent_dir = '' 191 | else: 192 | c.execute("SELECT {ptk} FROM {tn} WHERE {fp}=?".format(ptk=gazee.PARENT_KEY, tn=gazee.DIR_NAMES, fp=gazee.NICE_NAME), (directory,)) 193 | ptkinit = c.fetchall() 194 | parent_key = [tup[0] for tup in ptkinit] 195 | 196 | for n in parent_key: 197 | c.execute("SELECT {fp} FROM {tn} WHERE {prk}=?".format(fp=gazee.FULL_DIR_PATH, tn=gazee.ALL_DIRS, prk=gazee.KEY), (n,)) 198 | 199 | pdirinit = c.fetchall() 200 | parent_dir = [tup[0] for tup in pdirinit] 201 | 202 | if parent in parent_dir: 203 | break 204 | 205 | full_dir = os.path.join(parent_dir[0], directory) 206 | 207 | c.execute("SELECT {prk} FROM {tn} WHERE {fp}=?".format(prk=gazee.KEY, tn=gazee.ALL_DIRS, fp=gazee.FULL_DIR_PATH), (full_dir,)) 208 | 209 | pkinit = c.fetchall() 210 | pk = [tup[0] for tup in pkinit] 211 | 212 | # Select all the Nice Names from the Dir Names table. 213 | try: 214 | c.execute("SELECT {nn}, {di} FROM {tn} WHERE {ptk}=?".format(nn=gazee.NICE_NAME, di=gazee.DIR_IMAGE, tn=gazee.DIR_NAMES, ptk=gazee.PARENT_KEY), (pk[0],)) 215 | 216 | dirsinit = c.fetchall() 217 | unsorted_directories = [] 218 | for d in dirsinit: 219 | if d[1] is None: 220 | unsorted_directories.append({"DirectoryName": d[0], 221 | "DirectoryImage": "static/images/imgnotfound.png"}) 222 | else: 223 | unsorted_directories.append({"DirectoryName": d[0], 224 | "DirectoryImage": d[1]}) 225 | 226 | c.execute("SELECT COUNT(*) FROM {tn} WHERE {pk}=?".format(tn=gazee.ALL_COMICS, pk=gazee.PARENT_KEY), (pk[0],)) 227 | numcinit = c.fetchone() 228 | num_of_comics = numcinit[0] 229 | num_of_pages = 0 230 | while num_of_comics >= 0: 231 | num_of_comics -= gazee.COMICS_PER_PAGE 232 | num_of_pages += 1 233 | 234 | if page_num == 1: 235 | PAGE_OFFSET = 0 236 | else: 237 | PAGE_OFFSET = gazee.COMICS_PER_PAGE * (int(page_num) - 1) 238 | 239 | # Select all of the comics associated with the parent dir as well. 240 | c.execute("SELECT * FROM {tn} WHERE {prk}=? ORDER BY {cn} ASC LIMIT {np} OFFSET {pn}".format(tn=gazee.ALL_COMICS, cn=gazee.COMIC_NUMBER, np=gazee.COMICS_PER_PAGE, prk=gazee.PARENT_KEY, pn=PAGE_OFFSET), (pk[0],)) 241 | 242 | # DB Always returns a tuple of lists. After fetching it, we then iterate over its various lists to assign their values to a dictionary. 243 | comicsinit = c.fetchall() 244 | comics = [] 245 | for f in comicsinit: 246 | comics.append({"Key": f[0], 247 | "ComicName": f[1], 248 | "ComicImage": f[2], 249 | "ComicIssue": f[3], 250 | "ComicVolume": f[4], 251 | "ComicSummary": f[5], 252 | "ComicPath": f[6], 253 | "DateAdded": f[7]}) 254 | 255 | cp_split = os.path.split(gazee.COMIC_PATH) 256 | 257 | # Grinding the breadcrumb. 258 | if parent_dir == '': 259 | prd = '' 260 | else: 261 | parent_parts = os.path.split(parent_dir[0]) 262 | prd = parent_parts[1] 263 | 264 | if prd == cp_split[1]: 265 | prd = '' 266 | 267 | # Sort and filter the directories 268 | new_dirs = sorted(unsorted_directories, key=lambda k: k['DirectoryName']) 269 | sorted_dirs = new_dirs 270 | directories = sorted_dirs 271 | 272 | filelist = [] 273 | 274 | for d in sorted_dirs: 275 | if d['DirectoryName'].startswith('.'): 276 | directories[:] = [r for r in directories if r.get('DirectoryName') != d['DirectoryName']] 277 | if parent_dir == '': 278 | for root, dirs, files in os.walk(os.path.join(directory, d['DirectoryName'])): 279 | filelist.extend(f for f in files) 280 | if any(".cbz" in s for s in filelist): 281 | filelist = [] 282 | continue 283 | elif any(".cbr" in s for s in filelist): 284 | filelist = [] 285 | continue 286 | else: 287 | filelist = [] 288 | directories[:] = [r for r in directories if r.get('DirectoryName') != d['DirectoryName']] 289 | else: 290 | for root, dirs, files in os.walk(os.path.join(parent_dir[0], directory, d['DirectoryName'])): 291 | filelist.extend(f for f in files) 292 | if any(".cbz" in s for s in filelist): 293 | filelist = [] 294 | continue 295 | elif any(".cbr" in s for s in filelist): 296 | filelist = [] 297 | continue 298 | else: 299 | filelist = [] 300 | directories[:] = [r for r in directories if r.get('DirectoryName') != d['DirectoryName']] 301 | 302 | connection.commit() 303 | connection.close() 304 | 305 | logging.info("Library Served") 306 | 307 | except IndexError: 308 | logging.warning("No Child Directories, Scan your comic path") 309 | directories = [] 310 | comics = [] 311 | prd = '' 312 | num_of_pages = 1 313 | page_num = 1 314 | directory = gazee.COMIC_PATH 315 | 316 | user = cherrypy.request.login 317 | user_level = gazee.authmech.get_user_level(user) 318 | 319 | return serve_template(templatename="library.html", directories=directories, comics=comics, parent_dir=prd, num_of_pages=num_of_pages, current_page=int(page_num), current_dir=directory, user_level=user_level) 320 | 321 | @cherrypy.expose 322 | def download_comic(self, comic_path): 323 | return cherrypy.lib.static.serve_download(comic_path) 324 | 325 | """ 326 | This returns the reading view of the selected comic after being passed the comic path and forcing the default of starting at page 0. 327 | """ 328 | @cherrypy.expose 329 | def read_comic(self, comic_path, page_num=0): 330 | logging.debug("Reader Requested") 331 | 332 | cherrypy.session.load() 333 | username = cherrypy.request.login 334 | 335 | if 'sizepref' not in cherrypy.session: 336 | cherrypy.session['sizepref'] = 'wide' 337 | user_size_pref = cherrypy.session['sizepref'] 338 | 339 | scanner = ComicScanner() 340 | scanner.user_unpack_comic(comic_path, username) 341 | image_list = scanner.reading_images(username) 342 | num_pages = len(image_list) 343 | 344 | if num_pages == 0: 345 | image_list = ['static/images/imgnotfound.png'] 346 | 347 | cookie_comic = re.sub(r'\W+', '', comic_path) 348 | cookie_check = cherrypy.request.cookie 349 | if cookie_comic not in cookie_check: 350 | logging.debug("Cookie Creation") 351 | cookie_set = cherrypy.response.cookie 352 | cookie_set[cookie_comic] = 0 353 | cookie_set[cookie_comic]['path'] = '/' 354 | cookie_set[cookie_comic]['max-age'] = 2419200 355 | next_page = 1 356 | last_page = num_pages - 1 357 | else: 358 | logging.debug("Cookie Read") 359 | page_num = int(cookie_check[cookie_comic].value) 360 | logging.debug("Cookie Set To %d" % page_num) 361 | next_page = page_num + 1 362 | last_page = page_num - 1 363 | 364 | logging.info("Reader Served") 365 | return serve_template(templatename="read.html", pages=image_list, current_page=page_num, np=next_page, lp=last_page, nop=num_pages, size=user_size_pref, cc=cookie_comic) 366 | 367 | """ 368 | This allows us to change pages and do some basic sanity checking. 369 | """ 370 | @cherrypy.expose 371 | def change_page(self, page_str, cookie_comic): 372 | cherrypy.session.load() 373 | if 'sizepref' not in cherrypy.session: 374 | cherrypy.session['sizepref'] = 'wide' 375 | user_size_pref = cherrypy.session['sizepref'] 376 | username = cherrypy.request.login 377 | page_num = int(page_str) 378 | next_page = page_num + 1 379 | last_page = page_num - 1 380 | scanner = ComicScanner() 381 | image_list = scanner.reading_images(username) 382 | num_pages = len(image_list) 383 | if page_num == -1: 384 | page_num = num_pages - 1 385 | next_page = 0 386 | last_page = num_pages - 2 387 | if page_num == num_pages: 388 | page_num = 0 389 | next_page = 1 390 | last_page = num_pages - 1 391 | 392 | cookie_set = cherrypy.response.cookie 393 | cookie_set[cookie_comic] = page_num 394 | cookie_set[cookie_comic]['path'] = '/' 395 | cookie_set[cookie_comic]['max-age'] = 2419200 396 | 397 | return serve_template(templatename="read.html", pages=image_list, current_page=page_num, np=next_page, lp=last_page, nop=num_pages, size=user_size_pref, cc=cookie_comic) 398 | 399 | @cherrypy.expose 400 | def up_size_pref(self, pref): 401 | cherrypy.session.load() 402 | cherrypy.session['sizepref'] = pref 403 | cherrypy.session.save() 404 | return 405 | """ 406 | This returns the settings page. 407 | """ 408 | @cherrypy.expose 409 | def settings(self): 410 | # Here we set the db file path. 411 | db = Path(os.path.join(gazee.DATA_DIR, gazee.DB_NAME)) 412 | 413 | # Here we make the inital DB connection that we will be using throughout this function. 414 | connection = sqlite3.connect(str(db)) 415 | c = connection.cursor() 416 | # Grab Number of Comics in DB for display 417 | c.execute("SELECT COUNT(*) FROM {tn}".format(tn=gazee.ALL_COMICS)) 418 | numcinit = c.fetchone() 419 | num_of_comics = numcinit[0] 420 | 421 | user = cherrypy.request.login 422 | user_level = gazee.authmech.get_user_level(user) 423 | 424 | # Grab all the users for display 425 | c.execute("SELECT * FROM {tn}".format(tn=gazee.USERS)) 426 | usersinit = c.fetchall() 427 | users = [] 428 | for f in usersinit: 429 | users.append({"User": f[0], 430 | "Type": f[2]}) 431 | 432 | # Generate time comic scan has been ongoing 433 | if os.path.exists(os.path.join(gazee.DATA_DIR, "db.lock")): 434 | scan_in_progress = True 435 | made = os.path.getmtime(os.path.join(gazee.DATA_DIR, "db.lock")) 436 | now = time.time() 437 | since = now - made 438 | m, s = divmod(int(since), 60) 439 | h, m = divmod(m, 60) 440 | scantime = ("%d:%02d:%02d" % (h, m, s)) 441 | else: 442 | scan_in_progress = False 443 | scantime = ("%d:%02d:%02d" % (0, 0, 0)) 444 | 445 | logo_paths = [] 446 | for root, dirs, files in os.walk(os.path.join("public", "images", "logos")): 447 | logo_paths.extend(os.path.join(root, f) for f in files if '.png' in f) 448 | 449 | logos = [] 450 | for f in logo_paths: 451 | logos.append(f.replace('public', 'static')) 452 | 453 | logdir = gazee.LOG_DIR 454 | logfiles = [i for i in os.listdir(logdir) if os.path.isfile(os.path.join(logdir, i)) and '.log' in i] 455 | 456 | logging.info("Settings Served") 457 | 458 | return serve_template(templatename="settings.html", user=user, user_level=user_level, 459 | users=users, sip=scan_in_progress, noc=num_of_comics, logdir=logdir, logfiles=logfiles, 460 | scantime=scantime, logos=logos, gazee_version=gazee.versioning.current_version(), 461 | latest_version=gazee.versioning.latest_version(), python_version=sys.version_info) 462 | 463 | @cherrypy.expose 464 | @cherrypy.tools.accept(media='text/plain') 465 | def save_settings(self, scomicPath=None, scomicsPerPage=None, scomicScanInterval=None, smylarPath=None, ssslKey=None, ssslCert=None, sport=4242): 466 | # Set these here as they'll be used to assign the default values of the method arguments to the current values if they aren't updated when the method is called. 467 | config = configparser.ConfigParser() 468 | config.read(os.path.join(gazee.DATA_DIR, 'app.ini')) 469 | 470 | config['GLOBAL']['PORT'] = sport 471 | config['GLOBAL']['COMIC_PATH'] = scomicPath 472 | config['GLOBAL']['COMICS_PER_PAGE'] = scomicsPerPage 473 | config['GLOBAL']['COMIC_SCAN_INTERVAL'] = scomicScanInterval 474 | config['GLOBAL']['MYLAR_DB'] = smylarPath 475 | config['GLOBAL']['SSL_KEY'] = ssslKey 476 | config['GLOBAL']['SSL_CERT'] = ssslCert 477 | with open(os.path.join(gazee.DATA_DIR, 'app.ini'), 'w') as configfile: 478 | config.write(configfile) 479 | configfile.close() 480 | logging.info("Settings Saved") 481 | return 482 | 483 | @cherrypy.expose 484 | def change_theme(self, mainColor, accentColor, webTextColor, logo): 485 | # Set these here as they'll be used to assign the default values of the method arguments to the current values if they aren't updated when the method is called. 486 | config = configparser.ConfigParser() 487 | config.read(os.path.join(gazee.DATA_DIR, 'app.ini')) 488 | 489 | config['GLOBAL']['MAIN_COLOR'] = mainColor 490 | config['GLOBAL']['ACCENT_COLOR'] = accentColor 491 | config['GLOBAL']['WEB_TEXT_COLOR'] = webTextColor 492 | config['GLOBAL']['LOGO'] = logo 493 | with open(os.path.join(gazee.DATA_DIR, 'app.ini'), 'w') as configfile: 494 | config.write(configfile) 495 | configfile.close() 496 | 497 | with open('public/css/style.css', 'r+') as f: 498 | style = f.read() 499 | f.seek(0) 500 | style = style.replace(gazee.MAIN_COLOR, mainColor) 501 | style = style.replace(gazee.ACCENT_COLOR, accentColor) 502 | style = style.replace(gazee.WEB_TEXT_COLOR, webTextColor) 503 | f.write(style) 504 | f.truncate() 505 | 506 | gazee.MAIN_COLOR = mainColor 507 | gazee.ACCENT_COLOR = accentColor 508 | gazee.WEB_TEXT_COLOR = webTextColor 509 | gazee.LOGO = logo 510 | 511 | logging.info("Theme Saved") 512 | return 513 | 514 | @cherrypy.expose 515 | def get_log_text(self, logfile): 516 | logging.info('Dumping log file {} to text.'.format(logfile)) 517 | 518 | with open(os.path.join(gazee.LOG_DIR, logfile), 'r') as f: 519 | log_text = ''.join(reversed(f.readlines())) 520 | 521 | return log_text 522 | 523 | @cherrypy.expose 524 | def change_password(self, user, password): 525 | gazee.authmech.change_pass(user, password) 526 | logging.info("Password Changed") 527 | return 528 | 529 | @cherrypy.expose 530 | def new_user(self, username, password, usertype): 531 | added = False 532 | if gazee.authmech.add_user(username, password, usertype): 533 | logging.info("New " + usertype.title() + " " + username + " Added") 534 | added = True 535 | return json.dumps({'added': added}) 536 | 537 | @cherrypy.expose 538 | def del_user(self, username): 539 | db = Path(os.path.join(gazee.DATA_DIR, gazee.DB_NAME)) 540 | connection = sqlite3.connect(str(db)) 541 | c = connection.cursor() 542 | c.execute("DELETE FROM {tn} WHERE {cn}=?".format(tn=gazee.USERS, cn=gazee.USERNAME), (username,)) 543 | connection.commit() 544 | connection.close() 545 | logging.info("User Deleted") 546 | return 547 | 548 | @cherrypy.expose 549 | def comic_scan(self): 550 | logging.info("DB Build Requested") 551 | scanner = ComicScanner() 552 | t1 = threading.Thread(target=scanner.db_builder) 553 | t1.start() 554 | return 555 | 556 | @cherrypy.expose 557 | def shutdown(self): 558 | cherrypy.engine.exit() 559 | if (os.path.exists(os.path.join(gazee.DATA_DIR, 'db.lock'))): 560 | os.remove(os.path.join(gazee.DATA_DIR, 'db.lock')) 561 | threading.Timer(1, lambda: os._exit(0)).start() 562 | print("Gazee is stopping") 563 | logging.info('Gazee is shutting down...') 564 | return 565 | 566 | @cherrypy.expose 567 | def restart(self): 568 | cherrypy.engine.exit() 569 | if (os.path.exists(os.path.join(gazee.DATA_DIR, 'db.lock'))): 570 | os.remove(os.path.join(gazee.DATA_DIR, 'db.lock')) 571 | popen_list = [sys.executable, gazee.FULL_PATH] 572 | popen_list += gazee.ARGS 573 | print("Gazee is restarting") 574 | logging.info('Restarting Gazee with ' + str(popen_list)) 575 | if sys.platform == 'win32': 576 | subprocess.Popen(popen_list, cwd=os.getcwd()) 577 | os._exit(0) 578 | else: 579 | os.execv(sys.executable, popen_list) 580 | logging.info('Gazee is restarting...') 581 | return 582 | 583 | @cherrypy.expose 584 | def update_gazee(self): 585 | updated = False 586 | if gazee.versioning.update_app(): 587 | print("Gazee is restarting to update.") 588 | logging.info('Gazee is restarting to apply update.') 589 | if (os.path.exists(os.path.join(gazee.DATA_DIR, 'db.lock'))): 590 | os.remove(os.path.join(gazee.DATA_DIR, 'db.lock')) 591 | updated = True 592 | return json.dumps({'update': updated, 'current_version': gazee.versioning.current_version(), 593 | 'latest_version': gazee.versioning.latest_version()}) 594 | 595 | @cherrypy.expose 596 | def opds(self): 597 | # TODO 598 | return "not implemented yet" 599 | -------------------------------------------------------------------------------- /public/js/jscolor.min.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jscolor - JavaScript Color Picker 3 | * 4 | * @link http://jscolor.com 5 | * @license For open source use: GPLv3 6 | * For commercial use: JSColor Commercial License 7 | * @author Jan Odvarko 8 | * 9 | * See usage examples at http://jscolor.com/examples/ 10 | */"use strict";window.jscolor||(window.jscolor=function(){var e={register:function(){e.attachDOMReadyEvent(e.init),e.attachEvent(document,"mousedown",e.onDocumentMouseDown),e.attachEvent(document,"touchstart",e.onDocumentTouchStart),e.attachEvent(window,"resize",e.onWindowResize)},init:function(){e.jscolor.lookupClass&&e.jscolor.installByClassName(e.jscolor.lookupClass)},tryInstallOnElements:function(t,n){var r=new RegExp("(^|\\s)("+n+")(\\s*(\\{[^}]*\\})|\\s|$)","i");for(var i=0;is[u]?-r[u]+n[u]+i[u]/2>s[u]/2&&n[u]+i[u]-o[u]>=0?n[u]+i[u]-o[u]:n[u]:n[u],-r[a]+n[a]+i[a]+o[a]-l+l*f>s[a]?-r[a]+n[a]+i[a]/2>s[a]/2&&n[a]+i[a]-l-l*f>=0?n[a]+i[a]-l-l*f:n[a]+i[a]-l+l*f:n[a]+i[a]-l+l*f>=0?n[a]+i[a]-l+l*f:n[a]+i[a]-l-l*f];var h=c[u],p=c[a],d=t.fixed?"fixed":"absolute",v=(c[0]+o[0]>n[0]||c[0]2)switch(e.mode.charAt(2).toLowerCase()){case"s":return"s";case"v":return"v"}return null},onDocumentMouseDown:function(t){t||(t=window.event);var n=t.target||t.srcElement;n._jscLinkedInstance?n._jscLinkedInstance.showOnClick&&n._jscLinkedInstance.show():n._jscControlName?e.onControlPointerStart(t,n,n._jscControlName,"mouse"):e.picker&&e.picker.owner&&e.picker.owner.hide()},onDocumentTouchStart:function(t){t||(t=window.event);var n=t.target||t.srcElement;n._jscLinkedInstance?n._jscLinkedInstance.showOnClick&&n._jscLinkedInstance.show():n._jscControlName?e.onControlPointerStart(t,n,n._jscControlName,"touch"):e.picker&&e.picker.owner&&e.picker.owner.hide()},onWindowResize:function(t){e.redrawPosition()},onParentScroll:function(t){e.picker&&e.picker.owner&&e.picker.owner.hide()},_pointerMoveEvent:{mouse:"mousemove",touch:"touchmove"},_pointerEndEvent:{mouse:"mouseup",touch:"touchend"},_pointerOrigin:null,_capturedTarget:null,onControlPointerStart:function(t,n,r,i){var s=n._jscInstance;e.preventDefault(t),e.captureTarget(n);var o=function(s,o){e.attachGroupEvent("drag",s,e._pointerMoveEvent[i],e.onDocumentPointerMove(t,n,r,i,o)),e.attachGroupEvent("drag",s,e._pointerEndEvent[i],e.onDocumentPointerEnd(t,n,r,i))};o(document,[0,0]);if(window.parent&&window.frameElement){var u=window.frameElement.getBoundingClientRect(),a=[-u.left,-u.top];o(window.parent.window.document,a)}var f=e.getAbsPointerPos(t),l=e.getRelPointerPos(t);e._pointerOrigin={x:f.x-l.x,y:f.y-l.y};switch(r){case"pad":switch(e.getSliderComponent(s)){case"s":s.hsv[1]===0&&s.fromHSV(null,100,null);break;case"v":s.hsv[2]===0&&s.fromHSV(null,null,100)}e.setPad(s,t,0,0);break;case"sld":e.setSld(s,t,0)}e.dispatchFineChange(s)},onDocumentPointerMove:function(t,n,r,i,s){return function(t){var i=n._jscInstance;switch(r){case"pad":t||(t=window.event),e.setPad(i,t,s[0],s[1]),e.dispatchFineChange(i);break;case"sld":t||(t=window.event),e.setSld(i,t,s[1]),e.dispatchFineChange(i)}}},onDocumentPointerEnd:function(t,n,r,i){return function(t){var r=n._jscInstance;e.detachGroupEvents("drag"),e.releaseTarget(),e.dispatchChange(r)}},dispatchChange:function(t){t.valueElement&&e.isElementType(t.valueElement,"input")&&e.fireEvent(t.valueElement,"change")},dispatchFineChange:function(e){if(e.onFineChange){var t;typeof e.onFineChange=="string"?t=new Function(e.onFineChange):t=e.onFineChange,t.call(e)}},setPad:function(t,n,r,i){var s=e.getAbsPointerPos(n),o=r+s.x-e._pointerOrigin.x-t.padding-t.insetWidth,u=i+s.y-e._pointerOrigin.y-t.padding-t.insetWidth,a=o*(360/(t.width-1)),f=100-u*(100/(t.height-1));switch(e.getPadYComponent(t)){case"s":t.fromHSV(a,f,null,e.leaveSld);break;case"v":t.fromHSV(a,null,f,e.leaveSld)}},setSld:function(t,n,r){var i=e.getAbsPointerPos(n),s=r+i.y-e._pointerOrigin.y-t.padding-t.insetWidth,o=100-s*(100/(t.height-1));switch(e.getSliderComponent(t)){case"s":t.fromHSV(null,o,null,e.leavePad);break;case"v":t.fromHSV(null,null,o,e.leavePad)}},_vmlNS:"jsc_vml_",_vmlCSS:"jsc_vml_css_",_vmlReady:!1,initVML:function(){if(!e._vmlReady){var t=document;t.namespaces[e._vmlNS]||t.namespaces.add(e._vmlNS,"urn:schemas-microsoft-com:vml");if(!t.styleSheets[e._vmlCSS]){var n=["shape","shapetype","group","background","path","formulas","handles","fill","stroke","shadow","textbox","textpath","imagedata","line","polyline","curve","rect","roundrect","oval","arc","image"],r=t.createStyleSheet();r.owningElement.id=e._vmlCSS;for(var i=0;i=3&&(s=r[0].match(i))&&(o=r[1].match(i))&&(u=r[2].match(i))){var a=parseFloat((s[1]||"0")+(s[2]||"")),f=parseFloat((o[1]||"0")+(o[2]||"")),l=parseFloat((u[1]||"0")+(u[2]||""));return this.fromRGB(a,f,l,t),!0}}return!1},this.toString=function(){return(256|Math.round(this.rgb[0])).toString(16).substr(1)+(256|Math.round(this.rgb[1])).toString(16).substr(1)+(256|Math.round(this.rgb[2])).toString(16).substr(1)},this.toHEXString=function(){return"#"+this.toString().toUpperCase()},this.toRGBString=function(){return"rgb("+Math.round(this.rgb[0])+","+Math.round(this.rgb[1])+","+Math.round(this.rgb[2])+")"},this.isLight=function(){return.213*this.rgb[0]+.715*this.rgb[1]+.072*this.rgb[2]>127.5},this._processParentElementsInDOM=function(){if(this._linkedElementsProcessed)return;this._linkedElementsProcessed=!0;var t=this.targetElement;do{var n=e.getStyle(t);n&&n.position.toLowerCase()==="fixed"&&(this.fixed=!0),t!==this.targetElement&&(t._jscEventsAttached||(e.attachEvent(t,"scroll",e.onParentScroll),t._jscEventsAttached=!0))}while((t=t.parentNode)&&!e.isElementType(t,"body"))};if(typeof t=="string"){var h=t,p=document.getElementById(h);p?this.targetElement=p:e.warn("Could not find target element with ID '"+h+"'")}else t?this.targetElement=t:e.warn("Invalid target element: '"+t+"'");if(this.targetElement._jscLinkedInstance){e.warn("Cannot link jscolor twice to the same element. Skipping.");return}this.targetElement._jscLinkedInstance=this,this.valueElement=e.fetchElement(this.valueElement),this.styleElement=e.fetchElement(this.styleElement);var d=this,v=this.container?e.fetchElement(this.container):document.getElementsByTagName("body")[0],m=3;if(e.isElementType(this.targetElement,"button"))if(this.targetElement.onclick){var g=this.targetElement.onclick;this.targetElement.onclick=function(e){return g.call(this,e),!1}}else this.targetElement.onclick=function(){return!1};if(this.valueElement&&e.isElementType(this.valueElement,"input")){var y=function(){d.fromString(d.valueElement.value,e.leaveValue),e.dispatchFineChange(d)};e.attachEvent(this.valueElement,"keyup",y),e.attachEvent(this.valueElement,"input",y),e.attachEvent(this.valueElement,"blur",c),this.valueElement.setAttribute("autocomplete","off")}this.styleElement&&(this.styleElement._jscOrigStyle={backgroundImage:this.styleElement.style.backgroundImage,backgroundColor:this.styleElement.style.backgroundColor,color:this.styleElement.style.color}),this.value?this.fromString(this.value)||this.exportColor():this.importColor()}};return e.jscolor.lookupClass="jscolor",e.jscolor.installByClassName=function(t){var n=document.getElementsByTagName("input"),r=document.getElementsByTagName("button");e.tryInstallOnElements(n,t),e.tryInstallOnElements(r,t)},e.register(),e.jscolor}()); -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | Gazee - A web based comic reader 635 | Copyright (C) 2017 Jessi Moss / Hubcaps 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Gazee Copyright (C) 2017 Jessi Moss / Hubcaps 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | 676 | --------------------------------------------------------------------------------