spl0k / supysonic

Supysonic is a Python implementation of the Subsonic server API.
https://supysonic.readthedocs.io
GNU Affero General Public License v3.0
260 stars 57 forks source link

Allow setting metadata and tags in transcoded files #170

Closed pR0Ps closed 4 years ago

pR0Ps commented 4 years ago

In some cases it would be useful for the transcoded output files to retain the metadata of the original files.

As an example of a use-case, I use Ultrasonic on Android to stream from Supysonic. It has a "pin" feature where you can permanently cache songs to the phone. I use this feature as an easy way to get MP3 files on my device that I can play with other apps or send to other devices. Without the metadata being embedded into the transcoded files though, I have to manually add tags to the files after I pin them.

An easy and backwards-compatible way of doing this would be to simply make more variables available to the transcoder subprocesses.

Currently the only options for passing to the transcoding subprocess are %srcpath, %srcfmt %outfmt, and %outrate. By also supporting some variables for basic metadata that most formats can embed (title, album, artist, tracknumber, genre, date), all that would be required would be for the transcode command to be changed to add the required information, ie:

encoder_mp3 = lame --quiet -b %outrate --tt %title --tl %album --ta %artist --tn %tracknumber --tg %genre --ty %date --add-id3v2 - -