ExifTool on DSM7

Started by stefanjoa, August 26, 2021, 04:16:41 AM

Previous topic - Next topic

stefanjoa

Hi All,

I just upgraded my Synology to DSM 7 and identified that ExifTool is no longer working. Is there a plan to upgrade it to work again?
The ExifTool is the most important tool on my Synology because it sorts all my pictures the way I want it.

Would love to use it again :)

Thank you!

StarGeek

Exiftool is written in Perl, which is system neutral for the most part.  So the problem is most likely on the Synology side.

You don't mention how exiftool stopped working, so there's not much help we can provide.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

marfig

Hello,
I'm facing the same issue. It stopped working, because Synology DSM requires a reinstall of the package
https://www.cphub.net/?p=exiftool
but the package has no longer valid format for DSM.

I've already sent a message to Nexius2, who originally created the package.

Would be great, if we can find anyone who has an experience with DSM packages and could take a look on this.

(I've investigated if there is any option how to manually install exiftool as perl script on DSM, but without any success)

Thank you
Regards
Martin

marfig

So :)
I always love workarounds. In my case, exiftool is called from web photo gallery - piwigo, from PHO script via shell_exec.
I've downloaded exiftool package, extracted it somewhere in syno and updated the path in PHP script into something like
shell_exec('perl /volume1/web/Image-ExifTool-12.30/exiftool -json "'.$filepath.'"');

and voila .. it works

Regards
Martin

Nexius2

Hello,
the probleme is from the way new packages for DSM 7 need to be written.
as I no longer have a synology, I can't keep up with the update.
you'll have to find a workaround by yourself.
if someone want's to continue updating the package, I'd be glad to give him what he needs

stefanjoa

Thanks for your messages. I just put the latest version of ExifTool on my synology and calling it directly in my script.
There is no need to have a package.

acampbell3000

Quote from: Nexius2 on August 26, 2021, 04:09:26 PM
Hello,
the probleme is from the way new packages for DSM 7 need to be written.
as I no longer have a synology, I can't keep up with the update.
you'll have to find a workaround by yourself.
if someone want's to continue updating the package, I'd be glad to give him what he needs

Is the package on GitHub? Perhaps we could share the package with the wider Synology community and find out if someone wants to take up ownership?

A.

scrapix

I'll try to set up a github repo for the ExifTool Syno Package in the next time. Meanwhile you can set up ExifTool as follows:

How To get exiftool running on Synology DSM 7


  •    ssh into your synology
  •    wget https://exiftool.org/Image-ExifTool-12.33.tar.gz
  •    rm Image-ExifTool-12.33 ExifTool.tar.gz
  •    mv Image-ExifTool-12.33 ExifTool
  •    sudo mv /volume1/homes/YourUserName/ExifTool /usr/share/applications/
  •    sudo vi /etc/profile
  •    add ":/usr/share/applications/ExifTool"
  •    save and exit
  •    exit
  •    ssh again into your synology and you should be able to use exiftool via command line

