Changeset 1732
- Timestamp:
- 2005-12-24 14:24:39 (3 years ago)
- Files:
-
- annoamp/trunk/annoamp.py (modified) (4 diffs)
- annoamp/trunk/anxplayer.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
annoamp/trunk/annoamp.py
r1688 r1732 157 157 else: 158 158 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 160 160 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) 162 162 else: 163 163 xml.get_widget("description").set_text("No Description") … … 167 167 else: 168 168 xml.get_widget("link").set_label('No Link.') 169 img_src = player.chapter_info_list[current][chapter].props.img_ src169 img_src = player.chapter_info_list[current][chapter].props.img_uri 170 170 if img_src != None: 171 171 try: … … 227 227 if chooser.run() == gtk.RESPONSE_OK: 228 228 file = chooser.get_filename() 229 chooser.destroy()229 chooser.destroy() 230 230 load_file(file) 231 231 else: 232 chooser.destroy()232 chooser.destroy() 233 233 234 234 def add_file_p2(filename, info): … … 275 275 276 276 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." 278 281 279 282 def save_settings( player ): annoamp/trunk/anxplayer.py
r1689 r1732 20 20 import gobject 21 21 import sys 22 sys.path.extend(["/usr/local/lib/python2.4/site-packages/gst-0. 9"])22 sys.path.extend(["/usr/local/lib/python2.4/site-packages/gst-0.10"]) 23 23 import gst 24 24 … … 65 65 66 66 #Stores the following properties of a clip: 67 #anchor_href, anchor_text, desc , empty, end_time, id, img_alt, img_src, meta, start_time, track67 #anchor_href, anchor_text, description, empty, end_time, id, img_alt, img_uri, meta, start_time, track 68 68 self.chapter_info_list = [] 69 69 self.file_to_index_map = {} … … 78 78 79 79 if time >= 0: 80 #FIXME: new chapters should be handled by the bus call below. 80 81 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 83 83 self.pos = 0 84 84 self.current_chapter_callback(self.current, 0) 85 85 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.SECOND86 chapter_end_at = self.chapter_info_list[self.current][self.pos].props.end_time/(gst.SECOND*1000000) 87 87 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.SECOND88 chapter_next_at = self.chapter_info_list[self.current][self.pos].props.start_time/(gst.SECOND*1000000) 89 89 if time+1 >= chapter_next_at: #the end of this chapter is the start of the next 90 90 self.pos += 1 … … 99 99 if message.type == gst.MESSAGE_TAG: 100 100 self.debug("Tag!") 101 def temp (tag list, tag):101 def temp (tag): 102 102 #print taglist.get(tag) 103 if type(tag list.get(tag)) == types.LongType or type(taglist.get(tag)) == types.StringType:104 self.debug(tag list.get(tag))105 #FIXME: This isn't how we should bget the type106 elif type(tag list.get(tag)).__name__ == '__main__.GstCmmlTagHead':107 self.debug(type(tag list.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)) 108 108 pass 109 elif type(tag list.get(tag)).__name__ == '__main__.GstCmmlTagClip':110 self.debug(type(tag list.get(tag)))111 self.debug(tag list.get(tag).get_property("id"))109 elif type(tag).__name__ == '__main__.GstCmmlTagClip': 110 self.debug(type(tag)) 111 self.debug(tag.props.id) 112 112 113 113 taglist = message.parse_tag() 114 taglist.foreach(temp) 114 for key in taglist.keys(): 115 temp(taglist[key]) 115 116 elif message.type == gst.MESSAGE_ERROR: 116 117 self.error(message.parse_error()) … … 142 143 #create a fake pipeline which we'll play, gathering all the tags and storing this information 143 144 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') 145 146 fake_filesrc = fake.get_by_name('source') 146 147 fake_filesrc.set_property('location', filename) … … 161 162 self.debug("whooops, warning: "+message.parse_warning()) 162 163 elif message.type == gst.MESSAGE_ERROR: 163 self.chapter_info_list[ file_to_index_map[filename]] = chapter_info164 self.chapter_info_list[self.file_to_index_map[filename]] = chapter_info 164 165 self.add_file_callback(filename, playlist_info) 165 166 self.error(message.parse_error()) 166 167 fake.set_state(gst.STATE_NULL) 167 168 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: 171 171 pass 172 172 #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': 175 174 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 180 180 else: 181 playlist_str += " - " + tag list.get(tag).get_property("id")182 info[0].append([playlist_str, taglist.get(tag).get_property("start_time")/gst.SECOND]) #playlist info183 info[1].append(tag list.get(tag)) #chapter info181 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 184 184 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]) 186 187 return True 187 188 bus = fake.get_bus ()