dvd::rip

->ABOUT / NEWS

->DOCUMENTATION
-TABLE OF CONTENTS
-INSTALLATION
-USING THE GUI
-CLUSTER MODE
-FAQ

->KEY FEATURES

->DOWNLOAD

->SUPPORT

->TRANSLATIONS

->MAILING LIST
-SEARCH ARCHIVE

->CHANGE LOG

->CREDITS

->TODO

->LINKS

http://www.exit1.org/


Re: [dvd::rip] automation code... can anyone help?

Subject: Re: [dvd::rip] automation code... can anyone help?
From: Jörn Reder <joern@xxxxxx>
Date: Wed, 27 Dec 2006 09:46:21 +0100
buzz wrote:

> *What I need help with is:* what code that I should be executing to make a
> specific task occur (note: i'm not a Gtk or dvd::rip guru, by any stretch,
> but I do program perl for a living)

You find the correspondent code snippets resp. subroutines in the module
files which cover building the GUI and connecting actions to buttons and
stuff. For the main window these are located in this directory:

  lib/Video/DVDRip/GUI/Project/

The module files are named by the corresponding tabs on the GUI, e.g.

  ClipZoom.pm

To use this example, you will see that the "Grab frame" button is 
connected to this subroutine, located in the same file:

  sub grab_preview_frame { ... }

You can call it within dvd::rip using this construct:

  $self->get_context->get_object("clip_zoom")->grab_preview_frame();

$self is assumed to be an arbitrary dvd::rip GUI object - these are all
derived from a base class which provides the get_context() method. From
where does this "clip_zoom" identifier come? Each GUI object registers 
itself to the central "Context" object, which all dvd::rip objects bound
to the GUI. In the constructor of Video::DVDRip::GUI::Project::ClipZoom
- the new() subroutine - the corresponding code is 
$self->get_context->set_object( "clip_zoom" => $self ), so from here 
comes the name "clip_zoom".

This subroutine doesn't get a parameter *which* frame to grab, because 
this is stored in the data object, which are present for each DVD title.
The code for this very centric dvd::rip module is located here:

  lib/Video/DVDRip/Title.pm

You get the currently selected title this way:

  my $title = $self->get_context->get_object("title")

To set the preview frame number just use this: (take a look at the top 
of Title.pm to see all the attributes covered by Video::DVDRip::Title)

  $title->set_preview_frame_nr(500)

or to put it at the middle of the movie you can use this:

  $title->set_preview_frame_nr(int($title->get_frames / 2))

So the complete example of setting the preview frame number and start 
grabbing would look like this:

  my $context   = $self->get_context;
  my $title     = $context->get_object("title");
  my $clip_zoom = $context->get_object("clip_zoom");

  $title->set_preview_frame_nr(500);

  $clip_zoom->grab_preview_frame();

Have fun,

Joern

-- 
 .''`.  Jörn Reder <joern@xxxxxx>
: :' :  http://www.exit1.org/ http://www.zyn.de/
`. `'
  `-    Debian GNU/Linux -- The power of freedom

Attachment: pgpLkzXeEtIbP.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>
 

Archive powered by MHonArc. Search powered by ht://dig.

[ top ]