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

Resolve entry by URI.

parent 501db575
No related branches found
No related tags found
No related merge requests found
...@@ -21,8 +21,8 @@ import logging ...@@ -21,8 +21,8 @@ import logging
from collections import deque from collections import deque
from modules.base.exceptions import NoActiveEntryException from modules.base.exceptions import NoActiveEntryException
from modules.base.utils import SimpleUtil, EngineUtil from modules.base.utils import SimpleUtil as SU, EngineUtil
from modules.core.channels import ChannelType
...@@ -73,45 +73,36 @@ class PlayerStateService: ...@@ -73,45 +73,36 @@ class PlayerStateService:
return self.entry_history[0] return self.entry_history[0]
def entry_for_source(self, source): def resolve_entry(self, source):
""" """
Retrieves the `PlaylistEntry` matching the provied source URI. Retrieves the `PlaylistEntry` matching the provied source URI.
"""
# TODO Implement
def store_trackservice_entry(self, filepath):
"""
Stores the entry identified by the given source in the Track Service.
Args: Args:
filepath (String): The path of the currently playing file source (String): The URI of the source playing
Raises: Raises:
(NoActiveEntryException): In case currently nothing is playing (NoActiveEntryException)
""" """
found = False result = None
# entries = self.get_recent_entries() entries = self.get_recent_entries()
if not entries:
# if not entries: raise NoActiveEntryException
# raise NoActiveEntryException
for entry in entries:
# for active_entry in entries: entry_source = entry.source
# base_dir = self.config.get("audiofolder")
# if EngineUtil.uri_to_filepath(base_dir, active_entry.source) == filepath: if entry.channel in ChannelType.FILESYSTEM.channels:
# trackservice = TrackService(active_entry) base_dir = self.config.get("audiofolder")
# trackservice.store(add=True, commit=True) entry_source = EngineUtil.uri_to_filepath(base_dir, entry.source)
if entry_source == source:
# active_entry.trackservice_id = trackservice.id self.logger.info("Resolved '%s' entry '%s' for URI '%s'" % (entry.get_type(), entry, source))
# active_entry.store(add=False, commit=True) result = entry
break
# self.logger.info("Stored active entry '%s' to TrackService as '%s'" % (active_entry, trackservice))
# found = True if not result:
msg = "Found no entry in the recent history which matches the given source '%s'" % (source)
# if not found: self.logger.critical(SU.red(msg))
# msg = "Found no entry in the recent history which matches the given source '%s'" % (filepath)
# self.logger.critical(SimpleUtil.red(msg)) return result
def print_entry_history(self): def print_entry_history(self):
......
...@@ -32,6 +32,7 @@ def do_meta_filesystem(meta) = ...@@ -32,6 +32,7 @@ def do_meta_filesystem(meta) =
filename = meta["filename"] filename = meta["filename"]
# artist = meta["artist"] # artist = meta["artist"]
# title = meta["title"] # title = meta["title"]
# print('CALLING GURU #{list.assoc(default="", "install_dir", ini)}/guru.py')
system('#{list.assoc(default="", "install_dir", ini)}/guru.py --on_play "#{filename}" &') system('#{list.assoc(default="", "install_dir", ini)}/guru.py --on_play "#{filename}" &')
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment