コード例 #1
0
def directConverter(chapterids=[]):
    """ Function that handles direct calls of the Converter """

    logging.debug("Following Chapters are directly converted:")
    logging.debug(chapterids)

    chapters = helper.getChaptersFromID(chapterids)

    if not chapters:
        logging.error("No Chapters found with said ID!")
    else:
        # Start conversion loop!
        for chapter in chapters:

            # Verify if chapter has been downloaded already
            if not helper.verifyDownload(chapter):
                logging.info("Manga %s has not been downloaded!", chapter[2])
            else:

                # Spawn an Converter Object & get basic data from database & config
                current_conversation = Converter()
                current_conversation.data_collector(chapter)

                if os.path.exists(current_conversation.cbzlocation):
                    logging.info("Manga %s converted to CBZ already!",
                                 current_conversation.mangatitle)
                else:
                    current_conversation.cbz_creator()

                # Start conversion to Ebook format!
                if os.path.exists(current_conversation.eblocation):
                    logging.info("Manga %s converted to Ebook already!",
                                 current_conversation.mangatitle)
                else:
                    current_conversation.eb_creator()
コード例 #2
0
ファイル: SenderHandler.py プロジェクト: rhcw/m2em
def directSender(chapterids=[]):
    """ Function that handles the coordination of directly sending ebooks """

    logging.debug("Following Chapters are directly sent:")
    logging.debug(chapterids)

    chapters = helper.getChaptersFromID(chapterids)

    # Load Users
    users = helper.getUsers()

    # Debug Users:
    logging.debug("Userlist:")
    for i in users:
        logging.debug(i.name)

    if not chapters:
        logging.error("No Chapters found with said ID!")
    else:
        # Start conversion loop!
        for chapter in chapters:

            # Initiate Sender class and fill it with data
            current_sender = Sender()
            current_sender.data_collector(chapter)
            current_sender.users = users

            # Check if ebook has been converted yet, else skip
            if not os.path.exists(current_sender.eblocation):
                logging.debug("Manga %s has not been converted yet.",
                              current_sender.mangatitle)
            else:
                logging.info("Sending %s...", current_sender.mangatitle)
                current_sender.send_eb()
コード例 #3
0
ファイル: DownloaderHandler.py プロジェクト: rhcw/m2em
def directDownloader(chapterids=[]):

    logging.debug("Following Chapters are directly converted:")
    logging.debug(chapterids)

    chapters = helper.getChaptersFromID(chapterids)

    # Load Users
    users = helper.getUsers()

    # Debug Users:
    logging.debug("Userlist:")
    logging.debug(users)

    if not chapters:
        logging.error("No Chapters found with said ID!")
    else:
        # Start conversion loop!
        for chapter in chapters:

            # Initialize Downloader class & load basic params
            current_chapter = Downloader()
            current_chapter.data_collector(chapter)

            # Check if the old DL location is being used and fix it!
            oldlocation = str(current_chapter.saveloc +
                              current_chapter.mangatitle)
            newlocation = str(current_chapter.saveloc +
                              current_chapter.manganame)
            if os.path.isdir(oldlocation):
                logging.info("Moving %s from old DL location to new one..." %
                             current_chapter.mangatitle)
                helper.createFolder(newlocation)
                move(oldlocation, newlocation)

            # Check if chapter needs to be downloaded
            if helper.verifyDownload(chapter):
                logging.info("Manga %s downloaded already!" %
                             current_chapter.mangatitle)
            else:

                current_chapter.data_processor()