예제 #1
0
def videoStatusHandleMovie(myMedia):
    if pchtrakt.lastPath != myMedia.oStatus.fullPath:
        pchtrakt.watched = 0
        pchtrakt.lastPath = myMedia.oStatus.fullPath
        pchtrakt.currentTime = myMedia.oStatus.currentTime
        if pchtrakt.lastPath != '':
            if myMedia.oStatus.percent > 90:
                pchtrakt.watched = 1
                Debug('Started at more than 90%! I' 'm not doing anything!')
            else:
                movieStarted(myMedia)
    if not pchtrakt.watched:
        if myMedia.oStatus.percent > 90:
            pchtrakt.watched = movieIsEnding(myMedia)
        elif myMedia.oStatus.currentTime > pchtrakt.currentTime + int(
                TraktRefreshTime) * 60:
            pchtrakt.currentTime = myMedia.oStatus.currentTime
            movieStillRunning(myMedia)
    elif myMedia.oStatus.percent < 10 and myMedia.oStatus.status != EnumStatus.STOP:
        Debug(
            'It seems you came back at the begining of the video... so I say to trakt it\'s playing'
        )
        pchtrakt.watched = 0
        pchtrakt.currentTime = myMedia.oStatus.currentTime
        movieStarted(myMedia)
예제 #2
0
def showStarted(myMedia):
    if TraktScrobbleTvShow:
        response = utilities.watchingEpisodeOnTrakt(
            myMedia.parsedInfo.id, myMedia.parsedInfo.name,
            myMedia.parsedInfo.year, str(myMedia.parsedInfo.season_number),
            str(myMedia.parsedInfo.episode_numbers[myMedia.idxEpisode]),
            str(myMedia.oStatus.totalTime), str(myMedia.oStatus.percent))
        msg = u'Sending play: {0} {1} {2} {3}' \
              ' {4} {5} {6}'.format(myMedia.parsedInfo.id,
                                    myMedia.parsedInfo.name,
                                    myMedia.parsedInfo.year,
                                    str(myMedia.parsedInfo.season_number),
                                    str(myMedia.parsedInfo.episode_numbers[myMedia.idxEpisode]),
                                    str(myMedia.oStatus.totalTime),
                                    str(myMedia.oStatus.percent))
        Debug(msg)
        pchtrakt.logger.info(msg)
        if response != None:
            msg = 'Video playing: %s - %s' % (response['status'],
                                              response['message'])

        else:
            msg = 'No response from Trakt.tv'
        Debug(msg)
        pchtrakt.logger.info(msg)
예제 #3
0
    def clean_series_name(self, series_name):
        """Cleans up series name by removing any . and _
        characters, along with any trailing hyphens.

        Is basically equivalent to replacing all _ and . with a
        space, but handles decimal numbers in string, for example:

        >>> cleanRegexedSeriesName("an.example.1.0.test")
        'an example 1.0 test'
        >>> cleanRegexedSeriesName("an_example_1.0_test")
        'an example 1.0 test'

        Stolen from dbr's tvnamer
        """
        series_name = re.sub("(\D)[.](\D)", "\\1 \\2", series_name)
        series_name = re.sub(
            "(\D)[.]", "\\1 ",
            series_name)  # if it ends in a year then don't keep the dot
        series_name = re.sub("[.](\D)", " \\1", series_name)
        series_name = re.sub("\[.*?\]", "", series_name)
        series_name = series_name.replace("_", " ")
        series_name = series_name.replace(" - ", " ")
        series_name = re.sub("-$", "", series_name)
        Debug('[The TvDB] Tv search string before changes = ' + series_name)
        #reps = {'S H I E L D':'S.H.I.E.L.D','CSI':'CSI: Crime Scene Investigation','Megabuilders':'Mega Builders', 'Discovery ':'', 'BBC':'', 'HDgrp':'', 'CSI New York':'CSI: NY', '2bg':'2 Broke Girls', 'tbbt':'The Big Bang Theory'}
        for i, j in Useredits.iteritems():
            series_name = series_name.replace(i, j)
        Debug('[The TvDB] Actually searching for: ' + series_name)
        return series_name.strip()
예제 #4
0
def watchedFileCreation(myMedia):
    try:
        Debug('[Pchtrakt] watchedFileCreation')
        path = myMedia.oStatus.fileName.encode('utf-8', 'replace')
    except:
        Debug('doing except for path')
        path = myMedia.oStatus.fileName.encode('latin-1', 'replace')
    if YamJWatchedVithVideo:
        try:
            path = myMedia.oStatus.fullPath.encode('utf-8', 'replace')
        except:
            path = myMedia.oStatus.fullPath.encode('latin-1', 'replace')
        if (path.split(".")[-1] == "DVD"):  #Remember that .DVD extension
            path = path[:-4]
        if not OnPCH:
            path = path.replace('/opt/sybhttpd/localhost.drives/', '')
            path = path.split('/', 2)[2]
            path = '{0}{1}'.format(YamjWatchedPath, path)
    else:
        if (path.split(".")[-1] == "DVD"):
            path = path[:-4]
        path = '{0}{1}'.format(YamjWatchedPath, path)
    path = '{0}.watched'.format(path)
    if not isfile(path):
        try:
            Debug('[Pchtrakt] Start to write file')
            f = open(path, 'w')
            f.close()
            msg = ' [Pchtrakt] I have created the file {0}'.format(path)
            pchtrakt.logger.info(msg)
            pchtrakt.CreatedFile = 1
        except IOError, e:
            pchtrakt.logger.exception(e)
            pchtrakt.CreatedFile = 1
예제 #5
0
 def YAMJSync(self):
     if YAMJSyncCheck >= 0:
         Debug('[Pchtrakt] Reading ' + self.name)
         self.tree = ElementTree.parse(self.name)
         Debug('[Pchtrakt] Finished')
         if YAMJumc or YAMJumw:
             self.get_YAMJ_movies()
             self.get_trakt_movies()
             if YAMJumc:
                 self.YAMJ_movies_to_trakt()
             if YAMJumw:
                 self.get_trakt_movies() #Need to re-get trakt films in case they were updated above
                 self.YAMJ_movies_watched_to_trakt()
                 if markYAMJ:
                     self.trakt_movies_watched_to_YAMJ()
             self.YAMJ_movies = None
             self.YAMJ_movies_seen = None
             self.YAMJ_movies_unseen = None
             self.trakt_movies = None
 
         if YAMJusc or YAMJusw:
             self.YAMJ_shows = {}
             self.get_YAMJ_shows()
             self.get_trakt_shows()
             if YAMJusc:
                 self.YAMJ_shows_to_trakt()
             if YAMJusw:
                 self.get_trakt_shows() #Need to re-get trakt shows in case they were updated above
                 self.YAMJ_shows_watched_to_trakt()
                 if markYAMJ:
                     self.trakt_shows_watched_to_YAMJ()
     #clear globals
     del self
