Search the Community
Showing results for tags 'bash query'.
-
It's very bizar I have this script in Alfred: ####################################### #Exiftool utility for Alfred workflow # ####################################### set -x IFS=$'\t' read -ra files <<< "${file_list}" command=${command} #Located at the arg block after the List Filter in the workflow sourceFiles="/Users/$USER/temp/" case $command in basRen) #Basic rename ${exiftool} -d "%Y-%m-%d %H,%M,%S%%-c" '-filename<${DateTimeOriginal} $Make-$Model.%e' "${files[@]}" ;; k_basRenExtFile) #Basic rename with an extra added name from a query ${exiftool} -userparam extName="$keyword" -d "%Y-%m-%d %H,%M,%S%%-c" '-filename<${DateTimeOriginal} $Make-$Model $extName.%e' "${files[@]}" ;; k_basRenCurFile) #Rename the current file(s) with a extra query e.g. test.jpg > test foo.jpg ${exiftool} -userparam extName="$keyword" -d "%%f" '-filename<${DateTimeOriginal} $extName.%e' "${files[@]}" ;; datMap) #Move selected files to a subfolder YYYY-mm created from DateTimeOriginal exif tag, if the folder doesn't exsist create it creates that folder ${exiftool} -d "%%d/%Y-%m/%%f.%%e" '-filename<DateTimeOriginal' "${files[@]}" ;; geoTag) #Select a single file and Show it in Apple maps or Google maps. In the main vars section choose by map_provider 'Apple' or 'Google' [[ "${map_provider}" == 'Google' ]] && map_url='https://www.google.com/maps?t=k&q=' || map_url='http://maps.apple.com/?q=' coordinates="$(${exiftool} -printFormat '$gpslatitude, $gpslongitude' --printConv "${files}")" open "${map_url}${coordinates}" ;; tracklog) #Find the tracklog in finder > double tab cmd and choose 'copy path to clipboard' and run this script ${exiftool} -overwrite_original -userparam tracklog="$clip" -geotag=$tracklog "${files[@]}" ;; photos2kml) #Select photos and check if it has GPS data in the Exif, if so that create a KML file and open it in Google Earth ${exiftool} -p "${sourceFiles}gpx.fmt" -r "${files[@]}" > "${sourceFiles}photos.kml" open "${sourceFiles}" open "${sourceFiles}photos.kml" ;; dateFields) #Show alle date fields in CSV format from selected files ${exiftool} -csv -time:all -s "${files[@]}" > "${sourceFiles}exiftool_output.csv" open "${sourceFiles}exiftool_output.csv" ;; megapixels) #Show magapixels in CSV format from selected files ${exiftool} -csv -megapixels "${files[@]}" > "${sourceFiles}exiftool_output.csv" open "${sourceFiles}exiftool_output.csv" ;; basDetails) #Show basic information in CSV format from selected files, you can edit the fiels in the format file ${exiftool} -c %.7f -api filter='$_ = qq{"$_"} if s/"/""/g or /(^\s+|\s+$)/ or /[,\n\r]/' -f -p "${sourceFiles}csv.fmt" "${files[@]}" > "${sourceFiles}exiftool_output.csv" open "${sourceFiles}exiftool_output.csv" ;; *) exit ;; esac set +x All the case parts works perfect, except case tracklog the part that says: -geotag=$tracklog when I run this script I see this result in the debug screen: case $command in + /usr/local/bin/exiftool -overwrite_original -userparam 'tracklog=/Users/ralphschipper/Downloads/2020-05-09 17_15_25.gpx' -geotag= '/Volumes/Ext 1TB/Google Drive/temp/test1/MapA/P1110188.JPG' if you look at the pard -geotag= you see its blank the next part is the photo that is selected tru a File Action As I said all the rest of the cases works great except tis part. Can anyone see what I'm doing wrong here?
-
Hi there. Does anyone have an example Bash script that works with items selected with the option-up? Having trouble separating the items. Thanks