Made it work with relative paths also.
This commit is contained in:
parent
74bff6ea13
commit
b2bd8ef784
4 changed files with 11 additions and 5 deletions
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
|
@ -27,7 +28,14 @@ def main():
|
|||
if arguments.track:
|
||||
app.library.temporary_playlist.clear()
|
||||
app.library.temporary_playlist.view.clear()
|
||||
app.library.temporary_playlist.load_from_paths(arguments.track)
|
||||
|
||||
# make track paths absolute
|
||||
tracks = []
|
||||
|
||||
for track in arguments.track:
|
||||
tracks.append(os.path.abspath(track))
|
||||
|
||||
app.library.temporary_playlist.load_from_paths(tracks)
|
||||
app.library.temporary_playlist.view.load_tracks()
|
||||
|
||||
app.player.current_playlist = app.library.temporary_playlist
|
||||
|
|
|
@ -22,7 +22,7 @@ class Library:
|
|||
self.playlists = [self.temporary_playlist]
|
||||
|
||||
def load(self):
|
||||
path_playlists = f"{self.app.settings.library_path}/playlists"
|
||||
path_playlists = os.path.expanduser(f"{self.app.settings.library_path}/playlists")
|
||||
|
||||
if not os.path.exists(path_playlists):
|
||||
os.makedirs(path_playlists)
|
||||
|
|
|
@ -17,8 +17,6 @@ class Wobuzz:
|
|||
|
||||
self.utils = Utils(self)
|
||||
|
||||
os.chdir(self.utils.home_path)
|
||||
|
||||
self.settings = load_dataclass_json(Settings, self.utils.settings_location, self, True, True)
|
||||
self.settings.set_attribute_change_event(self.on_settings_change)
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ class Playlist:
|
|||
for track in self.tracks:
|
||||
wbz_data += f"{track.path}\n"
|
||||
|
||||
wbz = open(f"{self.app.settings.library_path}/playlists/{self.title.replace(" ", "_")}.wbz.m3u", "w")
|
||||
wbz = open(os.path.expanduser(f"{self.app.settings.library_path}/playlists/{self.title.replace(" ", "_")}.wbz.m3u"), "w")
|
||||
wbz.write(wbz_data)
|
||||
wbz.close()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue