Changeset 1732

Show
Ignore:
Timestamp:
2005-12-24 14:24:39 (3 years ago)
Author:
scott
Message:

Modified to work with current gstreamer CVS 12/24/05, >0.10.1.
Fixed handling of taglist.
Still very unstable but works occasionally.
Will work with twism on errors.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • annoamp/trunk/annoamp.py

    r1688 r1732  
    157157    else: 
    158158        tree_selection.select_path(playlist.get_path(playlist.iter_nth_child(playlist.iter_nth_child(None,current),chapter))) 
    159         desc = player.chapter_info_list[current][chapter].props.desc 
     159        desc = player.chapter_info_list[current][chapter].props.description 
    160160        if desc != None: 
    161             xml.get_widget("description").set_text(player.chapter_info_list[current][chapter].props.desc
     161            xml.get_widget("description").set_text(player.chapter_info_list[current][chapter].props.description
    162162        else: 
    163163            xml.get_widget("description").set_text("No Description") 
     
    167167        else: 
    168168            xml.get_widget("link").set_label('No Link.') 
    169         img_src = player.chapter_info_list[current][chapter].props.img_src 
     169        img_src = player.chapter_info_list[current][chapter].props.img_uri 
    170170        if img_src != None: 
    171171            try: 
     
    227227    if chooser.run() == gtk.RESPONSE_OK: 
    228228        file = chooser.get_filename() 
    229        chooser.destroy() 
     229        chooser.destroy() 
    230230        load_file(file) 
    231231    else: 
    232        chooser.destroy() 
     232        chooser.destroy() 
    233233     
    234234def add_file_p2(filename, info): 
     
    275275         
    276276        for file in files: 
    277             load_file(file) 
     277            if os.path.exists(file): 
     278                load_file(file) 
     279            else: 
     280                print "File: " + file + " cannot be found." 
    278281         
    279282def save_settings( player ): 
  • annoamp/trunk/anxplayer.py

    r1689 r1732  
    2020import gobject 
    2121import sys 
    22 sys.path.extend(["/usr/local/lib/python2.4/site-packages/gst-0.9"]) 
     22sys.path.extend(["/usr/local/lib/python2.4/site-packages/gst-0.10"]) 
    2323import gst 
    2424 
     
    6565         
    6666        #Stores the following properties of a clip: 
    67         #anchor_href, anchor_text, desc, empty, end_time, id, img_alt, img_src, meta, start_time, track 
     67        #anchor_href, anchor_text, description, empty, end_time, id, img_alt, img_uri, meta, start_time, track 
    6868        self.chapter_info_list = [] 
    6969        self.file_to_index_map = {} 
     
    7878 
    7979        if time >= 0: 
     80            #FIXME: new chapters should be handled by the bus call below. 
    8081            self.update_time_callback(time, self.duration) 
    81              
    82             if self.pos == -1 and len(self.chapter_info_list[self.current]) != 0 and time > self.chapter_info_list[self.current][0].props.start_time/gst.SECOND: #we are before the first defined clip 
     82            if self.pos == -1 and len(self.chapter_info_list[self.current]) != 0 and time > self.chapter_info_list[self.current][0].props.start_time/(gst.SECOND*1000000): #we are before the first defined clip 
    8383                self.pos = 0 
    8484                self.current_chapter_callback(self.current, 0) 
    8585            elif self.pos < len(self.chapter_info_list[self.current]) - 1: 
    86                 chapter_end_at = self.chapter_info_list[self.current][self.pos].props.end_time/gst.SECOND 
     86                chapter_end_at = self.chapter_info_list[self.current][self.pos].props.end_time/(gst.SECOND*1000000) 
    8787                if time >= chapter_end_at: #we hit the end of the chapter 
    88                     chapter_next_at = self.chapter_info_list[self.current][self.pos].props.start_time/gst.SECOND 
     88                    chapter_next_at = self.chapter_info_list[self.current][self.pos].props.start_time/(gst.SECOND*1000000) 
    8989                    if time+1 >= chapter_next_at: #the end of this chapter is the start of the next 
    9090                        self.pos += 1 
     
    9999        if message.type == gst.MESSAGE_TAG: 
    100100            self.debug("Tag!") 
    101             def temp (taglist, tag): 
     101            def temp (tag): 
    102102                #print taglist.get(tag) 
    103                 if type(taglist.get(tag)) == types.LongType or type(taglist.get(tag)) == types.StringType: 
    104                     self.debug(taglist.get(tag)
    105                 #FIXME: This isn't how we should bget the type 
    106                 elif type(taglist.get(tag)).__name__ == '__main__.GstCmmlTagHead': 
    107                     self.debug(type(taglist.get(tag))) 
     103                if type(tag) == types.LongType or type(tag) == types.StringType: 
     104                    self.debug(tag
     105                #FIXME: This isn't how we should get the type 
     106                elif type(tag).__name__ == '__main__.GstCmmlTagHead': 
     107                    self.debug(type(tag)) 
    108108                    pass 
    109                 elif type(taglist.get(tag)).__name__ == '__main__.GstCmmlTagClip': 
    110                     self.debug(type(taglist.get(tag))) 
    111                     self.debug(taglist.get(tag).get_property("id")
     109                elif type(tag).__name__ == '__main__.GstCmmlTagClip': 
     110                    self.debug(type(tag)) 
     111                    self.debug(tag.props.id
    112112 
    113113            taglist = message.parse_tag() 
    114             taglist.foreach(temp) 
     114            for key in taglist.keys(): 
     115                temp(taglist[key]) 
    115116        elif message.type == gst.MESSAGE_ERROR: 
    116117            self.error(message.parse_error()) 
     
    142143        #create a fake pipeline which we'll play, gathering all the tags and storing this information 
    143144        if filename[-4:]==".anx": 
    144             fake = gst.parse_launch('filesrc name=source ! oggdemux name=demuxer ! cmmldec name=cmml extract_mode=true ! fakesink \n') 
     145            fake = gst.parse_launch('filesrc name=source ! oggdemux name=demuxer ! cmmldec name=cmml wait-clip-end-time=true ! fakesink \n') 
    145146            fake_filesrc = fake.get_by_name('source') 
    146147            fake_filesrc.set_property('location', filename) 
     
    161162                    self.debug("whooops, warning: "+message.parse_warning()) 
    162163                elif message.type == gst.MESSAGE_ERROR: 
    163                     self.chapter_info_list[file_to_index_map[filename]] = chapter_info 
     164                    self.chapter_info_list[self.file_to_index_map[filename]] = chapter_info 
    164165                    self.add_file_callback(filename, playlist_info) 
    165166                    self.error(message.parse_error()) 
    166167                    fake.set_state(gst.STATE_NULL) 
    167168                elif message.type == gst.MESSAGE_TAG: 
    168                     def temp (taglist, tag, info): 
    169                         if type(taglist.get(tag)) == types.LongType or type(taglist.get(tag)) == types.StringType: 
    170                             #print taglist.get(tag) 
     169                    def temp (tag, info): 
     170                        if type(tag) == types.LongType or type(tag) == types.StringType: 
    171171                            pass 
    172172                        #FIXME: This isn't how we should be getting the type 
    173                         elif type(taglist.get(tag)).__name__ == '__main__.GstCmmlTagHead': 
    174                             #print type(taglist.get(tag)) 
     173                        elif type(tag).__name__ == '__main__.GstCmmlTagHead': 
    175174                            pass 
    176                         elif type(taglist.get(tag)).__name__ == '__main__.GstCmmlTagClip': 
    177                             playlist_str = format_time(taglist.get(tag).get_property("start_time")/gst.SECOND) 
    178                             if taglist.get(tag).get_property("desc") != None: 
    179                                 playlist_str += " - " + taglist.get(tag).get_property("desc") 
     175                        elif type(tag).__name__ == '__main__.GstCmmlTagClip': 
     176                            #FIXME remove 1000000s gst.SECOND should be enough. 
     177                            playlist_str = format_time(int(tag.props.start_time/gst.SECOND/1000000)) 
     178                            if tag.props.description != None: 
     179                                playlist_str += " - " + tag.props.description 
    180180                            else: 
    181                                 playlist_str += " - " + taglist.get(tag).get_property("id") 
    182                             info[0].append([playlist_str,taglist.get(tag).get_property("start_time")/gst.SECOND]) #playlist info 
    183                             info[1].append(taglist.get(tag)) #chapter info 
     181                                playlist_str += " - " + tag.props.id 
     182                            info[0].append([playlist_str,int(tag.props.start_time/gst.SECOND/1000000)]) #playlist info 
     183                            info[1].append(tag) #chapter info 
    184184                    taglist = message.parse_tag() 
    185                     taglist.foreach(temp, [playlist_info,chapter_info]) 
     185                    for key in taglist.keys(): 
     186                        temp(taglist[key], [playlist_info,chapter_info]) 
    186187                return True 
    187188            bus = fake.get_bus ()