Exemple #1
0
    def openManga(self,
                  path,
                  startOnPage=0,
                  replaceCurrent=True,
                  loadNotify=True,
                  checkHistory=True):
        if replaceCurrent:
            mangaState = None
            if checkHistory:  # check for saved state for the path
                mangaState = self.getMangaStateFromHistory(path)
            if mangaState:
                print('manga path found in history')
                self.openMangaFromState(mangaState)
            else:
                print("opening %s on page %d" % (path, startOnPage))
                mangaInstance = manga.Manga(self,
                                            path,
                                            startOnPage,
                                            loadNotify=loadNotify)
                # close and replace any current active manga
                self.setActiveManga(mangaInstance)

                # increment manga count
                self.stats.incrementUnitCount()

                # return the newly created manga instance
                return mangaInstance
        else:
            return manga.Manga(self, path, startOnPage, loadNotify=loadNotify)
Exemple #2
0
def __tuple_to_manga(tuple):
    #basic information
    manga = mn.Manga(tuple[__manga_index_MangaID],
                     tuple[__manga_index_Nickname])
    manga = mn.Manga(tuple[__manga_index_MangaID],
                     tuple[__manga_index_Nickname])
    manga.full_name = tuple[__manga_index_FullName]
    #fields for people working on it
    manga.translator = tuple[__manga_index_Translator]
    manga.proofreader = tuple[__manga_index_Proofreader]
    manga.redrawer = tuple[__manga_index_Redrawer]
    manga.typesetter = tuple[__manga_index_Typesetter]
    manga.qc = tuple[__manga_index_QC]
    #abandoned status
    manga.abandoned = bool(tuple[__manga_index_Abandoned])
    return manga
Exemple #3
0
 def openMangaFromState(self, state):
     print("opening manga from state")
     mangaInstance = manga.Manga(self, load=False)
     mangaInstance.setState(state)
     if mangaInstance.container is None:
         print("container creation failed")
         return False
     else:
         # close and replace any current active manga
         self.setActiveManga(mangaInstance)
         return True
Exemple #4
0
    def manga(self, manga_id):
        """Creates an instance of myanimelist.Manga with the given ID.

        :type manga_id: int
        :param manga_id: The desired manga's ID.

        :rtype: :class:`myanimelist.manga.Manga`
        :return: A new Manga instance with the given ID.

        """
        return manga.Manga(self, manga_id)
Exemple #5
0
async def manga(ctx, *args):
    if len(args) == 0:
        await ctx.send("No arguments. Usage:")
        await ctx.send(middle.get_help("manga"))
    elif len(args) == 1:
        await ctx.send("Need to provide both ID and manga")
    elif len(args) == 2:
        if args[0].isnumeric() == False or int(args[0]) < 1 or len(
                args[0]) > 6 or len(args[1]) > 30:
            await ctx.send(
                "ID must be positive up to 6 numbers and up to 30 characters for manga"
            )
            return
        try:
            manga = mn.Manga(int(args[0]), args[1])
            await ctx.send(middle.new_manga(manga))
        except ValueError:
            await ctx.send("ID needs to be a number. Usage:")
            await ctx.send(middle.get_help("manga"))
    else:
        await ctx.send("Too many arguments. Usage:")
        await ctx.send(middle.get_help("manga"))
#need classes from these
import manga
import chapter

#Test initialization
database.initialize()
assert database.__connection_open, "Database connection not opened"
assert database.__connection is not None, "Connection object not initialized"
assert database.__cursor is not None, "Cursor not initialized"

#remove past test values...
database.__cursor.execute('delete from Manga where MangaID=15514')
database.__cursor.execute('delete from Chapters where RelatedMangaID=15514')

#Test creating values
test_write_manga = manga.Manga(15514, "kobayashi")
database.create_manga(test_write_manga)

#test creating chapters
database.create_chapter(test_write_manga, 1)
test_write_chapter = chapter.Chapter(test_write_manga, 2)
database.create_chapter_o(test_write_chapter)

#have to manually check in the sqlite files if these are present
print(
    "Check in sqlite file after completion if the chapters and manga are present and correct"
)

#test getting ID from nickname
test_id = database.get_manga_id("kobayashi")
assert test_id, "Failed to get ID"