2011-10-16, 16:43
i try do it,
[url]http://myip:myport[/url]/xbmcCmds/xbmcHttp?command=Swapplaylistitems(playlist;item1;item2)
I have understood this below :
item1 = first file for swap
item2 = second file for swap
but playlist...
I create playlist from script python code when xbmc startup
autoexec.py
StartProject.py
I want to swap playlist from my web.
How to coding?
Thank for suggestions.
I hope to hear from you soon...
[url]http://myip:myport[/url]/xbmcCmds/xbmcHttp?command=Swapplaylistitems(playlist;item1;item2)
I have understood this below :
item1 = first file for swap
item2 = second file for swap
but playlist...
I create playlist from script python code when xbmc startup
autoexec.py
Code:
import os, xbmc
xbmc.executescript('C:\\Program Files\\XBMC\\addons\\script.project.StartProject\\StartProject.py')
print "finished autoexec.py"
StartProject.py
Code:
# Import XBMC module
import xbmc,xbmcgui
import os
dir = 'C:\\Program Files\\XBMC\\PlayOnXBMC\\'
#print dir
lstDirList = os.listdir('C:\\Program Files\\XBMC\\PlayOnXBMC')
numVDO = len(lstDirList)
#print numVDO
videoLan = 'C:\\Program Files\\XBMC\\PlayOnXBMC\\videoLan.txt'
#print videoLan
RF = open(videoLan, 'r')
RF2 = open(videoLan, 'r')
for strNameFile in lstDirList :
url = dir + strNameFile
s = os.path.splitext(url) # split namefile and format file
if s[1]==".txt": # namefile --> s[0] , format file --> s[1]
numVDO = numVDO - 1
for line in RF:
if "\r\n" in line :
print line
if os.path.isfile(line[:-2]) == True :
numVDO = numVDO + 1
else :
pass
else :
print line
if os.path.isfile(line) == True :
numVDO = numVDO + 1
else :
pass
if s[1] == ".db":
numVDO = numVDO - 1
else :
#store url&index to arrayList
pass
RF.close()
#print "NumVDO = ",numVDO
arrayList = [None] * numVDO # Array for store url&index in playList
for i in range(numVDO):
arrayList[i] = [None] * 2 # arrayList --> [url][index][StatusFile]
#for i in range(numVDO):
#print arrayList[i]
cRowList = 0
for strFileDir in lstDirList :
url = dir + strFileDir
#print url
s = os.path.splitext(url) # split namefile and format file
if s[1]==".txt": # namefile --> s[0] , format file --> s[1]
for line in RF2:
if "\r\n" in line :
if os.path.isfile(line[:-2]) == True :
#print "VDO LAN BR"
#print line[:-2]
#print cRowList
arrayList[cRowList][0] = line[:-2]
arrayList[cRowList][1] = cRowList + 1
cRowList = cRowList + 1
else :
pass
else :
if os.path.isfile(line) == True :
#print "VDO LAN"
#print line
#print cRowList
arrayList[cRowList][0] = line
arrayList[cRowList][1] = cRowList + 1
cRowList = cRowList + 1
else :
pass
if s[1] == ".db":
pass
#print "Thumb.db"
#print cRowList
elif s[1] != ".txt" and s[1] != ".db":
#print "normal file"
#print cRowList
#store url&index to arrayList
arrayList[cRowList][0] = url
arrayList[cRowList][1] = cRowList + 1
cRowList = cRowList + 1
def addPlayList(array, numList):
playList=xbmc.PlayList(1)
playList.clear()
for i in range(numList) :
check = array[i][0].find('C:\\') #If array[i][0] is not found, return -1. If array[i][0] is not found, return 0.
if check != -1 : # File in HDD
namefile = array[i][0][33:]
else : # File in LAN
namefile = array[i][0][26:]
print i,namefile
listitem = xbmcgui.ListItem(namefile, thumbnailImage='C:\\Program Files\\XBMC\\cinema.png')
playList.add(array[i][0],listitem)
return playList
playList = addPlayList(arrayList, numVDO)
for lenplayList in range(playList.__len__()) :
playListItem = xbmc.PlayListItem()
playListItem = playList[lenplayList]
#print playListItem.getfilename()
I want to swap playlist from my web.
How to coding?
Thank for suggestions.
I hope to hear from you soon...