Exemple #1
0
    def getVideoInfo(self, content, name, year, imdb, tvdb):
        try:
            self.loadingTime = time.time()
            self.totalTime = 0
            self.currentTime = 0
            self.folderPath = control.infoLabel('Container.FolderPath')
            self.name = name
            self.year = year
            self.content = content
            self.file = self.name + '.strm'
            self.file = self.file.translate(None, '\/:*?"<>|').strip('.')
            self.imdb = 'tt' + imdb if imdb.isdigit() else imdb
            self.tvdb = tvdb if not tvdb == None else '0'
        except:
            pass

        try:
            if self.content == 'movie':
                self.title = re.compile('(.+?) [(]\d{4}[)]$').findall(
                    self.name)[0]
            elif self.content == 'episode':
                self.tvshowtitle, self.season, self.episode = re.compile(
                    '(.+?) S(\d*)E(\d*)$').findall(self.name)[0]
                self.season, self.episode = '%01d' % int(
                    self.season), '%01d' % int(self.episode)
                self.file2 = '%s (%s) S%02dE%02d.strm' % (
                    self.tvshowtitle.translate(None, '\/:*?"<>|'), self.year,
                    int(self.season), int(self.episode))
            elif self.content == 'live':
                self.title = self.name
        except:
            pass

        try:
            if control.setting('resume_playback') == 'true':
                self.offset = bookmarks.getBookmark(self.name, self.imdb)
                if self.offset == '0': raise Exception()

                minutes, seconds = divmod(float(self.offset), 60)
                hours, minutes = divmod(minutes, 60)
                yes = control.yesnoDialog(
                    '%s %02d:%02d:%02d' % (control.lang(30461).encode('utf-8'),
                                           hours, minutes, seconds), '', '',
                    self.name,
                    control.lang(30463).encode('utf-8'),
                    control.lang(30462).encode('utf-8'))

                if yes: self.offset = '0'
        except:
            pass

        try:
            if self.content == 'movie':
                control.window.setProperty('script.trakt.ids',
                                           json.dumps({'imdb': self.imdb}))
            elif self.content == 'episode':
                control.window.setProperty('script.trakt.ids',
                                           json.dumps({'tvdb': self.tvdb}))
        except:
            pass
Exemple #2
0
    def getVideoInfo(self, content, name, year, imdb, tvdb):
        try:
            self.loadingTime = time.time()
            self.totalTime = 0 ; self.currentTime = 0
            self.folderPath = control.infoLabel('Container.FolderPath')
            self.name = name ; self.year = year ; self.content = content
            self.file = self.name + '.strm'
            self.file = self.file.translate(None, '\/:*?"<>|').strip('.')
            self.imdb = 'tt' + imdb if imdb.isdigit() else imdb
            self.tvdb = tvdb if not tvdb == None else '0'
        except:
            pass

        try:
            if self.content == 'movie':
                self.title = re.compile('(.+?) [(]\d{4}[)]$').findall(self.name)[0]
            elif self.content == 'episode':
                self.tvshowtitle, self.season, self.episode = re.compile('(.+?) S(\d*)E(\d*)$').findall(self.name)[0]
                self.season, self.episode = '%01d' % int(self.season), '%01d' % int(self.episode)
                self.file2 = '%s (%s) S%02dE%02d.strm' % (self.tvshowtitle.translate(None, '\/:*?"<>|'), self.year, int(self.season), int(self.episode))
            elif self.content == 'live':
                self.title = self.name
        except:
            pass

        try:
            if control.setting('resume_playback') == 'true':
                self.offset = bookmarks.getBookmark(self.name, self.imdb)
                if self.offset == '0': raise Exception()

                minutes, seconds = divmod(float(self.offset), 60) ; hours, minutes = divmod(minutes, 60)
                yes = control.yesnoDialog('%s %02d:%02d:%02d' % (control.lang(30461).encode('utf-8'), hours, minutes, seconds), '', '', self.name, control.lang(30463).encode('utf-8'), control.lang(30462).encode('utf-8'))

                if yes: self.offset = '0'
        except:
            pass

        try:
            if self.content == 'movie':
                control.window.setProperty('script.trakt.ids', json.dumps({'imdb': self.imdb}))
            elif self.content == 'episode':
                control.window.setProperty('script.trakt.ids', json.dumps({'tvdb': self.tvdb}))
        except:
            pass