Skip to content
Snippets Groups Projects
Commit 7a5b96c7 authored by David Trattnig's avatar David Trattnig
Browse files

Resolve filepath dynamically.

parent 16b98e64
No related branches found
No related tags found
No related merge requests found
......@@ -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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment