Ejemplo n.º 1
0
 def to_db(self, database: Database):
     self.list.sort(key=lambda e: e.index)
     database.add_node(self, label=str(len(self.list)))
     for item in self.list:
         item_hash = item.to_db(database)
         database.add_edge(self.hash, item_hash)
     return self.hash
Ejemplo n.º 2
0
 def PopulateAnime(self, database: Database, anime_hash: str):
     oldAnimeData = AnimeStruct.Anime.from_db(anime_hash, database)
     if oldAnimeData.id.getID("Animeshon"):
         AnimeshonID = oldAnimeData.id.getID("Animeshon")
         query = queries.getAnime.format(AnimeshonID=AnimeshonID)
         print(f"Animeshon: Obtaining Anime Metadata: {AnimeshonID}")
         queryReply, raw = self.query(query, 'get')
         anime_metadata = queryReply.get("data").get('getAnime')
         properAnime = AnimeshonFormatter.AnimeMetadata(anime_metadata, oldAnimeData)
         # remove edges to stop the anime from keeping some old info like type
         database.remove_successor_edges(oldAnimeData.hash)
         properAnime.to_db(database)
Ejemplo n.º 3
0
 def PopulateAnime(self, database: Database, anime_hash: str):
     oldAnimeData = AnimeStruct.Anime.from_db(anime_hash, database)
     if oldAnimeData.id.getID("MAL"):
         malID = oldAnimeData.id.getID("MAL")
         print(f"MAL: Obtaining Anime Metadata: {malID}")
         url = URL_MAIN + URL_DETAILS.format(
             id=str(malID)) + ANIME_ALL_FIELDS
         anime_metadata = self.load(url)
         properAnime = MALFormatter.AnimeMetadata(anime_metadata,
                                                  oldAnimeData)
         # remove edges to stop the anime from keeping some old info like type
         database.remove_successor_edges(oldAnimeData.hash)
         properAnime.to_db(database)
Ejemplo n.º 4
0
 def to_db(self, database: Database):
     since = to = "Unknown"
     if self.since:
         since = self.since.isoformat()
     if self.to:
         to = self.to.isoformat()
     label = f"from:{since} to:{to}"
     return database.add_node(self, label=label, raw=True)
Ejemplo n.º 5
0
 def to_db(self, database: Database):
     database.add_node(self, label='')
     # contenthash = self.content.to_db(database)
     # database.add_edge(self.hash, contenthash)
     audiohash = self.audio.to_db(database)
     database.add_edge(self.hash, audiohash)
     typehash = self.type.to_db(database)
     database.add_edge(self.hash, typehash)
     versionhash = self.version.to_db(database)
     database.add_edge(self.hash, versionhash)
     return self.hash
Ejemplo n.º 6
0
 def __init__(self, taskDict: dict):
     self.tasker: Tasker = Tasker(taskDict)
     self.database: Database = Database()
     self.settings: Settings = Settings()
     self.plugins: Plugins = Plugins(self.settings)
     self.metadataManager = MetadataManager(self)
     self.libraryManager = LibraryManager(self)
     self.ui = UI(self)
     populate_tasks(self)
     self.tasker.loop()
Ejemplo n.º 7
0
 def to_db(self, database: Database):
     database.add_node(self, label=self.actor.name)
     if self.actor:
         database.add_edge(self.hash, self.actor.to_db(database))
     if self.voiced:
         database.add_edge(self.hash, self.voiced.to_db(database))
     return self.hash
Ejemplo n.º 8
0
 def to_db(self, database: Database):
     database.add_node(self, label=self.Type.name)
     typehash = self.Type.to_db(database)
     database.add_edge(self.hash, typehash)
     metahash = self.MetaIDs.to_db(database)
     database.add_edge(self.hash, metahash)
     return self.hash
Ejemplo n.º 9
0
 def to_db(self, database: Database):
     database.add_node(self,
                       label=f"{self.rated}/{self.rank}/{self.popularity}",
                       raw=True)
     return self.hash
