[SOLVED] How to import radio stations - Printable Version +- Moode Forum (https://moodeaudio.org/forum) +-- Forum: Community (https://moodeaudio.org/forum/forumdisplay.php?fid=18) +--- Forum: General Discussion (https://moodeaudio.org/forum/forumdisplay.php?fid=21) +--- Thread: [SOLVED] How to import radio stations (/showthread.php?tid=5623) |
How to import radio stations - haeckse - 06-11-2023 Hey all, A while ago I've created a React web client for streaming internet radio: RadioMii The client pulls the info about the streams from radio-browser.info Favorites created in RadioMii can be exported with XSPF or M3U format. As it seems, Moode does not provide an option yet to import radio stations via M3U files. When I copy a M3U file to /var/lib/mpd/playlists, its radio stations don't appear in the UI, presumably because of missing entries in the db and missing cover images. Looking into Moode's default radio playlist, the #EXTIMG tag shows that the station images seem to be stored locally, so the images are presumably referenced in the db entries then: Code: #EXTGENRE:Various I wonder if there is a way on console level to do a M3U bulk import with fetching station images dynamically and write them to Moode's database. I could adjust the RadioMii M3U export so that it contains the link to an image in #EXTIMG and also some other data like the stations genre, homepage, language, country, bitrate etc. as extended info key-value pairs. Cheers Andrea RE: Import radio stations - TheOldPresbyope - 06-11-2023 (06-11-2023, 09:13 AM)haeckse Wrote: Hey all, Hi, Andrea. moOde stores data about radio stations in three places:
I'm thinking a quick-n-dirty solution to the problem you pose is to write some code to convert your .m3u files and image files into a form which fits what station_manager.py already does. But it's up to you how you want to slice-and-dice the problem. Regards, Kent PS - .m3u files are used in moOde only to store playlists. RE: Import radio stations - Tim Curtis - 06-11-2023 ETA: To add to what Kent mentioned. M3U files are only used for playlists and are stored in /var/lib/mpd/playlists. You could use system Backup to export just the Playlists, modify the backup zip to contain your playlists, re-zip the file and then do a Restore. If you want to do bulk import of radio stations into the Radio feature then read below. 1. SQL table cfg_radio in /var/local/www/db/moode-sqlite3.db This table contains metadata for each station and is referenced by the station URL which is what MPD loads into the Queue from a station .pls file. Code: moodeutl -q "select * from cfg_radio" 2. Station .pls files in /var/lib/mpd/music/RADIO/ These files are what MPD indexes into its database and what MPD reads to load a station URL into the Queue. These files are generated from the cfg_radio table during the image build process using the station_manager.py utility Code: pi@moode:~ $ cat /var/lib/mpd/music/RADIO/FluxFM.pls 3. Station cover logos in /var/local/www/imagesw/radio-logos/ and radio-logos/thumbs/ Code: radio-logos/stationName.jpg Full sized logo displayed in Playback view 4. Station manager utility https://github.com/moode-player/moode/blob/develop/www/util/station_manager.py Code: pi@moode:~ $ /var/www/util/station_manager.py -h The station manager utility can be used to bulk import stations into the Radio feature by the following process: - Export the already bundled stations - Unzip the export file - Modify radio-logos/ and station_data.json to only include the stations to be imported - Re-zip - Import the zip which will add the stations to cfg_radio starting at id=500, add the radio logos and create the .pls files. sudo /var/www/util/station_manager.py --scope other --import ./tim.zip Code: pi@moode:~ $ /var/www/util/station_manager.py --scope all --export ./tim.zip RE: Import radio stations - haeckse - 06-11-2023 Hello @TheOldPresbyope, hello @Tim Curtis, Thank you guys for all the information about what is expected where in the directory structure, that helps a lot. Now I know how to proceed and with the neat station manager utility the import will work just fine. Cheers, Andrea |