update path and download state if the track has a jellyfin id set.
This commit is contained in:
12
app/tasks.py
12
app/tasks.py
@@ -57,6 +57,18 @@ def update_all_playlists_track_status(self):
|
|||||||
if track.filesystem_path and os.path.exists(track.filesystem_path):
|
if track.filesystem_path and os.path.exists(track.filesystem_path):
|
||||||
available_tracks += 1
|
available_tracks += 1
|
||||||
track.downloaded = True
|
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:
|
else:
|
||||||
track.downloaded = False
|
track.downloaded = False
|
||||||
|
|||||||
Reference in New Issue
Block a user