ok = makemkvcon.ready()
  time.sleep(0.5)
if not ok:
  plugin.notify(plugin.lang(50006))
  sys.exit(1)
plugin.log('makemkvcon ready')

# Process
params = parseQuery()

# Get titles
titles = makemkvcon.listTitles()
plugin.log('titles = %s' % str(titles))
if not titles:
  plugin.notify(plugin.lang(50007))

# List?
if not plugin.get_bool('disc_autoplay'):
  for t in titles:
    addTitle(t)
  xbmcplugin.endOfDirectory(int(sys.argv[1]))

# Play longest
else:
  title = None
  for t in titles:
    if not title or t['length'] > title['length']:
      title = t
  if title:
    playTitle(title)
    ok = makemkvcon.ready()
    time.sleep(0.5)
if not ok:
    plugin.notify(plugin.lang(50006))
    sys.exit(1)
plugin.log('makemkvcon ready')

# Process
params = parseQuery()

# Get titles
titles = makemkvcon.listTitles()
plugin.log('titles = %s' % str(titles))
if not titles:
    plugin.notify(plugin.lang(50007))

# List?
if not plugin.get_bool('disc_autoplay'):
    for t in titles:
        addTitle(t)
    xbmcplugin.endOfDirectory(int(sys.argv[1]))

# Play longest
else:
    title = None
    for t in titles:
        if not title or t['length'] > title['length']:
            title = t
    if title:
        playTitle(title)
Exemplo n.º 3
0
  plugin.log('config %s => %s' % (k, v))

# Service loop
key_checked  = 0
disc_current = None
disc_started = 0
disc_ready   = False
while not xbmc.abortRequested:

  # Update fixed key
  key = plugin.get('license_key')
  if key:
    makemkv.set(makemkv.APP_KEY, key)

  # Check for beta key
  elif plugin.get_bool('license_beta_auto'):
    period = plugin.get_int('license_beta_period') * 3600
    now    = time.time()
    if now - key_checked > period:
      if makemkv.updateLicense():
        plugin.notify(plugin.lang(50002))
      key_checked = now

  # Disc removed
  if disc_current:
    path = os.path.join('/media', disc_current, BDDIR)
    if not os.path.exists(path):
      plugin.notify(plugin.lang(50005) % disc_current)
      makemkvcon.kill()
      disc_current = None
      disc_ready   = False