# if not container or container == 'unknown': # raise UnsuitableEngineError return { "type": guess_media_type(ext), "container": container, "display_name": u"%s.%s" % (name, container or ext), "unique_id": unique_id, } def get_uris(self, file): """Return a list of URIs from which the stored file can be accessed. :rtype: list :returns: All :class:`StorageURI` tuples for this file. """ uid = file.unique_id if uid.startswith("rtmp://"): sep_index = uid.find(RTMP_URI_DIVIDER) # can raise ValueError if sep_index < 0: log.warn("File %r has an invalidly formatted unique ID for RTMP.", file) return [] server_uri = uid[:sep_index] file_uri = uid[sep_index + len(RTMP_URI_DIVIDER)] return [StorageURI(file, "rtmp", file_uri, server_uri)] return [StorageURI(file, "http", file.unique_id, None)] StorageEngine.register(RemoteURLStorage)
'type': guess_media_type(ext), 'container': container, 'display_name': u'%s.%s' % (name, container or ext), 'unique_id': unique_id, } def get_uris(self, media_file): """Return a list of URIs from which the stored file can be accessed. :type media_file: :class:`~mediacore.model.media.MediaFile` :param media_file: The associated media file object. :rtype: list :returns: All :class:`StorageURI` tuples for this file. """ uid = media_file.unique_id if uid.startswith('rtmp://'): sep_index = uid.find(RTMP_URI_DIVIDER) # can raise ValueError if sep_index < 0: log.warn( 'File %r has an invalidly formatted unique ID for RTMP.', media_file) return [] server_uri = uid[:sep_index] file_uri = uid[sep_index + len(RTMP_URI_DIVIDER):] return [StorageURI(media_file, 'rtmp', file_uri, server_uri)] return [StorageURI(media_file, 'http', uid, None)] StorageEngine.register(RemoteURLStorage)
from mediacore.lib.storage import StorageEngine class baidupcs(StorageEngine): """ Implement all abstract properties and abstract methods here ... """ StorageEngine.register(baidupcs)