Commit fc5c41b6 authored by Thomas Bernhart's avatar Thomas Bernhart
Browse files

Return original filename in pair when searching media files

parent 0fb92b30
......@@ -4,28 +4,26 @@ from ch.memobase.foxml import FoxmlReader
class MediaFileSearcher:
def __init__(self, foxml_reader: FoxmlReader, http_files_path, rtmp_files_path):
def __init__(self, foxml_reader: FoxmlReader, datastream_store_path, http_files_path, rtmp_files_path):
self.foxml_reader = foxml_reader
self.datastream_store_path = datastream_store_path
self.http_files_path = http_files_path
self.rtmp_files_path = rtmp_files_path
def search_media_file(self):
accesscopy_file = self.foxml_reader.get_accesscopy_datastream_file()
if accesscopy_file is not None:
ext = path.splitext(self.foxml_reader.get_accesscopy_datastream_original_filename())[1]
return accesscopy_file, ext
return path.join(self.datastream_store_path, accesscopy_file), path.basename(self.foxml_reader.get_accesscopy_datastream_original_filename())
else:
locator = self.foxml_reader.get_locator()
if locator is not None:
# copy streaming resource
# search streaming resource
if locator.startswith('https://memobase.ch/files/'):
http_resource_file = self.__get_http_resource_file(locator)
ext = path.splitext(http_resource_file)[1]
return http_resource_file, ext
return http_resource_file, path.basename(http_resource_file)
elif locator.startswith('rtmp://intstream.memobase.ch:1935/memobase/'):
rtmp_resource_file = self.__get_rtmp_resource_file(locator)
ext = path.splitext(rtmp_resource_file)[1]
return rtmp_resource_file, ext
return rtmp_resource_file, path.basename(rtmp_resource_file)
else:
return None
else:
......@@ -35,7 +33,7 @@ class MediaFileSearcher:
thumbnail_file = self.foxml_reader.get_thumbnail_datastream_file()
if thumbnail_file is not None:
ext = path.splitext(self.foxml_reader.get_thumbnail_datastream_original_filename())[1]
return thumbnail_file, ext
return path.join(self.datastream_store_path, thumbnail_file), ext
else:
return None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment