Advertisement
jappish84

bgmusic

Apr 12th, 2013
322
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.07 KB | None | 0 0
  1. media="c:\\video\\"
  2.  # This can be a playlist, music, or video file or an Url.
  3.  playercontrol1="RepeatAll"
  4.  playercontrol2=""
  5.  # "RandomOn", "RandomOff", "RepeatOne", "RepeatAll", "Partymode(music)", "Partymode(path to .xsp file)"
  6.  sfx=False
  7.  # True or False | Note that there are no quotes around True or False
  8.  # media needs to be a path to a .wav file if this is true
  9.  randomplaylist=True
  10.  # Set randomplaylist to True and playercontrol1 to RandomOn to start the playlist
  11.  # on the second (random) song. Otherwise set this to False.
  12.  volume=""
  13.  # If you want to reset the volume each time before the playlist starts, put a number in the "" quotes.
  14.  # The number is a percent between 0 and 100. 0 is mute and 100 is max volume.
  15.  
  16.  
  17.  ####################################
  18.  #Don't mess with anything down here#
  19.  #unless you know what you're doing #
  20.  ####################################
  21.  
  22. import os
  23. import sys
  24. import xbmc
  25. import xbmcaddon
  26. import gui
  27. import path
  28.  
  29.  # if (media!="" and not path.isfile(media)):
  30.  #    xbmcgui.Dialog().ok('Invalid Path','Path to media not found')
  31.  
  32.  # while (not xbmc.abortRequested):
  33.      if not xbmc.Player().isPlaying():
  34.          if(volume!="") : xbmc.executebuiltin('SetVolume('+volume+')')
  35.          if(media==""):
  36.              if (playercontrol1=="Partymode(music)" or playercontrol2=="Partymode(music)"):
  37.                  xbmc.executebuiltin('XBMC.PlayerControl(Partymode(music))')
  38.                  xbmc.sleep(5000)
  39.          elif(sfx==True):
  40.              try:
  41.                  xbmc.playSFX(media)
  42.              except:
  43.                  xbmc.log('playSFX failed')
  44.          else:
  45.              xbmc.executebuiltin('XBMC.PlayMedia('+media+')')
  46.              if playercontrol1!="":
  47.                  xbmc.executebuiltin('XBMC.PlayerControl('+playercontrol1+')')
  48.              if playercontrol2!="":
  49.                  xbmc.executebuiltin('XBMC.PlayerControl('+playercontrol2+')')
  50.              if randomplaylist==True:
  51.                  xbmc.executebuiltin('XBMC.PlayerControl(Next)')
  52.              xbmc.sleep(5000)
  53.      else:
  54.          xbmc.sleep(1000)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement