[transmageddon] More fixes for DVD ripping support, getting there



commit 17abf1d17cccf7962d10dd60faf2a17344f3b579
Author: Christian Fredrik Kalager Schaller <uraeus linuxrising org>
Date:   Sun Mar 31 12:24:42 2013 +0200

    More fixes for DVD ripping support, getting there

 src/dvdtrackchooser.py   |   20 +++++++++++---------
 src/transcoder_engine.py |   36 ++++++++++++++++++++++--------------
 src/transmageddon.py     |   12 +++++++-----
 3 files changed, 40 insertions(+), 28 deletions(-)
---
diff --git a/src/dvdtrackchooser.py b/src/dvdtrackchooser.py
index aaef8f5..2e9b435 100644
--- a/src/dvdtrackchooser.py
+++ b/src/dvdtrackchooser.py
@@ -19,8 +19,9 @@ class dvdtrackchooser(Gtk.Dialog):
        self.dvdpickui.connect_signals(self) # Initialize User Interface
        self.dvdtrack=None # this will hold the selected DVD track value
        self.isdvd=False
+       self.dvdtitle=False
 
-       store = Gtk.ListStore(str)
+       store = Gtk.ListStore(str, int)
        # udev code to find DVD drive on system - This code needs to go into Transmageddon proper
        client = GUdev.Client(subsystems=['block'])
        for device in client.query_by_subsystem("block"):
@@ -52,14 +53,15 @@ class dvdtrackchooser(Gtk.Dialog):
            languages.append(language)
            
            # create a string to push into the listview
-           self.listoftracks.append(_("Track ") + str(scounter) + ", " + _("Languages: ") + 
languages[scounter] + _(" Lenght: ") + str(round((self.Tracks[scounter]['length']/60), 2)) + " Minutes")
+           self.listoftracks.append(_("Title:b ") + str(scounter) + ", " + _("Languages: ") + 
languages[scounter] + _(" Lenght: ") + str(round((self.Tracks[scounter]['length']/60), 2)) + " Minutes")
 
            # For testing purposes look for longest track
            scounter=scounter+1
 
-
+       x=1
        for act in self.listoftracks:
-           store.append([act])
+           store.append([act,x])
+           x=x+1
                            
        self.dvdtrackview = Gtk.TreeView(store)
        self.dvdtrackview.set_reorderable(False)
@@ -85,13 +87,13 @@ class dvdtrackchooser(Gtk.Dialog):
 
 
    def on_selectbutton_clicked(self, widget):
-       dvdtrack=self.dvdtrackview.get_selection()
-       (model, pathlist) = dvdtrack.get_selected_rows()
+       dvdtitle = self.dvdtrackview.get_selection()
+       (model, pathlist) = dvdtitle.get_selected_rows()
        for path in pathlist :
            tree_iter = model.get_iter(path)
-           value = model.get_value(tree_iter,0)
-           numvalue=path.to_string()
-           self.dvdtrack=1 #FIXME
+           value = model.get_value(tree_iter,1)
+           self.dvdtitle=value
+           print("TITLE IS " +str(value))
            self.isdvd=True
        self.dvdwindow.destroy()
 
diff --git a/src/transcoder_engine.py b/src/transcoder_engine.py
index dc9fbd9..61da245 100644
--- a/src/transcoder_engine.py
+++ b/src/transcoder_engine.py
@@ -70,6 +70,7 @@ class Transcoder(GObject.GObject):
        self.missingplugin= False
        self.probestreamid = False
        self.sinkpad = False
+       self.usedstreamids = []
 
        # switching width and height around for rotationchoices where it makes sense
        if self.rotationvalue == 1 or self.rotationvalue == 3:
@@ -151,7 +152,6 @@ class Transcoder(GObject.GObject):
                    self.audioprofile = 
GstPbutils.EncodingAudioProfile.new(self.audiodata[x]['outputaudiocaps'], audiopreset, Gst.Caps.new_any(), 0)
                    self.audioprofilenames.append("audioprofilename"+str(x))
                    self.audioprofile.set_name(self.audioprofilenames[x])
-                   print("audioprofilenames " + str(self.audioprofilenames))
                    self.encodebinprofile.add_profile(self.audioprofile)
            x=x+1 
        
@@ -329,7 +329,10 @@ class Transcoder(GObject.GObject):
            x=0
            while x < len(self.audiodata):
                if self.probestreamid==self.audiodata[x]['streamid']:
-                       print(str(pad)+" - "+"streamid from parse_stream_start "+ str(self.probestreamid))
+                   if self.probestreamid not in self.usedstreamids:
+                       #FIXME - Need to clean usedstreamid list at some point
+                       self.usedstreamids.append(self.probestreamid)
+                       # print(str(pad)+" - "+"streamid from parse_stream_start "+ str(self.probestreamid))
                        self.sinkpad = self.encodebin.emit("request-profile-pad", self.audioprofilenames[x])
                        pad.link(self.sinkpad)
                x=x+1
@@ -360,6 +363,7 @@ class Transcoder(GObject.GObject):
        elif mtype == Gst.MessageType.EOS:
            if (self.multipass != 0):
                if (self.passcounter == 0):
+                   self.usedstreamids=[]
                    #removing multipass cache file when done
                    if os.access(self.cachefile, os.F_OK):
                        os.remove(self.cachefile)
@@ -399,15 +403,16 @@ class Transcoder(GObject.GObject):
                if c.startswith("audio/"):
                    # print(c)
                    if self.passcounter == int(0):
-                       stick=src_pad.get_sticky_event(Gst.EventType.STREAM_START, 0)
-                       print(stick)
-                       while x < len(self.audiodata):
-                           if stick==self.audiodata[x]['streamid']:
-                               #print(str(pad)+" - "+"streamid from parse_stream_start "+ 
str(self.probestreamid))
-                               sinkpad = self.encodebin.emit("request-profile-pad", 
self.audioprofilenames[x])
-                               src_pad.link(sinkpad)
-                       x=x+1
-                       #src_pad.add_probe(Gst.PadProbeType.EVENT_DOWNSTREAM, self.padprobe, None)
+                       #stick=src_pad.get_sticky_event(Gst.EventType.STREAM_START, 0)
+                       #print("stick is " +str(stick))
+                       #x=0
+                       #while x < len(self.audiodata):
+                       #    if stick==self.audiodata[x]['streamid']:
+                       #        print(str(pad)+" - "+"streamid from parse_stream_start "+ 
str(self.probestreamid))
+                       #        sinkpad = self.encodebin.emit("request-profile-pad", 
self.audioprofilenames[x])
+                       #        src_pad.link(sinkpad)
+                       #x=x+1
+                       src_pad.add_probe(Gst.PadProbeType.EVENT_DOWNSTREAM, self.padprobe, None)
                elif ((c.startswith("video/") or c.startswith("image/")) and 
(self.videodata[0]['outputvideocaps'] != False)):
                    if self.videodata[0]['dopassthrough']==False:
                        if (self.multipass != 0) and (self.passcounter != int(0)):
@@ -421,9 +426,12 @@ class Transcoder(GObject.GObject):
                    else:
                            src_pad.link(self.sinkpad)
    def dvdreadproperties(self, parent, element):
-       # if self.isdvd:
-           element.set_property("device", self.streamdata['filename'])
-           element.set_property("chapter", 1)
+        print("setting DVD properties")
+        print(self.streamdata['filename'])
+        print(self.streamdata['dvdtitle'])
+        #if self.streamdata['dvdtitle']:
+        element.set_property("device", self.streamdata['filename'])
+        element.set_property("title", self.streamdata['dvdtitle'])
 
    def OnEncodebinElementAdd(self, encodebin, element):
        factory=element.get_factory()
diff --git a/src/transmageddon.py b/src/transmageddon.py
index d67db6b..34831fc 100644
--- a/src/transmageddon.py
+++ b/src/transmageddon.py
@@ -280,8 +280,8 @@ class TransmageddonUI(Gtk.ApplicationWindow):
        self.cancelbutton = self.builder.get_object("cancelbutton")
        self.StatusBar = self.builder.get_object("StatusBar")
        self.table1 = self.builder.get_object("table1")
-       self.CodecBox.attach(self.audiobox, 0, 1, 1, 2, yoptions = Gtk.AttachOptions.FILL)
-       self.CodecBox.attach(self.videobox, 2, 3, 1, 2, yoptions = Gtk.AttachOptions.FILL)
+       self.CodecBox.attach(self.audiobox, 0, 1, 1, 2) #, yoptions = Gtk.AttachOptions.FILL)
+       self.CodecBox.attach(self.videobox, 2, 3, 1, 2, yoptions = Gtk.AttachOptions.SHRINK)
        self.CodecBox.show_all()
        self.containerchoice.connect("changed", self.on_containerchoice_changed)
        self.presetchoice.connect("changed", self.on_presetchoice_changed)
@@ -393,7 +393,7 @@ class TransmageddonUI(Gtk.ApplicationWindow):
        self.audiodata =[]
        self.videodata =[]
        # all other data will go into streamdata
-       self.streamdata = {'filechoice' : False, 'filename' : False, 'outputdirectory' : False, 'container' : 
False, 'devicename' : "nopreset", 'multipass': 0, 'passcounter': 0, 'outputfilename' : False, 'timestamp': 
False}
+       self.streamdata = {'filechoice' : False, 'filename' : False, 'outputdirectory' : False, 'container' : 
False, 'devicename' : "nopreset", 'multipass': 0, 'passcounter': 0, 'outputfilename' : False, 'timestamp': 
False, 'dvdtitle': False}
 
        # Populate the Container format combobox
        # print("do we try to populate container choice")
@@ -620,8 +620,9 @@ class TransmageddonUI(Gtk.ApplicationWindow):
    def dvdreadproperties(self, parent, element):
        if self.isdvd:
            element.set_property("device", self.dvddevice)
-           element.set_property("chapter", 1)
-           print("set dvd properties")
+           # print("Title " + str(self.dvdttitle))
+           element.set_property("title", 0)
+
 
  
    def succeed(self, discoverer, info, error):
@@ -1295,6 +1296,7 @@ class TransmageddonUI(Gtk.ApplicationWindow):
            self.isdvd=dvd.isdvd
            self.streamdata['filename'] = self.dvddevice
            self.streamdata['filechoice'] = "dvd://"+self.dvddevice
+           self.streamdata['dvdtitle']=dvd.dvdtitle
            self.on_filechooser_file_set(self,self.dvddevice)
 
     


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]