Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Check for errors when importing files #18

Closed
jip149 opened this issue Oct 22, 2022 · 8 comments
Closed

Bug: Check for errors when importing files #18

jip149 opened this issue Oct 22, 2022 · 8 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@jip149
Copy link

jip149 commented Oct 22, 2022

Exit status of exiftool in _import_media function is not checked. This is dangerous especially since cleanup can now be used with import.

@fxstein
Copy link
Owner

fxstein commented Oct 22, 2022

Now I remember why I originally did not allow clean with import only. Had some issues with the exit status of exiftool. Need to investigate and do some testing.
Hence the exit status of exiftool is currently unchecked in all parts of goprox. Definitely needs to be addressed.

@fxstein
Copy link
Owner

fxstein commented Oct 22, 2022

So here is the issue:

I need the ability to re-import and re-process files, sometimes all, sometimes sparse - e.g. just the missing files. When an output file already exists, exiftool throws an error and moves to the next files. These are acceptable errors as the default behavior of goprox is based on skipping existing files. However it means the error status of exiftool is no longer 0.

Other errors obviously need to get caught. Need to see if I can tell exiftool that existing target files errors are to be ignored while others are not.

@fxstein fxstein self-assigned this Oct 22, 2022
@fxstein fxstein added the further investigation Needs further investigation label Oct 22, 2022
@jip149
Copy link
Author

jip149 commented Oct 22, 2022

I think it would still be dangerous to clean files if some existing files were skipped.

Imagine an import is stopped in the middle for whatever reason (power outage, disconnected drive…), one of the file may be existing but incomplete. If the user does not pay attention and blindly runs the command again, a file will be lost.

It would not seem a problem to me if cleanup were allowed only when exiftool return no error. If exiftool fails because of existing files, it would be the responsibility of the user to solve the problem (use archive and cleanup, manually cleanup, or remove existing files and run the command again).

What do you think?

@fxstein
Copy link
Owner

fxstein commented Oct 22, 2022

That is indeed a potentially simple solution. Also still looking at some exiftool options. Will get back asap.

@fxstein
Copy link
Owner

fxstein commented Oct 22, 2022

FYI This is why I personally always make archives that I store separately, even at the cost of a lot of extra storage, because it is the one guarantee I have to be able to re-run from scratch. Especially since developing goprox is still missing key features that I would like to apply to parts of my historic library.

But this issue needs to be addressed no matter what.

fxstein added a commit that referenced this issue Oct 22, 2022
New exiftool error handling and error code capture. Most exiftools errors are summarized as warnings to the user. In the case of an exiftool error prior to a clean task, the process gets aborted with an exiftool error message
@fxstein
Copy link
Owner

fxstein commented Oct 22, 2022

@Giga Pushed the initial error handling logic as discussed. Can you test before I cut this into a new release? Thanks!

Example output when encountering one or more exiftool errors:

[2022-10-22 12:52:31] Info: Starting media import... 
[2022-10-22 12:52:31] Info: Source: /Users/xxxxx/Desktop/20221021120343_GoPro_Hero10_2826 
[2022-10-22 12:52:31] Info: Library: /Users/xxxxx/goprox-test/imported 
[2022-10-22 12:52:31] ======== /Users/xxxxx/Desktop/20221021120343_GoPro_Hero10_2826/DCIM/100GOPRO/G0030790.JPG [1/2]
[2022-10-22 12:52:31] Error: '/Users/xxxxx/goprox-test/imported/2022/20221001/20221001122745_GoPro_Hero10_2826_G0030790.JPG' already exists - /Users/xxxxx/Desktop/20221021120343_GoPro_Hero10_2826/DCIM/100GOPRO/G0030790.JPG
[2022-10-22 12:52:31] ======== /Users/xxxxx/Desktop/20221021120343_GoPro_Hero10_2826/DCIM/100GOPRO/G0030789.JPG [2/2]
[2022-10-22 12:52:31] Error: '/Users/xxxxx/goprox-test/imported/2022/20221001/20221001122735_GoPro_Hero10_2826_G0030789.JPG' already exists - /Users/xxxxx/Desktop/20221021120343_GoPro_Hero10_2826/DCIM/100GOPRO/G0030789.JPG
[2022-10-22 12:52:31] Warning: exiftool reported one or more errors. Please check output. 
[2022-10-22 12:52:31] Info: Finished media import 
[2022-10-22 12:52:31] Info: Cleaning Source Media... 
[2022-10-22 12:52:31] Info: Source: /Users/xxxxx/Desktop/20221021120343_GoPro_Hero10_2826 
[2022-10-22 12:52:31] Error: Will not clean /Users/xxxxx/Desktop/20221021120343_GoPro_Hero10_2826 due to exiftool error status: 1 
[2022-10-22 12:52:31] Error: Please check output. 

@fxstein fxstein closed this as completed Oct 23, 2022
@fxstein fxstein added bug Something isn't working enhancement New feature or request and removed further investigation Needs further investigation labels Oct 23, 2022
@jip149
Copy link
Author

jip149 commented Oct 28, 2022

Hello,

Many thanks for the reactivity. I have this error with latest version: _clean_media:[:8: ']' expected

@fxstein
Copy link
Owner

fxstein commented Oct 28, 2022

Could you please open a new issue and share more details?

Would be great if you could run your command with --debug and copy the output there.

Thanks!

Repository owner locked and limited conversation to collaborators Oct 29, 2022
@fxstein fxstein changed the title Check for errors when importing files Bug: Check for errors when importing files Oct 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants