Changeset 1619
- Timestamp:
- 2005-11-09 11:19:28 (3 years ago)
- Files:
-
- annoamp/trunk/annoamp.py (modified) (1 diff)
- annoamp/trunk/anxplayer.py (modified) (4 diffs)
- annoamp/trunk/m3uhandler.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
annoamp/trunk/annoamp.py
r1618 r1619 39 39 global playlist_view 40 40 41 #use the first file if nothing is already selected 42 if player.current == -1: 43 treemodel = playlist_view.get_model() 44 player.switch_source( treemodel.get_value(treemodel.get_iter_first(),0), 0 ) 45 player.play(); 41 if len(player.chapter_info) != 0: 42 #use the first file if nothing is already selected 43 if player.current == -1: 44 treemodel = playlist_view.get_model() 45 player.switch_source( treemodel.get_value(treemodel.get_iter_first(),0), 0 ) 46 player.play(); 46 47 47 48 def pause(widget): annoamp/trunk/anxplayer.py
r1615 r1619 173 173 def play(self): 174 174 print "Play." 175 if self.current == -1: 176 return 177 175 178 result = self.bin.set_state(gst.STATE_PLAYING) 176 179 self.bin.get_state() #block until the state is really changed … … 181 184 def pause(self): 182 185 print "Pause." 186 if self.current == -1: 187 return 188 183 189 result = self.bin.set_state(gst.STATE_PAUSED) 184 190 self.bin.get_state() #block until the state is really changed 185 191 186 192 def seek(self,location): 193 if self.current == -1: 194 return 195 187 196 event = gst.event_new_seek(1.0, gst.FORMAT_TIME, gst.SEEK_FLAG_FLUSH | gst.SEEK_FLAG_ACCURATE, gst.SEEK_TYPE_SET, gst.SECOND*location, gst.SEEK_TYPE_NONE, 0); 188 197 print "%s" % event … … 203 212 204 213 def next(self): 205 if self. pos == len(self.chapter_info[self.current])-1:214 if self.current == -1 or self.pos == len(self.chapter_info[self.current])-1: 206 215 print "Error in next()." 207 216 return … … 224 233 # These will differ when the stream is between clips. 225 234 def chapter_at(self,location): 235 if self.current == -1: 236 return (-1,-1) 237 226 238 chapter_end_at = -1 227 239 for i in range(0,len(self.chapter_info[self.current])): annoamp/trunk/m3uhandler.py
r1618 r1619 18 18 19 19 def load_m3u( filename ): 20 try: 21 handle = file(filename, 'r') 22 except: 23 print "Unable to open",filename,"for reading" 24 return 25 20 26 playlist = [] 21 22 27 counter = 0 23 handle = file(filename)24 28 for line in handle: 25 29 if line == "#EXTM3U\n": … … 40 44 41 45 def save_m3u( filename, playlist ): 42 #TODO: do error checking 43 handle = open(filename, 'w') 46 try: 47 handle = file(filename, 'w') 48 except: 49 print "Unable to open",filename,"for writing" 50 return 51 44 52 handle.write('#EXTM3U\n') 45 for file in playlist:46 handle.write("#EXTINF:0,"+file +'\n')47 handle.write(file +'\n')53 for filename in playlist: 54 handle.write("#EXTINF:0,"+filename+'\n') 55 handle.write(filename+'\n')