Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying/overwriting source file #158

Open
thomasfillon opened this issue Mar 7, 2017 · 3 comments
Open

Modifying/overwriting source file #158

thomasfillon opened this issue Mar 7, 2017 · 3 comments

Comments

@thomasfillon
Copy link
Member

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 ?

@thomasfillon
Copy link
Member Author

@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.

@yomguy
Copy link
Member

yomguy commented May 5, 2017

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 ?

@thomasfillon
Copy link
Member Author

maybe something like TELEMETA_PRESERVE_SOURCE_FILES default to True

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants