update path and download state if the track has a jellyfin id set.

This commit is contained in:
Kamil
2024-12-04 00:03:29 +00:00
parent 9a5adfaa5b
commit 07503a8003

View File

@@ -57,6 +57,18 @@ def update_all_playlists_track_status(self):
if track.filesystem_path and os.path.exists(track.filesystem_path):
available_tracks += 1
track.downloaded = True
#If not found in filesystem, but a jellyfin_id is set, query the jellyfin server for the track and populate the filesystem_path from the response with the path
elif track.jellyfin_id:
jellyfin_track = jellyfin.get_item(jellyfin_admin_token, track.jellyfin_id)
if jellyfin_track and os.path.exists(jellyfin_track['Path']):
track.filesystem_path = jellyfin_track['Path']
track.downloaded = True
available_tracks += 1
else:
track.downloaded = False
track.filesystem_path = None
else:
track.downloaded = False