The main window don't accept any keyboard command no matter what interface you use (RC, Dummy, qt, Telnet). Also, when you attach a rc interface the commands pause, stop don't work. Only some commands do work.
I'm using Advene library for VLC 1.0.5: http://liris.cnrs.fr/advene/download/py ... 1.0/vlc.py
Python Code used
Code: Select all
import win32file
import win32con
import threading
import time
from vlc import *
class ExclusionZone:
def __init__ (self):
self.lista = []
def insertRange (self, range):
self.lista.append(range)
def checkRange (self,pos):
for i in self.lista:
if (pos > i[0]) and (pos < i[1]):
return i[1]
return -1
class ExclusionScenes:
def __init__ (self):
self.Excl = ExclusionZone()
self.leng = 0
self.tit = 0;
self.loaded = 0;
def loadData (self,fname):
try:
l = open(fname).readlines()
self.tit = int(l[0].rstrip())
self.leng = int(l[1].rstrip())
for i in l[2:]:
tuple = i.rstrip().split(",")
tmp = (int(tuple[0]),int(tuple[1]))
self.Excl.insertRange (tmp)
self.loaded = 1
return 0
except:
return -1
def checkRange (self,pos,leng,tit):
if (leng==self.leng) and (tit==self.tit):
return self.Excl.checkRange(pos)
else:
return -1
class ClientThread ( threading.Thread ):
def __init__ ( self, player,media,filter):
self.player = player
self.media = media
self.filter = filter
threading.Thread.__init__ ( self )
def run ( self ):
while (1):
res = self.filter.checkRange(self.player.get_time(),self.media.get_duration(),self.player.get_title())
if (res > 0):
self.player.set_time(res+500)
print res
time.sleep(0.1)
def ReadSectors (drive, startinglogicalsector, numberofsectors):
_devicename = "\\\\.\\a:"
_devicename = _devicename[:4] + chr(ord(_devicename[4]) + drive) + ":"
try:
hDevice = win32file.CreateFile(_devicename,win32con.GENERIC_READ, win32con.FILE_SHARE_READ,None, win32con.OPEN_EXISTING, 0, None)
except:
return None
win32file.SetFilePointer (hDevice, (startinglogicalsector*512), win32con.FILE_BEGIN)
buffer = win32file.ReadFile (hDevice, 512*numberofsectors, None)
if (buffer == None):
win32file.CloseHandle(hDevice)
return None
win32file.CloseHandle(hDevice)
return buffer
def GetId ():
drive = 0
data = ReadSectors(drive,32*2048/512,2048/4);
while (data == None):
drive += 1
data = ReadSectors(drive,32*2048/512,2048/4);
if (drive > 25):
return "",""
name = data[1][25:73]
serial = data[1][73:89]
if (drive < 20):
Valid = 1
nn = ""
for i in name:
if i <> "\0":
nn += i
else:
break
return nn,serial.rstrip("\0"),drive
paths = ["F:\\","C:\\Users\\ppaulojr\\Desktop\\","C:\\","D:\\","E:\\"]
name,identificador,drive = GetId()
drive = chr(ord("A")+drive)
print "%s.txt"%identificador
filter = ExclusionScenes()
for pth in paths:
if filter.loadData("%s%s.txt"%(pth,identificador))>=0:
break;
try:
from msvcrt import getch
except ImportError:
def getch():
import tty
import termios
fd=sys.stdin.fileno()
old_settings=termios.tcgetattr(fd)
try:
tty.setraw(fd)
ch=sys.stdin.read(1)
finally:
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
return ch
@callbackmethod
def end_callback(event, data):
print "End of stream"
sys.exit(0)
instance=Instance('vlc','-f',"--ignore-config","-I dummy","--extraintf=rc","--rc-host=localhost:43988",'--plugin-path='+detected_plugin_path,"--sub-filter=osdmenu", "--osdmenu-file=C:\\Program Files\\VideoLAN\\VLC\\osdmenu\\default.cfg")
instance.set_log_verbosity(0)
media=instance.media_new("dvd://%s:"%drive)
player=instance.media_player_new()
player.set_media(media)
player.play()
time.sleep(10)
while not player.is_playing():
time.sleep(3)
print "Waiting..."
a.start()
event_manager=player.event_manager()
event_manager.event_attach(EventType.MediaPlayerEndReached, end_callback, None)
while True:
sleep(10)