Skip to content

Commit

Permalink
Merge pull request #6 from laorange/v1.2.1
Browse files Browse the repository at this point in the history
v1.2.1
  • Loading branch information
laorange authored Dec 30, 2021
2 parents a8bd25b + 5095ad6 commit 43ad979
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 10 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,16 @@ LICENCE:GPL-3.0

## 6.更新日志

### v1.2.1

- [x] 优化:下载地址会记录原视频链接
- [x] 优化:优化界面,(新增按钮:打开保存目录)

### v1.2.0

- [x] 新增:打开保存地址的按钮
- [x] 变更:设置采用`Json`文件来储存设置信息,增强向下兼容性
- [x] 新增:可自定义异步下载数量上限
- [x] 新增:打开保存地址的按钮

### v1.1.4

Expand Down
Binary file modified README.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion cmd.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ PySide6-uic ..\cookie.ui -o cookie_ui.py
activate qt
d:
cd D:\programming\py\gui\bilibili_downloader
pyinstaller -Fw main.py -i static/ico.ico -n bilibili_downloader_1.2.0
pyinstaller -Fw main.py -i static/ico.ico -n bilibili_downloader_1.2.1
5 changes: 2 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,18 @@
from threading import Thread
from urllib.parse import quote, unquote

# import PySide6
import httpx
from PySide6.QtWidgets import QApplication, QMessageBox, QMainWindow, QWidget, QFileDialog

from util.main_ui import Ui_bilibili_downloader
from util.log_ui import Ui_log
from util.cookie_ui import Ui_cookie_ui

from util.common_util import Util, CursorDecorator
from util.my_classes import MyConfig, ui_tool_kit
from util.video_handler import VideoHandler
from util.signals import my_signal

__version__ = "1.2.0"
__version__ = "1.2.1"

BASE_DIR = Path(os.path.realpath(sys.argv[0])).resolve().parent

Expand Down Expand Up @@ -106,6 +104,7 @@ def __init__(self):
self.ui.set_cookie_action.triggered.connect(self.set_cookie_action)
self.ui.check_for_update_action.triggered.connect(self.check_for_update)

self.ui.open_save_dir_button.clicked.connect(self.open_save_dir_func)
self.ui.change_save_path.clicked.connect(self.change_save_path_event)
self.ui.video_format.currentIndexChanged.connect(self.video_format_change_event)
self.ui.video_quality.currentIndexChanged.connect(self.video_quality_change_event)
Expand Down
22 changes: 21 additions & 1 deletion main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="0,0,1">
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="0,0,0,0,0">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
Expand All @@ -215,6 +215,26 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="open_save_dir_button">
<property name="text">
<string>打开</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
Expand Down
11 changes: 10 additions & 1 deletion util/main_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,15 @@ def setupUi(self, bilibili_downloader):

self.horizontalLayout_5.addWidget(self.save_path)

self.horizontalLayout_5.setStretch(2, 1)
self.open_save_dir_button = QToolButton(self.centralwidget)
self.open_save_dir_button.setObjectName(u"open_save_dir_button")

self.horizontalLayout_5.addWidget(self.open_save_dir_button)

self.horizontalSpacer_6 = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)

self.horizontalLayout_5.addItem(self.horizontalSpacer_6)


self.verticalLayout.addLayout(self.horizontalLayout_5)

Expand Down Expand Up @@ -353,6 +361,7 @@ def retranslateUi(self, bilibili_downloader):
self.label_3.setText(QCoreApplication.translate("bilibili_downloader", u"\u4fdd\u5b58\u8def\u5f84\uff1a", None))
self.change_save_path.setText(QCoreApplication.translate("bilibili_downloader", u"\u66f4\u6539", None))
self.save_path.setText(QCoreApplication.translate("bilibili_downloader", u"-----", None))
self.open_save_dir_button.setText(QCoreApplication.translate("bilibili_downloader", u"\u6253\u5f00", None))
self.label_7.setText(QCoreApplication.translate("bilibili_downloader", u"\u6587\u4ef6\u683c\u5f0f\uff1a", None))
self.video_format.setItemText(0, QCoreApplication.translate("bilibili_downloader", u".flv", None))

Expand Down
2 changes: 1 addition & 1 deletion util/my_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ async def download(self, save_path: Path, video_format: str = ".flv",
headers = MyConfig.download_base_headers
self.local_path: Path = Util.ensure_dir_exists(save_path / self.title)
if original_url:
with open(self.local_path / "原视频网址.txt") as url_file:
with open(self.local_path / "原视频网址.txt", "wt") as url_file:
url_file.write(original_url)

for _index, url in enumerate(url_list := self.page.get_url()):
Expand Down
5 changes: 3 additions & 2 deletions util/video_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def download():
new_loop = asyncio.new_event_loop()
new_loop.run_until_complete(asyncio.wait(async_tasks))
new_loop.close()
async_tasks.clear()

_threshold_count = 1
for _index, downloader in enumerate(self.video_parser.downloader_list):
Expand All @@ -38,10 +39,10 @@ def download():
if _index / self.async_tasks_max_num >= _threshold_count:
_threshold_count += 1
download()
async_tasks.clear()
async_tasks.append(downloader.download(self.save_path,
self.video_format,
(_index + 1) / len(self.video_parser.downloader_list) * 100))
(_index + 1) / len(self.video_parser.downloader_list) * 100,
original_url=self.url))
download()


Expand Down

0 comments on commit 43ad979

Please sign in to comment.