def load_subs(self, filename, lang, filesize, filehash, always_choose_subtitles=False): logger.debug('Downloading %s subs for %s', lang, filename) res= OpenSubtitles.download_if_not_exists(filename,lang, filesize, filehash, can_choose='always' if always_choose_subtitles else True) if res: logger.debug('Loadeded subs') return self.subs_option(res) else: logger.debug('No subs found') return []
def test_hash(self): size = os.stat(fname).st_size self.assertEqual(size, 12909756) hash = OpenSubtitles.hash_file(open(fname, 'rb'), size) self.assertEqual(hash, '8e245d9679d31e12')
def run(self): with self._btfile.create_cursor() as c: filehash=OpenSubtitles.hash_file(c, self._btfile.size) self.hash=filehash self._hash_cb(filehash)
def test_hash(self): size = os.stat(fname).st_size self.assertEqual(size, 12909756) hash=OpenSubtitles.hash_file(open(fname,'rb'), size) self.assertEqual(hash, '8e245d9679d31e12')