-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
179 additions
and
36 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*- coding:utf-8 -*- | ||
|
||
from configparser import ConfigParser | ||
|
||
CONFIG = 'default.ini' | ||
|
||
HTML_TEMPLATE = ''' | ||
<!doctype html> | ||
<html lang="en"> | ||
<head></head> | ||
<body> | ||
<div>{}</div> | ||
</body> | ||
</html> | ||
''' | ||
|
||
|
||
class SingleConfig: | ||
"""Singleton forcing that there is only one configuration instance used""" | ||
class Config(ConfigParser): | ||
|
||
def get_config(self, name): | ||
self.read(name) | ||
return self | ||
|
||
instance = None | ||
|
||
def __init__(self): | ||
if not SingleConfig.instance: | ||
SingleConfig.instance = SingleConfig.Config() | ||
|
||
def __getattr__(self, item): | ||
return getattr(self.instance, item) | ||
|
||
|
||
def get_config(name): | ||
config = SingleConfig() | ||
return config.get_config(name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# -*- coding:utf-8 -*- | ||
|
||
import sys | ||
from argparse import ArgumentParser | ||
from .main import ComicThief | ||
|
||
OPTIONS = [ | ||
(('-s', '--search'), {'help': 'search'}), | ||
(('-d', '--download'), {'help': 'download'}), | ||
(('-e', '--episode'), {'help': 'choose episode', 'type': int}), | ||
(('-o', '--output'), {'help': 'output format html. pdf, cbr'}), | ||
] | ||
|
||
|
||
def add_arguments(parser): | ||
for option, kwargs in OPTIONS: | ||
parser.add_argument(*option, **kwargs) | ||
|
||
if __name__ == '__main__': | ||
""" | ||
ct.py -s nazwa_komiksu <-szuka komiks i gdy znajdzie zwraca epizody | ||
ct.py -d nazwa_komiksu -e nazwa_epizodu -> sciaga dany epizod komiksu | ||
ct.py -d nazwa_komiksu -e -all -> sciaga wszystkie epizody komiksu | ||
""" | ||
ct = ComicThief() | ||
parser = ArgumentParser() | ||
add_arguments(parser) | ||
args = parser.parse_args() | ||
if args.search: | ||
print('searching') | ||
ct.search(args.search) | ||
elif args.download: | ||
print('downloading') | ||
if args.output: | ||
print("outputing") | ||
if args.episode: | ||
print("outputing") | ||
|
||
print(sys.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[COMICS_LIST] | ||
default: http://www.readcomics.tv/comic-list | ||
|
||
[COMICS_LIST_XPATH] | ||
default: //div[@class="serie-box"]/ul/li/a | ||
|
||
[COMICS_SUBPAGE_XPATH] | ||
default: //ul[@class="basic-list"]/li/a | ||
|
||
[COMICS_IMAGES_XPATH] | ||
default: //div[@class="chapter-container"]/img/@src | ||
|
||
[SETTINGS] | ||
img_dir = img |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters