Telemeta
Telemeta copied to clipboard
Modifying/overwriting source file
As far as I understand, in views/item.py -> item_export source media could be used for streaming if there are already in the required mime type but metadata would also be added to the original file as shown below:
if mime_type in format:
# source > stream
if not extension in mapping.unavailable_extensions:
proc = encoder(source, overwrite=True)
proc.set_metadata(metadata)
try:
#FIXME: should test if metadata writer is available
proc.write_metadata()
except:
pass
response = StreamingHttpResponse(stream_from_file(source), mimetype = mime_type)
I may be wrong but it does not seem appropriate to me to modify the source file by adding some metadata although I understand the need to add those metadata before streaming.
Shouldn't we use a copy of the original media instead and rename it and put it in cache-export directory ?
@yomguy Are you ok to remove the following behavior:
If source file is of the require mime type then directly stream the source file and eventually overwrite its metadata.
And instead just treat it as usual : transcode into another file, eventually write metadata and then serve/stream the file.
This behavior should be optional because there are several use cases where it would be nice to put the metadata directly in the source files. For example, when the items come from a personal modern MP3 collection where metadata has to be fixed though the web app, but keeping them in the files in order to copy them on external devices. It would be really bad to have to copy all files, roughly doubling the collection, in this case. What about to put TELEMETA_METADATA_EMBEDDING in the settings ?
maybe something like TELEMETA_PRESERVE_SOURCE_FILES default to True