from song import Song # Use to define various operations class Operations: def __init__(self): self.song = None self.plist = None self.library = None # Begin playback def play(self,widget,data): if self.song == None: return self.song.play() # Pause playback def pause(self,widget,data): if self.song == None: return self.song.pause() # Advance to the next song def next(self,widget,data): # Close open songs if self.song != None: self.song.close() # Get next song index = self.plist.next() if index > -1: self.song = None info = self.library.data.files[index] self.song = Song(info,self.next) if index > -2: self.song.play() # Mark progress on the progress bar def markProgress(self,widget,data): self.song.curTime() widget.set_fraction(float(self.song.current)/float(self.song.total)) #print float(self.song.current)/float(self.song.total) return True # Print detailed song info def info(self,widget,data): # Return if no song found if self.song == None: return # Return if no tags found if self.song.info.tags == None: print "Could not find any tags" return for tag in self.song.info.tags.keys(): print tag+":",self.song.info.tags[tag] print self.song.info.filename