Explanation

  •     you log in via command line to your synology (ssh)
  •     download and unpack  exiftool from exiftool.org to your home directory
  •     remove zipped file Image-ExifTool-12.33 ExifTool.tar.gz
  •     rename directory "Image-ExifTool-12.33" to "ExifTool"
  •     move directory "ExifTool" to /usr/share/applications/
  •     open profile file in text editor "vi" to add a path to applications so that you can use the command "exiftool" in command line
  •     exit your ssh connection
  •     log in again to be able to finally use exiftool
  •     enjoy (hope I haven't forgot anything)

acampbell3000

Quote from: scrapix on October 25, 2021, 12:56:23 AM
I'll try to set up a github repo for the ExifTool Syno Package in the next time. Meanwhile you can set up ExifTool as follows:

How To get exiftool running on Synology DSM 7


  •    ssh into your synology
  •    wget https://exiftool.org/Image-ExifTool-12.33.tar.gz
  •    rm Image-ExifTool-12.33 ExifTool.tar.gz
  •    mv Image-ExifTool-12.33 ExifTool
  •    sudo mv /volume1/homes/YourUserName/ExifTool /usr/share/applications/
  •    sudo vi /etc/profile
  •    add ":/usr/share/applications/ExifTool"
  •    save and exit
  •    exit
  •    ssh again into your synology and you should be able to use exiftool via command line

Explanation

  •     you log in via command line to your synology (ssh)
  •     download and unpack  exiftool from exiftool.org to your home directory
  •     remove zipped file Image-ExifTool-12.33 ExifTool.tar.gz
  •     rename directory "Image-ExifTool-12.33" to "ExifTool"
  •     move directory "ExifTool" to /usr/share/applications/
  •     open profile file in text editor "vi" to add a path to applications so that you can use the command "exiftool" in command line
  •     exit your ssh connection
  •     log in again to be able to finally use exiftool
  •     enjoy (hope I haven't forgot anything)

Thanks scrapix, much appreciated. Makes sense, essentially adding the latest exiftool binary to the path.

Curious, how complicated are synology DSM packages? I assume, they required a specific folder structure along with a load of metadata?

FixEUser

QuoteCurious, how complicated are synology DSM packages? I assume, they required a specific folder structure along with a load of metadata?

@acampbell3000 - Maybe this guides can give you an impression:
https://global.download.synology.com/download/Document/Software/DeveloperGuide/Firmware/DSM/7.0/enu/DSM_Developer_Guide_7_0_Beta.pdf
or online
https://help.synology.com/developer-guide/

StarGeek

Quote from: scrapix on October 25, 2021, 12:56:23 AM

  • 2.   wget https://exiftool.org/Image-ExifTool-12.33.tar.gz
  • 3.   rm Image-ExifTool-12.33 ExifTool.tar.gz

Shouldn't there be a step such as tar -xf Image-ExifTool-12.33.tar.gz in between?  Otherwise it looks like you're just downloading the file and deleting it.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

scrapix

Quote from: StarGeek on October 25, 2021, 11:27:33 AM
Shouldn't there be a step such as tar -xf Image-ExifTool-12.33.tar.gz in between?  Otherwise it looks like you're just downloading the file and deleting it.

Thank you for the hint! That was indeed missing and an important step!
Corrected Version:

How To get exiftool running on Synology DSM 7
In a terminal/shell/cmd on your computer/mac do following:


  •    ssh yourSynologyAdminUser@yourSynologyIpAddress -p yourPortNumber
  •    wget https://exiftool.org/Image-ExifTool-12.33.tar.gz
  •    tar -xf Image-ExifTool-12.33.tar.gz
  •    rm Image-ExifTool-12.33 ExifTool.tar.gz
  •    mv Image-ExifTool-12.33 ExifTool
  •    sudo mv /volume1/homes/YourUserName/ExifTool /usr/share/applications/
  •    sudo vi /etc/profile
  •    add ":/usr/share/applications/ExifTool"
  •    save and exit
  •    exit
  •    ssh again into your synology and you should be able to use exiftool via command line

Explanation

  •     you log in via command line to your synology (ssh)
  •     download and unpack exiftool from exiftool.org to your home directory
  •     extract zipped file Image-ExifTool-12.33 ExifTool.tar.gz
  •     remove zipped file Image-ExifTool-12.33 ExifTool.tar.gz
  •     rename directory "Image-ExifTool-12.33" to "ExifTool"
  •     move directory "ExifTool" to /usr/share/applications/
  •     open profile file in text editor "vi" to add a path to applications so that you can use the command "exiftool" in command line
  •     exit your ssh connection
  •     log in again to be able to finally use exiftool
  •     enjoy (hope I haven't forgot anything)

jeff_k

This is outstanding — thank you for writing these up!
As a followup, if later on I am updating the exiftool version, it *looks* like I'd need to have a step 5.5 where I would remove the existing /usr/share/applications/ExifTool directory before moving the newly downloaded version there, correct?

StarGeek

Quote from: jeff_k on January 08, 2022, 01:56:13 PMAs a followup, if later on I am updating the exiftool version, it *looks* like I'd need to have a step 5.5 where I would remove the existing /usr/share/applications/ExifTool directory before moving the newly downloaded version there, correct?

It's perfectly find to just overwrite the program files.  But doing a quick check on the linux mv command, it looks like it can't overwrite according to this StackExchange answer.  If that's so, then yes, either delete the target or use cp instead and delete the source directory afterwards.

Bah, conflicting answer in this StackExchange answer which says you can add -f to force an overwrite.  If so, then just add that to step 5.

Hopefully someone who can check and see will give a definitive answer.

Reading further, the comments in that first link seem to indicate the mv -f won't overwrite subdirectories.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

On my system (MacOS), mv will overwrite the target file if you have permission, but if the target is a directory then it will be moved into the directory.  But depending on your shell configuration, mv -i may be the default, in which case it will prompt to overwrite a file unless you use -f.

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

planetS

Hello,
Perhaps someone could point me into the correct direction ...
I had a python photo sorting script set up on DMS 6 using the cphup ExifTool package.
All was fine until I upgraded to DSM 7 and now I'm fighting since couple of days to get ExifTool to work again in python.
Please note: I've done a complete reinstall of the Synology NAS when upgrading - no old configs left.

I've followed all steps from the latest message of "scrapix". When connected via ssh I'm able to successfully run "exiftool [path of photo]" and I get the desired result by ExifTool properly displayed.

Here is a small python test script to show my current issue:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import subprocess
import os, getpass
print (getpass.getuser())
subprocess.Popen(['exiftool', '/volume1/homes/USERNAME/Drive/Development/Exif-Sorting/temp1.JPG'])


All is fine, if the script is called when logged in via ssh on terminal. It shows first the username and then all exif tags of the photo.

However, when the script is triggered via the Task Scheduler:
python3 /volume1/homes/USERNAME/Drive/Development/Exif-Sorting/test.py

This results in:
Standard output/error:
[same username is shown as when the script is run via terminal]
Traceback (most recent call last):
  File "/volume1/homes/USERNAME/Drive/Development/Exif-Sorting/test.py", line 4, in <module>
    subprocess.Popen(['exiftool', '/volume1/homes/USERNAME/Drive/Development/Exif-Sorting/temp1.JPG'])
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1706, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'exiftool'


Perhaps I'm missing some config, that would allow the system to find exiftool? (/etc/profile was updated as in the instructions)
Thanks for any help.

planetS

Well, sorry for the confusion caused - it seems that I just found the answer to my issue.
I need to now refer to the absolute path of exiftool in python.
'/usr/share/applications/ExifTool/exiftool' instead of only 'exiftool'

Now working as well when the python script is triggered from Task Scheduler:
#!/usr/bin/python
# -*- coding: utf-8 -*-
import subprocess
import os, getpass
print (getpass.getuser())
subprocess.Popen(['/usr/share/applications/ExifTool/exiftool', '/volume1/homes/USERNAME/Drive/Development/Exif-Sorting/temp1.JPG'])