Josh Narins wrote:
> Does anyone have anything that can be run from the command line which
> would create a Project, add some Files to the Timeline, then save the
> project?
> 

As I mentioned in my previous email this has been available as of 0.13.x, but 
since you seem to be willing to wade around in the code...

> I'm getting a little confused when it comes to FileSourceFactory (is
> that even what I need) and what actually needs to be done to get a
> "/path/to/file.png" to become an object I can add to the Timeline.

In general, you don't create FileSourceFactories directly. Instead you ask the 
project's SourceList instance to add uris to itself. When a uri is successfully 
imported, a signal will be emitted from the SourceList object. Once you have a 
factory, you can add it to the project timeline with the 
timeline.addSourceFactory method.

In the case of still images, the actual class that will be created is 
PictureFileSourceFactory, and I bring this up because this is where 
default_duration of 5 seconds is hard-coded.

> It wasn't so hard to get this far...
> 
> #!/usr/bin/env python
> 
> 
> 
> # my first python script :)
> import sys
> import gtk
> import gst
> sys.path.insert(0,'/usr/local/lib/pitivi/python')
> 
> # load the pitivi stuff
> import pitivi.pitivi as ptv
> from pitivi.project import Project
> from pitivi.timeline.timeline import Timeline
> from pitivi.timeline.source import TimelineFileSource, TimelineSource
> from pitivi.projectsaver import ProjectSaver
> from pitivi.objectfactory import FileSourceFactory, PictureFileSourceFactory
> 
> # start a new project
> uri = "/home/josh/test_project"
> project = Project(uri=uri)
> timeline = Timeline(project=project)
> source = TimelineSource(timeline)

This is not the best way to script PiTiVi, though I have to admit that I'm at a 
loss as to the best way to handle this, though we do eventually want to factor 
out PiTiVi core as a python library.

Probably what you should do is check out a fresh copy  of the PiTiVi source 
(preferably from git) and make local changes to it. You can then run this 
modified copy of PiTiVi directly, rather than installing it. Having a look at 
the pitivi/application class might give you some ideas. In particular you'll 
want to see how the auto-import-add code works. Due to the asynchronous nature 
of gstreamer, part of the code has to be handled in a signal callback.

I encourage you to play around with the source and try to figure out how all of 
this works.
> 
> ------------------------------------------------------------------------------
> _______________________________________________
> Pitivi-pitivi mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/pitivi-pitivi


------------------------------------------------------------------------------
_______________________________________________
Pitivi-pitivi mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pitivi-pitivi

Reply via email to