Ejemplo n.º 10
0
 def to_db(self, database: Database):
     # Todo: See if there are more Tags in the database with the same name
     #  but that may have a different list of aliases
     return database.add_node(self, label=self.name, raw=True)
Ejemplo n.º 11
0
 def to_db(self, database: Database):
     return database.add_node(self, label=self.Tag, raw=True)
Ejemplo n.º 12
0
    def to_db(self, database: Database):
        # Todo: maybe add Class atribute?
        # Todo: When adding to the database see if another exists
        #  see the diferences (like going from scheduled to airing)
        #  and call the appropriate flags
        hash_list: List[str] = []

        if self.ageRating:
            this_hash = self.ageRating.to_db(database)
            hash_list.append(this_hash)

        if self.status:
            this_hash = self.status.to_db(database)
            hash_list.append(this_hash)

        if self.publicRating:
            this_hash = self.publicRating.to_db(database)
            hash_list.append(this_hash)

        if self.libraryStatus:
            this_hash = self.libraryStatus.to_db(database)
            hash_list.append(this_hash)

        if self.personalRating:
            this_hash = self.personalRating.to_db(database)
            hash_list.append(this_hash)

        if self.description:
            this_hash = self.description.to_db(database)
            hash_list.append(this_hash)

        if self.type:
            this_hash = self.type.to_db(database)
            hash_list.append(this_hash)

        if self.season:
            this_hash = self.season.to_db(database)
            hash_list.append(this_hash)

        if self.episodes:
            this_hash = self.episodes.to_db(database)
            hash_list.append(this_hash)

        if self.id:
            this_hash = self.id.to_db(database)
            hash_list.append(this_hash)

        for name in self.names.list:
            this_hash = name.to_db(database)
            hash_list.append(this_hash)

        for image in self.images.list:
            this_hash = image.to_db(database)
            hash_list.append(this_hash)

        for tag in self.tags.list:
            this_hash = tag.to_db(database)
            hash_list.append(this_hash)

        for audio in self.soundtracks.list:
            this_hash = audio.to_db(database)
            hash_list.append(this_hash)

        for voiceacting in self.voiceActings.list:
            this_hash = voiceacting.to_db(database)
            hash_list.append(this_hash)

        for crossref in self.crossRefs.list:
            this_hash = crossref.to_db(database)
            hash_list.append(this_hash)

        for video in self.videos.list:
            this_hash = video.to_db(database)
            hash_list.append(this_hash)

        for running in self.runnings.list:
            this_hash = running.to_db(database)
            hash_list.append(this_hash)

        for studio in self.studios.list:
            this_hash = studio.to_db(database)
            hash_list.append(this_hash)

        database.add_node(self, label=self.names.list[0].Text)
        for hash in hash_list:
            database.add_edge(self.hash, hash)
        return self.hash
Ejemplo n.º 13
0
 def to_db(self, database: Database):
     database.add_node(self,
                       label=f"{self.state.name}/{self.episodesWatched}",
                       raw=True)
     return self.hash
Ejemplo n.º 14
0
 def to_db(self, database: Database):
     database.add_node(self, label=self.name, raw=True)
     database.add_edge(self.hash, self.names.to_db(database))
     database.add_edge(self.hash, self.images.to_db(database))
     return self.hash
Ejemplo n.º 15
0
 def to_db(self, database: Database):
     database.add_node(self, label="", raw=True)
     namehash = self.names.to_db(database)
     database.add_edge(self.hash, namehash)
     return self.hash
Ejemplo n.º 16
0
 def to_db(self, database: Database):
     database.add_node(self, label=str(len(self.list)))
     for metaid in self.list:
         this_hash = metaid.to_db(database)
         database.add_edge(self.hash, this_hash)
     return self.hash
Ejemplo n.º 17
0
 def to_db(self, database: Database):
     database.add_node(self, label=str(len(self.list)))
     for item in self.list:
         item_hash = item.to_db(database)
         database.add_edge(self.hash, item_hash)
     return self.hash
