plugin.makemkvbluray/service.py

46 lines
1.3 KiB
Python
Raw Normal View History

2011-12-26 12:45:54 +01:00
import xbmc, xbmcgui, subprocess, os, sys, urllib, re
import xbmcplugin, xbmcaddon
__scriptID__ = "plugin.makemkvbluray"
__addon__ = xbmcaddon.Addon(__scriptID__)
# Shared resources
BASE_RESOURCE_PATH = os.path.join( __addon__.getAddonInfo('path'), "resources" )
sys.path.append( os.path.join( BASE_RESOURCE_PATH, "lib" ) )
import makemkv
__language__ = __addon__.getLocalizedString
_ = sys.modules[ "__main__" ].__language__
import settings, file, mkvparser, brlog, makemkv
_log = brlog.BrLog('tracker service')
2014-01-26 15:10:39 +01:00
_log.info('Starting the Blu-Ray tracker service')
2011-12-26 12:45:54 +01:00
2012-10-06 12:21:30 +02:00
2011-12-26 12:45:54 +01:00
class MyPlayer(xbmc.Player):
def __init__(self):
xbmc.Player.__init__(self)
self.makemkv = makemkv.MakeMkvInteraction()
2014-01-26 15:10:39 +01:00
2011-12-26 12:45:54 +01:00
def onPlayBackStopped(self):
_log.info('Playback stopped, trying to kill makemkv')
self.makemkv.killMkv()
def onPlayBackStarted(self):
_log.info('Playback started')
2014-01-26 15:10:39 +01:00
2011-12-26 12:45:54 +01:00
myPlayer = MyPlayer()
xbmc.sleep(4)
if not makemkv.MakeMkvInteraction().makeMkvExists():
2012-10-06 12:21:30 +02:00
imagePath = os.path.join(__addon__.getAddonInfo('path'), 'resources', 'images', 'alerticon.png')
2014-01-26 15:10:39 +01:00
xbmc.executebuiltin('Notification("MakeMkv", "The MakeMKV Blu-Ray plugin cannot find MakeMkv. Please configure the plugin to point to it", "15000", "%s")' % (imagePath))
2011-12-26 12:45:54 +01:00
while (not xbmc.abortRequested):
xbmc.sleep(4)