Author Topic: Create hardlink even for unsupported file format  (Read 352 times)

tylla

  • Newbie
  • *
  • Posts: 8
Create hardlink even for unsupported file format
« on: January 04, 2019, 06:49:08 PM »
Hi Phil/Everyone,

currently I'm using (and loving ;-))) exiftool to create hardlinks to my source files while writing some extra tags into them.

Nevertheless I'm having a hard time figuring out the way to be able to create the hard links to those files as well that are unsupported for tag writing.
Eg. between the heap of .JPEGs there are some .AVI files as well which are skipped by exiftool with an error message (writing is not yet supported). This is fine but the hard link creation is also skipped.

Is there a way to overcome this or I will be forced to make two separate runs (one for tagging and one for hardlinking)?

Thank you for this marvelous piece of software,
Tylla

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14733
    • ExifTool Home Page
Re: Create hardlink even for unsupported file format
« Reply #1 on: January 04, 2019, 10:45:37 PM »
Hi Tylla,

I'm happy to see someone using the HardLink feature.

See FAQ 16 for an answer to your question.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

tylla

  • Newbie
  • *
  • Posts: 8
Re: Create hardlink even for unsupported file format
« Reply #2 on: January 05, 2019, 07:09:54 AM »
Hi Phil,

yeah, I really love it, makes things so much easier!

I've already seen and tried FAQ 16 - sorry I didn't mentioned it, it must have slipped through the lots of trials I've done.
So I've tried it - first using with ver. 9.74, afterwards with ver. 10.40 and 11.16. The -ext+ variant didn't worked with the older version so I installed the latest from Debian repo, but still no luck.

My current command line is like:
/usr/bin/exiftool -config /home/tylla/.ExifTool_config -overwrite_original -preserve -ignore .rsync_partial -d %Y%m%d_%H%M%S -ext '*' '-Author=tylla' '-OriginalFileName<FileName' '-HardLink</home/tylla/tmp/photos_test/incoming/${FallbackDateTime}_tylla%+c.%le' -V0 -@  /home/tylla/tmp/photos_test/incoming//.exiftool_copied_files.txt
The error is the usual: "Writing AVI files is not yet supported" and no hard link is created.

Is it possible that only the more current version supports the -ext "*" properly?
Am I missing something?

Thanks,
Tylla

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14733
    • ExifTool Home Page
Re: Create hardlink even for unsupported file format
« Reply #3 on: January 05, 2019, 09:08:45 AM »
This will happen with your command if FallbackDateTime is not defined. 

But if it is defined, try building up the command a bit at a time.  I don't know what is in your argfile, but I can't imagine anything that would cause this other than a missing FallbackDateTime.

What happens if you remove all other arguments except the -config option and and the hardlink argument?  If this doesn't work, try changing "hardlink" to "testname" to see what hard link it is trying to create.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

tylla

  • Newbie
  • *
  • Posts: 8
Re: Create hardlink even for unsupported file format
« Reply #4 on: January 05, 2019, 11:54:57 AM »
I've made some experiments and it seems that if I remove the '-Author=tylla' '-OriginalFileName<FileName' it succeeds, but any of these causes failure.

So I tried to reduce the whole problem to the bare minimum (the -config was needed only for defining FallbackDateTime):
$ exiftool -ext '*' '-HardLink<${FileName}%+c.%le' MVI_2234.AVI
    0 image files updated
    1 image files unchanged
    1 hard links created
$ exiftool -ext '*' '-Author=Tylla' '-HardLink<${FileName}%+c.%le' MVI_2234.AVI
Error: Writing of AVI files is not yet supported - MVI_2234.AVI
    0 image files updated
    1 files weren't updated due to errors
$ exiftool -ext '*' '-Author=Tylla' MVI_2234.AVI
Error: Writing of AVI files is not yet supported - MVI_2234.AVI
    0 image files updated
    1 files weren't updated due to errors

I tried -ext+ 'avi', -ext+ '.avi', -ext 'avi', -ext'.avi', and removing it, doesn't really matter.

Does it matter that I'm only using version 11.16? Normally I don't install versions not available in the normal Debian repositories, but if this is the only solution I could try it.

Regards,
Tylla

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14733
    • ExifTool Home Page
Re: Create hardlink even for unsupported file format
« Reply #5 on: January 05, 2019, 04:38:55 PM »
Hi Tylla,

You're right.  I should have tried writing some other tags at the same time.  The hard link isn't creating if writing any "real" tag fails.  This is because in this case the hard link is created for the updated file, and since the file wasn't updated the hard link wasn't created.  It would require extra logic to make a hard link to the original file if there was an error updating the file, and I'm not sure that this is what I want to do (since there was an error, I would prefer that nothing was changed).

So you would need to make the hard link with a command that doesn't write any real tags for unsupported files.

If you disagree, I'm open to discussing this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

tylla

  • Newbie
  • *
  • Posts: 8
Re: Create hardlink even for unsupported file format
« Reply #6 on: January 05, 2019, 06:07:05 PM »
Hi Phil,

now that you explained it, it makes sense... :)
I even tried the -FileName and -Directory and it works consequently , so maybe I should accept it like this.

OTOH I don't know how it is implemented internally, so I don't know how much work would it need to implement a switch like 'ignore_unsupported_format_errors' or something like this that would let all those other commands execute which can be done.
Now as I think about it maybe this should be shoveled under the umbrella of minor errors as from an opportunistic point-of-view, the program should do as much as it can and only stop with error when there is really nowhere to go further.

Or maybe I'm just too tired to think normally :-)
(I'm from Hungary and now it's already past midnight here)

I think I'll take another go at this tomorrow...

Bye,
Tylla

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14733
    • ExifTool Home Page
Re: Create hardlink even for unsupported file format
« Reply #7 on: January 05, 2019, 08:26:50 PM »
Hi Tylla,

I can't just make it a minor error because I don't know if the renaming/hardlink will be successful after writing the file fails.  And there is also the case where there are no more operations, in which case the error should not be ignorable.  And checking to see if there are more valid operations would be very tricky.

So I think the current behaviour makes the most sense.  But I'll think about it a bit more and I should at least document this behaviour.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

tylla

  • Newbie
  • *
  • Posts: 8
Re: Create hardlink even for unsupported file format
« Reply #8 on: January 06, 2019, 05:43:37 PM »
Hi Phil,

I see your point and I agree with you that this is quite complicated (that's why I wrote previously that I don't know the internal structure of ExifTool).
Nevertheless I think somehow there should be a distinction between an "unsupported file format" (eg. this file format is generally not supported for tag writing) error and other errors (eg. this single tag is not supported in this file, or file write error because of permissions).
Or if approached from a different angle, there should be some special handling for System//pseudo tags and errors which don't really go hand-in-hand with other "real" tags.

But I accept that there is no easy, clear solution to this (not even if it's a bad solution :)))
So, for now I think I will go with two runs of ExifTool (one for tagging and one for hardlinking).

If you find some good (or any) solution to this problem, I'll be more than happy to discuss/test it.

Thank you for your time and support (which I found more than amazing)
Regards,
Tylla