morrolinux / mpradio

Morrolinux's Pirate radio (PiFmRDS / PiFmAdv implementation with Bluetooth and mp3 support) - Stream music to your car's FM radio or use it as a Bluetooth speaker via headphone jack
GNU General Public License v3.0
108 stars 17 forks source link

Added mp3-metadata reading, using id3lib #32

Closed Hurricos closed 6 years ago

Hurricos commented 6 years ago

This update accomplishes the following:

morrolinux commented 6 years ago

Wow that's nice! I've had a brief look at the code, and I'll test it ASAP

morrolinux commented 6 years ago

Not fully tested jet. But as of now, seems perfect. Could you just move out of the config file the "echo" command? it would be better if it was in the service script rather than on the configuration file :)

Hurricos commented 6 years ago

The idea behind inserting the echo there was to allow the end-user to possibly further customize the way RDS is generated - for example, by echoing and then cutting the fields to fit, or using an awk script, or however. That being said, this may be better (possible?) to restrict to printf (see man printf 1), which itself has nice conventions for format strings (near-identical to C printf()). I just haven't figured out the right escape sequence to be able to say rdsPattern='%.8s: %s (%.10s)' $ARTIST_NAME $SONG_NAME $ALBUM_NAME ... this would be easier if it weren't relying on shell evaluation. :(

I'm aware it's a bit overcomplicated of a solution, but the hope is to make it function elegantly for the end user.

morrolinux commented 6 years ago

Alright I get the cutting and stuff, but couldn't it work it simply was eval echo $PATTERN in getTitle() or am I missing something? Afterwards, an advanced user could always append cut or any other filter to the pattern in configuration file, right?

Hurricos commented 6 years ago

Yes, that would work fine, but I was imagining to instead do printf $PATTERN (or eval printf $PATTERN?), because that is flexible enough, and just about anyone who has a Raspberry Pi should know the C / Python convention of 'format string' $ARG1 $ARG2 $ARG3 ...

morrolinux commented 6 years ago

Let's just not overcomplicate it for the moment, I like using echo and just sticking with the simple syntax which is more user friendly for the vast majority of standard users. Also, I plan to move the RDS service to a simple thread of the player process in the future, so let's not put too much effort in it. Please revert it back to echo and stuff (leaving echo out of the config file) , and we're done :)

Hurricos commented 6 years ago

As you wish. End-user can handle what they need (and when the RDS service is running on C++, it can be built with more in mind anyways).

Please test, as I have, at this second, no access to an RDS receiver.

morrolinux commented 6 years ago

Yup. As of now I'd rather focus on enabling mpradio to communicate with other processes via socket (just like PiFmRds does) which puts the basis for the companion app (server side) and few more nice things!

morrolinux commented 6 years ago

Tested and merged! thanks for your contribution!

Hurricos commented 6 years ago

That all makes much more sense now.

I am happy to contribute any way I can to such a useful piece of software.