Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryu1845 committed Dec 15, 2021
1 parent 8a277ba commit 432c131
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 25 deletions.
25 changes: 14 additions & 11 deletions poetry.lock

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

13 changes: 0 additions & 13 deletions twspace_dl/FormatInfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,19 +97,6 @@ def sterilize_fn(value: str) -> str:
if value in invalid_filenames:
value = "_" + value

# Truncate filenames to valid length
max_len = 32

if len(value + extension) > max_len:
if len(extension) > len(value):
# Truncate extension instead of filename, no extension should be
# this long..
new_length = max_len - len(value)
extension = extension[:new_length]
else:
new_length = max_len - len(extension)
value = value[:new_length]

return value + extension

def format(self, format_str: str) -> str:
Expand Down
2 changes: 1 addition & 1 deletion twspace_dl/TwspaceDL.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,6 @@ def download(self) -> None:
subprocess.run(cmd_old, check=True)
except subprocess.CalledProcessError as err:
raise RuntimeError(" ".join(err.cmd)) from err
shutil.move(filename_old, self.filename + ".m4a")
shutil.move(filename_old, FormatInfo.sterilize_fn(self.filename) + ".m4a")

logging.info("Finished downloading")

0 comments on commit 432c131

Please sign in to comment.