diff --git a/modules/core/state.py b/modules/core/state.py index a571a68099f569ac3d8e0cb5199c6f9d098f0217..4f12aadee78a0e65586633f8ff735e94b2508f13 100644 --- a/modules/core/state.py +++ b/modules/core/state.py @@ -21,7 +21,7 @@ import logging from collections import deque from modules.base.exceptions import NoActiveEntryException -from modules.base.utils import SimpleUtil +from modules.base.utils import SimpleUtil, EngineUtil from modules.database.model import SingleEntry, SingleEntryMetaData, PlaylistEntry, PlaylistEntryMetaData, TrackService @@ -73,12 +73,12 @@ class PlayerStateService: return self.entry_history[0] - def store_trackservice_entry(self, source): + def store_trackservice_entry(self, filepath): """ Stores the entry identified by the given source in the Track Service. Args: - source (String): The URI of the currently playing source + filepath (String): The path of the currently playing file Raises: (NoActiveEntryException): In case currently nothing is playing @@ -90,7 +90,8 @@ class PlayerStateService: raise NoActiveEntryException for active_entry in entries: - if active_entry.source == source: + base_dir = self.config.get("audiofolder") + if EngineUtil.uri_to_filepath(base_dir, active_entry.source) == filepath: trackservice = TrackService(active_entry) trackservice.store(add=True, commit=True) @@ -101,7 +102,7 @@ class PlayerStateService: found = True if not found: - msg = "Found no entry in the recent history which matches the given source '%s'" % (source) + msg = "Found no entry in the recent history which matches the given source '%s'" % (filepath) self.logger.critical(SimpleUtil.red(msg))