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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue