Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
miyouzi committed Jan 15, 2019
1 parent b44c440 commit 6661299
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
9 changes: 4 additions & 5 deletions Anime.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# @Author : Miyouzi
# @File : Anime.py @Software: PyCharm
import ftplib

import Config
from bs4 import BeautifulSoup
import re, time, os, platform, subprocess, requests, random, sys, datetime
Expand Down Expand Up @@ -284,7 +283,7 @@ def get_m3u8_dict(self):
self.__get_m3u8_dict()
return self._m3u8_dict

def download(self, resolution='', save_dir='', bangumi_tag='',realtime_show_file_size=False):
def download(self, resolution='', save_dir='', bangumi_tag='', realtime_show_file_size=False):
self.realtime_show_file_size = realtime_show_file_size
if not resolution:
resolution = self._settings['download_resolution']
Expand Down Expand Up @@ -684,9 +683,9 @@ def del_all_files():


if __name__ == '__main__':
a = Anime(11468, debug_mode=True)
path = 'F:\\Project\\PythonProjects\\aniGamerPlus-Git\\bangumi\\2019一月番\\動物朋友 2\\【動畫瘋】動物朋友 2[1][1080P].mp4'
a.upload(debug_file=path)
# a = Anime(11468, debug_mode=True)
# path = 'F:\\Project\\PythonProjects\\aniGamerPlus-Git\\bangumi\\2019一月番\\動物朋友 2\\【動畫瘋】動物朋友 2[1][1080P].mp4'
# a.upload(debug_file=path)
# print(a.upload_succeed_flag)
# a.download('1080')
pass
9 changes: 3 additions & 6 deletions Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ def __init_settings():
'pwd': ''
},
'upload_to_server': False,
'ftp': { # 将文件上传至远程服务器,咕咕咕咕……
'ftp': { # 将文件上传至远程服务器
'server': '',
'port': '',
'user': '',
'pwd': '',
'tls': True,
'cwd': '', # 文件存放目录
'cwd': '', # 文件存放目录, 登陆后首先进入的目录
'show_error_detail': False,
'max_retry_num': 10
'max_retry_num': 15
},
'check_latest_version': True, # 是否检查新版本
'read_sn_list_when_checking_update': True,
Expand Down Expand Up @@ -203,7 +203,4 @@ def read_latest_version_on_github():


if __name__ == '__main__':
# read_settings()
# from pprint import pprint
# pprint(read_sn_list())
pass
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pip3 install requests beautifulsoup4 lxml termcolor

#### 使用Chrome舉例如何獲取 Cookie:

- 開啓Chrome的無痕模式, 登陸動畫瘋, 記得勾選**保持登入狀態**
- 開啓Chrome的**無痕模式**, 登陸動畫瘋, 記得勾選**保持登入狀態**

- 按 F12 調出開發者工具, 前往動畫瘋, 切換到 Network 標簽, 在下方選中 "ani.gamer.com.tw" 在右側即可看到 Cookie, 如圖:
![](screenshot/WhereIsCookie.png)
Expand Down
14 changes: 7 additions & 7 deletions aniGamerPlus.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ def __download_only(sn, dl_resolution='', dl_save_dir='', realtime_show_file_siz
err_counter = 0
anime = Anime(sn)
if dl_resolution:
anime.download(dl_resolution, dl_save_dir, realtime_show_file_size)
anime.download(dl_resolution, dl_save_dir, realtime_show_file_size=realtime_show_file_size)
else:
anime.download(settings['download_resolution'], dl_save_dir, realtime_show_file_size)
anime.download(settings['download_resolution'], dl_save_dir, realtime_show_file_size=realtime_show_file_size)
while anime.video_size < 10:
if err_counter >= 3:
err_print('任務失敗達三次! 終止任務! sn=' + str(anime.get_sn()) + ' title=' + anime.get_title())
Expand All @@ -213,9 +213,9 @@ def __download_only(sn, dl_resolution='', dl_save_dir='', realtime_show_file_siz
time.sleep(10)
anime.renew()
if dl_resolution:
anime.download(dl_resolution, dl_save_dir, realtime_show_file_size)
anime.download(dl_resolution, dl_save_dir, realtime_show_file_size=realtime_show_file_size)
else:
anime.download(settings['download_resolution'], dl_save_dir, realtime_show_file_size)
anime.download(settings['download_resolution'], dl_save_dir, realtime_show_file_size=realtime_show_file_size)
thread_limiter.release()


Expand All @@ -227,7 +227,7 @@ def __cui(sn, cui_resolution, cui_download_mode, cui_thread_limit, ep_range, cui

if cui_download_mode == 'single':
print('當前下載模式: 僅下載本集\n')
Anime(sn).download(cui_resolution, cui_save_dir, True) # True 是实时显示文件大小, 仅一个下载任务时适用
Anime(sn).download(cui_resolution, cui_save_dir, realtime_show_file_size=True) # True 是实时显示文件大小, 仅一个下载任务时适用

elif cui_download_mode == 'latest' or cui_download_mode == 'largest-sn':
if cui_download_mode == 'latest':
Expand All @@ -242,9 +242,9 @@ def __cui(sn, cui_resolution, cui_download_mode, cui_thread_limit, ep_range, cui
bangumi_list.sort()

if bangumi_list[-1] == sn:
anime.download(cui_resolution, cui_save_dir, True)
anime.download(cui_resolution, cui_save_dir, realtime_show_file_size=True)
else:
Anime(bangumi_list[-1]).download(cui_resolution, cui_save_dir, True)
Anime(bangumi_list[-1]).download(cui_resolution, cui_save_dir, realtime_show_file_size=True)

elif cui_download_mode == 'all':
print('當前下載模式: 下載本番劇所有劇集\n')
Expand Down

0 comments on commit 6661299

Please sign in to comment.