Added some small shit that will get used in the future and made the code compatible with Python>=3.10. (According to Pycharm)
This commit is contained in:
parent
36b085d38a
commit
e0c4843f06
3 changed files with 8 additions and 2 deletions
|
@ -128,21 +128,26 @@ class Library:
|
|||
playlist.load()
|
||||
|
||||
def import_track(self, track, import_options: Types.ImportOptions):
|
||||
change_metadata = False
|
||||
|
||||
if import_options.artist is not None:
|
||||
track.metadata.artist = import_options.artist
|
||||
change_metadata = True
|
||||
|
||||
if import_options.album is not None:
|
||||
track.metadata.album = import_options.album
|
||||
change_metadata = True
|
||||
|
||||
if import_options.genre is not None:
|
||||
track.metadata.genre = import_options.genre
|
||||
change_metadata = True
|
||||
|
||||
artist_path = os.path.expanduser(f"{self.app.settings.library_path}/artists/{track.metadata.artist}")
|
||||
|
||||
if not os.path.exists(artist_path):
|
||||
os.makedirs(artist_path)
|
||||
|
||||
new_track_path = f"{artist_path}/{track.path.split("/")[-1]}"
|
||||
new_track_path = f"{artist_path}/{track.path.split('/')[-1]}"
|
||||
|
||||
if track.path == new_track_path or os.path.exists(new_track_path): # track is already in the library
|
||||
return
|
||||
|
|
|
@ -365,7 +365,7 @@ class Playlist:
|
|||
|
||||
def path_from_title(self, title):
|
||||
path = os.path.expanduser(
|
||||
f"{self.app.settings.library_path}/playlists/{title.replace(" ", "_")}.wbz.m3u"
|
||||
f"{self.app.settings.library_path}/playlists/{title.replace(' ', '_')}.wbz.m3u"
|
||||
)
|
||||
|
||||
return path
|
||||
|
|
|
@ -27,6 +27,7 @@ class PlaylistContextMenu(QMenu):
|
|||
self.rename_action.triggered.connect(self.rename)
|
||||
self.delete_action.triggered.connect(self.delete)
|
||||
|
||||
# noinspection PyMethodOverriding
|
||||
def exec(self, pos: QPoint, index: int, playlist):
|
||||
self.tab_index = index
|
||||
self.playlist = playlist
|
||||
|
|
Loading…
Add table
Reference in a new issue