def getShowDetails(self, filesystemDir, MatchingShow): """ Retrieves Show details. :param filesystemDir: Path to filetypes.xml :type filesystemDir: string :param Show: Show object to add file name details to. :type Show: :class:`api.dbapi.Show` """ if MatchingShow == None: return None #FIXME: Show should not be a list (but resolved after self.getMatchingShows() ). seasonNumber = self.getSeason() episodeNumber = self.getEpisode() try: NewSeason = MatchingShow.getSeason(Season(seasonNumber)) NewEpisode = NewSeason.getEpisode( Episode(episodeNumber, 'title', 'airdate')) NewSeason.episodes = [] except AttributeError: print "The episode does not exist. Update database!" return None ## Episode does not exist. if NewEpisode == None: return None #FIXME: Proper regex function to get file suffix. self.fileSuffix = self.fileName[-4:] NewShow = Show(MatchingShow.name, MatchingShow.duration, MatchingShow.backend, MatchingShow.url) NewShow.addEpisode(NewEpisode, NewSeason) return NewShow
def compareDetails( self, currentShow, newShow ) : """ Compares two Shows for differences. :param currentShow: Old show :type currentShow: :class:`api.dbapi.Show` :param newShow: New show :type newShow: :class:`api.dbapi.Show` :returns: Updated show. :rtype: :class:`api.dbapi.Show` """ editedShow = Show( currentShow.name, currentShow.duration, currentShow.backend, currentShow.url ) for newSeason in newShow.seasons : currentSeason = currentShow.getSeason( newSeason ) if currentSeason == None : editedShow.addSeason( newSeason ) else : editedShow.addSeason( self.compareSeasons( currentSeason, newSeason ) ) return editedShow