|
I wasn't going to send my incomplete changes yet, but incase someone out there likes them... - here's a diff of my changes, done as per the recommendation on the website:
( I removed all the cvs related junk from the diff )
I have also cut-n-pasted (at the bottom) my sample ~/.dvdripauto file.
Buzz.
#----------------------------start diff----------------------------------
diff -urN dvdrip.orig/bin/dvdrip dvdrip.patched/bin/dvdrip --- dvdrip.orig/bin/dvdrip 2006-12-26 15:45:39.000000000 +1000 +++ dvdrip.patched/bin/dvdrip 2006-12-27 15:15:10.000000000 +1000 @@ -42,7 +42,11 @@
}
my $has_dvdrip_rc; -BEGIN { $has_dvdrip_rc = -f "$ENV{HOME}/.dvdriprc" } +my $has_dvdrip_auto; +BEGIN { + $has_dvdrip_rc = -f "$ENV{HOME}/.dvdriprc"; + $has_dvdrip_auto = -f "$ENV{HOME}/.dvdripauto";
+ }
my $USAGE = __ " Usage: dvdrip [-c] [-d level] [-p file] [-f function [-t title-nr]] [file] @@ -56,6 +60,9 @@ transcode transcode the selected title transcode_split transcode and split the selected title
+ -a automate a minimal sequence of predefined actions to take a DVD (or DVD HDD image/copy) + from woh->to->go (ie do everything needed hands-off!) + -t title-nr to which the function above should apply
(Default: last selected title)
@@ -65,8 +72,8 @@ ";
main: { - if ( $ARGV[0] =~ /^-(v|-?version)$/ ) { - $Video::DVDRip::PREFERENCE_FILE = "$ENV{HOME}/.dvdriprc"; + if ( $ARGV[0] =~ /^-(v|-?version)$/ ) { + $Video::DVDRip::PREFERENCE_FILE = "$ENV{HOME}/.dvdriprc";
require Video::DVDRip; print $Video::DVDRip::VERSION, "\n"; exit 0; @@ -78,17 +85,21 @@
# get options my %opt; - my $opt_ok = getopts( 'cd:f:t:p:', \%opt ); + my $opt_ok = getopts( 'cd:f:t:p:a:', \%opt ); usage() if not $opt_ok;
my $open_cluster_control = $opt{c}; my $function = $opt{f}; my $title_nr = $opt{t}; my $prefs = $opt{p}; + my $automate = $opt{a};
usage() if $function and $function !~ /^(transcode|transcode_split)$/;
+ usage() if $automate and ! $has_dvdrip_auto; + $Video::DVDRip::PREFERENCE_FILE = $prefs || "$ENV{HOME}/.dvdriprc"; + $Video::DVDRip::AUTOMATE_FILE = "$ENV{HOME}/.dvdripauto" || '';
require Video::DVDRip; require Video::DVDRip::GUI::Main; @@ -112,6 +123,10 @@
Glib::Timeout->add( 500, sub { hide_start_splash($splash_fh); 0 } );
+ # enable automation of GUI app classes from base app. + $gui->automate(); + print "autmate executed\n";
+ # start GUI $gui->start( filename => $filename,
diff -urN dvdrip.orig/lib/Video/DVDRip/Base.pm dvdrip.patched/lib/Video/DVDRip/Base.pm --- dvdrip.orig/lib/Video/DVDRip/Base.pm 2006-12-26 15:45:41.000000000 +1000 +++ dvdrip.patched/lib/Video/DVDRip/Base.pm 2006-12-27 15:15:
11.000000000 +1000 @@ -28,6 +28,9 @@ $CONFIG_OBJECT->save if not -f $Video::DVDRip::PREFERENCE_FILE; $CONFIG_OBJECT->load;
+# automate file: +$Video::DVDRip::AUTOMATE_FILE ||= "$ENV{HOME}/.dvdripauto"; + # detect installed tool versions ------------------------------------- require Video::DVDRip::Depend; my $DEPEND_OBJECT = Video::DVDRip::Depend->new;
@@ -44,6 +47,22 @@ my $class = shift; return bless {}, $class; } +sub automate { + my $self = shift; + # load automation (if present) + # eval is insecure, but works
+ open(A,"< $Video::DVDRip::AUTOMATE_FILE") || warn "unable to read automation file: $Video::DVDRip::AUTOMATE_FILE"; + local $/; + my $autocontents = <A>; + close A;
+ print("--------------------\n"); + print($autocontents); + print("--------------------\n"); + eval($autocontents); + print "unable to eval automation file:|$@|\n" if $@;
+ # simple test: + print "WE HAVE SOMETHING!\n" if $Video::DVDRip::SOMETHING; +}
sub config { my $thingy = shift;
diff -urN dvdrip.orig/lib/Video/DVDRip/Content.pm dvdrip.patched/lib/Video/DVDRip/Content.pm --- dvdrip.orig/lib/Video/DVDRip/Content.pm 2006-12-26 15:45:40.000000000 +1000 +++ dvdrip.patched/lib/Video/DVDRip/Content.pm 2006-12-27 15:15:
10.000000000 +1000 @@ -74,7 +74,8 @@ sub set_selected_title_nr { my $self = shift; my ($nr) = @_; - die "msg: " . __x( "Illegal title number {nr}", nr => $nr ) + print "in set_selected_title_nr: $nr\n";
+ die "msg: " . __x( "Illegal title number {$nr}", nr => $nr ) unless exists $self->titles->{$nr}; $self->set_selected_titles( [ $nr - 1 ] ); return $nr;
diff -urN dvdrip.orig/lib/Video/DVDRip/GUI/Main.pm dvdrip.patched/lib/Video/DVDRip/GUI/Main.pm --- dvdrip.orig/lib/Video/DVDRip/GUI/Main.pm 2006-12-26 15:45:40.000000000 +1000 +++ dvdrip.patched/lib/Video/DVDRip/GUI/Main.pm 2006-12-27 15:15:
10.000000000 +1000 @@ -14,6 +14,7 @@
use base qw(Video::DVDRip::GUI::Base); use Locale::TextDomain qw (video.dvdrip); +use Data::Dumper;
use Gtk2; use Gtk2::Ex::FormFactory 0.65; @@ -62,6 +63,8 @@ my $logger = Video::DVDRip::Logger->new; $self->set_logger($logger);
+ @{$self->{'AUTOMATE'}} = (); + return $self; }
@@ -148,7 +151,7 @@ $project->content->set_selected_titles( [$select_title] ); }
- # Execute a function, if requested + # Execute a basic function, if requested if ( $function eq 'preferences' ) { $self->edit_preferences(1);
} @@ -158,6 +161,22 @@ $title->set_tc_split(1) if $function eq 'transcode_split'; $self->get_context_object("transcode")->transcode;
} + + # execute automation function/s, if requested + if ( scalar ( $self->{AUTOMATE}) > 0 ) { + print "start - running auomation tasks\n";
+ foreach my $funct ( @{$self->{AUTOMATE}} ) { + Glib::Idle->add(sub{ + print "executing function: $funct\n";
+ eval("$funct"); + print "eval error:$@" if $@; + sleep 1; + return 0;
+ } ) ; + } + print "done - running auomation tasks\n"; + } + return 0; }
);
#----------------------------end diff----------------------------------
#----------------------------start .dvdripauto----------------------------------
$Video::DVDRip::SOMETHING = 1; # for testing only $self->{AUTOMATE} = [ '$self->open_project_file(filename => "/a3/unnamed.rip");', '$self->get_context->get_object("toc_gui")->read_dvd_toc();',
'', ];
#----------------------------end .dvdripauto----------------------------------
On 12/26/06, Jörn Reder <joern@xxxxxx> wrote:
buzz wrote:
> I have an enhancement I'm working on and I thought I'd see if I could apply
> it to the latest development version...however, it appears that checking out > the cvs 'head' reports itself as 0.98.1, but there is also a revision tagged > 0.98.2 ?? > > So, what tag should I be doing development against?
Use CVS HEAD.
0.98.2 is on the 0-98-patches branch, which is the current stable version of dvd::rip. Bugfixes enter this branch and thus can be merged back on the trunk.
The 0.98.1 tag on CVS HEAD is because we had no release on the unstable
branch yet (and no unstable version number / tag), so it's the latest stable tag before I did the branch.
Regards,
Joern
-- Think before you code. And while you're doing it probably won't hurt. ;)
|