Moode Forum

Full Version: How to automate daily update of library?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am using Moodeaudio on a Raspberry Pi with HifiBerry. My muisc library is on a Synology NAS connected via Wifi.

The whole setup works fine.

I now want to automate the update of the music library so that changes are incorporated automatically.

I have enabled cron on the pi and defined a daily job to update the library. I tried to update using 


Code:
mpc -w update
   or
mpc -w rescan
   or
curl http://<hostname>/command/cmd=update

All three comands work from the command line interface (user: pi, no error messages). cron activates the script, as I can see from the logfile. I also tried the commands directly from the shell.

With mpc rescan, I verified afterwards with
Code:
mpc listall
and saw that new files were added tp the database.

With all three commands, when I login to moodeaudio later, new files in the library are not shown. When I do update from Configure>Library>update
it works fine.

Can anyone give me a hint what I am doing wrong?

Thank you,
Gerhard
Hey, try:

Code:
http://moode/command/?cmd=libupd-submit.php
or
Code:
php /var/www/libupd-submit.php
instead of mpc commands, it should update MPD and covers.

You also can clear the library cache after the update:
Code:
truncate /var/local/www/libcache.json --size 0
You have solved my problem.


Though /var/www/libupd-submit.php doesn't exist in my installation. Maybe a different version of Moode.

However, clearing the cache

Code:
truncate /var/local/www/libcache.json --size 0

after running the mpc update command does the job.

And I just saw, there is actually a script /home/pi/mu which does exactly that. I should have looked around before asking.

Thank you for your help!
(08-02-2020, 03:06 PM)TookaFace Wrote: [ -> ]Hey, try:

Code:
http://moode/command/?cmd=libupd-submit.php
or
Code:
php /var/www/libupd-submit.php
instead of mpc commands, it should update MPD and covers.

You also can clear the library cache after the update:
Code:
truncate /var/local/www/libcache.json --size 0
 Thanks for this amazing advice. You have solved my problem as well. Have a great day Smile
(08-21-2020, 01:25 PM)modeosonja Wrote: [ -> ]
(08-02-2020, 03:06 PM)TookaFace Wrote: [ -> ]Hey, try:

Code:
http://moode/command/?cmd=libupd-submit.php
or
Code:
php /var/www/libupd-submit.php
instead of mpc commands, it should update MPD and covers.

You also can clear the library cache after the update:
Code:
truncate /var/local/www/libcache.json --size 0
 Thanks for this amazing advice. You have solved my problem as well. Have a great day Smile

The option  to update the MPD database on a schedule would be a welcome addition to core functionality and should be configurable from the Moode UI.

My usage case is a shared NAS, a Moode player in the living room which runs podget as a scheduled task via cron (with an mpc update afterwards), and another Moode player in the lockdown office.  Without a scheduled task on the second Pi I have to remember to manually update the Podcasts directory.

Whatever one does, it would be cool to have an automatic update at a scheduled time to keep everything in sync after files are added.

Cheers,

Phil
Could prolly add it to Clock Radio for the Sleep Timer mode.

Something like "Update Library" would be added to the the "Action after stop" option.