ArturSierzant / OMPD

O!MPD is free, opensource MPD client based on PHP and mySQL.
http://ompd.pl
GNU General Public License v3.0
40 stars 13 forks source link

Fixes #155 by enabling to start an update by running `php update.php` #170

Open tomchiverton opened 2 months ago

tomchiverton commented 2 months ago

I'm currently getting

PHP Fatal error:  Uncaught Error: Call to a member function analyze() on null in /tmp/update.php:820
Stack trace:
#0 /tmp/update.php(608): fileStructure('/exports/mp3/Al...', Array, Array, 'h1e9ld8x9q', '1650293688')
#1 /tmp/update.php(522): recursiveScan('/exports/mp3/Al...')
#2 /tmp/update.php(522): recursiveScan('/exports/mp3/Al...')
#3 /tmp/update.php(372): recursiveScan('/exports/mp3/')
#4 /tmp/update.php(101): update_impl('/exports/mp3/')
#5 /tmp/update.php(81): cliUpdate()

but think this is a bad file in my collection

tomchiverton commented 2 months ago

Think fixed that, log file ends up with

Update stop time: 20240908 15:11:26
ArturSierzant commented 2 months ago

Thanks for your effort and sorry for long time to answer to your posts. I took a look at your code and modified it a little bit so it doesn't display HTML code in CLI. Unfortunately I can't push it to GitHub, I don't know why. I'll try tomorrow.

ArturSierzant commented 2 months ago

OK, I pushed my changes to new branch pr/n170_autoupdate. Please take a look. I think your idea is good, so please feel free to go on with this. First I would add passing dir to update as an argument in cli: php update.php /path/to/dir/to/be/updated Next step would be an error handling with messages shown in cli.

tomchiverton commented 2 months ago

Update changes in https://github.com/ArturSierzant/OMPD/pull/171

I'm not sure how to recover from the error inside the catch block - I think we should do what ever the magic "cancel" click does on the web GUI but I am unsure where that code lives.

ArturSierzant commented 2 months ago

Code that do magic :) is here: https://github.com/ArturSierzant/OMPD/blob/9d1ecd44116d000cb8cd4146b3b7ffe688dd50e5/config.php#L244C2-L265C3 Basically it resets some values in database to allow next update and to prevent erasing data.