Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Bulk saving/loading user-defined radio stations
#1
Those of us who regularly add user-defined radio stations to our moOde players know the pain of having to add them again to fresh installs.

I have written a pair of Python scripts to reduce this pain. They must be executed manually from the command line so the process isn't totally pain-free but it works for me Smile 

See my github repo for details.

The scripts have been tested only with moOde 5.3.1 and moOde 6.0.0 and work with both. 

Regards,
Kent
Reply
#2
Hi Kent,

thanks a lot for creating and sharing the scripts - I'll test them as soon as possible (unfortunately most probably this will be next week earliest).
I tested the script and they work perfect for my needs. Migrated from 5.x to Moode 6.1 and imported my Radio channels within a few seconds Smile
For all other settings, I just made a SQL dump from the database of the old system an so I was able to quickly redo my settings by comparing to the dump.
Reply
#3
Not really sure what I'm doing wrong but I cant get your script to work

If I run python3 savemyradios.py all I get is an empty myradios.tar.gz

I also tired 
chmod +x savemyradios.py
./savemyradios.py

with the same results.

Please check the attachment.


Attached Files Thumbnail(s)
       
Reply
#4
What is the output from the command below?

Code:
sqlite3 /var/local/www/db/moode-sqlite3.db "select * from cfg_radio where type='u'";
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#5
@Im bored

The commandline output from the script is telling me that you have two user-defined radio stations in your moode-sqlite3.db database which don't have the required corresponding .pls file in the /var/lib/mpd/music/RADIO/ directory.

Further, the names of the two stations are names for the stations I created for my example myradios.tar.gz file so would not be expected to be in your database to start with. 

Could it be you tried to run the loadmyradios.py script first? The example file contains all three elements---database entry, .pls file, .jpg files---for each station so it should not have left your system in the state it seems to be in. If you ran it, did the script fail somehow? If so, what was the output?

Regards,
Kent
Reply
#6
(08-21-2019, 07:50 PM)Tim Curtis Wrote: What is the output from the command below?

Code:
sqlite3 /var/local/www/db/moode-sqlite3.db "select * from cfg_radio where type='u'";

login as: pi
pi@192.168.1.49's password:
Kernel 4.19.66-v7+, Raspbian 10.0, moOde 6.1.0
                          ____     __
              __ _  ___  / __ \___/ /__
             /  ' \/ _ \/ /_/ / _  / -_)
            /_/_/_/\___/\____/\_,_/\__/

                 moOde audio player
                © 2014 Tim Curtis


The programs included with Moode are free software; the
exact distribution terms for each program are described
in the individual files in /usr/share/doc/*/copyright.
Moode comes with absolutely no warranties expressed or
implied, or any other guarantees.

Last login: Wed Aug 21 11:37:46 2019 from 192.168.1.5
pi@OutdoorSpeakers:~ $ sqlite3 /var/local/www/db/moode-sqlite3.db "select * from cfg_radio where type='u'";
500|https://archive.org/download/gd68-02-14.sbd.kaplan.15640.sbeok.shnf/gd68-02-14.sbd.kaplan.15640.sbeok.shnf_vbr.m3u|Grateful Dead Live at Carousel Ballroom - 1968|u|local
501|http://mangoradio.stream.laut.fm/mangoradio?t302=2019-08-11_17-26-44&uuid= f5df91b3-0dbd-4169-9dae-ed43ed409bbf|MANGORADIO|u|local


Attached Files Thumbnail(s)
   
Reply
#7
(08-21-2019, 08:28 PM)TheOldPresbyope Wrote: @Im bored

The commandline output from the script is telling me that you have two user-defined radio stations in your moode-sqlite3.db database which don't have the required corresponding .pls file in the /var/lib/mpd/music/RADIO/ directory.

Further, the names of the two stations are names for the stations I created for my example myradios.tar.gz file so would not be expected to be in your database to start with. 

Could it be you tried to run the loadmyradios.py script first? The example file contains all three elements---database entry, .pls file, .jpg files---for each station so it should not have left your system in the state it seems to be in. If you ran it, did the script fail somehow? If so, what was the output?

Regards,
Kent

This are the steps taken:
1. Update to 6.10 via ISO
2. go through and setup manually
3. manually add radio stations and images

Run 
4. git clone https://github.com/TheOldPresbyope/moode...-utils.git
5. cd moode-radio-utils

Run
6. python3 savemyradios.py

7. Download and check myradios.tar.gz inside of that file was two radio stations. (the test ones)

Run 
8. sudo python3 loadmyradios.py (to test to see if the script works)
Yes it worked, it wiped out my radio stations and replaced only with 2 test radio stations.

9. Manually replace my radio stations again 

Run
10. python3 savemyradios.py

And at this point it backs up no radio stations



I attached a list of my radio stations just to show whats currently in there, And that's what I'm trying to backup


Attached Files Thumbnail(s)
   
Reply
#8
When you manually add your stations do you also update the cfg_radio table?
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#9
(08-21-2019, 09:19 PM)Tim Curtis Wrote: When you manually add your stations do you also update the cfg_radio table?

When I manually add radio stations I update them in the interface by pressing the refresh buttons.
And If that doesn't work I go to config and Update MPD database.

Is that what you mean?


Attached Files Thumbnail(s)
   
Reply
#10
@Im bored

I'm a bit lost here.

You said:
Quote:1. Update to 6.10 via ISO
2. go through and setup manually
3. manually add radio stations and images


What exactly did you do in step 3? 

For each station, did you use the "+" icon in the Radio Directory to open the "New Station" popup and in it enter your station name, URL, Logo, and then hit the "Create" button?  This creates the database entry and the .pls file and copies in the .jpg files.

The "Refresh" button does not enter stations but it does scan the .pls file directory. If you've added your own .pls files to the /var/lib/mpd/music/RADIO directoy and .jpg files to the /var/www/images/radio-logos and ../thumbs directories, then they will show up in the UI after the refresh. However, they will not automagically be entered into the database and my script will not know of their existence. That's spelled out in the comment block at the head of each script.

I don't understand also why you did all this on one moOde player. The point is to be able to save stations which have been created on one player and load them onto others.

As an aside, I can see I made a mistake adding my example tar file. I'll have to modify the repo to hide it in a subdirectory to avoid unnecessary confusion. Also, I need to check savemyradios.py to make sure it doesn't create a tar file if it will be empty.

Regards,
Kent
Reply


Forum Jump: