diff --git a/default.py b/default.py
index b49fcba..ae2e9a8 100644
--- a/default.py
+++ b/default.py
@@ -21,44 +21,44 @@ import settings, file, mkvparser, brlog, makemkv
_log = brlog.BrLog()
-_log.info('Starting the BluRay script') #@UndefinedVariable
+_log.info('Starting the BluRay script')
class BluRayStarter:
def __init__(self):
- _log.info('Staring') #@UndefinedVariable
+ _log.info('Staring')
self.settings = settings.BluRaySettings()
self.makemkv = makemkv.MakeMkvInteraction()
def killAndStart(self, mkvStart):
if self.settings.local:
- _log.info('Running makemkvcon locally') #@UndefinedVariable
+ _log.info('Running makemkvcon locally')
self.killMkv()
# Determine if we're doing the disc or if we're browsing..
- _log.info(mkvStart) #@UndefinedVariable
+ _log.info(mkvStart)
return subprocess.Popen(mkvStart, shell=True)
else:
- _log.info('connecting to remote stream, returning fake file browse class..') #@UndefinedVariable
+ _log.info('connecting to remote stream, returning fake file browse class..')
return file.FakeFile()
def killMkv(self):
# Linux
try :
- _log.info('attempting linux kill of makemkvcon') #@UndefinedVariable
+ _log.info('attempting linux kill of makemkvcon')
subprocess.call('killall -9 makemkvcon', shell=True)
- _log.info('Linux call successful') #@UndefinedVariable
+ _log.info('Linux call successful')
except:
pass
#Windows.
try :
- _log.info('attempting windows kill of makemkvcon') #@UndefinedVariable
+ _log.info('attempting windows kill of makemkvcon')
subprocess.call('taskkill /F /IM makemkvcon.exe', shell=True)
- _log.info('Windows call successful') #@UndefinedVariable
+ _log.info('Windows call successful')
except:
pass
def browse(self, url) :
- _log.info('starting browser handler') #@UndefinedVariable
+ _log.info('starting browser handler')
h = mkvparser.BrowseHandler()
h.start(url)
for k,v in h.titleMap.iteritems() : #@UnusedVariable
@@ -87,9 +87,7 @@ class BluRayStarter:
_log.info('Showing categories')
self.CATEGORIES()
_log.info('Showing categories done')
-# _log.info(__addon__.)
xbmcplugin.endOfDirectory(int(sys.argv[1]))
-
if mode == 1 :
_log.info( 'Entering Disc mode')
self.process(self.makemkv.startStream(self.settings.disc))
@@ -99,7 +97,7 @@ class BluRayStarter:
mystarter.process('')
elif mode == 2:
_log.info( 'Entering Browse mode')
- d = xbmcgui.Dialog() #@UndefinedVariable
+ d = xbmcgui.Dialog()
choice = d.browse(1, 'Select folder', 'video', 'index.bdmv|.iso|.isoRenamedMeansSkip!|.MDS|.CUE|.CDI|.CCD', False, False, '')
if choice <> '':
self.process(self.makemkv.startFileStream(choice))
@@ -130,21 +128,21 @@ class BluRayStarter:
_log.info( 'Playing file ' + testfile)
li = xbmcgui.ListItem(path = testfile)
li.setProperty('IsPlayable', 'true')
- xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, li) #@UndefinedVariable
+ xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, li)
else:
self.message(_(50071))
- xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, xbmcgui.ListItem()) #@UndefinedVariable
+ xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, xbmcgui.ListItem())
else:
# Add the selections as selectable files.
self.browse(self.settings.rootURL)
- xbmcplugin.endOfDirectory(int(sys.argv[1])) #@UndefinedVariable
+ xbmcplugin.endOfDirectory(int(sys.argv[1]))
except :
self.message(_(50072))
self.pDialog.close()
- xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, xbmcgui.ListItem()) #@UndefinedVariable
+ xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, xbmcgui.ListItem())
raise
def CATEGORIES(self):
@@ -152,22 +150,18 @@ class BluRayStarter:
if self.settings.enableDisc:
disclist = self.makemkv.discList()
for disc in disclist:
- self.addDir(_(50061) %(disc[0], disc[1]),1, True, disc[0])
+ self.addDir(_(50061) %(disc[0], disc[1]),1, True, disc[0], disc[1])
for disc in disclist:
- self.addDir(_(50062) %(disc[0], disc[1]),1, False, disc[0])
+ self.addDir(_(50062) %(disc[0], disc[1]),1, False, disc[0], disc[1])
# Filelocation
if self.settings.enableFile:
self.addDir(_(50063),2, True)
self.addDir(_(50064),2, False)
- # Remote
- # if self.settings.enableRemote:
- # self.addDir(_(50065),3, True)
- # self.addDir(_(50066),3, False)
- self.addDir(_(50060),20, True, '0', False)
+ self.addDir(_(50060),20, True, '0', 'settings', False)
xbmcplugin.endOfDirectory(int(sys.argv[1]))
- def addDir(self, name,mode, autoplay, disc = '0', isPlayable = True):
+ def addDir(self, name,mode, autoplay, disc = '0', disc_title ='idontknow', isPlayable = True):
u=sys.argv[0]+"?mode="+str(mode)+"&autoplay="+urllib.quote_plus(str(autoplay)) + "&disc=" + disc
_log.info(u)
icon = "DefaultVideoPlaylists.png"
@@ -182,13 +176,13 @@ class BluRayStarter:
def addLink(self, name,url):
- liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage='') #@UndefinedVariable
+ liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage='')
liz.setInfo( type="Video", infoLabels={ "Title": name } )
liz.setProperty("IsPlayable" , "true")
- xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz) #@UndefinedVariable
+ xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz)
def message(self, messageText):
- dialog = xbmcgui.Dialog() #@UndefinedVariable
+ dialog = xbmcgui.Dialog()
dialog.ok("Info", messageText)
_log.info("args")
diff --git a/resources/lib/makemkv.py b/resources/lib/makemkv.py
index 3217121..9d638ef 100644
--- a/resources/lib/makemkv.py
+++ b/resources/lib/makemkv.py
@@ -1,24 +1,16 @@
-import subprocess, settings, brlog, tempfile, os, threading, xbmcgui, urllib, re, xbmc
+import subprocess, settings, brlog, tempfile, os, threading, xbmcgui, urllib, re, xbmc, xbmcplugin
from functools import partial
-def killMkvOnPlaybackEnd(pid):
- dialog = xbmcgui.Dialog() #@UndefinedVariable
- dialog.ok("playback ended, about to kill %d"%(pid))
-
-
class MakeMkvInteraction:
def __init__(self):
self.settings = settings.BluRaySettings()
- self.progress = ProgressInfo()
- self.progress.start()
self.log = brlog.BrLog('makemkvinteraction')
def discList(self):
# First stop any old one
self.killMkv()
tmpf = tempfile.NamedTemporaryFile(delete=True)
- progressFile = self.progress.startProgress()
- sp = os.system(r'%s -r --cache=1 --progress=%s --messages=%s info disc:10' %(self.settings.mkvLocation, progressFile, tmpf.name))
+ sp = os.system(r'%s -r --cache=1 --messages=%s info disc:10' %(self.settings.mkvLocation, tmpf.name))
tmpf = open(tmpf.name)
content = tmpf.read()
@@ -34,7 +26,6 @@ class MakeMkvInteraction:
def startStream(self, disc):
self.log.info("Starting stream on disc %s with local url %s" %(disc, self.settings.rootURL))
# Then fork the makemkv process
- # progressFile = self.progress.startProgress(times = 2)
return self.__runandregistershutdown('%s -r --cache=128 stream disc:%s' %(self.settings.mkvLocation, disc))
def startFileStream(self, choice):
@@ -53,17 +44,16 @@ class MakeMkvInteraction:
# Check if the file is reachable through the filesystem, to prevent errors with smb:// shares etc.
if not os.path.exists(choice) :
- dialog = xbmcgui.Dialog() #@UndefinedVariable
+ dialog = xbmcgui.Dialog()
dialog.ok("Info", _(50073))
return False
-
+
return self.__runandregistershutdown('"%s" -r --cache=128 stream \'%s:%s\'' %(self.settings.mkvLocation, type, choice))
def __runandregistershutdown(self, mkvStart):
result = self.__runmkvstream(mkvStart)
if result >= 0:
- xbmc.Player().onPlayBackStopped(partial(killMkvOnPlaybackEnd, result))
return True
else:
return False
@@ -95,54 +85,17 @@ class MakeMkvInteraction:
def killMkv(self):
# Linux
try :
- self.log.info('attempting linux kill of makemkvcon') #@UndefinedVariable
+ self.log.info('attempting linux kill of makemkvcon')
subprocess.call('killall -9 makemkvcon', shell=True)
- self.log.info('Linux call successful') #@UndefinedVariable
+ self.log.info('Linux call successful')
except:
pass
#Windows.
try :
- self.log.info('attempting windows kill of makemkvcon') #@UndefinedVariable
+ self.log.info('attempting windows kill of makemkvcon')
subprocess.call('taskkill /F /IM makemkvcon.exe', shell=True)
- self.log.info('Windows call successful') #@UndefinedVariable
+ self.log.info('Windows call successful')
except:
pass
-
-
-class ProgressInfo(threading.Thread):
- def __init__(self):
- threading.Thread.__init__(self)
- self.progressFile = None
- self.showing = False
- self.dialog = None
-
- def run(self):
- while True:
- if self.showing:
- busy = True
- maxprg = 1000
- current = 0
-
- while self.showing:
- line = self.progressFile.readline()
- if line.startswith('PRGV:'):
- progress = line[4:].split(',')
- maxprg = int(progress[2])
- current= int(progress[1])
- self.dialog.update(int(float(current) / float(maxprg) * 1000.0) )
- if current >= maxprg:
- self.times = self.times - 1
-
- if self.times == 0:
- self.dialog.close()
- self.showing = False
-
- def startProgress(self, times = 1):
- self.dialog = xbmcgui.DialogProgress()
- self.dialog.create('XBMC', '', '')
- self.progressFile = tempfile.NamedTemporaryFile()
- self.times = times
- self.showing = True
- return self.progressFile.name
-
+
\ No newline at end of file
diff --git a/resources/lib/settings.py b/resources/lib/settings.py
index db1eb41..ef67428 100644
--- a/resources/lib/settings.py
+++ b/resources/lib/settings.py
@@ -10,32 +10,26 @@ class BluRaySettings:
def __init__(self):
addon = xbmcaddon.Addon(__scriptID__)
self.log = brlog.BrLog('settings')
- self.log.info('reading settings') #@UndefinedVariable
+ self.log.info('reading settings')
params = self.getParams()
+ self.handle = int(sys.argv[1])
self.paramUrl = self.getParam(params, 'url')
self.paramName = self.getParam(params, "name")
self.paramMode = self.getIntParam(params, "mode")
self.autoPlay = self.getBoolParam(params, "autoplay")
self.disc = self.getParam(params, "disc")
- self.local = self.paramMode <> 3
- self.ipAddress = addon.getSetting('ip_address') #@UndefinedVariable
- self.portNumber = addon.getSetting('port_number') #@UndefinedVariable
- if (self.local):
- #Make sure local means 127.0.0.1 ...
- self.ipAddress = '127.0.0.1'
- else :
- #Remote so use that portnumber
- self.portNumber = addon.getSetting('remote_port_number') #@UndefinedVariable
+ self.local = True
+ self.portNumber = addon.getSetting('port_number')
+ self.ipAddress = '127.0.0.1'
- self.mkvLocation = addon.getSetting('mkvlocation') #@UndefinedVariable
+ self.mkvLocation = addon.getSetting('mkvlocation')
self.rootURL = 'http://%s:%s/' % (self.ipAddress, self.portNumber)
- self.waitTimeOut = int(addon.getSetting('wait_timeout')) #@UndefinedVariable
+ self.waitTimeOut = int(addon.getSetting('wait_timeout'))
# Sections:
- self.enableDisc = addon.getSetting('support_disc') == "true" #@UndefinedVariable
- self.enableFile = addon.getSetting('support_fileselect') == "true" #@UndefinedVariable
- self.enableRemote = addon.getSetting('support_remote') == "true" #@UndefinedVariable
+ self.enableDisc = addon.getSetting('support_disc') == "true"
+ self.enableFile = addon.getSetting('support_fileselect') == "true"
def getParam(self, params, name):
try:
@@ -83,4 +77,4 @@ class BluRaySettings:
return []
def showSettings(self):
- xbmcaddon.Addon(__scriptID__).openSettings(sys.argv[ 0 ]) #@UndefinedVariable
+ xbmcaddon.Addon(__scriptID__).openSettings(sys.argv[ 0 ])
diff --git a/resources/settings.xml b/resources/settings.xml
index 4596004..9f8233b 100644
--- a/resources/settings.xml
+++ b/resources/settings.xml
@@ -8,10 +8,5 @@
-
-
-
-
-
diff --git a/service.py b/service.py
index 7348819..13f702d 100644
--- a/service.py
+++ b/service.py
@@ -18,7 +18,7 @@ import settings, file, mkvparser, brlog, makemkv
_log = brlog.BrLog('tracker service')
-_log.info('Starting the BluRay tracker service') #@UndefinedVariable
+_log.info('Starting the BluRay tracker service')
class MyPlayer(xbmc.Player):
def __init__(self):