Exemple #1
0
                content_size = int(response.headers['content-length'])
                bar = ProgressBar(prefix + ' Get',
                                  file_name.strip(), content_size)
                sub_data_bytes = b''
                for data in response.iter_content(chunk_size=chunk_size):
                    sub_data_bytes += data
                    bar.refresh(len(sub_data_bytes))
        except requests.Timeout:
            return None, None, 'false'
        if '.rar' in filename:
            datatype = '.rar'
        elif '.zip' in filename:
            datatype = '.zip'
        elif '.7z' in filename:
            datatype = '.7z'
        else:
            datatype = 'Unknown'

        return datatype, sub_data_bytes


if __name__ == '__main__':
    from main import GetSubtitles
    keywords, info_dict = GetSubtitles(
        '', 1, 2, 3, 4, 5, 6, 7, 8, 9).sort_keyword('the expanse s01e01')
    zimuku = ZimukuDownloader()
    sub_dict = zimuku.get_subtitles(keywords)
    print('\nResult:')
    for k, v in sub_dict.items():
        print(k, v)
Exemple #2
0
                bar = ProgressBar(prefix + " Get", file_name.strip(),
                                  content_size)
                sub_data_bytes = b""
                for data in response.iter_content(chunk_size=chunk_size):
                    sub_data_bytes += data
                    bar.refresh(len(sub_data_bytes))
        except requests.Timeout:
            return None, None, "false"
        if ".rar" in filename:
            datatype = ".rar"
        elif ".zip" in filename:
            datatype = ".zip"
        elif ".7z" in filename:
            datatype = ".7z"
        else:
            datatype = "Unknown"

        return datatype, sub_data_bytes


if __name__ == "__main__":
    from main import GetSubtitles

    keywords, info_dict = GetSubtitles("", 1, 2, 3, 4, 5, 6, 7, 8,
                                       9).sort_keyword("the expanse s01e01")
    zimuku = ZimukuDownloader()
    sub_dict = zimuku.get_subtitles(keywords)
    print("\nResult:")
    for k, v in sub_dict.items():
        print(k, v)