Controller¶
Basic Controllers¶
-
class
controllers.root.
RootController
(session, path='')[source]¶ Bases:
sphinx.ext.autodoc.importer._MockObject
Root Web Controller
-
class
controllers.base.
BaseController
(path='', **kwargs)[source]¶ Bases:
twisted.web.resource.Resource
Web Base Controller
-
__init__
(path='', **kwargs)[source]¶ - Args:
- path: Base path
- session: (?) Session instance
- withMainTemplate: (?)
- isJson: responses shall be JSON encoded
- isCustom: (?)
- isGZ: responses shall be GZIP compressed
- isMobile: (?) responses shall be optimised for mobile devices
- isImage: (?) responses shall image
-
-
controllers.utilities.
NS
= {'DVB-C': 4294901760, 'DVB-T': 4008574976}¶ Label:Namespace map
-
controllers.utilities.
NS_DVB_C
= 4294901760¶ Namespace - DVB-C services
-
controllers.utilities.
NS_DVB_T
= 4008574976¶ Namespace - DVB-T services
-
controllers.utilities.
NS_LOOKUP
= {4008574976: 'DVB-T', 4294901760: 'DVB-C'}¶ Namespace:Label lookup map
-
controllers.utilities.
create_servicereference
(*args, **kwargs)[source]¶ Generate a (Enigma2 style) service reference string representation.
Parameters: - args[0] (
dict
) – Service Reference Parameter as dict - service_type (int) – Service Type
- sid (int) – SID
- tsid (int) – TSID
- oid (int) – OID
- ns (int) – Enigma2 Namespace
- args[0] (
-
controllers.utilities.
get_config_attribute
(path, root_obj, head=None)[source]¶ Determine attribute of root_obj to be accessed by path in a (somewhat) safe manner. This implementation will allow key and index based accessing too (e.g.
config.some_list[0]
orconfig.some_dict['some_key']
) The path value needs to start with head (default=’config’).- Args:
- path: character string specifying which attribute is to be accessed root_obj: An object whose attributes are to be accessed. head: Value of the first portion of path
- Returns:
- Attribute of root_obj
- Raises:
- ValueError: If path is invalid. AttributeError: If attribute cannot be accessed
-
controllers.utilities.
lenient_decode
(value, encoding=None)[source]¶ Decode an encoded string and convert it to an unicode string.
- Args:
- value: input value encoding: string encoding, defaults to utf-8
- Returns:
- (unicode) decoded value
>>> lenient_decode("Hallo") u'Hallo' >>> lenient_decode(u"Hallo") u'Hallo' >>> lenient_decode("HällöÜ") u'H\xe4ll\xf6\xdc'
-
controllers.utilities.
lenient_force_utf_8
(value)[source]¶ - Args:
- value: input value
- Returns:
- (basestring) utf-8 encoded value
>>> isinstance(lenient_force_utf_8(''), basestring) True >>> lenient_force_utf_8(u"Hallo") 'Hallo' >>> lenient_force_utf_8("HällöÜ") 'H\xc3\xa4ll\xc3\xb6\xc3\x9c'
-
controllers.utilities.
parse_servicereference
(serviceref)[source]¶ Parse a Enigma2 style service reference string representation.
Parameters: serviceref (string) – Enigma2 style service reference >>> sref = '1:0:1:300:7:85:00c00000:0:0:0:' >>> result = parse_servicereference(sref) >>> result {'service_type': 1, 'oid': 133, 'tsid': 7, 'ns': 12582912, 'sid': 768} >>> sref_g = create_servicereference(**result) >>> sref_g '1:0:1:300:7:85:00c00000:0:0:0:' >>> sref_g2 = create_servicereference(result) >>> sref_g2 '1:0:1:300:7:85:00c00000:0:0:0:' >>> sref == sref_g True >>> sref2 = '1:64:A:0:0:0:0:0:0:0::SKY Sport' >>> result2 = parse_servicereference(sref2) >>> result2 {'service_type': 10, 'oid': 0, 'tsid': 0, 'ns': 0, 'sid': 0} >>> sref3 = '1:0:0:0:0:0:0:0:0:0:/media/hdd/movie/20170921 2055 - DASDING - DASDING Sprechstunde - .ts' >>> result3 = parse_servicereference(sref3) >>> result3 {'service_type': 0, 'oid': 0, 'tsid': 0, 'ns': 0, 'sid': 0}
Web Controllers¶
-
class
controllers.web.
WebController
(session, path='')[source]¶ Bases:
controllers.base.BaseController
HTTP Web Controller
Fork of Enigma2 WebInterface API as described in e.g. https://dream.reichholf.net/e2web/.
-
P_about
(request)[source]¶ Request handler for the about endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_addlocation
(request)[source]¶ Request handler for the addlocation endpoint. Add a path to the list of paths where video files are stored.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_bouquets
(request)[source]¶ Request handler for the boquets endpoint. Get list of tuples (bouquet reference, bouquet name) for available bouquets.
Note
Not available in Enigma2 WebInterface API.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_currenttime
(request)[source]¶ Request handler for the currenttime endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_deviceinfo
(request)[source]¶ Request handler for the deviceinfo endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_epgmulti
(request)[source]¶ Request handler for the epgmulti endpoint.
Note
Not available in Enigma2 WebInterface API.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_epgsearch
(request)[source]¶ EPG event search and lookup handler.
Note
One may use
controllers.events.EventsController.search()
for searching events.- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_epgxmltv
(request)[source]¶ Request handler for the epgxmltv endpoint.
Note
Not available in Enigma2 WebInterface API.
- Args:
- request (twisted.web.server.Request): HTTP request object bRef: mandatory, method uses epgmulti lang: mandatory, needed for xmltv and Enigma2 has no parameter for epg language
- Returns:
- HTTP response with headers
-
P_external
(request)[source]¶ Request handler for the external endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_getallservices
(request)[source]¶ Request handler for the getallservices endpoint. Retrieve list of services in bouquets.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_getaudiotracks
(request)[source]¶ Request handler for the /getaudiotracks endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_getcurrent
(request)[source]¶ Request handler for the getcurrent endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
GET
/web/getcurrent
¶
-
P_getcurrlocation
(request)[source]¶ Request handler for the getcurrlocation endpoint. Get currently selected path where video files are to be stored.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_getlocations
(request)[source]¶ Request handler for the getlocations endpoint. Retrieve paths where video files are stored.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_getpid
(request)[source]¶ Request handler for the getpid endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_getserviceref
(request)[source]¶ Get the serviceref from name.
-
GET
/api/getserviceref
¶ Query Parameters: - name (string) – service name to find
- searchinBouquetsOnly (string) – must be ‘true’
- bRef (string) – define only one single bouquet where to find
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
-
P_getservices
(request)[source]¶ Request handler for the getservices endpoint. Retrieve list of bouquets.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_getsubtitles
(request)[source]¶ Request handler for the getsubtitles endpoint.
Note
Not available in Enigma2 WebInterface API.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
Request handler for the gettags endpoint. Get tags of movie file (?).
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_loadepg
(request)[source]¶ Request handler for the loadepg endpoint.
Note
Not available in Enigma2 WebInterface API.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_message
(request)[source]¶ Request handler for the message endpoint. Display a message on the screen attached to enigma2 device.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_messageanswer
(request)[source]¶ Request handler for the messageanswer endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_moviedelete
(request)[source]¶ Request handler for the moviedelete endpoint. Delete movie file.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_moviedetails
(request)[source]¶ Request handler for the movie endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_movieinfo
(request)[source]¶ Request handler for the movie endpoint. Add/Remove tags to movie file. Multiple tags needs to separate by , Remame title of movie. Get/set movie cuts.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_movielist
(request)[source]¶ Request handler for the movielist endpoint. Retrieve list of movie items. (alternative implementation)
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_movielisthtml
(request)[source]¶ Request handler for the movielisthtml endpoint. Retrieve list of movie items in HTML format.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_movielistm3u
(request)[source]¶ Request handler for the movielistm3u endpoint. Retrieve list of movie items in M3U format.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_movielistrss
(request)[source]¶ Request handler for the movielistrss endpoint. Retrieve list of movie items in RSS format.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_moviemove
(request)[source]¶ Request handler for the moviemove endpoint. Move movie file.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_movierename
(request)[source]¶ Request handler for the movierename endpoint. Rename movie file.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
Request handler for the movietags endpoint. Add/Remove tags to movie file.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_parentcontrollist
(request)[source]¶ Request handler for the parentcontrollist endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_pluginlistread
(request)[source]¶ Request handler for the pluginlistread endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_powerstate
(request)[source]¶ Request handler for the powerstate endpoint. Get/set power state of enigma2 device.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_recordnow
(request)[source]¶ Request handler for the recordnow endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_remotecontrol
(request)[source]¶ Request handler for the remotecontrol endpoint. Send remote control codes.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_removelocation
(request)[source]¶ Request handler for the removelocation endpoint. Remove a path from the list of paths where video files are stored.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_restarttwisted
(request)[source]¶ Request handler for the restarttwisted endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_saveconfig
(request)[source]¶ Request handler for the saveconfig endpoint.
Note
Not available in Enigma2 WebInterface API.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
POST
/web/saveconfig
¶ Query Parameters: - key (string) – configuration key
- value (string) – configuration value
-
P_saveepg
(request)[source]¶ Request handler for the saveepg endpoint.
Note
Not available in Enigma2 WebInterface API.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_selectaudiotrack
(request)[source]¶ Request handler for the /selectaudiotrack endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
GET
/web/signal
¶ Query Parameters: - id (int) – audio track ID
-
P_servicelistplayable
(request)[source]¶ Request handler for the servicelistplayable endpoint. Retrieve list of ‘playable’ bouquets.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_servicelistreload
(request)[source]¶ Reload service lists, transponders, parental control black-/white lists or/and lamedb.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_serviceplayable
(request)[source]¶ Request handler for the serviceplayable endpoint. Check if referenced service is ‘playable’.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_servicesm3u
(request)[source]¶ Request handler for the servicesm3u endpoint. Retrieve list of bouquets(?) in M3U format.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
GET
/web/services.m3u
¶ Query Parameters: - bRef (string) – bouquet reference
-
P_servicesxspf
(request)[source]¶ Request handler for the servicesxspf endpoint. Retrieve list of bouquets(?) in XSPF format.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
GET
/web/services.xspf
¶ Query Parameters: - bRef (string) – bouquet reference
-
P_set_powerup_without_waking_tv
(request)[source]¶ Request handler for the set_powerup_without_waking_tv endpoint. Mark ‘powerup without waking TV’ being available.
Note
Not available in Enigma2 WebInterface API.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_settings
(request)[source]¶ Request handler for the settings endpoint. Retrieve list of key/kalue pairs of device configuration.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_sleeptimer
(request)[source]¶ Request handler for the sleeptimer endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
GET
/web/sleeptimer
¶ Query Parameters: - cmd (string) – command (get or set)
- time (int) – time in minutes (0 – 999)
- action (string) – action (standby or shutdown)
- enabled (string) – enabled (True or False)
- confirmed (string) – confirmed (supported?)
-
P_streamcurrentm3u
(request)[source]¶ Request handler for the streamcurrentm3u endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
GET
/web/streamcurrent.m3u
¶
-
P_streamm3u
(request)[source]¶ Request handler for the streamm3u endpoint.
Note
Parameters Not available in Enigma2 WebInterface API.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
GET
/web/stream.m3u
¶ Query Parameters: - ref (string) – service reference
- name (string) – service name
-
P_streamsubservices
(request)[source]¶ Request handler for the streamsubservices endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
GET
/web/streamsubservices
¶ Query Parameters: - sRef (string) – service reference
-
P_subservices
(request)[source]¶ Request handler for the subservices endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_supports_powerup_without_waking_tv
(request)[source]¶ Request handler for the supports_powerup_without_waking_tv endpoint. Check if ‘powerup without waking TV’ is available.
Note
Not available in Enigma2 WebInterface API.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_timeradd
(request)[source]¶ Request handler for the timeradd endpoint. Add timer
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_timeraddbyeventid
(request)[source]¶ Request handler for the timeraddbyeventid endpoint. Add timer by event ID
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_timerchange
(request)[source]¶ Request handler for the timerchange endpoint. Change timer
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
GET
/web/timerchange
¶ Query Parameters: - sRef (string) – service reference
- begin (int) – begin timestamp
- end (int) – end timestamp
- name (string) – name
- description (string) – description
- channelOld (string) – old channel(?)
- beginOld (int) – old begin timestamp(?)
- endOld (int) – old end timestamp(?)
- justplay (int) – Just Play indicator
- dirname (string) – target path(?)
- tags (string) – tags to add(?)
- always_zap (int) – always zap first(?)
- disabled (int) – disabled state
- afterevent (int) – afterevent state
-
P_timercleanup
(request)[source]¶ Request handler for the timercleanup endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_timerdelete
(request)[source]¶ Request handler for the timerdelete endpoint. Delete timer
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_timerlist
(request)[source]¶ Request handler for the timerlist endpoint. Retrieve list of timers.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_timerlistwrite
(request)[source]¶ Request handler for the timerlistwrite endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_timertogglestatus
(request)[source]¶ Request handler for the timertogglestatus endpoint.
Note
Not available in Enigma2 WebInterface API.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_tsm3u
(request)[source]¶ Request handler for the tsm3u endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
GET
/web/ts.m3u
¶
-
P_tsstart
(request)[source]¶ Request handler for the tsstart endpoint. Start timeshift (?).
Note
Not available in Enigma2 WebInterface API.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_tsstate
(request, success=True)[source]¶ Request handler for the tsstate endpoint. Retrieve timeshift status(?).
Note
Not available in Enigma2 WebInterface API.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_tsstop
(request)[source]¶ Request handler for the tsstop endpoint. Stop timeshift (?).
Note
Not available in Enigma2 WebInterface API.
TODO: improve after action / save , save+record , nothing config.timeshift.favoriteSaveAction ….
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_tunersignal
(request)[source]¶ Request handler for the tunersignal endpoint. Get tuner signal status(?)
See also
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
GET
/web/signal
¶
-
P_tvbrowser
(request)[source]¶ Request handler for the tvbrowser endpoint.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_vol
(request)[source]¶ Request handler for the vol endpoint. Get/Set current volume setting.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-
P_vpschannels
(request)[source]¶ Request handler for the vpschannels endpoint.
Note
Not available in Enigma2 WebInterface API.
- Args:
- request (twisted.web.server.Request): HTTP request object
- Returns:
- HTTP response with headers
-