Esempio n. 1
0
    def run(self):
        utils.communicator.updategui.emit('Querying Addic7ed.com...', 'info')
        for details_dict in self.files_list[:]:
            if not self.stopping:
                filename = details_dict['file_name']
                save_to = details_dict['save_subs_to']

                try:
                    (searched_url, downloadlink) = self._query(filename)
                    if downloadlink:
                        subs = self.download_subtitles(searched_url,
                                downloadlink, filename)
                    else:
                        utils.communicator.updategui.emit('Nothing found.', 'error')
                        utils.communicator.reprocess.emit(details_dict)
                        continue
                except utils.NoInternetConnectionFound:
                        utils.communicator.updategui.emit('No active Internet connection found. Kindly check and try again.',
                    'error')
                except: #utils.DailyDownloadLimitExceeded:
                    for details_dict in self.files_list:
                        utils.communicator.reprocess.emit(details_dict)
                    raise
                else:
                    utils.save_subs(subs, save_to)
                    self.files_list.remove(details_dict)
                    utils.communicator.downloaded_sub.emit()
Esempio n. 2
0
    def search_subtitles(self):
        search = []

        for video_file_details in self.moviefiles.itervalues():
            video_file_details['sublanguageid'] = self.lang
            search.append(video_file_details)
        
        results = self._query_opensubs(search)
        subtitles = self.clean_results(results)

        for (hash, found_matches) in subtitles.iteritems():
            subtitles[hash] = utils.multikeysort(found_matches,
                    ['overlap', 'user_rank', '-rating', '-downcount'])[0]

        for (hash, filedetails) in self.moviefiles.iteritems():
            if not self.stopping:
                if subtitles.get(hash):
                    utils.communicator.updategui.emit('Saving subtitles for %s'%filedetails['file_name'], 'success')
                    subtitle = \
                        self.download_subtitles([subtitles[hash]['subid'
                            ]])
                    utils.communicator.downloaded_sub.emit()
                    utils.save_subs(subtitle, filedetails['save_subs_to'],
                                    subtitles[hash])
                else:
                    utils.communicator.no_sub_found.emit(filedetails['file_name'])
            else:
                return
Esempio n. 3
0
    def run(self):
        utils.communicator.updategui.emit('Querying Addic7ed.com...', 'info')
        for details_dict in self.files_list[:]:
            if not self.stopping:
                filename = details_dict['file_name']
                save_to = details_dict['save_subs_to']

                try:
                    (searched_url, downloadlink) = self._query(filename)
                    if downloadlink:
                        subs = self.download_subtitles(searched_url,
                                downloadlink, filename)
                    else:
                        utils.communicator.updategui.emit('Nothing found.', 'error')
                        utils.communicator.reprocess.emit(details_dict)
                        continue
                except utils.NoInternetConnectionFound:
                        utils.communicator.updategui.emit('No active Internet connection found. Kindly check and try again.',
                    'error')
                except: #utils.DailyDownloadLimitExceeded:
                    for details_dict in self.files_list:
                        utils.communicator.reprocess.emit(details_dict)
                    raise
                else:
                    utils.save_subs(subs, save_to)
                    self.files_list.remove(details_dict)
                    utils.communicator.downloaded_sub.emit()
Esempio n. 4
0
    def search_subtitles(self):
        search = []

        for video_file_details in self.moviefiles.itervalues():
            video_file_details['sublanguageid'] = self.lang
            search.append(video_file_details)
        
        results = self._query_opensubs(search)
        subtitles = self.clean_results(results)

        for (hash, found_matches) in subtitles.iteritems():
            subtitles[hash] = utils.multikeysort(found_matches,
                    ['overlap', 'user_rank', '-rating', '-downcount'])[0]

        for (hash, filedetails) in self.moviefiles.iteritems():
            if not self.stopping:
                if subtitles.get(hash):
                    utils.communicator.updategui.emit('Saving subtitles for %s'%filedetails['file_name'], 'success')
                    subtitle = \
                        self.download_subtitles([subtitles[hash]['subid'
                            ]])
                    utils.communicator.downloaded_sub.emit()
                    utils.save_subs(subtitle, filedetails['save_subs_to'],
                                    subtitles[hash])
                else:
                    utils.communicator.no_sub_found.emit(filedetails['file_name'])
            else:
                return
Esempio n. 5
0
    def run(self):
        utils.communicator.updategui.emit('Querying Addic7ed.com...', 'info')
        for details_dict in self.files_list[:]:
            if not self.stopping:
                filename = details_dict['file_name']
                save_to = details_dict['save_subs_to']

                (searched_url, downloadlink) = self._query(filename)
                if downloadlink:
                    try:
                        subs = self.download_subtitles(searched_url,
                                downloadlink, filename)
                    except utils.DailyDownloadLimitExceeded:
                        for details_dict in self.files_list:
                            utils.communicator.reprocess.emit(details_dict)
                        raise
                    utils.save_subs(subs, save_to)
                    self.files_list.remove(details_dict)
                    utils.communicator.downloaded_sub.emit()
                else:
                    utils.communicator.reprocess.emit(details_dict)        
Esempio n. 6
0
def PLAY(url, name, sub_files=[]):
    link = get_html(url)
    match = re.compile('\'(.+?.m3u8)\'').findall(link)
    for u in match:
        listitem = xbmcgui.ListItem(name)
        listitem.setInfo('video', {'Title': name, 'Genre': 'Humor'})
        Player().play(unquote(u), listitem)
        while not Player().isPlaying():
            sleep(10)  # wait until video is being played
        for s in save_subs(path=addon.getAddonInfo('path'),
                           subs_href=sub_files,
                           url=url):
            Player().setSubtitles(s)