Load last played song on startup if user doesn't give us a path to use
This commit is contained in:
parent
808bc88dfa
commit
cc1627225d
|
@ -46,8 +46,10 @@ def load(path):
|
|||
|
||||
def play():
|
||||
global pipeline
|
||||
if not pipeline == None:
|
||||
pipeline.set_state(gst.STATE_PLAYING)
|
||||
#if not pipeline == None:
|
||||
pipeline.set_state(gst.STATE_PLAYING)
|
||||
#else:
|
||||
# manager.run("next",settings.get("cursong"))
|
||||
|
||||
|
||||
def pause():
|
||||
|
@ -138,6 +140,11 @@ def init():
|
|||
join = ' '
|
||||
path = join.join(input)
|
||||
load(path)
|
||||
else:
|
||||
if settings.has("curtrk")==True:
|
||||
track = settings.get("curtrk")
|
||||
if track > 0:
|
||||
manager.run("next",[track,False])
|
||||
if settings.has("volume") == False:
|
||||
settings.set("volume",1.0)
|
||||
setvol(settings.get("volume"))
|
||||
|
|
|
@ -38,9 +38,7 @@ class Plugin(plugin.Plugin):
|
|||
whrstr += " AND libtrack.track=track.id AND libtrack.library="+curlib
|
||||
sel = sql.Select(selstr, frmstr, whrstr)
|
||||
result = sel.execute().fetchall()
|
||||
|
||||
#if len(result) <= id:
|
||||
# return
|
||||
|
||||
result = result[id]
|
||||
|
||||
write(result[0])
|
||||
|
|
|
@ -54,6 +54,9 @@ class Plugin(plugin.Plugin):
|
|||
return
|
||||
|
||||
nxttrk = int(args[0])
|
||||
play = True
|
||||
if len(args)>1 and bool(args[1])==False:
|
||||
play = False
|
||||
|
||||
curlib = str( settings.get("curlib") )
|
||||
sel = sql.Select("track","libtrack","library="+curlib)
|
||||
|
@ -66,6 +69,8 @@ class Plugin(plugin.Plugin):
|
|||
|
||||
settings.set("curtrk",nxttrk)
|
||||
manager.run("music",["load",path])
|
||||
manager.run("music",["play"])
|
||||
if play==True:
|
||||
manager.run("music",["play"])
|
||||
manager.run("music",["now"])
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue