Changeset 2268

Show
Ignore:
Timestamp:
2006-05-13 13:33:36 (3 years ago)
Author:
jkivlighn
Message:

SVN_SILENT: variable names 'chapter'->'clip' for consistency

Files:

Legend:

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

    r2266 r2268  
    142142    if value >= 0 and value <= player.duration: 
    143143        update_gui_time(value,player.duration) 
    144         update_clip(player.current,player.chapter_at(value)[0]) 
     144        update_clip(player.current,player.clip_at(value)[0]) 
    145145     
    146146def slider_pause(widget, event): 
     
    148148    player.pause() 
    149149 
    150 def update_clip(current, chapter): 
     150def update_clip(current, clip): 
    151151    global playlist_view 
    152152    global playlist 
     
    154154     
    155155    tree_selection = playlist_view.get_selection() 
    156     if chapter == -1: 
     156    if clip == -1: 
    157157        tree_selection.unselect_all() 
    158158        xml.get_widget("description").set_text('No Clip') 
    159159        xml.get_widget("link").set_label('No Link') 
    160160    else: 
    161         tree_selection.select_path(playlist.get_path(playlist.iter_nth_child(playlist.iter_nth_child(None,current),chapter))) 
    162         desc = player.tag_info_list[current].clip_info[chapter].props.description 
     161        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 
    163163        if desc != None: 
    164             xml.get_widget("description").set_text(player.tag_info_list[current].clip_info[chapter].props.description) 
     164            xml.get_widget("description").set_text(player.tag_info_list[current].clip_info[clip].props.description) 
    165165        else: 
    166166            xml.get_widget("description").set_text("No Description") 
    167         link_text = player.tag_info_list[current].clip_info[chapter].props.anchor_text 
     167        link_text = player.tag_info_list[current].clip_info[clip].props.anchor_text 
    168168        if link_text != None: 
    169169            xml.get_widget("link").set_label(link_text) 
    170170        else: 
    171171            xml.get_widget("link").set_label('No Link.') 
    172         img_src = player.tag_info_list[current].clip_info[chapter].props.img_uri 
     172        img_src = player.tag_info_list[current].clip_info[clip].props.img_uri 
    173173        if img_src != None: 
    174174            try: 
     
    187187def playlist_expanded(treeview,iter,path): 
    188188    #TODO: only update if expanding the playlist of what is currently playing 
    189     update_clip(player.current,player.chapter_at(xml.get_widget("slider").get_value())[0]) 
     189    update_clip(player.current,player.clip_at(xml.get_widget("slider").get_value())[0]) 
    190190     
    191191def playlist_collapsed(treeview,iter,path): 
  • annoamp/trunk/anxplayer.py

    r2267 r2268  
    7777 
    7878        if time >= 0: 
    79             #FIXME: new chapters should be handled by the bus call below. 
     79            #FIXME: new clips should be handled by the bus call below. 
    8080            self.on_position_change(time, self.duration) 
    8181            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 
     
    8383                self.on_clip_change(self.current, 0) 
    8484            elif self.pos < len(self.tag_info_list[self.current].clip_info) - 1: 
    85                 chapter_end_at = self.tag_info_list[self.current].clip_info[self.pos].props.end_time/(gst.SECOND) 
    86                 if time >= chapter_end_at: #we hit the end of the chapter 
    87                     chapter_next_at = self.tag_info_list[self.current].clip_info[self.pos].props.start_time/(gst.SECOND) 
    88                     self.debug("next at: "+format_time(chapter_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)) 
    8989                    self.debug("time now: "+format_time(time)) 
    90                     if time+1 >= chapter_next_at: #the end of this chapter is the start of the next 
     90                    if time+1 >= clip_next_at: #the end of this clip is the start of the next 
    9191                        self.pos += 1 
    9292                        self.on_clip_change(self.current, self.pos) 
    93                     else: #we are between chapter
     93                    else: #we are between clip
    9494                        self.on_clip_change(self.current, -1) #inform the UI, but leave the self.pos alone 
    9595            else: 
     
    190190                        self.debug("start: " + format_time(tag.props.start_time/gst.SECOND)) 
    191191                        self.debug("end: " + format_time(tag.props.end_time/gst.SECOND)) 
    192                         tag_info.clip_info.append(tag) #chapter info 
     192                        tag_info.clip_info.append(tag) #clip info 
    193193                    if key == "title": 
    194194                        tag_info.title = tag 
     
    229229 
    230230        if result == True: 
    231             chapter = self.chapter_at(location) 
     231            clip = self.clip_at(location) 
    232232 
    233233            if self.on_clip_change != None: 
    234                 self.on_clip_change(self.current, chapter[0]) 
     234                self.on_clip_change(self.current, clip[0]) 
    235235            self.on_position_change(location, self.duration) 
    236236             
    237             self.pos = chapter[1] 
    238             self.debug("pos is: "+str(self.pos)+" curr_chapter is "+str(chapter[0])) 
     237            self.pos = clip[1] 
     238            self.debug("pos is: "+str(self.pos)+" curr_clip is "+str(clip[0])) 
    239239 
    240240        self.debug("Seek: " + str(result)) 
     
    255255        self.seek(sec) #seek will update self.pos 
    256256     
    257     # Returns a tuple containing the current chapter position and the last chapter at the current position 
     257    # Returns a tuple containing the current clip position and the last clip at the current position 
    258258    # in the stream. 
    259259    # 
    260260    # These will differ when the stream is between clips. 
    261     def chapter_at(self,location): 
     261    def clip_at(self,location): 
    262262        if self.current == -1: 
    263263             return (-1,-1) 
    264264 
    265         chapter_end_at = -1 
     265        clip_end_at = -1 
    266266        for i in range(0,len(self.tag_info_list[self.current].clip_info)): 
    267             chapter_start_at = self.tag_info_list[self.current].clip_info[i].props.start_time/gst.SECOND 
    268             chapter_end_at = self.tag_info_list[self.current].clip_info[i].props.end_time/gst.SECOND 
    269  
    270             if chapter_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: 
    271271                return (i-1,i-1) 
    272             elif location < chapter_start_at: 
     272            elif location < clip_start_at: 
    273273                return (-1,i-1) 
    274274 
    275         if location > chapter_end_at: #we're past the end of the last clip 
     275        if location > clip_end_at: #we're past the end of the last clip 
    276276            return (-1,len(self.tag_info_list[self.current].clip_info)-1) 
    277277        return (len(self.tag_info_list[self.current].clip_info)-1,len(self.tag_info_list[self.current].clip_info)-1)