Posts: 566
Threads: 5
Joined: Mar 2020
Reputation:
31
(09-29-2021, 04:48 PM)forlau Wrote: Hi,
i'm using a fresh install of moode 7.40. First i tried to modify the exported station.zip file (station_data.json , radio-logos and thumbs) copied from on older installation/export. Unfortunately the import is showing errors:
Code: "SQL database location is '/var/local/www/db/moode-sqlite3.db' Station logos location is '/var/local/www/imagesw/radio-logos' Station pls file location is '/var/lib/mpd/music/RADIO' Using Station backup file '/var/local/www/station_import.zip'. ERROR: Station backup file '/var/local/www/station_import.zip' is not a valid format"
I spend already some hours in this topic and i found out, that if i unzip the exported station file and zip it again, i get the same error message. So the content of the zip did not change, but if i re-import the original station.zip file, it works. So the difference seems to be the zip format. Do you have any idea, what is going on here?
I'm running an Ubuntu laptop and tried different zip tools.
Hi Forlau,
If you want, try to submit one or more .zip examples ... we can probably understand where the problem is.
With best regards,
Francesco
Posts: 3
Threads: 0
Joined: Sep 2021
Reputation:
0
Thanks for your support. I found the problem. I extracted the zip into a folder and after modification i zipped the complete folder instead of zipping just the files (the station_data.json and radio-logos folder).
Posts: 566
Threads: 5
Joined: Mar 2020
Reputation:
31
(09-29-2021, 08:59 PM)forlau Wrote: Thanks for your support. I found the problem. I extracted the zip into a folder and after modification i zipped the complete folder instead of zipping just the files (the station_data.json and radio-logos folder).
Hi Forlau,
I am glad to know that the issue has been solved.
Well done.
Best regards,
Francesco
Posts: 566
Threads: 5
Joined: Mar 2020
Reputation:
31
(02-21-2021, 05:37 PM)TheOldPresbyope Wrote: Background
The Radio Manager was introduced in the moOde 6.6.0 release. Clicking on the gear icon in the Library > Radio view takes one to the Radio Manager panel.
- Clicking the Export button causes moOde to create a zip file of all the radio station information in the player and download it to one's local host (default filename "stations.zip").
- Going in the reverse direction, clicking the Import button causes moOde to ask the user to select the file to be imported, then uploads it and replaces all the existing radio station information with the content of the file.
This functionality works fine for many users but there are some issues:
- Because of a change in the underlying database schema for radio stations, a station file exported from moOde 6.6.0 through 6.7.1 cannot be imported into moOde 7.0.0 or 7.0.1.
- One may wish, say, to preserve all the curated stations in a fresh player and import only the user-created stations from a previous player.
- It's possible to create so many stations that the resulting file is larger than 50MB. The file will be exported but it can't be imported again. This is a somewhat arbitrary limitation imposed on the in-browser file-transfer method but there will always be some limit and modifying it is complicated for many users.
The upcoming moOde 7.1.0 release will include a new, improved Radio Manager functionality thanks to a superb Python script contributed by @bitlab. It solves the first issue. It solves the second issue when used stand-alone but as of 7.1.0TR2 such alternatives are not available via the Radio Manager. Future modifications to the moOde WebUI may allow more flexibility. The third issue deserves its own thread but the script solves it too when used stand-alone (within the limits of available memory, of course).
Meanwhile here's guidance on using the script stand-alone in moOde 7.0.1 and previous releases.
Procedure
1. On the destination player, log into the command line as user "pi" and download a copy of the script stationmanager.py from the github repo (I suggest you stay in the home directory /home/pi but the choice is yours)
Code: wget https://raw.githubusercontent.com/moode-player/moode/develop/www/command/stationmanager.py
2. Mark the downloaded script as executable
Code: chmod +x stationmanager.py
3. Take a moment to check out all the wonderful options
Code: ./stationmanager.py -h
4. As illustration, here's the dialogue I see on my moOde 7.0.1 player named moode701t for the preceding steps
Code: pi@moode701t:~ $ wget https://raw.githubusercontent.com/moode-player/moode/develop/www/command/stationmanager.py
--2021-02-21 11:28:01-- https://raw.githubusercontent.com/moode-player/moode/develop/www/command/stationmanager.py
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.109.133, 185.199.111.133, 185.199.110.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.109.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26562 (26K) [text/plain]
Saving to: ‘stationmanager.py’
stationmanager.py 100%[===========================================>] 25.94K --.-KB/s in 0.009s
2021-02-21 11:28:01 (2.77 MB/s) - ‘stationmanager.py’ saved [26562/26562]
pi@moode701t:~ $ chmod +x stationmanager.py
pi@moode701t:~ $ ./stationmanager.py -h
usage: stationmanager.py [-h] [--version]
(--import | --export | --clear | --compare)
[--scope {all,moode,other}]
[--type {favorite,regular,hidden,nothidden}]
[--how {clear,merge}] [--db DB]
[backupfile]
Manages import and export of moOde radiostations.
positional arguments:
backupfile Filename of the station backup. Required by the
import, export and compare.
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--import Import radio stations from backup.
--export Export radio stations to backup.
--clear Clear radio stations. This will delete the contents of
the SQL table, logo images and pls files of the
selected stations within the specified scope.
--compare Show difference between SQL table and station backup.
--scope {all,moode,other}
Indicate to which stations the specified action
applies. (default: other)
--type {favorite,regular,hidden,nothidden}
Indicate the type of station to export.
--how {clear,merge} On import, clear stations before action or merge and
add. (default: merge)
--db DB File name of the SQL database. (default:
/var/local/www/db/moode-sqlite3.db
Root privileges required for import or clear.
pi@moode701t:~ $
Note that scope "moode" means the curated stations and "other" means the user-created stations. The "how" option should be self-explanatory.
From this, the remaining steps should be pretty obvious.
5. Using your favorite method, transfer the desired stations.zip file (which was already downloaded to your local host from the source player) into the same directory on the destination moOde player. The file name itself isn't important.
6. Use the script to import the stations from the file into moOde, setting the "scope" and "how" options as desired. The default options should be satisfactory for many users.
Code: sudo ./stationmanager.py --import stations.zip
As illustration, here's the dialogue I see when I import into moOde 7.0.1 a stations.zip file I had exported from a moOde 6.7.1 player. The file contains all the moOde 6.7.1 curated stations and one user-defined station, Radio BluesFlac. I chose the defaults, so only the Radio BluesFlac station is imported and it is merged with my existing user-created stations.
Code: pi@moode701t:~ $ sudo ./stationmanager.py --import stations671+.zip
SQL database location is '/var/local/www/db/moode-sqlite3.db'
Station logos location is '/var/local/www/imagesw/radio-logos'
Station pls file location is '/var/lib/mpd/music/RADIO'
Using Station backup file 'stations671+.zip'.
WARNING: Station backup is an old format
import
WARNING: no schema information, guessing moOde 6.7.1 station backup format
WARNING: Source and target differ, correcting used types
Import Radio BluesFlac
WARNING: Missing station logo thumb for 'Radio BluesFlac', generating one
Imported 1 radio stations
Notes
- If you don't have a stations.zip file from your source player yet, you can either use the existing Radio Manager to create and download it or you can use the above as a guide to download and use the stationmanager.py script to create it. In the latter case, you'll have to transfer the file manually since the script does not automatically download the file to your local host.
- The new-format stations.zip file exported by the stationmanager.py script can be imported only by the script and not by the original moOde Radio Manager function. The default filename may be the same but the format and contents are different from those of the old-format stations.zip.
- This stationmanager.py script and the stations.zip files have nothing in common with my older, now deprecated moode-radio-utils (savemystations.py and loadmystations.py) nor the associated myradios.tar.gz file. If that's the only file you have, then loadmystations.py or loadmystations7.py is still the way to reclaim the contents. Except for that, don't use these deprecated scripts and once you've reclaimed the contents, start using only the stationmanager.py script.
- Once moOde 7.1.0 is officially released, the stationmanager.py script will be found at /var/www/command/stationmanager.py
Hi Kent,
How are you?
Please note that the "Stationmanager.py" seems not longer reachable.
Have you any suggestion?
Best regards and thanks,
Francesco
Posts: 6,010
Threads: 176
Joined: Apr 2018
Reputation:
234
@ fdealexa
Hi, Francesco.
Looking at my moOde 8.1.2 player just now, I see the script /var/www/util/station_manager.py
Code: pi@moode64:~ $ /var/www/util/station_manager.py -h
usage: station_manager.py [-h] [--version] (--import | --export | --clear | --compare | --diff DIFF | --regeneratepls) [--scope {all,moode,other}]
[--type {favorite,regular,hidden,nothidden}] [--how {clear,merge}] [--db DB] [--logopath LOGOPATH]
[backupfile]
Manages import and export of moOde radiostations.
positional arguments:
backupfile Filename of the station backup. Required by the import, export and compare.
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--import Import radio stations from backup.
--export Export radio stations to backup.
--clear Clear radio stations. This will delete the contents of the SQL table, logo images and pls files of the selected stations within the specified
scope.
--compare Show difference between SQL table and station backup.
--diff DIFF Create a diff backup with the difference between the old (=backup) and new (=db) to this files.
--regeneratepls Regenerate the radio .pls files from db.
--scope {all,moode,other}
Indicate to which stations the specified action applies. (default: other)
--type {favorite,regular,hidden,nothidden}
Indicate the type of station to export.
--how {clear,merge} On import, clear stations before action or merge and add. (default: merge)
--db DB File name of the SQL database. (default: /var/local/www/db/moode-sqlite3.db
--logopath LOGOPATH Location of the radio logos. (default: /var/local/www/imagesw/radio-logo
Root privileges required for import or clear.
I haven't had time to review this script to see if what I wrote in this HowTo is still relevant.
Regards,
Kent
Posts: 13,394
Threads: 304
Joined: Mar 2018
Reputation:
542
The how-to should still be golden. The file name changes were due to the partial refactoring of the back-end scripts that included refactoring the file names to adhere to language specific file naming standards. The refactoring was necessary to help make the code base easier to maintain. Still much more to be done!
Posts: 566
Threads: 5
Joined: Mar 2020
Reputation:
31
(07-24-2022, 12:37 AM)TheOldPresbyope Wrote: @fdealexa
Hi, Francesco.
Looking at my moOde 8.1.2 player just now, I see the script /var/www/util/station_manager.py
Code: pi@moode64:~ $ /var/www/util/station_manager.py -h
usage: station_manager.py [-h] [--version] (--import | --export | --clear | --compare | --diff DIFF | --regeneratepls) [--scope {all,moode,other}]
[--type {favorite,regular,hidden,nothidden}] [--how {clear,merge}] [--db DB] [--logopath LOGOPATH]
[backupfile]
Manages import and export of moOde radiostations.
positional arguments:
backupfile Filename of the station backup. Required by the import, export and compare.
optional arguments:
-h, --help show this help message and exit
--version show program's version number and exit
--import Import radio stations from backup.
--export Export radio stations to backup.
--clear Clear radio stations. This will delete the contents of the SQL table, logo images and pls files of the selected stations within the specified
scope.
--compare Show difference between SQL table and station backup.
--diff DIFF Create a diff backup with the difference between the old (=backup) and new (=db) to this files.
--regeneratepls Regenerate the radio .pls files from db.
--scope {all,moode,other}
Indicate to which stations the specified action applies. (default: other)
--type {favorite,regular,hidden,nothidden}
Indicate the type of station to export.
--how {clear,merge} On import, clear stations before action or merge and add. (default: merge)
--db DB File name of the SQL database. (default: /var/local/www/db/moode-sqlite3.db
--logopath LOGOPATH Location of the radio logos. (default: /var/local/www/imagesw/radio-logo
Root privileges required for import or clear.
I haven't had time to review this script to see if what I wrote in this HowTo is still relevant.
Regards,
Kent Thanks a lot, Kent.
Best regards,
Francesco
|