Print filename when showing detailed information
git-svn-id: file:///home/anna/Desktop/ocarina-legacy/mithos/ocarina@9 1daee41c-8060-4895-b1f0-2197c00d777a
This commit is contained in:
parent
64635c17dd
commit
d50b31cdef
|
@ -38,15 +38,7 @@ class main:
|
|||
info = SongInfo()
|
||||
info.filename = file
|
||||
self.song = Song(info,self.next,self.commands.printLines)
|
||||
self.next("")
|
||||
#if info != None:
|
||||
#self.plist.queueSong(info)
|
||||
#self.song = Song(info,self.next,self.commands.printLines)
|
||||
#self.plist.queueSong(-1)
|
||||
#self.next("")
|
||||
#self.song = Song(info,self.quit,self.commands.printLines)
|
||||
#self.song.play()
|
||||
# self.commands.printLine(str(self.song))
|
||||
self.next("")
|
||||
|
||||
# Start main loop as a thread so we can get bus calls and use command line
|
||||
gobject.threads_init()
|
||||
|
@ -65,6 +57,7 @@ class main:
|
|||
self.commands.register("this",self.this,"Display basic info about current song")
|
||||
self.commands.register("lib",self.scanLib,"Create a library based on the directory passed in")
|
||||
self.commands.register("next",self.next,"Advance to the next song")
|
||||
self.commands.register("random",self.random,"Toggle shuffle")
|
||||
|
||||
# Quit program
|
||||
def quit(self,unused):
|
||||
|
@ -104,6 +97,7 @@ class main:
|
|||
return
|
||||
for tag in self.song.info.tags.keys():
|
||||
self.commands.printLine(tag+": "+str(self.song.info.tags[tag]))
|
||||
self.commands.printLine(self.song.info.filename)
|
||||
|
||||
# Show basic song info
|
||||
def this(self,unused):
|
||||
|
@ -131,10 +125,15 @@ class main:
|
|||
if self.song != None:
|
||||
self.song.close()
|
||||
index = self.plist.next()
|
||||
if index != -1:
|
||||
if index > -1:
|
||||
self.song = None
|
||||
info = self.library.data.files[index]
|
||||
self.song = Song(info,self.next,self.commands.printLines)
|
||||
self.song.play()
|
||||
if index > -2:
|
||||
self.song.play()
|
||||
|
||||
|
||||
def random(self,unused):
|
||||
self.plist.random = not self.plist.random
|
||||
|
||||
if __name__=='__main__':main(sys.argv[1:])
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import Queue
|
||||
import random
|
||||
|
||||
class Playlist:
|
||||
def __init__(self,prnt):
|
||||
|
@ -6,10 +7,11 @@ class Playlist:
|
|||
self.list = []
|
||||
self.queue = Queue.Queue()
|
||||
self.curSong = 0
|
||||
self.random = True
|
||||
|
||||
|
||||
# Enqueue a song
|
||||
# Takes songInfo!
|
||||
# Takes songid
|
||||
def queueSong(self,song):
|
||||
self.queue.put(song)
|
||||
|
||||
|
@ -23,6 +25,10 @@ class Playlist:
|
|||
def next(self):
|
||||
if self.queue.empty() == False:
|
||||
return self.queue.get()
|
||||
if len(self.list) == 0:
|
||||
return -2
|
||||
if self.random==True:
|
||||
self.curSong = random.randint(0,len(self.list)-1)
|
||||
song = self.list[self.curSong]
|
||||
self.curSong += 1
|
||||
if self.curSong > len(self.list):
|
||||
|
|
Loading…
Reference in New Issue