Open whcrg opened 2 years ago
In general I agree that the diagnostics you are currently getting is substandard and we should definitely see what we can do to improve it. FYI, there is a pending refactoring patch (#1217) that should improve error notifications in general though I don't know if it would help in this particular case...
As to solving your specific problem:
First try to delete the symlink of the photo causing problems and see if that by itself helps during the next import.
If it doesn't, then, as you say, it's probably the database that has a corrupted record. You'll need to remove that record manually.
php artisan db
in the top-level Lychee directoryselect * from photos where title='IMG_20210914_085702'
delete from photos where title='IMG_20210914_085702'
php artisan lychee:ghostbuster
seemed to solve the problems without more manual intervention. Similar action in case of problem should be available for imports (for example --ghostbust=1 switch or something)
Similar action in case of problem should be available for imports (for example --ghostbust=1 switch or something)
Rather than add a flag, if you're already running the CLI you may as well just run the command.
Horribly inelegant to need to manually run this (I am trying to automate system with tens of thousands of photos, new ones arriving several times a day) and even more inelegant to hardcode it being run twice a day or something. Needs to be possible to automate recovery of such thing.
Other thing I noticed is that there is no way to create new album from command line, as only upload by ID and not album name currently possible. Autocreation of albums based on folder structure is not possible as it takes around a week to run though the photo main storage folder and stuff need to be updated semi real time --> needs to be able to point more exactly which photos to process, where to put them and be able to recover from minor problems.
Unfortunately my time and php-skills are not quite enough to write a patch for these myself :/
@whcrg https://github.com/Chostakovitch/pychee this might be of interest to you.
Horribly inelegant to need to manually run this
If you want to run this without human intervention, you may as well run the ghostbuster script automatically. I see no benefit in Adding a command line argument to make Lychee do it for you. It's a whole extra line in your script.
Other thing I noticed is that there is no way to create new album from command line, as only upload by ID and not album name currently possible.
Album names don't need to be unique -- that's why we only support ID as an argument.
As to creating a new album from command line, you can create an empty directory in the file system and import it -- that should create a new album. Though it wouldn't be easy to script it to then import into that new directory (if that's what you are trying to do) as again you won't know the ID.
In general, it's true that our commandline interface is limited, but that's simply because our focus is on a web interface. I wonder though if it would be possible to write a CLI client that support most (or all) of Lychee API? Maybe with the FUSE client in the works that's not needed...
Detailed description of the problem [REQUIRED]
Importing from command line with symlinks gives too vague error message, and situation is not handled well (in my opinion), when there is a problem, for example left overs from previous import process that has been killed mid process because of reboot or other various reasons.
Steps to reproduce the issue
Steps to reproduce the behavior:
nice -n 19 php artisan lychee:sync /storage/NAS/photo/2021/ -vvvv --import_via_symlink=1 --skip_duplicates=1
)problem: Could not import file, that seems to happen to the one that was being processed when the previous import was terminated.
Command line tool output:
/storage/NAS/photo/2021/: 67% /storage/NAS/photo/2021/IMG_20210912_203350.jpg: Skipped duplicate /storage/NAS/photo/2021/IMG_20210912_203408.jpg: Skipped duplicate /storage/NAS/photo/2021/: 67% /storage/NAS/photo/2021/IMG_20210914_085702.jpg: Could not import file /storage/NAS/photo/2021/: 68% /storage/NAS/photo/2021/: 68% /storage/NAS/photo/2021/: 68%
Log:
2022-03-03 11:06:03 -- notice -- App\Actions\Photo\Strategies\StrategyDuplicate::storeFile -- 31 -- Nothing to store, image is a duplicate 2022-03-03 11:06:04 -- notice -- App\Actions\Photo\Strategies\StrategyDuplicate::hydrate -- 79 -- Skipped upload of existing photo because skipDuplicates is activated 2022-03-03 11:06:04 -- error -- App\Actions\Import\Exec::do -- 256 -- Could not import file (/storage/NAS/photo/2021/IMG_20210914_085702.jpg) 2022-03-03 11:06:18 -- notice -- App\Actions\Photo\Extensions\ImageEditing::createThumb -- 165 -- Photo URL is e2a91dad86a3825c5b3af74186dbf97b.jpg 2022-03-03 11:06:28 -- notice -- App\Image\ImagickHandler::crop -- 161 -- Saving thumb to /storage/www/Lychee/public/uploads/thumb/e2a91dad86a3825c5b3af74186dbf97b.jpeg 2022-03-03 11:07:02 -- notice -- App\Image\ImagickHandler::crop -- 161 -- Saving thumb to /storage/www/Lychee/public/uploads/thumb/e2a91dad86a3825c5b3af74186dbf97b@2x.jpeg
This seems to because a conflicting link (and maybe an entry to database, how to check?) was already in place, but database-entry is not complete(?) so it is not recognised as a duplicate(?). Photo is not shown in the gallery. Link to photo is in place in Lychee/public/uploads/big/
What I expected would happen: Lychee either just deletes the offending link/file and restarts that ones import, or at least gives more verbose error message about what is wrong so it can be corrected manually (how?) If latter, there should be some --force parameter to delete offending/blocking stuff out of the way.
Output of the diagnostics [REQUIRED]
(Settings => Diagnostics or https://example.com/Diagnostics or
php artisan lychee:diagnostics
)Browser and system
Debian stable, current stable version of Lychee (both freshly installed 2 days ago). Browser: current chrome on mac os.