예제 #6
0
def showIsEnding(myMedia):
    #Debug("myMedia.ScrobResult" + str(myMedia.ScrobResult))
    if BetaSeriesScrobbleTvShow:
        result = 0
        msg = ' [BetaSAPI] Video is '
        serieXml = bs.getSerieUrl(myMedia.parsedInfo.id,
                                  myMedia.parsedInfo.name)
        if serieXml is not None:
            token = bs.getToken()
            isWatched = bs.isEpisodeWatched(
                serieXml, token, myMedia.parsedInfo.season_number,
                myMedia.parsedInfo.episode_numbers[myMedia.idxEpisode])
            Debug('[BetaSAPI] Is episode watched: {0}'.format(isWatched))
            if not isWatched:
                result = bs.scrobbleEpisode(
                    serieXml, token, myMedia.parsedInfo.season_number,
                    myMedia.parsedInfo.episode_numbers[myMedia.idxEpisode])
                bs.destroyToken(token)
                msg += 'ending: '
            else:
                bs.destroyToken(token)  #added this but not sure if needed
                msg += 'already watched: '
            if result or isWatched:
                result = 1
                msg += u'{0} {1}x{2}'.format(
                    myMedia.parsedInfo.name, myMedia.parsedInfo.season_number,
                    myMedia.parsedInfo.episode_numbers[myMedia.idxEpisode])
                pchtrakt.logger.info(msg)

            else:
                result = 1
        else:
            msg += 'not found '
            pchtrakt.logger.info(msg)
            result = 1
    if TraktScrobbleTvShow:
        Debug("[traktAPI] Tv Show is ending")
        result = 0
        if str(myMedia.parsedInfo.season_number) == "None":
            myMedia.parsedInfo.season_number = "1"
        try:
            Debug('NAME: ' + myMedia.parsedInfo.name + ' Season: ' +
                  str(myMedia.parsedInfo.season_number) + ' Episode: ' +
                  str(myMedia.parsedInfo.episode_numbers[myMedia.idxEpisode]))
        except Exception as e:
            print e
        response = utilities.scrobbleEpisodeOnTrakt(
            myMedia.parsedInfo.id, myMedia.parsedInfo.name,
            myMedia.parsedInfo.year, str(myMedia.parsedInfo.season_number),
            str(myMedia.parsedInfo.episode_numbers[myMedia.idxEpisode]),
            str(myMedia.oStatus.totalTime), str(myMedia.oStatus.percent))
        if response:
            #if response['message'] != 'fake scrobble':
            msg = ' [traktAPI] Tv Show is ending: - %s ' % (response)
            pchtrakt.logger.info(msg)
            result = 1
    else:
        result = 1
    return result
예제 #7
0
def showIsEnding(myMedia):
    try:
        if BetaSeriesScrobbleTvShow:
            result = 0
            serieXml = bs.getSerieUrl(myMedia.parsedInfo.name)
            token = bs.getToken()
            isWatched = bs.isEpisodeWatched(
                serieXml, token, myMedia.parsedInfo.season_number,
                myMedia.parsedInfo.episode_numbers[myMedia.idxEpisode])
            Debug('(BetaSeries) Is episode watched: {0}'.format(isWatched))
            msg = '(BetaSeries) Video is '
            if not isWatched:
                result = bs.scrobbleEpisode(
                    serieXml, token, myMedia.parsedInfo.season_number,
                    myMedia.parsedInfo.episode_numbers[myMedia.idxEpisode])
                bs.destroyToken(token)
                msg += 'ending: '
            else:
                msg += 'already watched: '
            if result or isWatched:
                myMedia.ScrobResult |= EnumScrobbleResult.BETASERIESOK
                msg += '{0} {1}x{2}'.format(
                    myMedia.parsedInfo.name, myMedia.parsedInfo.season_number,
                    myMedia.parsedInfo.episode_numbers[myMedia.idxEpisode])
                Debug(msg)
                pchtrakt.logger.info(msg)

        else:
            myMedia.ScrobResult |= EnumScrobbleResult.BETASERIESOK
    except BetaSerieAuthenticationException as e:
        Debug(e)
        pchtrakt.logger.info(e)
    except Exception as e:
        Debug(e)
        pchtrakt.logger.exception(e)
    if TraktScrobbleTvShow:
        result = 0
        response = utilities.scrobbleEpisodeOnTrakt(
            myMedia.parsedInfo.id, myMedia.parsedInfo.name,
            myMedia.parsedInfo.year, str(myMedia.parsedInfo.season_number),
            str(myMedia.parsedInfo.episode_numbers[myMedia.idxEpisode]),
            str(myMedia.oStatus.totalTime), str(myMedia.oStatus.percent))
        if response:
            msg = '(Trakt) Video is ending: %s - %s ' % (response['status'],
                                                         response['message'])
            Debug(msg)
            pchtrakt.logger.info(msg)
            result = 1

        if result == 1:
            myMedia.ScrobResult |= EnumScrobbleResult.TRAKTOK
    else:
        myMedia.ScrobResult |= EnumScrobbleResult.TRAKTOK
    return myMedia.ScrobResult == EnumScrobbleResult.TRAKTOK | EnumScrobbleResult.BETASERIESOK
예제 #8
0
 def imdbapi1(self):
     try:
         if self.year is None:
             ImdbAPIurl = ('http://www.imdbapi.com/?t={0}'.format(quote_plus(self.name.encode('utf-8', 'replace'))))
         else:
             ImdbAPIurl = ('http://www.imdbapi.com/?t={0}&y={1}'.format(quote_plus(self.name.encode('utf-8', 'replace')), self.year))
         Debug('[IMDB api] Trying search 1: ' + ImdbAPIurl)
         oResponse = urlopen(ImdbAPIurl,None,10)
         myMovieJson = json.loads(oResponse.read())
         if myMovieJson['Response'] == "True":
             self.id = myMovieJson['imdbID']
             Debug('[IMDB api] Movie match using: ' + ImdbAPIurl)
             return self.id
     except Exception as e:
         Debug('[IMDB api] ' + str(e))
