Skip to content

Commit

Permalink
fix: use another way to fix file too long
Browse files Browse the repository at this point in the history
Signed-off-by: jingfelix <jingfelix@outlook.com>
  • Loading branch information
jingfelix committed Feb 13, 2024
1 parent 7d49e28 commit ebc90c0
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 63 deletions.
44 changes: 36 additions & 8 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
[project]
name = "bilifm"
version = "0.1.8"
version = "0.2.0"
description = "Download Bilibili videos as audios."
authors = [
{name = "jingfelix", email = "jingfelix@outlook.com"},
{name = "Felix Jing", email = "jingfelix@outlook.com"},
]
dependencies = [
"click",
"requests",
"rich",
"typer",
"typer[all]>=0.9.0",
]
requires-python = ">=3.8"
readme = "README.md"
Expand Down
7 changes: 4 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# This file is @generated by PDM.
# Please do not edit it manually.

certifi==2023.11.17
certifi==2024.2.2
charset-normalizer==3.3.2
click==8.1.7
colorama==0.4.6; platform_system == "Windows"
colorama==0.4.6
idna==3.6
markdown-it-py==3.0.0
mdurl==0.1.2
pygments==2.17.2
requests==2.31.0
rich==13.7.0
shellingham==1.5.4
typer==0.9.0
typing-extensions==4.9.0
urllib3==2.1.0
urllib3==2.2.0
35 changes: 0 additions & 35 deletions setup.py

This file was deleted.

24 changes: 11 additions & 13 deletions src/bilifm/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,18 @@ def download(self):
start_time = time.time()
try:
for cid, part in zip(self.cid_list, self.part_list):
if len(self.part_list) > 1:
file_path = f"{self.title}-{part}.mp3"
else:
file_path = f"{self.title}.mp3"

if len(file_path) > 255:
file_path = file_path[:255]

# 如果文件已存在,则跳过下载
file_path = f"{self.title}-{part}.mp3"
try:
if os.path.exists(file_path):
typer.echo(f"{self.title} already exists, skip for now")
return
except OSError as e:
if e.errno == 36:
file_path = f"{part}.mp3"
if os.path.exists(file_path):
typer.echo(f"{part} already exists, skip for now")
return
else:
raise e
if os.path.exists(file_path):
typer.echo(f"{self.title} already exists, skip for now")
return

params = get_signed_params(
{
Expand Down

0 comments on commit ebc90c0

Please sign in to comment.