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

Utility to convert URI to actual filepath.

parent 6748bb73
No related branches found
No related tags found
No related merge requests found
......@@ -29,6 +29,9 @@ class EngineUtil:
"""
A class for Engine utilities.
"""
@staticmethod
def get_channel_type(uri):
"""
......@@ -47,6 +50,23 @@ class EngineUtil:
return ChannelType.LIVE
@staticmethod
def uri_to_filepath(base_dir, uri):
"""
Converts a file-system URI to an actual, absolute path to the file.
Args:
basi_dir (String): The location of the audio store.
uri (String): The URI of the file
Returns:
path (String): Absolute file path
"""
return base_dir + "/" + uri[7:] + ".flac"
@staticmethod
def get_entries_string(entries):
"""
......
......@@ -301,22 +301,6 @@ class CalendarFetcher:
def convert_to_filename(self, uri):
"""
Converts a file-system URI to an actual, absolute path to the file.
Args:
uri (String): The URI of the file
Returns:
path (String): Absolute file path
"""
e = self.config.get("audiofolder") + "/" + uri[7:] + ".flac"
if not os.path.isfile(e):
self.logger.warning("File %s does not exist!" % e)
return e
def __fetch_data__(self, type, url):
"""
......
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