예제 #9
0
 def imdbapi2(self):
     try:
         if self.id == None:
             if self.year is None:
                 ImdbAPIurl = ('http://www.deanclatworthy.com/imdb/?q={0}'.format(quote_plus(self.name.encode('utf-8', 'replace'))))
             else:
                 ImdbAPIurl = ('http://www.deanclatworthy.com/imdb/?q={0}&year={1}'.format(quote_plus(self.name.encode('utf-8', 'replace')), self.year))
             Debug('[IMDB api] Trying search 2: ' + ImdbAPIurl)
             oResponse = urlopen(ImdbAPIurl,None,10)
             myMovieJson = json.loads(oResponse.read())
             if "title" in myMovieJson.keys():
                 self.id = myMovieJson['imdbid']
                 Debug('[IMDB api] Found Movie match using: ' + ImdbAPIurl)
                 return self.id
     except Exception as e:
         Debug('[IMDB api] ' + str(e))
예제 #10
0
def isIgnored(myMedia):
    ignored = False

    msg = u'File: {0}'.format(myMedia.oStatus.fileName)
    Debug(msg)
    pchtrakt.logger.info(msg)

    ignored = isKeywordIgnored(myMedia.oStatus.fileName)

    if not ignored and ignored_repertory[0] != '':
        for el in myMedia.oStatus.fullPath.split('/'):
            if el <> '' and el in ignored_repertory:
                msg = 'This video is in a ignored repertory: {0}'.format(el)
                ignored = True
                break

    if not ignored and YamjIgnoredCategory[0] != '':
        if isinstance(myMedia.parsedInfo, mp.MediaParserResultTVShow):
            files = listdir(YamjPath)
            for file in files:
                if file.endswith('xml'):
                    file = unicode(file, errors='replace')
                    if file.find(myMedia.parsedInfo.name) >= 0:
                        oXml = ElementTree.parse(YamjPath + file)
                        ignored = isGenreIgnored(oXml.findall('.//genre'))
                        if ignored:
                            break
        else:
            file = unicode(myMedia.oStatus.fileName.rsplit('.', 1)[0] + '.xml',
                           errors='replace')
            oXml = ElementTree.parse(YamjPath + file)
            genres = oXml.findall('.//genre')

            ignored = isGenreIgnored(genres)
    return ignored
예제 #11
0
 def WatchedYAMJtv(self, watched):
         pchtrakt.logger.info(' [YAMJ] Start to create watched files')
         if YamjWatched == True:
             for x in watched:
                 for y in x['episodes']:
                     if YamJWatchedVithVideo:
                         try:
                             path = y['path'].replace('file:///', '/').encode('utf-8', 'replace')
                         except:
                             path = y['path'].replace('file:///', '/').encode('latin-1', 'replace')
                         if (path.split(".")[-1] == "DVD"):#Remember that .DVD extension
                             path = path[:-4]
                     else:
                         try:
                             path = y['path'].split('/')[::-1][0].encode('utf-8', 'replace')
                         except:
                             path = y['path'].split('/')[::-1][0].encode('latin-1', 'replace')
                         if (path.split(".")[-1] == "DVD"):
                             path = path[:-4]
                         path = '{0}{1}'.format(YamjWatchedPath, path)
                     path = '{0}.watched'.format(path)
                     if not isfile(path):
                         try:
                             f = open(path, 'w+')
                             f.close()
                             msg = ' [Pchtrakt] I have created the file {0}'.format(path)
                             pchtrakt.logger.info(msg)
                         except BaseException as e:
                             pchtrakt.logger.info(u" [Pchtrakt] Error writing file: %s" % str(e))
                             continue
                     Debug('[Pchtrakt] {0} already present'.format(path))
예제 #12
0
 def imdbapi3(self):
     try:
         if self.id == None:
             if self.year is None:
                 ImdbAPIurl = ('http://www.google.com/search?q=www.imdb.com:site+{0})&num=1&start=0'.format(quote_plus(self.name.encode('utf-8', 'replace'))))
             else:
                 ImdbAPIurl = ('http://www.google.com/search?q=www.imdb.com:site+{0}+({1})&num=1&start=0'.format(quote_plus(self.name.encode('utf-8', 'replace')), self.year))
             Debug('[IMDB api] Trying search 3: ' + ImdbAPIurl)
             request = Request(ImdbAPIurl, None, {'User-Agent':'Mosilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11'})
             urlfile = urlopen(request)
             page = urlfile.read()
             entries = re.findall("/title/tt(\d{7})/", page)
             self.id = "tt"+str(entries[0])
             Debug('[IMDB api] Search address = ' + ImdbAPIurl + ' ID = ' + self.id)
             return self.id
     except Exception as e:
         Debug('[IMDB api] ' + str(e))
예제 #13
0
def isGenreIgnored(genres):
    txt = 'The ignored genres are :{0}'.format(YamjIgnoredCategory)
    Debug(txt)
    pchtrakt.logger.info(txt)
    for genre in genres:
        genre = genre.text.strip().lower()
        txt = 'This genre is {0}'.format(genre)
        txt += ' --- Should it be ignored? {0}'.format(
            genre in YamjIgnoredCategory)
        Debug(txt)
        pchtrakt.logger.info(txt)
        if genre in YamjIgnoredCategory:
            txt = 'This video is in the ignored genre {0}'.format(genre)
            Debug(txt)
            pchtrakt.logger.info(txt)
            return True
    return False
예제 #14
0
def videoStatusHandleTVSeries(myMedia):
    if len(myMedia.parsedInfo.episode_numbers) > 1:
        doubleEpisode = 1
    else:
        doubleEpisode = 0
    if pchtrakt.lastPath != myMedia.oStatus.fullPath:
        pchtrakt.watched = 0
        pchtrakt.lastPath = myMedia.oStatus.fullPath
        pchtrakt.currentTime = myMedia.oStatus.currentTime
        myMedia.idxEpisode = 0
        if pchtrakt.lastPath != '':
            if myMedia.oStatus.percent > 90:
                pchtrakt.watched = 1
                Debug('Started at more than 90%! I' 'm not doing anything!')
            elif doubleEpisode:
                while myMedia.oStatus.percent > (
                        myMedia.idxEpisode + 1) * 90.0 / len(
                            myMedia.parsedInfo.episode_numbers):
                    myMedia.idxEpisode += 1
                showStarted(myMedia)
                pchtrakt.currentTime = myMedia.oStatus.currentTime
            else:
                showStarted(myMedia)
    if not pchtrakt.watched:
        if myMedia.oStatus.percent > 90:
            pchtrakt.watched = showIsEnding(myMedia)
        elif myMedia.oStatus.currentTime > pchtrakt.currentTime + int(
                TraktRefreshTime) * 60:
            pchtrakt.currentTime = myMedia.oStatus.currentTime
            showStillRunning(myMedia)
        elif doubleEpisode and myMedia.oStatus.percent > (
                myMedia.idxEpisode + 1) * 90.0 / len(
                    myMedia.parsedInfo.episode_numbers
                ) and myMedia.idxEpisode + 1 < len(
                    myMedia.parsedInfo.episode_numbers):
            showIsEnding(myMedia)
            myMedia.idxEpisode += 1
            showStarted(myMedia)

    elif myMedia.oStatus.percent < 10 and myMedia.oStatus.status != EnumStatus.STOP:
        Debug(
            'It seems you came back at the begining of the video... so I say to trakt it\'s playing'
        )
        pchtrakt.watched = 0
        pchtrakt.currentTime = myMedia.oStatus.currentTime
        showStarted(myMedia)
예제 #15
0
 def _compile_regexes(self):
     for (cur_pattern_name, cur_pattern) in regexes.ep_regexes:
         try:
             cur_regex = re.compile(cur_pattern, re.VERBOSE | re.IGNORECASE)
         except re.error, errormsg:
             Debug(u'[The TvDB] WARNING: Invalid episode_pattern, %s. %s' %
                   (errormsg, cur_regex.pattern))
         else:
             self.compiled_regexes.append((cur_pattern_name, cur_regex))
예제 #16
0
def isKeywordIgnored(title):
    if ignored_keywords[0] != '':
        for keyword in ignored_keywords:
            if keyword in title:
                msg = u'This file contains a ignored keyword'
                Debug(msg)
                pchtrakt.logger.info(msg)
                return True
    return False
예제 #17
0
def movieStopped():
    response = utilities.cancelWatchingMovieOnTrakt()
    if response != None:
        msg = 'Video stopped: %s - %s' % (response['status'],
                                          response['message'])
    else:
        msg = 'No response from Trakt.tv'
    Debug(msg)
    pchtrakt.logger.info(msg)
예제 #18
0
def movieIsEnding(myMedia):
    response = utilities.scrobbleMovieOnTrakt(myMedia.parsedInfo.id,
                                              myMedia.parsedInfo.name,
                                              myMedia.parsedInfo.year,
                                              str(myMedia.oStatus.totalTime),
                                              str(myMedia.oStatus.percent))
    if response != None:
        msg = 'Video is ending: %s - %s ' % (response['status'],
                                             response['message'])
        Debug(msg)
        pchtrakt.logger.info(msg)
        return 1
    return 0
예제 #19
0
def movieStarted(myMedia):
    response = utilities.watchingMovieOnTrakt(myMedia.parsedInfo.id,
                                              myMedia.parsedInfo.name,
                                              myMedia.parsedInfo.year,
                                              str(myMedia.oStatus.totalTime),
                                              str(myMedia.oStatus.percent))
    if response != None:
        msg = 'Video playing: %s - %s' % (response['status'],
                                          response['message'])
    else:
        msg = 'No response from Trakt.tv'
    Debug(msg)
    pchtrakt.logger.info(msg)
예제 #20
0
def movieIsEnding(myMedia):
    Debug("[traktAPI] Movie is ending")
    response = utilities.scrobbleMovieOnTrakt(myMedia.parsedInfo.id,
                                              myMedia.parsedInfo.name,
                                              myMedia.parsedInfo.year,
                                              str(myMedia.oStatus.totalTime),
                                              str(myMedia.oStatus.percent))
    if response:
        if 'message' in response:
            if response['message'] != 'fake scrobble':
                msg = ' [traktAPI] Movie is ending: %s' % (response)
                pchtrakt.logger.info(msg)
        return 1
    return 0
예제 #21
0
def Reset():
    Debug('[Pchtrakt] RESETTING DATA')
    pchtrakt.StopTrying = 0
    pchtrakt.watched = 0
    pchtrakt.lastPath = ''
    pchtrakt.lastName = ''
    pchtrakt.lastShowName = ''
    pchtrakt.DirtyName = ''
    pchtrakt.isMovie = 0
    pchtrakt.isTvShow = 0
    pchtrakt.Check = 0
    pchtrakt.Ttime = 0
    pchtrakt.CreatedFile = 0
    myMedia.parsedInfo = None
    pchtrakt.logger.info(' [Pchtrakt] Waiting for a file to start.....')
예제 #22
0
def videoStopped(myMedia):
    if not pchtrakt.isTvShow and not pchtrakt.isMovie:
        Debug("[Pchtrakt] ****NOT TV OR FILM****")
    if pchtrakt.isTvShow and TraktScrobbleTvShow:
        showStopped(myMedia)
    elif pchtrakt.isMovie and TraktScrobbleMovie:
        movieStopped(myMedia)
    if pchtrakt.CreatedFile == 1:
        if YamjPath != "/":
            UpdateXMLFiles(pchtrakt)
        if apiurl != "":
            utilities.watched(pchtrakt)
    if markOversight and pchtrakt.lastPercent > watched_percent:
        Oversightwatched(pchtrakt.lastName)
    if (TraktScrobbleTvShow or TraktScrobbleMovie) and (not pchtrakt.online
                                                        and pchtrakt.watched):
        pchtrakt.logger.info(' [Pchtrakt] saving off-line scrobble')
        scrobbleMissed()
예제 #23
0
def watchedFileCreation(myMedia):
    if myMedia.oStatus.percent > 90:
        path = myMedia.oStatus.fileName
        if YamJWatchedVithVideo:
            path = myMedia.oStatus.fullPath
            if not OnPCH:
                path = path.replace('/opt/sybhttpd/localhost.drives/', '')
                path = path.split('/', 2)[2]
                path = '{0}{1}'.format(YamjWatchedPath, path)
        else:
            path = '{0}{1}'.format(YamjWatchedPath, path)
        path = '{0}.watched'.format(path)
        if not isfile(path):
            f = open(path, 'w')
            f.close()
            msg = 'I have created the file {0}'.format(path)
            Debug(msg)
            pchtrakt.logger.info(msg)
예제 #24
0
def isIgnored(myMedia):
    ignored = False
    ignored = isKeywordIgnored(myMedia.oStatus.fileName)
    if not ignored and ignored_repertory[0] != '':
        for el in myMedia.oStatus.fullPath.replace(
                '/opt/sybhttpd/localhost.drives/', '').split('/'):
            #if el != '':
            Debug("[Pchtrakt] Checking if %s is an ignored folder" % el)
            if el in ignored_repertory:
                msg = ' [Pchtrakt] This video is in a ignored repertory: {0}'.format(
                    el) + ' Waiting for next file to start.'
                pchtrakt.logger.info(msg)
                ignored = True
                break
    #Debug("[Pchtrakt] Finished Checking folders")
    if not ignored and YamjIgnoredCategory[0] != '':
        if YamjPath != "/":
            #YAMJ2 Genre
            file = myMedia.oStatus.fileName.encode('utf-8', 'replace').rsplit(
                '.', 1
            )[0] + '.xml'  #file = unicode(myMedia.oStatus.fileName.rsplit('.',1)[0] + '.xml', errors='replace')
            oXml = ElementTree.parse(YamjPath + file)
            genres = oXml.findall('.//genre')
            ignored = isGenreIgnored(genres)
        elif apiurl != "":
            #YAMJ3 Genre
            genres = []
            genre = utilities.getgenres(
                myMedia.oStatus.fileName.encode(
                    'utf-8',
                    'replace'))  #cnx = lib.connector.connect(**config)
            x = 0
            while x != genre['count']:
                genres.append(genre['results'][x]['name'])
                x = x + 1
            ignored = isY3GenreIgnored(genres)
    return ignored
예제 #25
0
 def __init__(self,file_name,name,year,imdbid):
     self.file_name = file_name
     self.name = name
     if year == None:
         self.year = ""
     else:
         self.year = year
     if pchtrakt.online:
         ImdbAPIurl = ('http://www.imdbapi.com/?t={0}&y={1}'.format(quote_plus(self.name.encode('utf-8', 'replace')), self.year))
         Debug('[IMDB api] Trying search 1: ' + ImdbAPIurl)
         try:
             oResponse = urlopen(ImdbAPIurl,None,10)
             myMovieJson = json.loads(oResponse.read())
             self.id = myMovieJson['imdbID']
             Debug('[IMDB api] Movie match using: ' + ImdbAPIurl)
         except URLError, HTTPError:
             pass
         except KeyError:
             ImdbAPIurl = ('http://www.deanclatworthy.com/imdb/?q={0}&year={1}'.format(quote_plus(self.name.encode('utf-8', 'replace')), self.year))
             Debug('[IMDB api] Trying search 2: ' + ImdbAPIurl)
             try:
                 oResponse = urlopen(ImdbAPIurl,None,10)
                 myMovieJson = json.loads(oResponse.read())
                 self.id = myMovieJson['imdbid']
                 Debug('[IMDB api] Found Movie match using: ' + ImdbAPIurl)
             except:
                 try:
                     address = ('http://www.google.com/search?q=www.imdb.com:site+{0}&num=1&start=0'.format(quote_plus(self.name.encode('utf-8', 'replace'))))
                     Debug('[IMDB api] Trying search 3: ' + address)
                     request = Request(address, None, {'User-Agent':'Mosilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11'})
                     urlfile = urlopen(request)
                     page = urlfile.read()
                     entries = re.findall("/title/tt(\d{7})/", page)
                     self.id = "tt"+str(entries[0])
                     Debug('[IMDB api] Search address = ' + address + ' ID = ' + self.id)
                 except:
                     raise MovieResultNotFound(file_name)
