Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions beetsplug/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,25 +616,23 @@
)

if playlist:
# Playlist paths are understood as relative to the dest directory.
# Generate playlist paths from converted item paths (updated in database)
pl_normpath = util.normpath(playlist)
pl_dir = os.path.dirname(pl_normpath)
self._log.info("Creating playlist file {}", pl_normpath)
# Generates a list of paths to media files, ensures the paths are
# relative to the playlist's location and translates the unicode
# strings we get from item.destination to bytes.
items_paths = [
os.path.relpath(
item.destination(basedir=dest, path_formats=path_formats),
pl_dir,
)

Check failure on line 623 in beetsplug/convert.py

View workflow job for this annotation

GitHub Actions / Check linting

Ruff (W293)

beetsplug/convert.py:623:1: W293 Blank line contains whitespace
# Refresh item paths to converted ones before generating playlist
updated_paths = [
os.path.relpath(item.path, pl_dir)
for item in items
]

Check failure on line 629 in beetsplug/convert.py

View workflow job for this annotation

GitHub Actions / Check linting

Ruff (W293)

beetsplug/convert.py:629:1: W293 Blank line contains whitespace
if not pretend:
m3ufile = M3UFile(playlist)
m3ufile.set_contents(items_paths)
m3ufile.set_contents(updated_paths)
m3ufile.write()


def convert_on_import(self, lib, item):
"""Transcode a file automatically after it is imported into the
library.
Expand Down
Loading