commit e7a8cb6681b3ef97334c47fabdc61ef7f6761e7b
parent f8e0e5d16dc964f12ec9511736838ce609be1370
Author: René Wagner <rwa@clttr.info>
Date: Mon, 1 May 2023 09:24:55 +0200
add Makefile, fix PKGBUILD
Diffstat:
A | Makefile | | | 25 | +++++++++++++++++++++++++ |
M | PKGBUILD | | | 21 | +++++++++------------ |
M | README.md | | | 40 | ++++++++++++---------------------------- |
M | afm | | | 8 | ++++---- |
M | jd | | | 8 | ++++---- |
D | spmvsc | | | 118 | ------------------------------------------------------------------------------- |
D | sposc | | | 104 | ------------------------------------------------------------------------------- |
7 files changed, 54 insertions(+), 270 deletions(-)
diff --git a/Makefile b/Makefile
@@ -0,0 +1,25 @@
+VERSION=1.1
+PREFIX?=/usr/local
+BINDIR?=$(PREFIX)/bin
+MANDIR?=$(PREFIX)/share/man
+DOCDIR?=$(PREFIX)/share/doc
+COMPLDIR?=$(PREFIX)/share/bash-completion
+.DEFAULT_GOAL=all
+
+afm:
+
+jd:
+
+all: afm jd
+
+install: all
+ mkdir -p $(DESTDIR)/$(BINDIR)
+ install -m755 afm $(DESTDIR)/$(BINDIR)/afm
+ install -m755 jd $(DESTDIR)/$(BINDIR)/jd
+
+uninstall:
+ rm -f $(DESTDIR)/$(BINDIR)/afm
+ rm -f $(DESTDIR)/$(BINDIR)/jd
+
+check: all
+ @find test -perm -111 -exec '{}' \;
diff --git a/PKGBUILD b/PKGBUILD
@@ -1,25 +1,22 @@
-# Maintainer: René Wagner < rwagner at rw-net dot de >
+# Maintainer: René Wagner < rwa at clttr dot info >
-pkgname=photo-helpers
+pkgname=art-helpers
pkgver=20221106
pkgrel=1
-pkgdesc='simple photo workflow helper scripts'
+pkgdesc='simple helper scripts for managing images processed by ART'
arch=('x86_64' 'aarch64' 'i686')
license=('BSD')
-url='https://src.clttr.info/rwa/photo-helpers'
-provides=('photo-helpers')
+depends=('perl-file-find-rule')
+url='https://git.sr.ht/~rwa/art-helpers'
+provides=('art-helpers')
options=(!strip)
-source=('afm' 'jd' 'sposc' 'spmvsc')
-sha256sums=('SKIP' 'SKIP' 'SKIP' 'SKIP')
+source=('afm' 'jd' 'Makefile')
+sha256sums=('SKIP' 'SKIP' 'SKIP')
pkgver() {
printf "%s" "$(git describe --abbrev=0)"
}
package() {
- mkdir -p "${pkgdir}/usr/bin"
- install -Dm755 afm "${pkgdir}/usr/bin/"
- install -Dm755 jd "${pkgdir}/usr/bin/"
- install -Dm755 sposc "${pkgdir}/usr/bin/"
- install -Dm755 spmvsc "${pkgdir}/usr/bin/"
+ make install DESTDIR="${pkgdir}" PREFIX="/usr"
}
diff --git a/README.md b/README.md
@@ -2,11 +2,11 @@
This rather small scripts written in [Perl](https://perl.org) provide useful function for managing (raw and output) files for photographers.
## usage
-Simply clone the repo or manually download the scripts from https://src.clttr.info/rwa/photo-helpers/
+Simply clone the repo or manually download the scripts from https://git.sr.ht/~rwa/art-helpers
To run the script, open a shell and invoke `perl <script>`, on most systems it should be sufficient to just invoke `script` (after you granted execute-permissions to the script).
-#### prerequisites for running the pure scripts
+### prerequisites for running the pure scripts
- Perl 5.30 (or newer)
@@ -23,42 +23,26 @@ Additionally the following perl modules need to be installed:
# ART helper scripts
Helper scripts to manage files which where handled by [ART](https://clttr.info/art), the easy-to-use RAW converter forked from RawTherapee.
-## processed file mover
-Filename: `afm`
-
-Moves all already converted raw files and their corresponding jpegs to a given folder.
-
-# generic scripts
-
-## JpegDivider
-Filename: `jd`
-
-Moves all jpeg files (suffixes .jpg and .jpeg) in the given folder or the current working directory to the subfolder JPEG (or the given subfolder).
-
-# Silkypix helper scripts
-Helper scripts to manage the sidecar data files created by [Silkypix Developer Studio](https://clttr.info/silkypix).
-
-Silkypix usually uses a folder structure similar to this example:
+ilkypix usually uses a folder structure similar to this example:
```
base folder
|_ RAW0001.DNG
+|_ RAW0001.DNG.arp
|_ RAW0002.DNG
+|_ RAW0002.DNG.arp
|_ JPEG
|_ RAW0001.jpg
|_ RAW0002.tif
-|_ SILKYPIX_DS
- |_ RAW0001.DNG.10.spd
- |_ RAW0002.DNG.10.spd
- |_ RAW0003.DNG.10.spf
```
-## orphaned sidecar cleaner
-Filename: `sposc`
+## ART File Mover
+Filename: `afm`
-Deletes all sidecar files in the given directory or alternatively in the current working directory when the associated raw file is missing.
+Find all by ART converted files in the current folder and their corresponding RAWs and move them to specified directory.
-## multiversion sidecar cleaner
-Filename: `spmvsc`
+## JpegDivider
+Filename: `jd`
+
+Moves all jpeg files (suffixes .jpg and .jpeg) in the given folder or the current working directory to the subfolder JPEG (or the given subfolder).
-Deletes Silkypix Sidecar files when newer versions of the files are available. This usually happens when a file is opened in a newer version of Silkypix, as the sidecar files are version specific.
diff --git a/afm b/afm
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# Copyright(c) René Wagner 2019-2021
-# https://src.clttr.info/rwa/photo-helpers
+# Copyright(c) René Wagner 2019-2023
+# https://git.sr.ht/~rwa/art-helpers
# published under BSD 3-Clause License
use Modern::Perl '2019';
@@ -140,8 +140,8 @@ sub main::VERSION_MESSAGE()
{
say $PROGRAM . ' - version ' . $VERSION;
say 'published under BSD 3 - Clause License';
- say 'Copyright(c) 2019-2020 René Wagner';
- say 'https://git.sr.ht/~rwa/photo-helpers';
+ say 'Copyright(c) 2019-2023 René Wagner';
+ say 'https://git.sr.ht/~rwa/art-helpers';
}
sub main::HELP_MESSAGE
diff --git a/jd b/jd
@@ -1,6 +1,6 @@
#!/usr/bin/perl
-# Copyright(c) René Wagner 2019-2020
-# https://src.clttr.info/rwa/photo-helpers
+# Copyright(c) René Wagner 2019-2023
+# https://git.sr.ht/~rwa/art-helpers
# published under BSD 3-Clause License
use Modern::Perl '2019';
@@ -79,8 +79,8 @@ sub main::VERSION_MESSAGE()
{
say $PROGRAM . ' - version ' . $VERSION;
say 'published under BSD 3 - Clause License';
- say 'Copyright(c) 2019-2020 René Wagner';
- say 'https://git.sr.ht/~rwa/photo-helpers';
+ say 'Copyright(c) 2019-2023 René Wagner';
+ say 'https://git.sr.ht/~rwa/art-helpers';
}
sub main::HELP_MESSAGE
diff --git a/spmvsc b/spmvsc
@@ -1,118 +0,0 @@
-#!/usr/bin/perl
-# Copyright(c) René Wagner 2019-2020
-# https://src.clttr.info/rwa/photo-helpers
-# published under BSD 3-Clause License
-
-use Modern::Perl '2019';
-use Cwd;
-use File::Basename;
-use File::Find::Rule;
-use Getopt::Std;
-
-$Getopt::Std::STANDARD_HELP_VERSION = 'true';
-
-my $VERSION = '0.6';
-my $PROGRAM = 'SilkyPix Multiversion Sidecar Cleaner';
-
-# read commandline switches
-our $opt_l = 0;
-
-getopts('l') or die "Invalid parameters provided! See 'spmvsc --help' for more details.";
-
-# read remaining commandline args
-# last dir will win
-my $work_dir = getcwd;
-foreach my $arg ( @ARGV )
-{
- if ( -d $arg ) { $work_dir = $arg }
-}
-
-delete_files($work_dir);
-
-exit 0;
-
-sub delete_files
-{
- my ( $dir ) = @_;
- my ( $file_counter ) = 0;
-
- say "working directory: $dir";
- say 'action : '. (!$opt_l ? 'delete' : 'list only') . "\r\n";
- say 'files with newer versions:';
-
- # alle Dateien in allen Unterordnern *.spd *.spf suchen
-
- my @files = File::Find::Rule->file->name( qr/\.sp(d|f)$/i )->in( $dir );
-
- foreach my $file ( @files )
- {
- if ( exist_newer_file($file, @files) )
- {
- print $file .'...';
- $file_counter++;
- if ( !$opt_l )
- {
- if ( unlink $file )
- {
- print 'deleted.'
- }
- else
- {
- print " deletion failed: $!";
- }
- }
- say '';
- }
- }
-
- say "\r\n$file_counter duplicate file versions found.";
-}
-
-sub exist_newer_file
-{
- my ( $original_file, @files_hash ) = @_;
-
- if ( -f $original_file )
- {
- # build the regex to find all versions of this file
- my @original_file_parts = split /\./, basename($original_file);
-
- # don't handle files that doesn't have a version
- if ( scalar @original_file_parts < 4 )
- {
- return 0;
- }
-
- my $filefinder_regex = "$original_file_parts[0]\\.$original_file_parts[1]\\.[0-9]+\\.$original_file_parts[3]";
- my @version_files = File::Find::Rule->file->name( qr/$filefinder_regex/i )->in( dirname($original_file) );
-
- foreach my $version_file ( @version_files )
- {
- my @version_file_parts = split /\./, $version_file;
- if ( $version_file_parts[2] > $original_file_parts[2] ) { return 1; }
- }
- }
-
- return 0;
-}
-
-sub main::VERSION_MESSAGE()
-{
- say $PROGRAM . ' - version ' . $VERSION;
- say 'published under BSD 3 - Clause License';
- say 'Copyright(c) 2019-2020 René Wagner';
- say 'https://git.sr.ht/~rwa/photo-helpers';
-}
-
-sub main::HELP_MESSAGE
-{
- say '';
- say 'Deletes Silkypix Sidecar files when newer versions of the files are available.';
- say 'This usually happens when a file is opened in a newer version of Silkypix, as the sidecar files are version specific.';
- say '';
- say 'usage: spmvsc [options] <target folder>';
- say '';
- say 'options:';
- say ' -l : list-only mode - does not delete files but only lists which files would be moved';
- say ' --help : show this help';
-}
diff --git a/sposc b/sposc
@@ -1,104 +0,0 @@
-#!/usr/bin/perl
-# Copyright(c) René Wagner 2019-2020
-# https://src.clttr.info/rwa/photo-helpers
-# published under BSD 3-Clause License
-
-use Modern::Perl '2019';
-use Cwd;
-use File::Basename;
-use File::Find::Rule;
-use File::Spec::Functions;
-use Getopt::Std;
-
-$Getopt::Std::STANDARD_HELP_VERSION = 'true';
-
-my $VERSION = '0.5';
-my $PROGRAM = 'SilkyPix Orphaned Sidecar Cleaner';
-
-# read commandline switches
-our $opt_l = 0;
-
-getopts('l') or die "Invalid parameters provided! See 'sposc --help' for more details.";
-
-# read remaining commandline args
-# last dir will win
-my $work_dir = getcwd;
-foreach my $arg ( @ARGV )
-{
- if ( -d $arg ) { $work_dir = $arg }
-}
-
-delete_files($work_dir);
-
-exit 0;
-
-sub delete_files
-{
- my ( $delete_dir ) = @_;
- my ( $file_counter ) = 0;
-
- say "working directory: $delete_dir";
- say 'action : '. (!$opt_l ? 'delete' : 'list only') ."\r\n";
- say 'files with missing raw:';
-
- # alle Dateien in allen Unterordnern *.spd *.spf suchen
- my @files = File::Find::Rule->file->name( qr/\.sp(d|f)$/i )->in( $delete_dir );
-
- foreach my $file ( @files )
- {
- if ( ! exists_raw_filename($file) )
- {
- print $file .'...';
- $file_counter++;
- if ( !$opt_l )
- {
- if ( unlink $file )
- {
- print 'deleted.';
- }
- else
- {
- print " deletion failed: $!";
- }
- }
- say '';
- }
- }
-
- say "\r\n$file_counter orphaned sidecar files found.";
-}
-
-sub exists_raw_filename
-{
- my ( $original_file ) = @_;
-
- my ( $filename, $dirs ) = fileparse($original_file);
- # Silkypix Sidecar files reside in a "SILKYPIX_DS" folder, so we need to search in the parent folder
- $filename =~ s/\.\d+\.sp.$//g;
- if ( -f catfile(dirname($dirs), $filename) )
- {
- return 1;
- }
- return 0;
-}
-
-sub main::VERSION_MESSAGE()
-{
- say $PROGRAM . ' - version ' . $VERSION;
- say 'published under BSD 3 - Clause License';
- say 'Copyright(c) 2019-2020 René Wagner';
- say 'https://git.sr.ht/~rwa/photo-helpers';
-}
-
-sub main::HELP_MESSAGE
-{
- say '';
- say 'Deletes Silkypix Sidecar files when corresponding RAW files are missing.';
- say 'The program searches for orphaned files in the given folder or the current working directory if no folder is given.';
- say '';
- say 'usage: sposc [options] <target folder>';
- say '';
- say 'options:';
- say ' -l : list-only mode - does not delete files but only lists which files would be moved';
- say ' --help : show this help';
-}