Made the tracks get copied into the library on import.

This commit is contained in:
The Wobbler 2025-03-07 20:27:18 +01:00
parent 259b453358
commit 4ae398c6aa
3 changed files with 43 additions and 3 deletions

View file

@ -11,7 +11,7 @@ from ..wobuzzm3u import WobuzzM3U, WBZM3UData
class Playlist:
def __init__(self, app, title: str, load_from=None):
def __init__(self, app, title: str, load_from=None, import_tracks: bool=False):
self.app = app
self.title = title # playlist title
@ -20,6 +20,8 @@ class Playlist:
# if None, playlist should be already in the library and will be loaded from a .wbz.m3u
self.load_from = load_from
self.import_tracks = import_tracks
# add to unique names so if the playlist is loaded from disk,
# no other playlist can be created using the same name
self.app.utils.unique_names.append(self.title)
@ -94,6 +96,10 @@ class Playlist:
self.loading = False
if self.import_tracks:
for track in self.tracks:
self.app.library.import_track(track)
for dock_id in self.views: # enable drag and drop on every view
view = self.views[dock_id]