From 0d2383a043596a4b2e6a04a7d61b7ca320dba1f3 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 7 Mar 2010 12:12:44 +0100 Subject: Renames: cam → feh-cam, gen_cam_menu.sh → gen-cam-menu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 5 ++ cam/Makefile.am | 4 +- cam/Makefile.in | 4 +- cam/README | 12 ++-- cam/cam | 192 ---------------------------------------------------- cam/feh-cam | 192 ++++++++++++++++++++++++++++++++++++++++++++++++++++ cam/gen-cam-menu | 41 +++++++++++ cam/gen_cam_menu.sh | 41 ----------- 8 files changed, 248 insertions(+), 243 deletions(-) delete mode 100755 cam/cam create mode 100755 cam/feh-cam create mode 100755 cam/gen-cam-menu delete mode 100755 cam/gen_cam_menu.sh diff --git a/ChangeLog b/ChangeLog index 1f60b14..a18e212 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Git head + + * Fix chrome theme in the default .fehrc + * Rename cam to feh-cam and gen_cam_menu.sh to gen-cam-menu + Thu Mar 4 14:55:02 CET 2010 Daniel Friesel * Release v1.4 diff --git a/cam/Makefile.am b/cam/Makefile.am index fb14a22..7fa0249 100644 --- a/cam/Makefile.am +++ b/cam/Makefile.am @@ -5,7 +5,7 @@ AUTOMAKE_OPTIONS = 1.4 foreign # A list of all the files in the current directory which can be regenerated MAINTAINERCLEANFILES = Makefile.in -EXTRA_DIST = README cam_bookmarks cam gen_cam_menu.sh +EXTRA_DIST = README cam_bookmarks feh-cam gen-cam-menu camdir = $(bindir) -cam_SCRIPTS = cam gen_cam_menu.sh +cam_SCRIPTS = feh-cam gen-cam-menu diff --git a/cam/Makefile.in b/cam/Makefile.in index 97f79ca..d683a5b 100644 --- a/cam/Makefile.in +++ b/cam/Makefile.in @@ -83,10 +83,10 @@ AUTOMAKE_OPTIONS = 1.4 foreign # A list of all the files in the current directory which can be regenerated MAINTAINERCLEANFILES = Makefile.in -EXTRA_DIST = README cam_bookmarks cam gen_cam_menu.sh +EXTRA_DIST = README cam_bookmarks feh-cam gen-cam-menu camdir = $(bindir) -cam_SCRIPTS = cam gen_cam_menu.sh +cam_SCRIPTS = feh-cam gen-cam-menu mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../src/config.h CONFIG_CLEAN_FILES = diff --git a/cam/README b/cam/README index 281c550..e67d60e 100644 --- a/cam/README +++ b/cam/README @@ -5,8 +5,8 @@ Please see the file COPYING for licensing information. Description =========== -Cam is a Perl wrapper for feh that simlifies viewing webcams. Cam uses -keyed bookmarks. Type "cam --help" at the command line for usage +feh-cam is a Perl wrapper for feh that simlifies viewing webcams. It uses +keyed bookmarks. Type "feh-cam --help" at the command line for usage information. Webcam Information @@ -21,17 +21,17 @@ have come online since cam's original release (0.1). Installation ============ -- Copy the "cam" script to a location in your PATH (ex /usr/bin, +- Copy the "feh-cam" script to a location in your PATH (ex /usr/bin, /usr/local/bin, or $HOME/bin), and make sure hte execute bit on the script is set (type "chmod a+x $HOME/.cam_bookmarks"). - Copy the "cam_bookmarks" file to $HOME/.cam_bookmarks and make sure - cam can see it by typing "cam --list". -- Optionally, modify the options inside the cam script. You can pass + cam can see it by typing "feh-cam --list". +- Optionally, modify the options inside the feh-cam script. You can pass feh any options before the image by adjusting the $PRE variable, and any options after the image by adjustin the $POST variable. For example, I like to keep all cam images by default; you can enable this behavior with the -k command line option, or enable it permanently - by adding it to the $PRE flags in cam. + by adding it to the $PRE flags in feh-cam. About the Authors ================= diff --git a/cam/cam b/cam/cam deleted file mode 100755 index 014b22b..0000000 --- a/cam/cam +++ /dev/null @@ -1,192 +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); - - -# 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 () { - 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 <, and - Richard Lowe - -Description: - A convenient webcam wrapper for feh. - -Usage: - $0 - 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); -} - diff --git a/cam/feh-cam b/cam/feh-cam new file mode 100755 index 0000000..014b22b --- /dev/null +++ b/cam/feh-cam @@ -0,0 +1,192 @@ +#!/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); + + +# 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 () { + 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 <, and + Richard Lowe + +Description: + A convenient webcam wrapper for feh. + +Usage: + $0 + 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); +} + diff --git a/cam/gen-cam-menu b/cam/gen-cam-menu new file mode 100755 index 0000000..96618c3 --- /dev/null +++ b/cam/gen-cam-menu @@ -0,0 +1,41 @@ +#!/bin/bash + +###################################################################### +# gen_cam_menu.sh 0.1 # +# by Paul Duncan # +# # +# This script will generate a menu of cam bookmarks for # +# Enlightenment DR0.16.x. TYou can safely run this script more than # +# once; it won't add an another entry to the left-click menu if it's # +# already been run once. It doesn't delete any existing menu # +# entries, and it backs up your existing menu files as well. (just # +# in case I screwed up.. hehe). THe two variables below allow you # +# rename the left-click menuitem, and the menu title. # +# # +# # +MENU_ITEM="Webcams"; # +MENU_TITLE="Webcam List"; # +BMARKS=$HOME"/.cam_bookmarks"; # +# # +###################################################################### + + +C_MENUFILE="webcam.menu"; +F_MENUFILE="file.menu"; +C_MENU=$HOME"/.enlightenment/"$C_MENUFILE; +F_MENU=$HOME"/.enlightenment/"$F_MENUFILE; + +# make backups, just in case +cp -f $C_MENU $C_MENU"-cam_menu.backup" +cp -f $F_MENU $F_MENU"-cam_menu.backup" + +# generate cam menu +echo "Generating \""$C_MENU"\"."; +echo "\"$TITLE\"" > "$C_MENU"; +cat $BMARKS | perl -e "while (<>) { /(.*?)=/; \$keys{\$1}=\"1\"; } foreach(sort keys %keys) { /(.)(.*$)/; print \"\\\"\".uc(\$1).\"\$2\\\" NULL exec \\\"feh-cam \$1\$2\\\"\\n\"; }">> $C_MENU; + +# add entry to file menu if there isn't one +echo "Generating \""$F_MENU"\"."; +perl -i -e "\$already_there=0; while (<>) { \$already_there++ if (/$MENU_ITEM/); print \"\\\"$MENU_ITEM\\\" NULL menu \\\"$C_MENUFILE\\\"\\n\" if (!\$already_there&&/Restart/); print; }" $F_MENU; + +echo "Done."; diff --git a/cam/gen_cam_menu.sh b/cam/gen_cam_menu.sh deleted file mode 100755 index 9fe3770..0000000 --- a/cam/gen_cam_menu.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -###################################################################### -# gen_cam_menu.sh 0.1 # -# by Paul Duncan # -# # -# This script will generate a menu of cam bookmarks for # -# Enlightenment DR0.16.x. TYou can safely run this script more than # -# once; it won't add an another entry to the left-click menu if it's # -# already been run once. It doesn't delete any existing menu # -# entries, and it backs up your existing menu files as well. (just # -# in case I screwed up.. hehe). THe two variables below allow you # -# rename the left-click menuitem, and the menu title. # -# # -# # -MENU_ITEM="Webcams"; # -MENU_TITLE="Webcam List"; # -BMARKS=$HOME"/.cam_bookmarks"; # -# # -###################################################################### - - -C_MENUFILE="webcam.menu"; -F_MENUFILE="file.menu"; -C_MENU=$HOME"/.enlightenment/"$C_MENUFILE; -F_MENU=$HOME"/.enlightenment/"$F_MENUFILE; - -# make backups, just in case -cp -f $C_MENU $C_MENU"-cam_menu.backup" -cp -f $F_MENU $F_MENU"-cam_menu.backup" - -# generate cam menu -echo "Generating \""$C_MENU"\"."; -echo "\"$TITLE\"" > "$C_MENU"; -cat $BMARKS | perl -e "while (<>) { /(.*?)=/; \$keys{\$1}=\"1\"; } foreach(sort keys %keys) { /(.)(.*$)/; print \"\\\"\".uc(\$1).\"\$2\\\" NULL exec \\\"cam \$1\$2\\\"\\n\"; }">> $C_MENU; - -# add entry to file menu if there isn't one -echo "Generating \""$F_MENU"\"."; -perl -i -e "\$already_there=0; while (<>) { \$already_there++ if (/$MENU_ITEM/); print \"\\\"$MENU_ITEM\\\" NULL menu \\\"$C_MENUFILE\\\"\\n\" if (!\$already_there&&/Restart/); print; }" $F_MENU; - -echo "Done."; -- cgit v1.2.3