Merge remote-tracking branch 'origin/with_api' into with_api
This commit is contained in:
commit
e50ca2fd5a
@ -29,18 +29,20 @@ def download(url):
|
|||||||
_size = os.path.getsize(path)
|
_size = os.path.getsize(path)
|
||||||
Common.modifyLastDownloadStatus("Downloading >{}< @ {:.2f}%".format(path, 100.0 * _size/Common.config["p_s"]))
|
Common.modifyLastDownloadStatus("Downloading >{}< @ {:.2f}%".format(path, 100.0 * _size/Common.config["p_s"]))
|
||||||
if _size > Common.config["p_s"] or Common.forceNotDownload:
|
if _size > Common.config["p_s"] or Common.forceNotDownload:
|
||||||
|
Common.modifyLastDownloadStatus("Download >{}< Exceed MaxSize".format(path))
|
||||||
break
|
break
|
||||||
Common.modifyLastDownloadStatus("Download >{}< Finished".format(path))
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Common.appendError("Download >{}< With Exception {}".format(path, datetime.strftime(datetime.now(), "%y%m%d %H%M"),
|
Common.appendError("Download >{}< With Exception {}".format(path, datetime.strftime(datetime.now(), "%y%m%d %H%M"),
|
||||||
e.__str__()))
|
e.__str__()))
|
||||||
f.close()
|
f.close()
|
||||||
isDownload = False
|
isDownload = False
|
||||||
|
Common.modifyLastDownloadStatus("Download >{}< Finished".format(path))
|
||||||
if os.path.getsize(path) < 1024 * 1024:
|
if os.path.getsize(path) < 1024 * 1024:
|
||||||
Common.modifyLastDownloadStatus("Downloaded File >{}< is too small, will ignore it".format(path))
|
Common.modifyLastDownloadStatus("Downloaded File >{}< is too small, will ignore it".format(path))
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
return False
|
return False
|
||||||
if Common.forceNotDownload:
|
if Common.forceNotDownload:
|
||||||
|
Common.modifyLastDownloadStatus("设置了不下载,所以[{}]不会下载".format(path))
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
Common.encodeQueue.put(path)
|
Common.encodeQueue.put(path)
|
||||||
@ -119,6 +121,13 @@ def run():
|
|||||||
if d is None:
|
if d is None:
|
||||||
d = datetime.strftime(datetime.now(), "%Y_%m_%d")
|
d = datetime.strftime(datetime.now(), "%Y_%m_%d")
|
||||||
if not t.is_alive() and not Common.forceNotDownload:
|
if not t.is_alive() and not Common.forceNotDownload:
|
||||||
|
try:
|
||||||
|
Common.api.updRoomInfo()
|
||||||
|
_count = 0
|
||||||
|
_count_error = 0
|
||||||
|
except Exception as e:
|
||||||
|
Common.appendError(e.__str__())
|
||||||
|
continue
|
||||||
_count_error += 1
|
_count_error += 1
|
||||||
_preT = Common.api.playlist
|
_preT = Common.api.playlist
|
||||||
t = threading.Thread(target=download, args=(_preT,))
|
t = threading.Thread(target=download, args=(_preT,))
|
||||||
|
Reference in New Issue
Block a user