def Start(): Log('Entered Start function ') #TODO plugin loads default prefs, then overwrites them with ones you have saved #TODO if there is extra ones I reckon it knacks things up #TODO get stored here AppData\Local\Plex Media Server\Plug-in Support\Preferences Plugin.AddViewGroup('List', viewMode='InfoList', mediaType='items') ObjectContainer.art = R(ART) ObjectContainer.title1 = Locale.LocalString('Title') DirectoryObject.thumb = R(ICON) #Set auth for the webservice in the enigma2 code if(Prefs['authrequired']): Log('Set Authentication for Web Interface to user: {} pass: XXXXXX'.format(Prefs['username'])) else: Log('Set Authentication for Web Interface to *NOT REQUIRED*') Log('Getting Initial Channel...') #Save the inital channel to reset the box. try: sRef, channel, provider, title, description, remaining = get_current_service(Prefs['host'], Prefs['port_web'])[0] Data.Save('sRef', sRef) Log('Loaded initial channel from receiver') Data.SaveObject('Started', True) except (HttpLib2Error, error) as e: Log('Error in Start.Httplib2 error. Unable to get current service - {}'.format(e.message)) Data.SaveObject('Started', False) except AttributeError as e: Log('Error in Start. Caught an attribute error - {}'.format(e.message)) Data.SaveObject('Started', False)
def Start(): Log('Entered Start function ') #TODO plugin loads default prefs, then overwrites them with ones you have saved #TODO if there is extra ones I reckon it knacks things up #TODO get stored here AppData\Local\Plex Media Server\Plug-in Support\Preferences Plugin.AddViewGroup('List', viewMode='InfoList', mediaType='items') ObjectContainer.art = R(ART) ObjectContainer.title1 = Locale.LocalString('Title') DirectoryObject.thumb = R(ICON) #Set auth for the webservice in the enigma2 code if (Prefs['authrequired']): Log('Set Authentication for Web Interface to user: {} pass: XXXXXX'. format(Prefs['username'])) else: Log('Set Authentication for Web Interface to *NOT REQUIRED*') Log('Getting Initial Channel...') #Save the inital channel to reset the box. try: sRef, channel, provider, title, description, remaining = get_current_service( Prefs['host'], Prefs['port_web'])[0] Data.Save('sRef', sRef) Log('Loaded initial channel from receiver') Data.SaveObject('Started', True) except (HttpLib2Error, error) as e: Log('Error in Start.Httplib2 error. Unable to get current service - {}' .format(e.message)) Data.SaveObject('Started', False) except AttributeError as e: Log('Error in Start. Caught an attribute error - {}'.format(e.message)) Data.SaveObject('Started', False)
def on_now_menuitem(): from enigma2 import get_current_service, get_number_of_audio_tracks, get_audio_tracks sRef, channel, provider, title, description, remaining = get_current_service(Prefs['host'], Prefs['port_web'])[0] if Client.Platform in CLIENT: result = Display_Event(sender='On Now - {} {}'.format(channel, title), channel=sRef, description=description, duration=int(remaining*1000)) else: result = Display_Event(sender='On Now - {} {}'.format(channel, title), channel=sRef, description=description, duration=int(remaining*1000)) return result
def on_now(): from enigma2 import get_current_service if Prefs['host'] and Prefs['port_web'] and Prefs['port_video']: # Add a item for the current serviceon now sRef, channel, provider, title, description, remaining = get_current_service(Prefs['host'], Prefs['port_web'])[0] if Client.Platform in CLIENT: result = VideoClipObject(url='http://{}/{}/{}/{}'.format(Prefs['host'], Prefs['port_web'], Prefs['port_video'], sRef), title='On Now - {} {}'.format(channel, description)) else: result = Display_Event(sender='On Now - {} {}'.format(channel, title), channel=sRef, description=description, duration=int(remaining*1000)) return result