Moode Forum
[PROBLEM] How to automate daily update of library? - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: FAQ and Guides (https://moodeaudio.org/forum/forumdisplay.php?fid=9)
+--- Thread: [PROBLEM] How to automate daily update of library? (/showthread.php?tid=2853)



How to automate daily update of library? - lessger - 08-02-2020

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


RE: How to automate daily update of library? - TookaFace - 08-02-2020

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



RE: How to automate daily update of library? - lessger - 08-02-2020

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!


RE: How to automate daily update of library? - modeosonja - 08-21-2020

(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


RE: How to automate daily update of library? - philrandal - 08-21-2020

(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


RE: How to automate daily update of library? - Tim Curtis - 08-21-2020

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.