Пример #1
0
    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
Пример #2
0
 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