예제 #26
0
                 '[traktAPI] Login or password incorrect')
             #sleep(sleepTime)
             startWait()
         else:
             pchtrakt.logger.error('Reason: %s ' % (e.reason))
     elif hasattr(e, 'code'):
         pchtrakt.logger.error('Error code: %s' % (e.code))
 except ValueError as e:
     pchtrakt.logger.error(
         '[traktAPI] Problem with trakt.tv site  - {0}'.format(e))
     #pchtrakt.stop = 1
     #videoStopped()
 except AttributeError as e:
     if pchtrakt.online:
         Debug(
             '[Pchtrakt] ID not found will retry in 60 seconds  - {0}'.
             format(e))
         while not (hasattr(myMedia.parsedInfo, 'id')
                    ) and myMedia.oStatus.status == EnumStatus.PLAY:
             sleep(15)
             myMedia.parsedInfo = pchtrakt.mediaparser.parse(
                 myMedia.oStatus.fileName)
             myMedia.oStatus = pchtrakt.oPchRequestor.getStatus(
                 ipPch, 10)
             Debug('[Pchtrakt] ID not found will retry in 60 seconds')
         videoStatusHandleMovie(myMedia)
     #else:
     #    Debug('[Pchtrakt] not on-line bla bla bla')
 except Exception as e:
     if hasattr(
             e, 'message'
예제 #27
0
def doWork():
    pchtrakt.problem = ''
    if hasattr(myMedia, 'parsedInfoOld'):
        myMedia.parsedInfoOld.percent = myMedia.oStatus.percent
    myMedia.oStatus = pchtrakt.oPchRequestor.getStatus(ipPch, 10)
    if myMedia.oStatus.status == EnumStatus.NOPLAY and (
            LastfmNowPlaying is True or LastfmScrobble is True):
        myMedia.oStatus = pchtrakt.oPchMusicRequestor.getStatus(ipPch, 10)
        if myMedia.oStatus.status == EnumStatus.PLAY:
            pchtrakt.logger.info(' [Pchtrakt] Music found playing')
            network = ''
            LastScrobble = 0
            while myMedia.oStatus.status != EnumStatus.NOPLAY:
                if network == '':
                    network = pylast.LastFMNetwork(
                        api_key="e43fb2fa81a6d8fa85b9e630c90bdf27",
                        api_secret="c51b8c3fa4b6b5b61cdfe59775b59c07",
                        username=LastfmUsername,
                        password_hash=pylast.md5(LastfmPwd))
                if LastfmNowPlaying is True and (
                        pchtrakt.lastPath != myMedia.oStatus.fullPath
                        and myMedia.oStatus.artist != ''):
                    network.update_now_playing(
                        myMedia.oStatus.artist,
                        myMedia.oStatus.title,
                        duration=int(myMedia.oStatus.totalTime -
                                     myMedia.oStatus.currentTime))
                    pchtrakt.lastPath = myMedia.oStatus.fullPath
                    LastScrobble = 0
                    pchtrakt.logger.info(
                        '  [Last.fm] Now playing %s - %s ' %
                        (myMedia.oStatus.artist, myMedia.oStatus.title))
                if LastfmScrobble is True and LastScrobble == 0:
                    if myMedia.oStatus.percent > 75:
                        network.scrobble(myMedia.oStatus.artist,
                                         myMedia.oStatus.title, int(time()))
                        LastScrobble = 1
                        pchtrakt.logger.info(
                            '  [Last.fm] Scrobbled %s - %s ' %
                            (myMedia.oStatus.artist, myMedia.oStatus.title))
                sleep(sleepTime)
                myMedia.oStatus = pchtrakt.oPchMusicRequestor.getStatus(
                    ipPch, 10)
    if pchtrakt.lastPath != myMedia.oStatus.fullPath and pchtrakt.StopTrying == 0:
        myMedia.parsedInfo = None
    if YamjWatched == True and not pchtrakt.watched and myMedia.oStatus.percent > watched_percent and pchtrakt.CreatedFile == 0:
        watchedFileCreation(myMedia)
    if not pchtrakt.StopTrying:
        if myMedia.oStatus.status not in [
                EnumStatus.NOPLAY, EnumStatus.UNKNOWN, EnumStatus.PAUSE
        ]:
            pchtrakt.allowedPauseTime = TraktMaxPauseTime
            if myMedia.parsedInfo == None:
                #Debug('[Pchtrakt] status: ' + myMedia.oStatus.status)
                Debug('[Pchtrakt] full path: ' + myMedia.oStatus.fullPath)
                #msg = ' [Pchtrakt] File: {0}'.format(myMedia.oStatus.fileName)
                pchtrakt.logger.info(
                    ' [Pchtrakt] %s File %s' %
                    (myMedia.oStatus.status, myMedia.oStatus.fileName))
                myMedia.parsedInfo = pchtrakt.mediaparser.parse(
                    myMedia.oStatus.fullPath)
                pchtrakt.Ttime = myMedia.oStatus.totalTime
                if hasattr(myMedia, 'parsedInfo'):
                    myMedia.parsedInfoOld = myMedia.parsedInfo
                if hasattr(myMedia.parsedInfo, 'dirty'):
                    pchtrakt.DirtyName = myMedia.parsedInfo.dirty
            if myMedia.oStatus.fullPath != '':
                if isIgnored(myMedia) == True:
                    startWait('it is being ignored')
                else:
                    videoStatusHandle(myMedia)
            if pchtrakt.problem != '':
                startWait(pchtrakt.problem)
        elif (myMedia.oStatus.status == EnumStatus.PAUSE
              and pchtrakt.allowedPauseTime > 0):
            pchtrakt.allowedPauseTime -= sleepTime
        else:
            if pchtrakt.lastPath != '':
                if myMedia.oStatus.status == EnumStatus.NOPLAY:
                    pchtrakt.logger.info(
                        ' [Pchtrakt] video/music file has stopped')
                    videoStopped(myMedia)
                if pchtrakt.allowedPauseTime <= 0:  # and not pchtrakt.watched:
                    pchtrakt.logger.info(' [Pchtrakt] It seems you paused ' \
                                         'the video for more than {0} minutes: ' \
                                         'I say to trakt you stopped watching ' \
                                         'your video'.format(TraktMaxPauseTime/60))
                Reset()
예제 #28
0
 def __init__(self,file_name,name,dirty,season_number,episode_numbers,air_by_date):
     self.file_name = file_name
     self.path = os.path.dirname(file_name)
     self.name = name
     self.air_by_date = air_by_date
     self.dirty = dirty
     self.id = ''
     #np = parser.NameParser()
     #parse_result = np.parse(self.file_name)
     if self.air_by_date:
         if self.name in pchtrakt.dictSerie:
             self.id = pchtrakt.dictSerie[self.name]['TvDbId']
         else:
             self.id = tvdb[self.name]['id']
         season_number = -1
         episode_numbers = [self.air_by_date]
         url = ('http://thetvdb.com/api/GetEpisodeByAirDate.php?apikey=0629B785CE550C8D&seriesid={0}&airdate={1}'.format(quote_plus(self.id), self.air_by_date))
         Debug('[The TvDB] GET EPISODE USING: ' + url)
         oResponse = ElementTree.parse(urlopen(url,None,5))
         #feed = RSSWrapper(tree.getroot())
         for movie in oResponse.findall('./'):
             #Debug("movie", repr(movie.title), movie.link)
             season_number = movie.find('SeasonNumber').text
             episode_numbers = movie.find('EpisodeNumber').text
     self.season_number = season_number
     self.episode_numbers = episode_numbers
     if self.name in pchtrakt.dictSerie:
         self.id = pchtrakt.dictSerie[self.name]['TvDbId']
         self.year = pchtrakt.dictSerie[self.name]['Year']
     else:
         if parseNFO:
             files = []
             if (self.file_name.split(".")[-1] == "DVD" or self.file_name.split(".")[-1].lower() == "iso"):
                 if isfile(self.path.rsplit('/', 2)[0] + '/tvshow.nfo'):
                     pchtrakt.logger.info(' [Pchtrakt] found ../../tvshow.nfo')
                     files.extend([(self.path.rsplit('/', 1)[0] + '/tvshow.nfo')])
             elif isfile(self.path.rsplit('/', 1)[0] + '/tvshow.nfo'):
                 pchtrakt.logger.info(' [Pchtrakt] found ../tvshow.nfo')
                 files.extend([(self.path.rsplit('/', 1)[0] + '/tvshow.nfo')])
             else:
                 for root, dirs, walk_files in os.walk(self.path):
                     files.extend([(os.path.join(root, file)) for file in walk_files])
             for file in getNfo(files):
                 pchtrakt.logger.info(' [Pchtrakt] parsing %s' % file)
                 self.id = getIDFromNFO('TV', file)
                 if self.id != '':
                     try:
                         if (re.match("tt\d{5,10}", self.id)):
                             pchtrakt.logger.info(' [Pchtrakt] Using IMDB ID to find match')
                             self.id = tvdb[self.id]['id']
                             #self.id = int(self.id)
                         self.name = tvdb[int(self.id)]['seriesname']
                         pchtrakt.online = 1
                         if tvdb[self.name]['firstaired'] != None:
                             self.year = tvdb[self.name]['firstaired'].split('-')[0]
                         else:
                             self.year = None
                         pchtrakt.dictSerie[self.name]={'Year':self.year, 'TvDbId':self.id}
                         with open('cache.json','w') as f:
                             json.dump(pchtrakt.dictSerie, f, separators=(',',':'), indent=4)
                     except tvdb_exceptions.tvdb_error, e:
                         pchtrakt.online = 0
                     break
         if self.id == '':
             try:
                 self.id = tvdb[self.name]['id']
                 pchtrakt.online = 1
                 if tvdb[self.name]['firstaired'] != None:
                     self.year = tvdb[self.name]['firstaired'].split('-')[0]
                 else:
                     self.year = None
                 pchtrakt.dictSerie[self.name]={'Year':self.year, 'TvDbId':self.id}
                 with open('cache.json','w') as f:
                     json.dump(pchtrakt.dictSerie, f, separators=(',',':'), indent=4)
             except tvdb_exceptions.tvdb_error, e:
                 pchtrakt.online = 0
예제 #29
0
def UpdateXMLFiles(pchtrakt):
    try:
        if updatexmlwatched:
            checkpath = YamjPath.encode('utf-8')
            #Check path is correct
            if not isfile(checkpath + 'Other_All_1.xml'):
                Debug('[Pchtrakt] Somthing wrong with jukebox path, using ' +
                      checkpath)
                Debug('[Pchtrakt] Trying to find correct path...')
                x = listdir('/opt/sybhttpd/localhost.drives/NETWORK_SHARE/')
                rest = '/' + ('/'.join(checkpath.split('/')[6:]))
                for y in x:
                    if isfile('/opt/sybhttpd/localhost.drives/NETWORK_SHARE/' +
                              y + rest + 'Other_All_1.xml'):
                        checkpath = '/opt/sybhttpd/localhost.drives/NETWORK_SHARE/' + y + rest
                        break
                if not checkpath.endswith('/'):
                    checkpath += '/'
            matchthis = pchtrakt.lastName.encode('utf-8')
            matchthisfull = ('/'.join(
                pchtrakt.lastPath.encode('utf-8').split('/')[-2:]))
            lookfor = matchthis[:-4].replace('&', '&amp;')
            mod = 0
            if pchtrakt.isMovie:
                moviexml = moviexmlfind
                msg = ' [Pchtrakt] Starting Normal Movie xml update in ' + checkpath
                pchtrakt.logger.info(msg)
                previous = None
                name = unquote_plus(checkpath + lookfor + '.xml')
                Debug('[Pchtrakt] Looking at ' + name)
                if isfile(name):
                    tree = ElementTree.parse(name)
                    try:
                        SET = unquote_plus(
                            tree.find('movie/sets/set').attrib['index'])
                    except AttributeError:
                        SET = '0'
                    Debug('[Pchtrakt] 1 ' + name)
                    for movie in tree.findall('movie'):
                        Debug('[Pchtrakt] 2 ' + name)
                        if movie.find('baseFilenameBase').text.encode(
                                'utf-8'
                        ) == lookfor:  #for  content in penContents:
                            Debug('[Pchtrakt] MATCH FOUND')
                            movie.find('watched').text = 'true'
                            for mfile in movie.findall('files/file'):
                                mfile.set('watched', 'true')
                                bak_name = name[:-4] + '.bak'
                                tree.write(bak_name, encoding='utf-8')
                                rename(bak_name, name)
                                txt = utilities.ss(
                                    name.replace(checkpath, '') +
                                    ' has been modified as watched')
                                Debug('[Pchtrakt] ' + txt)
                                mod += 1
                                break
                else:
                    pchtrakt.logger.info(
                        ' [Pchtrakt] Can not find file, check your jukebox path'
                    )
                try:
                    if SET != "0":
                        moviexml.insert(0, SET)
                        Debug('[Pchtrakt] Has Set_ file: ' + SET)
                    for xmlword in moviexml:
                        fileinfo = checkpath + xmlword + "*xml"
                        Debug('[Pchtrakt] ' + fileinfo)
                        for name in glob.glob(fileinfo):
                            Debug('[Pchtrakt] Looking for ' + lookfor +
                                  " in " + name)
                            if lookfor in open(
                                    name).read():  #gets xml file name as name
                                Debug('[Pchtrakt] MATCH FOUND')
                                tree = ElementTree.parse(name)
                                for movie in tree.findall('movies/movie'):
                                    if movie.find(
                                            'baseFilenameBase').text.encode(
                                                'utf-8') == lookfor:
                                        if movie.attrib[
                                                'isSet'] == "true" and SET != "0":
                                            Debug('[Pchtrakt] isset is true')
                                            raise OutToMainLoop()
                                        movie.find('watched').text = 'true'
                                        bak_name = name[:-4] + '.bak'
                                        tree.write(bak_name, encoding='utf-8')
                                        rename(bak_name, name)
                                        txt = utilities.ss(
                                            name.replace(checkpath, '') +
                                            ' has been modified as watched for '
                                            + matchthis)
                                        Debug('[Pchtrakt] ' + txt)
                                        mod += 1
                                        previous = xmlword
                                        break
                                break
                except OutToMainLoop:
                    pass
            elif pchtrakt.isTvShow:
                tvxml = tvxmlfind
                doubleEpisode = 0
                epno = str(pchtrakt.episode_numbers).replace('[', '').replace(
                    ']', '')
                if version_info >= (
                        2, 7):  #[@...=...] only available with python >= 2.7
                    if len(pchtrakt.episode_numbers) > 1:
                        doubleEpisode = 1
                        first, last = [epno[0], epno[-1]]
                        xpath = "*/movie/files/file[@firstPart='{0}'][@lastPart='{1}'][@season='{2}']".format(
                            first, last, str(pchtrakt.season_number))
                        pchtrakt.logger.info(
                            ' [Pchtrakt] Starting multi episode Tv xml update in '
                            + checkpath)
                    else:
                        xpath = "*/movie/files/file[@firstPart='{0}'][@season='{1}']".format(
                            epno, str(pchtrakt.season_number))
                        pchtrakt.logger.info(
                            ' [Pchtrakt] Starting normal Tv xml update in ' +
                            checkpath)
                else:
                    xpath = "*/movie/files/file"
                season_xml = insensitive_glob(pchtrakt.lastShowName)
                seasonb_xml = pchtrakt.DirtyName
                tvxml.extend(["Set_" + season_xml, seasonb_xml])
                Debug('[Pchtrakt] looking for ' + lookfor)
                for xmlword in tvxml:
                    fileinfo = checkpath + xmlword + "*.xml"
                    Debug('[Pchtrakt] scanning ' + xmlword)
                    for name in glob.glob(utilities.ss(fileinfo)):
                        Debug('[Pchtrakt] scanning ' + name)
                        if lookfor in open(name).read():
                            Debug("after name " + fileinfo)
                            tree = ElementTree.parse(name)
                            if xmlword == seasonb_xml:
                                if version_info >= (2, 7):
                                    if doubleEpisode:
                                        zpath = "./movie/files/file[@firstPart='{0}'][@lastPart='{1}'][@season='{2}']".format(
                                            first, last,
                                            str(pchtrakt.season_number))
                                    else:
                                        zpath = "./movie/files/file[@firstPart='{0}'][@season='{1}']".format(
                                            epno, str(pchtrakt.season_number))
                                else:
                                    zpath = "./movie/files/file"
                            else:
                                zpath = xpath
                            for movie in tree.findall(zpath):
                                Debug('[Pchtrakt] looking for ' +
                                      matchthisfull)
                                Debug('[Pchtrakt]  found this ' +
                                      unquote_plus('/'.join(
                                          movie.find('fileURL').text.encode(
                                              'utf-8').split('/')[-2:])))
                                if unquote_plus('/'.join(
                                        movie.find('fileURL').text.encode(
                                            'utf-8').split('/')
                                    [-2:])) == matchthisfull:
                                    Debug('[Pchtrakt] MATCH FOUND')
                                    movie.set('watched', 'true')
                                    bak_name = name[:-4] + '.bak'
                                    tree.write(bak_name, encoding='utf-8')
                                    rename(bak_name, name)
                                    txt = name.replace(
                                        checkpath,
                                        '') + ' has been modified as watched'
                                    Debug('[Pchtrakt] ' + txt)
                                    mod += 1
                                    previous = xmlword
                                    break
                            break
            msg = ' [Pchtrakt] XML Update complete, %d xml file(s) were updated' % mod
            pchtrakt.logger.info(msg)
        elif RutabagaModwatched:
            lookfor = matchthis[:-4]
            msg = ' [Pchtrakt] Starting html update in ' + checkpath
            pchtrakt.logger.info(msg)
            if pchtrakt.isMovie:
                fileinfo = checkpath + lookfor + ".html"
                content = open(fileinfo, 'rb+').read()
                replacedText = content.replace('unwatched', 'watched')
                if replacedText is not content:
                    open(fileinfo, 'w').write(replacedText)
                    txt = name.replace(
                        checkpath,
                        '') + ' has been modified as watched for ' + matchthis
                    pchtrakt.logger.info(' [Pchtrakt] ' + txt)
                else:
                    txt = name.replace(
                        checkpath, ''
                    ) + ' has NOT been modified as watched for ' + matchthis
                    pchtrakt.logger.info(' [Pchtrakt] ' + txt)
            #elif pchtrakt.isTvShow:
            #fileinfo = checkpath + lookfor + ".html"
            #content = open(fileinfo,'rb+').read()
            #replacedText = content.replace('unwatched', 'watched')
            #if replacedText is not content:
            #open(fileinfo, 'w').write(replacedText)
            #txt = name.replace(checkpath, '') + ' has been modified as watched for ' + matchthis
            #pchtrakt.logger.info(txt)
            #else:
            #txt = name.replace(checkpath, '') + ' has NOT been modified as watched for ' + matchthis
            #pchtrakt.logger.info(txt)
    except Exception as e:
        pchtrakt.CreatedFile = 0
        Debug(
            '[Pchtrakt] %s - Error accured during xml updating, Its being looked into'
            % str(e))
예제 #30
0
    def _parse_string(self, name):

        if not name:
            return None

        for (cur_regex_name, cur_regex) in self.compiled_regexes:
            match = cur_regex.match(name)

            if not match:
                continue

            result = ParseResult(name)
            result.which_regex = [cur_regex_name]
            Debug('[The TvDB] Found match using ' + cur_regex_name + ' regex')
            named_groups = match.groupdict().keys()

            if 'series_name' in named_groups:
                result.series_name = match.group('series_name')
                if result.series_name:
                    result.series_name_dirty = result.series_name
                    result.series_name = self.clean_series_name(
                        result.series_name)

            if 'season_num' in named_groups:
                tmp_season = int(match.group('season_num'))
                if cur_regex_name == 'bare' and tmp_season in (19, 20):
                    continue
                result.season_number = tmp_season

            if 'ep_num' in named_groups:
                ep_num = self._convert_number(match.group('ep_num'))
                if 'extra_ep_num' in named_groups and match.group(
                        'extra_ep_num'):
                    result.episode_numbers = range(
                        ep_num,
                        self._convert_number(match.group('extra_ep_num')) + 1)
                else:
                    result.episode_numbers = [ep_num]

            if 'air_year' in named_groups and 'air_month' in named_groups and 'air_day' in named_groups:
                year = int(match.group('air_year'))
                month = int(match.group('air_month'))
                day = int(match.group('air_day'))

                # make an attempt to detect YYYY-DD-MM formats
                if month > 12:
                    tmp_month = month
                    month = day
                    day = tmp_month

                try:
                    result.air_date = datetime.date(year, month, day)
                except ValueError, e:
                    raise InvalidNameException(e.message)

            if 'extra_info' in named_groups:
                tmp_extra_info = match.group('extra_info')

                # Show.S04.Special is almost certainly not every episode in the season
                if tmp_extra_info and cur_regex_name == 'season_only' and re.match(
                        r'([. _-]|^)(special|extra)\w*([. _-]|$)',
                        tmp_extra_info, re.I):
                    continue
                result.extra_info = tmp_extra_info

            if 'release_group' in named_groups:
                result.release_group = match.group('release_group')

            return result