diff --git a/DNSServer.py b/DNSServer.py index 124f12a1b..88876ac7b 100755 --- a/DNSServer.py +++ b/DNSServer.py @@ -332,9 +332,13 @@ def Run(cmdPipe, param): intercept = [param['HostToIntercept']] restrain = [] + if param['CSettings'].getSetting('intercept_atv_icon')=='True': + intercept.append('a1.phobos.apple.com') + dprint(__name__, 0, "Intercept Atv Icon: Enabled") if param['CSettings'].getSetting('prevent_atv_update')=='True': restrain = ['mesu.apple.com', 'appldnld.apple.com', 'appldnld.apple.com.edgesuite.net'] - + dprint(__name__, 0, "Prevent Atv Update: Enabled") + dprint(__name__, 0, "***") dprint(__name__, 0, "DNSServer: Serving DNS on {0} port {1}.", cfg_IP_self, cfg_Port_DNSServer) dprint(__name__, 1, "intercept: {0} => {1}", intercept, cfg_IP_self) @@ -442,6 +446,6 @@ def Run(cmdPipe, param): param['IP_self'] = '192.168.178.20' # IP_self? param['baseURL'] = 'http://'+ param['IP_self'] +':'+ cfg.getSetting('port_webserver') - param['HostToIntercept'] = 'trailers.apple.com' - + param['HostToIntercept'] = cfg.getSetting('hosttointercept') + Run(cmdPipe[1], param) diff --git a/Settings.py b/Settings.py index 09e93ca12..68f3d1e21 100755 --- a/Settings.py +++ b/Settings.py @@ -19,6 +19,7 @@ Intercept: Trailers-trailers.apple.com, WSJ-secure.marketwatch.com, iMovie-www.icloud.com HTTP: port_webserver - override when using webserver + forwarding to PlexConnect HTTPS: port_ssl, certfile, enable_webserver_ssl - configure SSL portion or webserver +intercept_atv_icon: changes atv icon to plex icon """ g_settings = [ ('enable_plexgdm' , ('True', '((True)|(False))')), @@ -29,6 +30,8 @@ ('port_dnsserver' , ('53', '[0-9]{1,5}')), ('ip_dnsmaster' , ('8.8.8.8', '([0-9]{1,3}\.){3}[0-9]{1,3}')), ('prevent_atv_update' , ('True', '((True)|(False))')), + ('intercept_atv_icon' , ('True', '((True)|(False))')), + ('icon', ('movie-trailers', '[a-zA-Z0-9_.-]+')), \ ('enable_plexconnect_autodetect', ('True', '((True)|(False))')), ('ip_plexconnect' , ('0.0.0.0', '([0-9]{1,3}\.){3}[0-9]{1,3}')), diff --git a/WebServer.py b/WebServer.py index f21b0faed..cf08170f7 100755 --- a/WebServer.py +++ b/WebServer.py @@ -198,7 +198,22 @@ def do_GET(self): JS = JSConverter(basename, options) self.sendResponse(JS, 'text/javascript', True) return - + + # proxy phobos.apple.com to support PlexConnect main icon + if "a1.phobos.apple.com" in self.headers['Host']: + resource = self.headers['Host']+self.path + icon = g_param['CSettings'].getSetting('icon') + if basename.startswith(icon): + icon_res = basename[len(icon):] # cut string from settings, keeps @720.png/@1080.png + resource = sys.path[0] + '/assets/icons/icon'+icon_res + dprint(__name__, 1, "serving "+self.headers['Host']+self.path+" with "+resource) + r = open(resource, "rb") + else: + r = urllib.urlopen('http://'+resource) + self.sendResponse(r.read(), 'image/png', False) + r.close() + return + # serve "*.jpg" - thumbnails for old-style mainpage if self.path.endswith(".jpg"): dprint(__name__, 1, "serving *.jpg: "+self.path) @@ -376,8 +391,8 @@ def Run_SSL(cmdPipe, param): param['IP_self'] = '192.168.178.20' # IP_self? param['baseURL'] = 'http://'+ param['IP_self'] +':'+ cfg.getSetting('port_webserver') - param['HostToIntercept'] = 'trailers.apple.com' - + param['HostToIntercept'] = cfg.getSetting('hosttointercept') + if len(sys.argv)==1: Run(cmdPipe[1], param) elif len(sys.argv)==2 and sys.argv[1]=='SSL': diff --git a/XMLConverter.py b/XMLConverter.py index 5febb65ec..1899f2f7c 100755 --- a/XMLConverter.py +++ b/XMLConverter.py @@ -1379,8 +1379,8 @@ def ATTRIB_BACKGROUNDURL(self, src, srcXML, param): cfg = Settings.CSettings() param = {} param['CSettings'] = cfg - - param['HostToIntercept'] = 'trailers.apple.com' + + param['HostToIntercept'] = cfg.getSetting('hosttointercept') setParams(param) cfg = ATVSettings.CATVSettings() diff --git a/assets/icons/icon@1080.png b/assets/icons/icon@1080.png new file mode 100755 index 000000000..21a5f1556 Binary files /dev/null and b/assets/icons/icon@1080.png differ diff --git a/assets/icons/icon@720.png b/assets/icons/icon@720.png new file mode 100755 index 000000000..020db1d79 Binary files /dev/null and b/assets/icons/icon@720.png differ