garzj / google-photos-migrate

A tool to fix EXIF data and recover filenames from a Google Photos takeout, preserving albums within the directory structure.
https://npmjs.com/package/google-photos-migrate
MIT License
104 stars 11 forks source link

Some issues #1

Closed Froghut closed 1 year ago

Froghut commented 1 year ago

I tried to run this tool on my Google Photos Takeout, for reference it's 58GB and ~33k files. I encountered three issues:

  1. I have some files that have "nopm" in their filename, and the tool tries to rename them to ":nopm:". This fails since ":" is not a valid character for a filename. I tried fixing this by basically replacing ":" with "_" in the destination filename.
  2. Not sure why, but the tool tries to copy files that do not exist (they do not have "nopm" in their filename so it's not related to this issue) I tried adding a file exists check but I have very little Typescript/NodeJS knowledge so I did not manage to get around that issue.
  3. I have some video files with .3gp and .m4v extensions that would be moved to the error folder, that was easily fixed by adding those extensions to the extension config

If I can provide additional info that might be useful let me know, and thanks in advance!

garzj commented 1 year ago
  1. In contrary to Windows, Android/Linux allows ":" in its filenames and this is probably the origin of your filenames. I added some sanitizing now, replacing special characters with "_".
  2. I'm not quite sure why this would happen either. If you want, you could tell me the missing path that's tried to be accessed and maybe compare it with the original filename.
  3. I added your extensions to the config permanently.
zx900930 commented 1 year ago

same issue 2 here:

node:internal/process/promises:279
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: ENOENT: no such file or directory, rename '/mnt/private/documents/takeout-20230624T041317Z-001/Takeout/output/rei.jpg' -> '/mnt/private/documents/takeout-20230624T041317Z-001/Takeout/error/rei.jpg'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'rename',
  path: '/mnt/private/documents/takeout-20230624T041317Z-001/Takeout/output/rei.jpg',
  dest: '/mnt/private/documents/takeout-20230624T041317Z-001/Takeout/error/rei.jpg'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Might be a Upper case/Lower case issue in smb share.
Because I also have a file named REI.jpg

Warning: Error: Warning:  setting FileModifyDate - /mnt/private/documents/takeout-20230624T041317Z-001/Takeout/output/REI.jpg
Original path: /mnt/private/documents/takeout-20230624T041317Z-001/Takeout/Google Photos/EVA/REI.jpg
Saved path: /mnt/private/documents/takeout-20230624T041317Z-001/Takeout/error/REI.jpg

Windows treat them the same file but linux dosent.

So avoid running this tool under a mounted samba share, copy the takeout folder to your home dir first!

garzj commented 1 year ago

@zx900930 You are right, how couldn't I think of that!

I changed my code to rely on the native node API again (with a lock for atomacy), this should fix it now.

Froghut commented 1 year ago

I tried the new version and this fixed all of my reported issues, so I must have messed up something to cause the problem of copying files that do not exist. Thanks! One small thing that now happens is I get the following error for bigger video files (.mp4 in my case): Warning: Error: timeout: waited 20000ms I "fixed" that by changing line 40 in migrate-google-dir.ts from exiftool: new ExifTool(), to exiftool: new ExifTool({ taskTimeoutMillis: 60000 }), I guess for bigger files 20 seconds just was not enough. Thanks again for the tool and your support!