inthreedee / photoprism-transfer-album

Transfer a Google Photos album to a new Photoprism album
GNU General Public License v3.0
109 stars 12 forks source link

Photos are not added to Albums #9

Open xmatthewx opened 5 months ago

xmatthewx commented 5 months ago

When I run the script, albums are created, but no images are added to the albums.

For every album, the log shows this (~150 albums). There are no other warnings or errors in the log.

Creating album "2015-07-lake-george"...
Album UID: as7wf9o19khskc6y
Searching jsons...
awk: can't open file /Volumes/RedDrive/PhotoPrism2/originals/GooglePhotos/2015-07-lake-george/**/*.json
 source line number 1
Search complete.

The volume is an attached SSD drive on MacOS 13.2. There's nothing unique about its setup.

After installing md5sha1sum with homebrew, I ran match on hash. I get:

Creating album "2015-07-lake-george"...
Album UID: as7wf9o19khskc6y
Searching for photos...
1: Trying to match *.*...
sha1sum: stat '/Volumes/RedDrive/PhotoPrism2/originals/GooglePhotos/2015-07-lake-george/**/*.*': No such file or directory
WARN: Couldn't find file /Volumes/RedDrive/PhotoPrism2/originals/GooglePhotos/2015-07-lake-george/**/*.* with hash  in database, skipping!
Search complete.

Any suggestions?

inthreedee commented 5 months ago

It sounds like it isn’t finding the expected Google takeout files. You can specify where the takeout directory is using the command line arguments described in the readme.

Note this line from the readme:

the script can be run either in a single album directory, or in the base Google Photos directory

Be sure you’re running the script from the right Takeout directory, or that you’re feeding it the correct Takeout directory using the —takeout-dir switch. If it can’t find the Takeout’s json and photo files, it can’t do its work. Double check that the expected files exist.

To clarify the difference between hash matching and name matching:

inthreedee commented 5 months ago

I also noticed you’re on a Mac. If everything else I mentioned above is being run correctly, you may need to try installing an updated version of Bash for that globstar to work properly. I’m not certain which version MacOS ships with these days, but it used to be quite out of date.

xmatthewx commented 5 months ago

I'm running the script from within the takeout directory. Since it's able to make the albums, I assume it's finding the files and connecting to photoprism ok. I'm using the standar locations for originals and storage within the primary photoprism directory.

I'll try an updated Bash.

inthreedee commented 5 months ago

Okay, I've had a chance to sit down, read your logs more carefully, and compare them against what the script is doing and expecting. What jumps out at me is this line:

1: Trying to match *.*...

I should have noticed that before, but it's been a while since I've looked at the code of the script. That's happening in line 229, and it should say a file name there instead of *.*.

If using an updated bash didn't work, try editing that line and changing *.* to just *. It's also possible that the globstar may not work on Macs. In that case, you can edit that line to remove the **. It can probably be changed to:

for albumFile in "$albumDir"/*; do

as long as you specify one album at a time using the --album-name switch. That should be much more portable.

Whatever your findings, I'd appreciate you reporting back so I can add some notes about compatibility with Macs in the readme.