summaryrefslogtreecommitdiff
path: root/cam/feh-cam
diff options
context:
space:
mode:
authorSven Willner <sven.willner@gmail.com>2019-04-01 13:58:50 +0200
committerSven Willner <sven.willner@gmail.com>2019-04-01 13:58:50 +0200
commita9ffd5d2234433bc3f3829713b0968a1d6c13b94 (patch)
tree78a78930edbf7c187e0803f367529f2aabc90627 /cam/feh-cam
parent1d3d1259590c8a600c3d800942ab5566802d3499 (diff)
parent18dd1c5ea218c1b86e305d3ee0052335b1e22fc8 (diff)
Merge remote-tracking branch 'original/master'
Diffstat (limited to 'cam/feh-cam')
-rwxr-xr-xcam/feh-cam195
1 files changed, 0 insertions, 195 deletions
diff --git a/cam/feh-cam b/cam/feh-cam
deleted file mode 100755
index 29b254f..0000000
--- a/cam/feh-cam
+++ /dev/null
@@ -1,195 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-use Getopt::Long;
-
-#############################################
-############# CAM RUN-TIME OPTIONS ##########
-#############################################
-my $feh = "feh";
-
-# additional feh cmdline options
-my $PRE = " -q -G -Twebcam -1 0 -0 1 ";
-my $POST = "";
-#############################################
-#############################################
-
-# Options
-my $help = '';
-my $fullscreen = '';
-my $geometry = '';
-my $list = '';
-my $verbose = '';
-my $add = '';
-my $keep = '';
-my $deftitle = '%cCAM - %u';
-my $title = '';
-my $bp = $ENV{HOME}."/.cam_bookmarks";
-my $DEBUG = 0;
-
-# check args
-&print_usage_and_exit unless (@ARGV);
-
-print STDERR "Note: feh-cam will be removed from the feh distribution in 2013.\n";
-print STDERR "Please mail derf\@finalrewind.org if you still use it.\n";
-
-
-# Url, Refresh, and bookmarks
-my $url = "";
-my $ref = "";
-my %bms = ();
-
-GetOptions('help|?|h' => \$help,
- 'full-screen|f|giblets-mom' => \$fullscreen,
- 'list|l' => \$list,
- 'geometry|g=s' => \$geometry,
- 'verbose|v' => \$verbose,
- 'add|a' => \$add,
- 'keep-images|k|save-pr0n' => \$keep,
- 'title|t=s' => \$title,
- 'debug|d' => \$DEBUG,
- 'bookmarks|b=s' => \$bp
- );
-
-my $key = shift @ARGV;
-
-&print_usage_and_exit if ($help);
-
-if ($verbose) {
- $PRE .= " -V ";
-}
-
-if ($fullscreen) {
- $PRE =~ s/-w//;
- $PRE .= " --full-screen --auto-zoom ";
-}
-
-if ($geometry) {
- $PRE .= " --geometry $geometry ";
-}
-
-# if requested, add a key/url pair to bookmarks file
-if ($add) {
- my $mytitle = '';
- ($url,$ref,$mytitle) = @ARGV;
- die "Bad key syntax\n" unless ($key && $url && $ref);
-
- $mytitle="" unless ($mytitle);
-
- open(BMF, ">>$bp") or die "Couldn't open bookmarks file \"$bp\": $!\n";
- print BMF "$key=$ref,$url \"$mytitle\"\n";
- close BMF;
- print "Added URL key \"$key\" = $url, $ref.\n"; # its useful to have this even if you arent debugging --richlowe
- exit 0;
-}
-
-if ($keep) {
- $PRE .= " -k ";
-}
-
-
-
-# load bookmarks
-open(BMF, "$bp") or die "Couldn't open bookmarks file \"$bp\": $!\n";
-foreach (<BMF>) {
- next unless /^(.*?)=(.*)$/;
- $bms{$1} = $2;
- print "key=$1, url=$2\n" if ($DEBUG);
-}
-close BMF;
-
-# if requested, dump a list of key/url pair values
-if ($list) {
- foreach (sort keys %bms) {
- my $t = $bms{$_};
-
- $t =~ s/^(.+?),(.+?)(^ "(.*)"|)?$/$2/;
- chomp $t;
- print "$_ = $t, $1, $3\n";
- }
- exit 0;
-}
-
-# main loop
-MAIN: {
- do {
- $title="";
- $url = $bms{$key};
- die "Couldn't find URL key \"$key.\"\n" unless($url);
-
- $url =~ s/^(.+?),(.+?)( "(.*)")?$/$2/;
- $ref = $1;
-
- if ($4) {
- $title = $4;
- } else {
- $title = $deftitle;
- }
-
- if ($title) {
- $title =~ s/\%c/$key/g;
- $title =~ s/\%u/$url/g;
- $title =~ s/\%r/$ref/g;
- $title =~ s/\%\%/\%/g;
- $title = " --title \"$title\" ";
- }
-
- my $cmd = "$feh $PRE $title -T".$key."cam -R $ref $url $POST";
- print "$cmd\n" if ($DEBUG);
- FORK: {
- my $pid;
- if ($pid = fork) {
- # We're a daddy! :)
- } elsif (defined $pid) {
- # child
- exec "$cmd" or die "Couldnt exec() $feh: $!\n";
- } elsif ( $! =~ /No more process/) {
- sleep 5;
- redo FORK;
- } else {
- # wtf?
- die "Unrecoverable fork() error: $!\n";
- }
- }
- } while ($key = shift @ARGV);
-}
-
-
-sub print_usage_and_exit() {
- print <<END_USAGE;
-$0 0.4
-by Paul Duncan <pabs\@pablotron.org>, and
- Richard Lowe <richlowe\@btinternet.com>
-
-Description:
- A convenient webcam wrapper for feh.
-
-Usage:
- $0 <keys>
- Load the urls specified by the given keys.
- key : a url key stored in the bookmarks file (\"$bp\").
- $0 <-a|--add> key url refresh
- Add a key to the bookmarks file.
- key : short key (ex \"jenni\"),
- url : url (ex \"http://www.jennicam.org/webcam/cam.jpg\"),
- refresh : refresh, in seconds (ex 120)
- $0 <-l|--list>
- List each url key in the bookmarks file (\"$bp\").
- $0 [-f|--full-screen] keys
- Start feh in full-screen mode (aka --giblets-mom \"viewing\" mode).
- $0 [-k|--keep-images] keys
- Save each image in the current directory (aka --save-pr0n).
- $0 [-g|--geometry] xxx
- Use window geometry xxx (e.g. 640x480).
- $0 [-v|--verbose] options
- Start feh in verbose mode (feh -V).
- $0 <-h|-?|--help>
- Display usage information (this screen).
-
-Notes:
-Thanks to giblet for feh, an awesome image and webcam viewing program,
-and raster for Imlib2.
-END_USAGE
- exit(-1);
-}
-