Exemple #1
0
 def SetRepeat(c,playerid,repeat):
     print "repeat:", repeat
     if repeat=="one":
         vlc.command("pl_loop")
     elif repeat=="all":
         vlc.command("pl_repeat")
     c.repeat= repeat
Exemple #2
0
 def SetMute(c,mute):
     c.muted= not c.muted
     if c.muted:
         vlc.command("volume",val=0)
     else:
         vlc.command("volume",val=256*(c.volume/100.0))
     c.VolumeChanged()
     return "OK"
Exemple #3
0
 def Seek(c,playerid,value):
     if type(value)==dict:
         pos= time2seconds(value)
     elif type(value)==float:
         pos= value*c.duration//100
     print value,pos
     vlc.command("seek",val=pos)
     r= c.Get(["totaltime","percentage","time"] )
     print r
     return r
Exemple #4
0
 def Open(c,playlistid=None, position=None, **o):
     if playlistid==None or position==None:
         position= len(c.items)
         if c.Add(0,o)!="OK":
             print "cannot add item:", o
             return {}
     
     print "playlist one position:", position
     print "nodes:", c.getnodes()
     if not len(c.nodes): return {}
     vlc.command("pl_play", id= c.getid(position))
     return c.items[position]
Exemple #5
0
 def Add(c,playlistid,item):
     items= plugin.get( **item ) or \
           AudioLibrary.Get( **item )
     if type(items)!=list:
         print "not list:",items
         return "Not found"
     for i in items:
         print i 
         i["type"]="song"        
         vlc.command("in_enqueue", input= quote(i["file"],safe='') )
         c.items.append( i )
         yamc.event.post().Playlist.OnAdd(
             i,
             playlistid= playlistid,
             position= len(c.items)  )
     c.dirty= True
     return "OK"
Exemple #6
0
    def PlayPause(c,playerid,**k):
        if k.has_key("play"):
            if k["play"] and c.speed==1: return "OK"
            if not k["play"] and c.speed==0: return "OK"

        s=vlc.command("pl_pause")
        if s["state"]=="paused":
            c.speed= 0
        elif s["state"]=="playing":
            c.speed= 1
        c.OnPlay()
        return "OK"
Exemple #7
0
def reverse(): vlc.command("seek",val="-5%")
def volumeminus(): Application.SetVolume( Application.volume-16 )
Exemple #8
0
def forward(): vlc.command("seek",val="+5%")
def reverse(): vlc.command("seek",val="-5%")
Exemple #9
0
 def SetVolume(c,volume):
     c.volume=volume
     vlc.command("volume",val=256*(c.volume/100.0))
     c.VolumeChanged()
Exemple #10
0
 def SetShuffle(c,playerid,shuffle):
     vlc.command("pl_random")
     return "OK"
Exemple #11
0
 def GoTo(c,playerid, to ):
     vlc.command("pl_play",id=Playlist.getnodes()[to] )
     c.position= to
     return "OK"
Exemple #12
0
 def SetSpeed(c,playerid,speed):
     if speed==1:
         vlc.command("pl_play")
Exemple #13
0
 def Stop(c,playerid):
     vlc.command("pl_stop")
     return "OK"
Exemple #14
0
 def Minus(c):
     vlc.command("pl_previous")
     c.position= Playlist.position( **vlc.status)
     c.OnPlay( **Playlist.items[c.position] )
     Playlist.dirty= True
Exemple #15
0
 def Plus(c):
     vlc.command("pl_next")
     c.position= Playlist.position( **vlc.status() )
     print "plus:", c.position
     c.OnPlay( **Playlist.items[c.position] )
     Playlist.dirty= True
Exemple #16
0
 def Clear(c,playlistid):
     vlc.command("pl_empty")
     c.items=[]
     c.dirty= True
     return "OK"