Beispiel #1
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
Beispiel #2
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
Beispiel #3
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
Beispiel #4
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
Beispiel #5
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
Beispiel #6
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)
Beispiel #7
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)
Beispiel #8
0
 def to_db(self, database: Database):
     database.add_node(self,
                       label=f"{self.state.name}/{self.episodesWatched}",
                       raw=True)
     return self.hash
Beispiel #9
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)
Beispiel #10
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
Beispiel #11
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
Beispiel #12
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
Beispiel #13
0
 def to_db(self, database: Database):
     database.add_node(self, label=f"{self.namespace}: {self.id}", raw=True)
     return self.__hash__()
Beispiel #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
Beispiel #15
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
Beispiel #16
0
 def to_db(self, database: Database):
     database.add_node(self,
                       label=f"{self.rated}/{self.rank}/{self.popularity}",
                       raw=True)
     return self.hash
Beispiel #17
0
 def to_db(self, database: Database):
     return database.add_node(self, label=self.Tag, raw=True)
Beispiel #18
0
 def to_db(self, database: Database):
     return database.add_node(self, label=str(self.number), raw=True)
Beispiel #19
0
 def to_db(self, database: Database):
     return database.add_node(self, label=self.url.split("/")[-1], raw=True)
Beispiel #20
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
Beispiel #21
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)
Beispiel #22
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
Beispiel #23
0
 def to_db(self, database: Database):
     return database.add_node(self,
                              label=f"{self.Localization.Tag}: {self.Text}",
                              raw=True)
Beispiel #24
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