Ejemplo n.º 18
0
def to_db(lists: AnimeLists, database: Database):
    root_hash = database.add_node(lists, label="Root")

    list_hash = database.add_node(lists.Watching, label="Watching")
    database.add_edge(root_hash, list_hash)
    for anime in lists.Watching.list:
        anime_hash = anime.to_db(database)
        database.add_edge(list_hash, anime_hash)

    list_hash = database.add_node(lists.Completed, label="Completed")
    database.add_edge(root_hash, list_hash)
    for anime in lists.Completed.list:
        anime_hash = anime.to_db(database)
        database.add_edge(list_hash, anime_hash)

    list_hash = database.add_node(lists.Hold, label="Hold")
    database.add_edge(root_hash, list_hash)
    for anime in lists.Hold.list:
        anime_hash = anime.to_db(database)
        database.add_edge(list_hash, anime_hash)

    list_hash = database.add_node(lists.Dropped, label="Dropped")
    database.add_edge(root_hash, list_hash)
    for anime in lists.Dropped.list:
        anime_hash = anime.to_db(database)
        database.add_edge(list_hash, anime_hash)

    list_hash = database.add_node(lists.PlanToWatch, label="PlanToWatch")
    database.add_edge(root_hash, list_hash)
    for anime in lists.PlanToWatch.list:
        anime_hash = anime.to_db(database)
        database.add_edge(list_hash, anime_hash)

    list_hash = database.add_node(lists.NoList, label="NoList")
    database.add_edge(root_hash, list_hash)
    for anime in lists.NoList.list:
        anime_hash = anime.to_db(database)
        database.add_edge(list_hash, anime_hash)
Ejemplo n.º 19
0
 def to_db(self, database: Database):
     database.add_node(self, label=self.index, raw=True)
     if self.ageRating:
         database.add_edge(self.hash, self.ageRating.to_db(database))
     if self.names:
         database.add_edge(self.hash, self.names.to_db(database))
     if self.tags:
         database.add_edge(self.hash, self.tags.to_db(database))
     if self.videos:
         database.add_edge(self.hash, self.videos.to_db(database))
     if self.type:
         database.add_edge(self.hash, self.type.to_db(database))
     if self.description:
         database.add_edge(self.hash, self.description.to_db(database))
     return self.hash
Ejemplo n.º 20
0
 def to_db(self, database: Database):
     database.add_node(self,
                       label=f"{self.url.split('/')[-1]}: {self.duration}",
                       raw=True)
     database.add_edge(self.hash, self.type.to_db(database))
     return self.hash
Ejemplo n.º 21
0
 def to_db(self, database: Database):
     database.add_node(self, label=f"{self.namespace}: {self.id}", raw=True)
     return self.__hash__()
Ejemplo n.º 22
0
 def to_db(self, database: Database):
     return database.add_node(self, label=self.url.split("/")[-1], raw=True)
Ejemplo n.º 23
0
 def to_db(self, database: Database):
     return database.add_node(self, label=str(self.number), raw=True)
Ejemplo n.º 24
0
 def to_db(self, database: Database):
     # Dont look for matches. If the hash matches its the same MetaID
     return database.add_node(self,
                              label=f"{self.PluginName}: {self.id}",
                              raw=True)
Ejemplo n.º 25
0
 def to_db(self, database: Database):
     database.add_node(self, label=str(self))
     database.add_edge(self.hash, self.Year.to_db(database))
     database.add_edge(self.hash, self.SeasonName.to_db(database))
     return self.hash
Ejemplo n.º 26
0
 def to_db(self, database: Database):
     return database.add_node(self,
                              label=f"{self.Localization.Tag}: {self.Text}",
                              raw=True)
Ejemplo n.º 27
0
 def to_db(self, database: Database):
     database.add_node(self, label='')
     database.add_edge(self.hash, self.names.to_db(database))
     return self.hash