Pass input args from ocarina to ocarina.py when called

git-svn-id: file:///home/anna/Desktop/ocarina-legacy/mithos/ocarina@17 1daee41c-8060-4895-b1f0-2197c00d777a
This commit is contained in:
bjschuma 2009-06-04 15:58:18 +00:00
parent 0292895823
commit f712855a9b
4 changed files with 43 additions and 36 deletions

View File

@ -1,2 +1,2 @@
#!/bin/bash
`which python` ocarina.py
`which python` ocarina.py $?

View File

@ -70,7 +70,7 @@ class main:
self.playButton = self.makeButton("playButton","images/play.png",None,self.ops.play)
self.pauseButton = self.makeButton("pauseButton","images/pause.png",None,self.ops.pause)
self.nextButton = self.makeButton("nextButton","images/next.png",None,self.ops.next)
self.thisButton = self.makeButton("thisButton",None,"This",self.this)
self.thisButton = self.makeButton("thisButton",None,"This",self.ops.this)
self.infoButton = self.makeButton("infoButton",None,"Info",self.ops.info)
# Add buttons to window
self.inside.pack_start(self.playButton,False,False,0)
@ -128,40 +128,28 @@ class main:
# Show running time info
def time(self,unused):
if self.song == None:
return
cur = self.song.curTime()
tot = self.song.info.length
self.commands.printLine(cur.toStr()+" / "+tot.toStr())
#def time(self,unused):
# if self.song == None:
# return
# cur = self.song.curTime()
# tot = self.song.info.length
# self.commands.printLine(cur.toStr()+" / "+tot.toStr())
# Show detailed song info
#def info(self,widget,data):
# # Return if no song found
# Show basic song info
#def this(self,unused):
#def this(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
# Show basic song info
#def this(self,unused):
def this(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
fields = ["title","artist","track-number","track-count","album"]
for field in fields:
if (field in self.song.info.tags.keys()) == True:
print field+":",self.song.info.tags[field]
# fields = ["title","artist","track-number","track-count","album"]
# for field in fields:
# if (field in self.song.info.tags.keys()) == True:
# print field+":",self.song.info.tags[field]
def scanLib(self,dir):

View File

@ -39,13 +39,29 @@ class Operations:
# Mark progress on the progress bar
def markProgress(self,widget,data):
time = self.song.curTime()
time = (False,None)
while time[0] == False:
time = self.song.curTime()
widget.set_fraction(float(self.song.current)/float(self.song.total))
widget.set_text(time.toStr()+" / "+self.song.info.length.toStr())
widget.set_text(time[1].toStr()+" / "+self.song.info.length.toStr())
#print float(self.song.current)/float(self.song.total)
return True
def this(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
fields = ["title","artist","track-number","track-count","album"]
for field in fields:
if (field in self.song.info.tags.keys()) == True:
print field+":",self.song.info.tags[field]
# Print detailed song info
def info(self,widget,data):
# Return if no song found

View File

@ -88,8 +88,11 @@ class Song():
# Print out current running time
def curTime(self):
length = self.player.query_position(self.time_format,None)[0]
self.current = length
dur = Duration()
dur.setTime(length)
return dur
try:
length = self.player.query_position(self.time_format,None)[0]
self.current = length
dur = Duration()
dur.setTime(length)
return (True,dur)
except:
return (False,None)