08-10-2019, 10:08 PM
(08-10-2019, 01:07 PM)TheOldPresbyope Wrote: @ghoeher
Hi, Georg.
If you can wait a couple more days I should have Python scripts ready for prime time which do the following:
These are just utility scripts (but I suppose they could be combined into one). I'm not tackling any kind of automated player-to-player transfer or any integration with the moOde UI. The user has to run the export script, transfer the tarball, run the import script, all from the command line. Further these scripts are all or none; I'm not tackling any kind of user selection of the stations to export or import.
- in export mode, scan the moOde database for user-defined radio station entries; for each one extract the db info along with the corresponding .pls file, the station logo .jpg file and its thumbnail .jpg file (if the image files exist); save all to a tarball (e.g., a tar file).
- in import mode, untar the tarball to a temp directory and, for each station, first check if it clashes with a station already present in the moOde database; if not, extract the station entry to the database and the corresponding files to their proper places.
I starting developing these scripts for my own use but they may be useful to others to:
I'll have to spend some time reading Tim's release notes to see how far back in moOde releases these scripts will work. IIRC, radio logo thumbnails were introduced mid 4.x. Don't recall if the database schema for radio stations or the location of the file directories has changed since 4.0.
- Deal with upgrading to a new major release of moOde
- Copy stations from one player to another player whether it's running the same release or a different release
- Share favorites to another user
Regards,
Kent
Hi Kent,
User added Radio logos were introduced in the 5.0 release and i think thats also when the type column was added to cfg_radio to help differentiate between user added and system pre-defined stations.
To list out the user added stations run the query below. Change 'u; to 's' to list out the system pre-defined stations. User added stations must start at id > 499.
Code:
sqlite3 /var/local/www/db/moode-sqlite3.db "select * from cfg_radio where type='u'"
I think when importing I'd first delete rows where type='u', then do a bulk import from a csv. This might avoid the need to check whether the stations already exist. For example:
Code:
sqlite3 /var/local/www/db/moode-sqlite3.db "DELETE FROM cfg_cfg_radio WHERE type='u'"
sqlite3 /var/local/www/db/moode-sqlite3.db -csv ".import /home/pi/cfg_radio.csv cfg_radio"
The csv file looks like below
Code:
1,http://strm112.1.fm/blues_mobile_mp3,1.FM - Blues Radio,s,local
2,http://eno.emit.com:8000/2bob_live_64.mp3,2BOB Radio 104.7 FM,s,local
3,http://stream.4zzzfm.org.au:789,4ZZZ FM 102.1 - Alternative,s,local
4,http://54.173.171.80:8000/6forty,6forty Radio,s,local
5,http://radio.stereoscenic.com/ama-h,A.M. Ambient,s,local
6,http://live-radio01.mediahubaustralia.com/CTRW/mp3/,ABC Country,s,local
7,http://live-radio01.mediahubaustralia.com/JAZW/mp3/,ABC Jazz,s,local
8,http://stream.absolutradio.de/hot/mp3-128/radioplayer/,Absolut Hot,s,local
9,http://stream.absolutradio.de/hq/mp3-160/radioplayer/,Absolut Radio,s,local
10,http://stream.absolutradio.de/relax/mp3-160/radioplayer/,Absolut Relax,s,local
11,http://radio.stereoscenic.com/asp-h,Ambient Sleeping Pill,s,local
.
.
-Tim