mutagen icon indicating copy to clipboard operation
mutagen copied to clipboard

Saving to another file, than reading from

Open JuniorJPDJ opened this issue 4 years ago • 4 comments

I'm reading files from read-only location and need to save them locally/in memory. ATM as far as I understood from error messages, when saving file it assumes the file contents are in output file. I theoretically could copy the file, but I'd like mutagen to do this so I can stream the output file without seeking and buffering whole.

JuniorJPDJ avatar Sep 05 '20 22:09 JuniorJPDJ

To be precise: Now metagen is moving data in file to make place for metadata. I'd like it to save/yield whole new file/bin data with tags applied.

What I finally want to achieve is giving mutagen readable filelike (lets call it input) with audio data and creating (lets call it output) stream with contents of input file with tags applied.

JuniorJPDJ avatar Sep 05 '20 22:09 JuniorJPDJ

Nothing like this exists atm, you have to copy first and then change it.

I can see the benefit for your use case though, so I'll leave this open.

lazka avatar Sep 06 '20 09:09 lazka

Tbh this function is suggesting it's working like that (what else could possibly filething arg in save function mean?) https://mutagen.readthedocs.io/en/latest/api/base.html#mutagen.FileType.save But it's not ;/

JuniorJPDJ avatar Sep 06 '20 14:09 JuniorJPDJ

yeah, that could be communicated better. In this case you could read the tags from one MP3 for example and then save them to another MP3, but both files needs to exist already.

lazka avatar Sep 06 '20 17:09 lazka