/usr/bin/open-raw.pl is in kphotoalbum 4.4-2build2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | #!/usr/bin/perl
# Copyright 2012 Miika Turkia <miika.turkia@gmail.com>
#
# Try to locate RAW files to open them in external editor from
# GUI application like KPhotoAlbum
my @params;
# Raw extensions you use. If you use Ufraw you might want to add ufraw
# as the first extension in the list
# Using same file format list as KPhotoAlbum from
# http://www.cybercom.net/~dcoffin/dcraw/rawphoto.c
my @rawExt = (
"3fr","arw","bay","bmq","cine","cr2","crw","cs1","dc2","dcr","dng","erf","fff","hdr","ia","jpg","k25","kc2","kdc","mdc","mef","mos","mrw","nef","nrw","orf","pef","pxn","qtk","raf","raw","rdc","rw2","sr2","srf","sti","tif","x3f"
);
# The application you use to develop the RAW files
my @raw_converters = ( "/usr/bin/AfterShotPro", "/usr/bin/bibble5",
"/usr/bin/ufraw", "/usr/bin/rt", "/usr/bin/darktable" );
my $extApp = "";
foreach my $app (@raw_converters) {
if ( -e $app ) {
$extApp = $app;
last;
}
}
# If you want to use specific converter, just assign it below
#$extApp = "/usr/bin/ufraw";
if ($extApp =~ m/^$/) {
my $errMsg = "Could not find RAW developer. If you have one, " .
"script open-raw.pl must be updated.";
exec("notify-send \"$errMsg\"");
}
# A default regular expression for detecting the original RAW file
# We attempt to update this with the one used by KPhotoAlbum later
my $regexp = "(_(v){0,1}([0-9]){1,2}){0,1}\\.(jpg|JPG|tif|TIF|png|PNG)";
# Attempt to read the KPA's regular expression from configuration file
sub read_config {
open CONFIG, "<", $ENV{"HOME"} . "/.kde/share/config/kphotoalbumrc" or return;
while (<CONFIG>) {
/modifiedFileComponent/ && do {
$regexp = $_;
$regexp =~ s/modifiedFileComponent=//;
$regexp =~ s/\\\\/\\/g;
chomp $regexp;
};
}
}
sub uniq {
return keys %{{ map { $_ => 1 } @_ }};
}
read_config();
# Process the parameters and search for "original" files
foreach my $argnum (0..$#ARGV) {
my $found = 0;
my $file = "$ARGV[$argnum]";
$file =~ s/$regexp//;
foreach my $ext (@rawExt) {
if (-e "$file.$ext") {
push @params, "$file.$ext";
$found = 1;
last;
} else {
$ext = uc($ext);
if (-e "$file.$ext") {
push @params, "$file.$ext";
$found = 1;
last;
}
}
}
push @params, "$ARGV[$argnum]" if not $found;
}
my @uniqParams = uniq(@params);
exec "$extApp @uniqParams";
|