Playing local files with RFID

Hello everyone,

I’m trying to build a headless Audio Player for my nephew.

I’m using Pi Musicbox as my base and
https://github.com/fsahli/music-cards and
https://github.com/9and3r/mopidy-ttsgpio

Everything is working fine by now. Control with the buttons and selecting spotify playlists with RFID. But i also want to get selecting local files with RFID working.

I used a Bashfile to create a .m3u Playlist

#!/bin/bash
rm -f /music/playlists/*.m3u
find "$1" -type d |
while read subdir
do
        for filename in "$subdir"/*.mp3
        do
          if [ -e "$filename" ]
          then
                echo $filename >> /music/playlists/"${subdir##*/}.m3u"
          fi
        done
done

Unbenannt
Now I want to play this playlist with music-cards. Instead of:
spotify:user:topsify:playlist:1uBI8icgYcUED3T1W1X6dB`
I used :
m3u:Karte1.m3u
This is the correct playlist file. The relevant Code file is here:
https:// github. com/fsahli/music-cards/blob/master/box.py
It is not working.

1 Like

Hi,

I did almost exactly what you did. This was some time a go, so I had to pull the card from the device to check the code to remember. However, what I used was “local:track:”… see https://docs.mopidy.com/en/latest/modules/local/

Also, I believe I used to just ls > file.m3u the directories when I made playlists. But I never tested this on anything else except “properly formed” folders, that is with only mp3’s that are named so that they list correctly and all in one folder.

Do you have an example? I don’t quite get it how I should code it. And the I don’t really understand what the docs are saying.

Ok. So I went and took a look at the code that you are using from that github repo. The code is storing the card names and the associated tracks in a csv-file. So when you say:

Now I want to play this playlist with music-cards. Instead of:
spotify:user:topsify:playlist:1uBI8icgYcUED3T1W1X6dB`
I used :
m3u:Karte1.m3u
This is the correct playlist file. The relevant Code file is here:
https:// github. com/fsahli/music-cards/blob/master/box.py
It is not working.

What I mean is that you should instead use: local:track:Karte1.m3u. Can you try that?

Hi have you solved this issue? Can you please let me know how did you select local files by using RFID card?
Thanks
Marco

What issue?

You can select the files however you want. How I did it is that I had a small database in a csv-file. The card number is in one column, and the track name is in the other. You could use other ways to select, I suppose, but this is a really easy way to do it.

In addition I created a small utility to add new cards to the database by just reading them. But since a csv-file is just a text file, you can also manage the file manually if you want.