from Components.config import config
from enigma import eTimer
from Tools.ISO639 import LanguageCodes
+from Tools.HardwareInfo import HardwareInfo
import os
import NavigationInstance
# Current value for movie start behaviour
self.movieStart = config.usage.on_movie_start.getValue()
+ # find out box type
+ self.oHWInfo = HardwareInfo()
+ if self.oHWInfo.get_device_name() in ("dm800","dm8000"):
+ self.bHasToRestartService = False
+ else:
+ self.bHasToRestartService = True
+
def initAudio(self):
self.iService = NavigationInstance.instance.getCurrentService()
self.iServiceReference = NavigationInstance.instance.getCurrentlyPlayingServiceReference()
def activateDelay(self):
if self.activateTimer.isActive:
self.activateTimer.stop()
- bInitialized = False
- if self.iService == None:
- self.initAudio()
- bInitialized = True
- if self.iServiceReference is not None:
- lCurPosition = self.cueGetCurrentPosition()
- self.deleteAudio()
- if self.whichAudio == self.channelAudio:
- config.usage.on_movie_start.setValue("beginning")
- NavigationInstance.instance.stopService()
- NavigationInstance.instance.playService(self.iServiceReference)
- config.usage.on_movie_start.setValue(self.movieStart)
- if lCurPosition is not None:
- self.lCurPosition = lCurPosition
- self.timer = eTimer()
- self.timer.callback.append(self.seekAfterWait)
- self.timer.start(200, False)
- else:
- self.deleteAudio()
+ if self.bHasToRestartService == True:
+ bInitialized = False
+ if self.iService == None:
+ self.initAudio()
+ bInitialized = True
+ if self.iServiceReference is not None:
+ lCurPosition = self.cueGetCurrentPosition()
+ self.deleteAudio()
+ if self.whichAudio == self.channelAudio:
+ config.usage.on_movie_start.setValue("beginning")
+ NavigationInstance.instance.stopService()
+ NavigationInstance.instance.playService(self.iServiceReference)
+ config.usage.on_movie_start.setValue(self.movieStart)
+ if lCurPosition is not None:
+ self.lCurPosition = lCurPosition
+ self.timer = eTimer()
+ self.timer.callback.append(self.seekAfterWait)
+ self.timer.start(200, False)
+ else:
+ self.deleteAudio()
def seekAfterWait(self):
self.timer.stop()
if self.iService == None:
self.initAudio()
bInitialized = True
- self.initAudio()
+
+ # check if we are in a recording
lCurPosition = self.cueGetCurrentPosition()
if lCurPosition is not None:
self.bIsRecording = True
+
+ # check if downmix is enabled
+ try:
+ bDownmixEnabled = config.av.downmix_ac3.value
+ except:
+ bDownmixEnabled = False
+
oAudioTracks = self.iService and self.iService.audioTracks()
n = oAudioTracks and oAudioTracks.getNumberOfTracks() or 0
tlist = []
tlist.append((description, x))
if x == self.selectedAudioIndex:
- if description.find("AC3") != -1 or description.find("DTS") != -1:
+ if (description.find("AC3") != -1 or description.find("DTS") != -1) and bDownmixEnabled == False:
self.whichAudio = AC3
self.channelAudio = AC3
else:
from AC3main import AC3LipSync
-from AC3utils import dec2hex, hex2dec
+from AC3utils import dec2hex, hex2dec, PLUGIN_BASE, PLUGIN_VERSION
from Components.ActionMap import ActionMap, NumberActionMap
from Components.Button import Button
from Components.ConfigList import ConfigListScreen
font="Regular;20" valign="center" halign="center" backgroundColor="#18188b" transparent="1"
shadowColor="#000000" shadowOffset="-1,-1" />
<widget name="config" position="10,40" size="540,320" scrollbarMode="showOnDemand" />
+ <widget name="PluginInfo" position="10,370" size="540,20" zPosition="4" font="Regular;18" foregroundColor="#cccccc" />
</screen>"""
- def __init__(self, session, args = None):
+ def __init__(self, session, plugin_path):
Screen.__init__(self, session)
- # nun erzeugen wir eine liste von elementen fuer die menu liste.
+ # Lets get a list of elements for the config list
self.list = [
getConfigListEntry(_("Outer Bound (+/-)"), config.plugins.AC3LipSync.outerBounds),
getConfigListEntry(_("Step in ms for arrow keys"), config.plugins.AC3LipSync.arrowStepSize),
self["config"].list = self.list
- # DO NOT ASK.
+ self.skin_path = plugin_path
+
+ # Plugin Information
+ self["PluginInfo"] = Label(_("Plugin: %(plugin)s , Version: %(version)s") %dict(plugin=PLUGIN_BASE,version=PLUGIN_VERSION))
+
+ # BUTTONS
self["key_red"] = Button(_("Cancel"))
self["key_green"] = Button(_("Save"))
self["key_yellow"] = Button(_(" "))
PCM = "PCM"
AC3PCM = (AC3,PCM)
+PLUGIN_BASE = "AC3LipSync"
+PLUGIN_VERSION = "0.8"
+
lFileDelay = {}
lFileDelay[AC3] = "/proc/stb/audio/audio_delay_bitstream"
lFileDelay[PCM] = "/proc/stb/audio/audio_delay_pcm"
def hex2dec(s):
"""return the signed integer value of a hexadecimal string s"""
- print "[AC3LipSync] hex2dec String: ",s
if s[:2] == "0x":
s = s[2:]
if s[:1] < '8':
def localeInit():
lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
os.environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
- print "[AC3LipSync] set language to ", lang
+ print "[" + PluginLanguageDomain + "] set language to ", lang
gettext.bindtextdomain(PluginLanguageDomain, resolveFilename(SCOPE_PLUGINS, PluginLanguagePath))
def _(txt):
t = gettext.dgettext(PluginLanguageDomain, txt)
if t == txt:
- print "[AC3LipSync] fallback to default translation for ", txt
+ print "[" + PluginLanguageDomain + "] fallback to default translation for ", txt
t = gettext.gettext(txt)
return t
def setup(session, **kwargs):
# reload(AC3setup)
- session.open(AC3setup.AC3LipSyncSetup)
+ session.open(AC3setup.AC3LipSyncSetup, plugin_path)
def mainSetup(menuid, **kwargs):
if menuid == "setup":
return [(_("AC3 Lip Sync"), main, "ac3_lipsync", 99)]
return [ ]
-def Plugins(**kwargs):
+def Plugins(path,**kwargs):
+ global plugin_path
+ plugin_path = path
return [ PluginDescriptor(name=_("AC3 Lip Sync"), description=_("sets the AC3 audio Delay (LipSync)"), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc=main),
PluginDescriptor(name=_("AC3 Lip Sync Setup"), description=_("Setup for the AC3 Lip Sync Plugin"), icon = "AC3LipSync.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=setup),
PluginDescriptor(name=_("AC3 Lip Sync"), description=_("sets the AC3 audio Delay (LipSync)"), where = PluginDescriptor.WHERE_MENU, fnc=mainSetup)]