Changeset 2268
- Timestamp:
- 2006-05-13 13:33:36 (3 years ago)
- Files:
-
- annoamp/trunk/annoamp.py (modified) (4 diffs)
- annoamp/trunk/anxplayer.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
annoamp/trunk/annoamp.py
r2266 r2268 142 142 if value >= 0 and value <= player.duration: 143 143 update_gui_time(value,player.duration) 144 update_clip(player.current,player.c hapter_at(value)[0])144 update_clip(player.current,player.clip_at(value)[0]) 145 145 146 146 def slider_pause(widget, event): … … 148 148 player.pause() 149 149 150 def update_clip(current, c hapter):150 def update_clip(current, clip): 151 151 global playlist_view 152 152 global playlist … … 154 154 155 155 tree_selection = playlist_view.get_selection() 156 if c hapter== -1:156 if clip == -1: 157 157 tree_selection.unselect_all() 158 158 xml.get_widget("description").set_text('No Clip') 159 159 xml.get_widget("link").set_label('No Link') 160 160 else: 161 tree_selection.select_path(playlist.get_path(playlist.iter_nth_child(playlist.iter_nth_child(None,current),c hapter)))162 desc = player.tag_info_list[current].clip_info[c hapter].props.description161 tree_selection.select_path(playlist.get_path(playlist.iter_nth_child(playlist.iter_nth_child(None,current),clip))) 162 desc = player.tag_info_list[current].clip_info[clip].props.description 163 163 if desc != None: 164 xml.get_widget("description").set_text(player.tag_info_list[current].clip_info[c hapter].props.description)164 xml.get_widget("description").set_text(player.tag_info_list[current].clip_info[clip].props.description) 165 165 else: 166 166 xml.get_widget("description").set_text("No Description") 167 link_text = player.tag_info_list[current].clip_info[c hapter].props.anchor_text167 link_text = player.tag_info_list[current].clip_info[clip].props.anchor_text 168 168 if link_text != None: 169 169 xml.get_widget("link").set_label(link_text) 170 170 else: 171 171 xml.get_widget("link").set_label('No Link.') 172 img_src = player.tag_info_list[current].clip_info[c hapter].props.img_uri172 img_src = player.tag_info_list[current].clip_info[clip].props.img_uri 173 173 if img_src != None: 174 174 try: … … 187 187 def playlist_expanded(treeview,iter,path): 188 188 #TODO: only update if expanding the playlist of what is currently playing 189 update_clip(player.current,player.c hapter_at(xml.get_widget("slider").get_value())[0])189 update_clip(player.current,player.clip_at(xml.get_widget("slider").get_value())[0]) 190 190 191 191 def playlist_collapsed(treeview,iter,path): annoamp/trunk/anxplayer.py
r2267 r2268 77 77 78 78 if time >= 0: 79 #FIXME: new c hapters should be handled by the bus call below.79 #FIXME: new clips should be handled by the bus call below. 80 80 self.on_position_change(time, self.duration) 81 81 if self.pos == -1 and len(self.tag_info_list[self.current].clip_info) != 0 and time > self.tag_info_list[self.current].clip_info[0].props.start_time/(gst.SECOND): #we are before the first defined clip … … 83 83 self.on_clip_change(self.current, 0) 84 84 elif self.pos < len(self.tag_info_list[self.current].clip_info) - 1: 85 c hapter_end_at = self.tag_info_list[self.current].clip_info[self.pos].props.end_time/(gst.SECOND)86 if time >= c hapter_end_at: #we hit the end of the chapter87 c hapter_next_at = self.tag_info_list[self.current].clip_info[self.pos].props.start_time/(gst.SECOND)88 self.debug("next at: "+format_time(c hapter_next_at))85 clip_end_at = self.tag_info_list[self.current].clip_info[self.pos].props.end_time/(gst.SECOND) 86 if time >= clip_end_at: #we hit the end of the clip 87 clip_next_at = self.tag_info_list[self.current].clip_info[self.pos].props.start_time/(gst.SECOND) 88 self.debug("next at: "+format_time(clip_next_at)) 89 89 self.debug("time now: "+format_time(time)) 90 if time+1 >= c hapter_next_at: #the end of this chapteris the start of the next90 if time+1 >= clip_next_at: #the end of this clip is the start of the next 91 91 self.pos += 1 92 92 self.on_clip_change(self.current, self.pos) 93 else: #we are between c hapters93 else: #we are between clips 94 94 self.on_clip_change(self.current, -1) #inform the UI, but leave the self.pos alone 95 95 else: … … 190 190 self.debug("start: " + format_time(tag.props.start_time/gst.SECOND)) 191 191 self.debug("end: " + format_time(tag.props.end_time/gst.SECOND)) 192 tag_info.clip_info.append(tag) #c hapterinfo192 tag_info.clip_info.append(tag) #clip info 193 193 if key == "title": 194 194 tag_info.title = tag … … 229 229 230 230 if result == True: 231 c hapter = self.chapter_at(location)231 clip = self.clip_at(location) 232 232 233 233 if self.on_clip_change != None: 234 self.on_clip_change(self.current, c hapter[0])234 self.on_clip_change(self.current, clip[0]) 235 235 self.on_position_change(location, self.duration) 236 236 237 self.pos = c hapter[1]238 self.debug("pos is: "+str(self.pos)+" curr_c hapter is "+str(chapter[0]))237 self.pos = clip[1] 238 self.debug("pos is: "+str(self.pos)+" curr_clip is "+str(clip[0])) 239 239 240 240 self.debug("Seek: " + str(result)) … … 255 255 self.seek(sec) #seek will update self.pos 256 256 257 # Returns a tuple containing the current c hapter position and the last chapterat the current position257 # Returns a tuple containing the current clip position and the last clip at the current position 258 258 # in the stream. 259 259 # 260 260 # These will differ when the stream is between clips. 261 def c hapter_at(self,location):261 def clip_at(self,location): 262 262 if self.current == -1: 263 263 return (-1,-1) 264 264 265 c hapter_end_at = -1265 clip_end_at = -1 266 266 for i in range(0,len(self.tag_info_list[self.current].clip_info)): 267 c hapter_start_at = self.tag_info_list[self.current].clip_info[i].props.start_time/gst.SECOND268 c hapter_end_at = self.tag_info_list[self.current].clip_info[i].props.end_time/gst.SECOND269 270 if c hapter_start_at > location < chapter_end_at:267 clip_start_at = self.tag_info_list[self.current].clip_info[i].props.start_time/gst.SECOND 268 clip_end_at = self.tag_info_list[self.current].clip_info[i].props.end_time/gst.SECOND 269 270 if clip_start_at > location < clip_end_at: 271 271 return (i-1,i-1) 272 elif location < c hapter_start_at:272 elif location < clip_start_at: 273 273 return (-1,i-1) 274 274 275 if location > c hapter_end_at: #we're past the end of the last clip275 if location > clip_end_at: #we're past the end of the last clip 276 276 return (-1,len(self.tag_info_list[self.current].clip_info)-1) 277 277 return (len(self.tag_info_list[self.current].clip_info)-1,len(self.tag_info_list[self.current].clip_info)-1)