mirror of
https://github.com/glomatico/gamdl.git
synced 2025-01-22 11:18:39 +00:00
refactor update_playlist_file
This commit is contained in:
parent
475bddb5f7
commit
16734b8b64
@ -287,13 +287,14 @@ class Downloader:
|
||||
final_path: Path,
|
||||
):
|
||||
playlist_file_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
playlist_file_path_parent_parts_len = len(playlist_file_path.parent.parts)
|
||||
output_path_parts_len = len(self.output_path.parts)
|
||||
final_path_relative = Path(
|
||||
("../" * (playlist_file_path_parent_parts_len - output_path_parts_len)),
|
||||
*final_path.parts[output_path_parts_len:],
|
||||
)
|
||||
with playlist_file_path.open("a", encoding="utf8") as playlist_file:
|
||||
playlist_file.write(
|
||||
final_path.relative_to(
|
||||
playlist_file_path.parent, walk_up=True
|
||||
).as_posix()
|
||||
+ "\n"
|
||||
)
|
||||
playlist_file.write(final_path_relative.as_posix() + "\n")
|
||||
|
||||
@staticmethod
|
||||
def millis_to_min_sec(millis):
|
||||
|
Loading…
Reference in New Issue
Block a user