summarylogtreecommitdiffstats
path: root/dir2slideshow_exiftool.patch
blob: b32fb53a1d169ba57d712fc1983e52348e30e079 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
--- dvd-slideshow-0.8.6-1/dir2slideshow.orig	2014-01-29 11:23:41.000000000 -0500
+++ dvd-slideshow-0.8.6-1/dir2slideshow	2020-10-05 10:44:28.520607731 -0400
@@ -419,13 +419,18 @@
 }
 
 ## check for the necessary programs:
-checkforprog ()
+checkfor_exiftool_jhead ()
 {
-        it=`which "$1"`
+        it=`which exiftool`
         if [ -z "$it" ] ; then
-                echo "[dir2slideshow] ERROR: $1 not found! "
-                echo "[dir2slideshow] Check the dependencies and make sure everything is installed."
-                exit 1
+                it=`which jhead`
+                if [ -z "$it" ] ; then
+                        echo ""
+                else
+                        echo "jhead"
+                fi
+        else
+                echo "exiftool"
         fi
 }
 
@@ -681,12 +686,21 @@
 myecho "[dir2slideshow] Sorting pictures..."
 if [ "$sortmethod" == 'taken_date' ] ; then
 	## sort by taken date:
-	checkforprog jhead
+	timestamp_tool=`checkfor_exiftool_jhead`
 	check_rm "$output_dir"/filelist_date.txt
 	for (( i=1 ; i<=picture_count ; i++ )) ; do
 		file=`sed -n "$i"p "$output_dir"/imagelist.txt`
-		taken=`jhead "$file" | grep 'Date/Time' | awk -F': ' '{print $2}'`
-		modified=`jhead "$file" | grep 'File date' | awk -F': ' '{print $2}'`
+                if [ "$timestamp_tool" == 'exiftool' ]; then
+			taken=`exiftool "$file" | grep 'Date/Time Original' | awk -F': ' '{print $2}'`
+			modified=`exiftool "$file" | grep 'File Modification Date/Time' | awk -F': ' '{print $2}' | awk -F'-' '{print $1}'`
+                elif [ "$timestamp_tool" == 'jhead' ]; then
+			taken=`jhead "$file" | grep 'Date/Time' | awk -F': ' '{print $2}'`
+			modified=`jhead "$file" | grep 'File date' | awk -F': ' '{print $2}'`
+                else
+                        echo "[dir2slideshow] ERROR: exiftool/jhead not found! "
+                        echo "[dir2slideshow] Check the dependencies and make sure everything is installed."
+                        exit 1
+                fi
 		if [ -n "$taken" ] ; then
 			echo "$file: $taken" >> "$output_dir"/filelist_date.txt
 		else