Пример #1
0
    def data_collector(self, chapter):
        # Load config right at the start
        config = None
        if not config:
            config = Config.load_config()

        # Load configs required here
        self.database = config["Database"]
        self.saveloc = config["SaveLocation"]

        # get relevant data of this Chapter
        self.mangastarturl = chapter.url
        self.mangapages = chapter.pages
        self.mangatitle = chapter.title
        self.manganame = chapter.manganame
        self.chapterdate = chapter.date

        # check if mangatitle or manganame contains ":" characters that OS can't handle as folders
        self.mangatitle = helper.sanetizeName(self.mangatitle)
        self.manganame = helper.sanetizeName(self.manganame)

        # Define Download location
        self.downloadfolder = str(self.saveloc + self.manganame + "/" +
                                  self.mangatitle + "/images")

        # get Origin of manga (Which mangawebsite)
        self.origin = helper.getSourceURL(self.mangastarturl)

        # Initiate URL list
        self.imageurls = []
Пример #2
0
    def __init__(self):

        # Python 3 is required!
        if sys.version_info[0] < 3:
            sys.stdout.write("Sorry, requires Python 3.x, not Python 2.x\n")
            sys.exit(1)

        # Get args right at the start
        self.args = None
        if not self.args:
            self.read_arguments()

        # Load config right at the start
        self.config = None
        if not self.config:
            self.config = Config.load_config()
            logging.debug("Loaded Config:")
            logging.debug(self.config)

        # Check if Database exists, else create
        if not os.path.isfile(self.config["Database"]):
            helper.createFolder(self.config["SaveLocation"])
            helper.createDB()

        # Check weather there are some database migrations
        mversion = helper.getMigrationVersion() + ".py"
        if self.config["DisableMigrations"] == "True":
            logging.debug("Migrations disabled! Current version: %s ",
                          mversion)
        else:
            if mversion in os.listdir(os.getcwd() + "/migrations"):
                logging.debug("No migrations required! Current version: %s ",
                              mversion)
            else:
                migrator.migrate()
Пример #3
0
    def data_collector(self, chapter):
        """ Method that gathers data required for this class """

        # Load config right at the start
        config = None
        if not config:
            config = Config.load_config()

        # Load configs required here
        self.saveloc = config["SaveLocation"]
        self.ebformat = config["EbookFormat"]
        self.smtpserver = config["SMTPServer"]
        self.serverport = config["ServerPort"]
        self.emailadress = config["EmailAddress"]
        self.password = config["EmailAddressPw"]
        self.starttls = config["ServerStartSSL"]


        # get relevant data of this Manga
        self.mangatitle = chapter.title
        self.chapterdate = chapter.date
        self.mangaid = int(chapter.chapterid)
        self.issent = int(chapter.issent)
        self.manganame = chapter.manganame

        # check if mangatitle or manganame contains ":" characters that OS can't handle as folders
        self.mangatitle = helper.sanetizeName(self.mangatitle)
        self.manganame = helper.sanetizeName(self.manganame)


        self.eblocation = str(self.saveloc + self.manganame + "/" + self.mangatitle + "/" +
                              self.mangatitle + "." + self.ebformat.lower())

        # Initialize emtpy Users table
        self.users = []
Пример #4
0
    def data_collector(self, chapter):
        """ Method that collects data"""

        # Load config right at the start
        config = None
        if not config:
            config = Config.load_config()

        # Load configs required here
        self.saveloc = config["SaveLocation"]
        self.ebformat = config["EbookFormat"]
        self.ebprofile = config["EbookProfile"]

        # get relevant data of this Manga
        self.mangatitle = chapter.title
        self.manganame = chapter.manganame
        self.chapterdate = chapter.date

        # check if mangatitle or manganame contains ":" characters that OS can't handle as folders
        self.mangatitle = helper.sanetizeName(self.mangatitle)
        self.manganame = helper.sanetizeName(self.manganame)

        # create folder variables
        self.imagefolder = str(self.saveloc + self.manganame + "/" +
                               self.mangatitle + "/images/")
        self.eblocation = str(self.saveloc + self.manganame + "/" +
                              self.mangatitle + "/" + self.mangatitle + "." +
                              self.ebformat.lower())
        self.cbzlocation = str(self.saveloc + self.manganame + "/" +
                               self.mangatitle + "/" + self.mangatitle +
                               ".cbz")
Пример #5
0
    def __init__(self):

        # Python 3 is required!
        if sys.version_info[0] < 3:
            sys.stdout.write("Sorry, requires Python 3.x, not Python 2.x\n")
            sys.exit(1)

        # Get args right at the start
        self.args = None
        if not self.args:
            self.read_arguments()

        # Load config right at the start
        self.config = None
        if not self.config:
            self.config = Config.load_config()
            logging.debug("Loaded Config:")
            logging.debug(self.config)

        # Check if Database exists, else create
        if not os.path.isfile(self.config["Database"]):
            helper.createFolder(self.config["SaveLocation"])
            helper.createDB()
Пример #6
0
""" Models Module """
from peewee import *
import bin.Config as Config

# Load config right at the start
config = Config.load_config()

db = SqliteDatabase(config['Database'])


class ModelBase(Model):
    class Meta:
        database = db


class User(ModelBase):
    email = TextField(null=True)
    name = TextField()
    kindle_mail = TextField(null=True)
    sendtokindle = IntegerField(null=True)
    userid = AutoField()


class Chapter(ModelBase):
    chapter = TextField(null=True)
    chapterid = AutoField()
    date = TextField(null=True)
    desc = TextField(null=True)
    isconverted = IntegerField(null=True)
    ispulled = IntegerField(null=True)
    issent = IntegerField(null=True)