ivandokov / phockup

Media sorting tool to organize photos and videos from your camera in folders by year, month and day.
MIT License
856 stars 108 forks source link

Support arbitrary sidecar files #210

Open qlyoung opened 1 year ago

qlyoung commented 1 year ago

Currently support exists for handling .xmp sidecar files. This change expands that support to any arbitrary sidecar file. It also expands the set of sidecars which are handled by default. The new default set, and the reason this set was chosen, is:

Users can override this default set by passing the new --sidecars option. For example, to handle .xyz, users should pass --sidecars="xmp,json,yml,xyz"; and to disable sidecar handling altogether, pass --sidecars=''

As with my other patch, I'm submitting this without tests so we can reach consensus about the feature.

Example

Before the change, .json sidecars are placed in unknown rather than being moved with their images:

[2023-08-31 01:20:39] - [INFO] - /mnt/in/2018/07/20180713_130947_D3B693D9.jpg => /mnt/out/2018/07/13/20180713-130947252564.jpg
[2023-08-31 01:20:40] - [INFO] - /mnt/in/2018/07/20180713_130947_D3B693D9.json => /mnt/out/unknown/20180713_130947_D3B693D9.json
[2023-08-31 01:20:40] - [INFO] - /mnt/in/2018/07/20180713_162837_1D565480.jpg => /mnt/out/2018/07/13/20180713-162837.jpg
[2023-08-31 01:20:40] - [INFO] - /mnt/in/2018/07/20180713_162837_1D565480.json => /mnt/out/unknown/20180713_162837_1D565480.json
[2023-08-31 01:20:40] - [INFO] - /mnt/in/2018/07/20180713_164015_86C6782E.jpg => /mnt/out/2018/07/13/20180713-164015.jpg
[2023-08-31 01:20:40] - [INFO] - /mnt/in/2018/07/20180713_164015_86C6782E.json => /mnt/out/unknown/20180713_164015_86C6782E.json
[2023-08-31 01:20:40] - [INFO] - /mnt/in/2018/07/20180713_171837_4104A370.jpg => /mnt/out/2018/07/13/20180713-171837205064.jpg
[2023-08-31 01:20:40] - [INFO] - /mnt/in/2018/07/20180713_171837_4104A370.json => /mnt/out/unknown/20180713_171837_4104A370.json
[2023-08-31 01:20:40] - [INFO] - /mnt/in/2018/07/20180713_171912_7AFD55D7.jpg => /mnt/out/2018/07/13/20180713-171912555982.jpg
[2023-08-31 01:20:40] - [INFO] - /mnt/in/2018/07/20180713_171912_7AFD55D7.json => /mnt/out/unknown/20180713_171912_7AFD55D7.json

After, they're handled correctly:

[2023-08-31 01:14:35] - [INFO] - /mnt/in/2018/07/20180713_130947_D3B693D9.jpg => /mnt/out/2018/07/13/20180713-130947252564.jpg
[2023-08-31 01:14:35] - [INFO] - /mnt/in/2018/07/20180713_130947_D3B693D9.json => /mnt/out/2018/07/13/20180713-130947252564.json
[2023-08-31 01:14:35] - [INFO] - /mnt/in/2018/07/20180713_162837_1D565480.jpg => /mnt/out/2018/07/13/20180713-162837.jpg
[2023-08-31 01:14:35] - [INFO] - /mnt/in/2018/07/20180713_162837_1D565480.json => /mnt/out/2018/07/13/20180713-162837.json
[2023-08-31 01:14:35] - [INFO] - /mnt/in/2018/07/20180713_164015_86C6782E.jpg => /mnt/out/2018/07/13/20180713-164015.jpg
[2023-08-31 01:14:35] - [INFO] - /mnt/in/2018/07/20180713_164015_86C6782E.json => /mnt/out/2018/07/13/20180713-164015.json
[2023-08-31 01:14:36] - [INFO] - /mnt/in/2018/07/20180713_171837_4104A370.jpg => /mnt/out/2018/07/13/20180713-171837205064.jpg
[2023-08-31 01:14:36] - [INFO] - /mnt/in/2018/07/20180713_171837_4104A370.json => /mnt/out/2018/07/13/20180713-171837205064.json
[2023-08-31 01:14:36] - [INFO] - /mnt/in/2018/07/20180713_171912_7AFD55D7.jpg => /mnt/out/2018/07/13/20180713-171912555982.jpg