-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
26 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,3 +16,4 @@ | |
/b2a/__pycache__ | ||
/__init__.spec | ||
/b2a_gui/ | ||
build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ | |
@Contact : [email protected] | ||
@Desc : | ||
""" | ||
import os | ||
import subprocess | ||
import aigpy | ||
from baidupcs_py.baidupcs import BaiduPCSApi | ||
# from common.io import RangeRequestIO | ||
|
@@ -120,21 +122,25 @@ def downloadFile(self, fileAttr: FileAttr, localFilePath: str) -> bool: | |
# stream.close() | ||
# return True | ||
|
||
headers = { | ||
"Cookie ": "; ".join( | ||
[f"{k}={v if v is not None else ''}" for k, v in self.key.api.cookies.items()] | ||
), | ||
"User-Agent": "netdisk;2.2.51.6;netdisk;10.0.63;PC;android-android", | ||
"Connection": "Keep-Alive", | ||
} | ||
|
||
link = self.__safeAPI__('download_link', fileAttr.path) | ||
if not link or len(link) <= 0: | ||
return False | ||
# headers = { | ||
# "Cookie ": "; ".join( | ||
# [f"{k}={v if v is not None else ''}" for k, v in self.key.api.cookies.items()] | ||
# ), | ||
# "User-Agent": "netdisk;2.2.51.6;netdisk;10.0.63;PC;android-android", | ||
# "Connection": "Keep-Alive", | ||
# } | ||
|
||
dl = Downloader(link, headers, localFilePath, fileAttr.size, 6) | ||
check = dl.run() | ||
return check | ||
# link = self.__safeAPI__('download_link', fileAttr.path) | ||
# if not link or len(link) <= 0: | ||
# return False | ||
|
||
# dl = Downloader(link, headers, localFilePath, fileAttr.size, 1) | ||
# check = dl.run() | ||
# return check | ||
|
||
cmd = f'BaiduPCS-Py download -o \"{path}\" \"{fileAttr.path}\"' | ||
child = subprocess.run(cmd) | ||
return child.returncode == 0 | ||
|
||
def uploadFile(self, localFilePath: str, remoteFilePath: str) -> bool: | ||
return False | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,5 @@ uvicorn~=0.13.4 | |
fastapi~=0.63.0 | ||
Jinja2~=2.11.3 | ||
b2a~=2021.7.23.2 | ||
PyQt5~=5.15.1 | ||
PyQt5~=5.15.1 | ||
BaiduPCS-Py~=0.6.32 |