ottimizzazione cloudflare all'avvio
This commit is contained in:
@@ -25,5 +25,6 @@
|
|||||||
"enabled": false,
|
"enabled": false,
|
||||||
"visible": false
|
"visible": false
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"cloudflare": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,5 +7,6 @@
|
|||||||
"thumbnail": "piratestreaming.png",
|
"thumbnail": "piratestreaming.png",
|
||||||
"bannermenu": "piratestreaming.png",
|
"bannermenu": "piratestreaming.png",
|
||||||
"categories": ["anime","movie","tvshow"],
|
"categories": ["anime","movie","tvshow"],
|
||||||
"settings": []
|
"settings": [],
|
||||||
|
"cloudflare": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,5 +7,6 @@
|
|||||||
"thumbnail": "seriehd.png",
|
"thumbnail": "seriehd.png",
|
||||||
"banner": "seriehd.png",
|
"banner": "seriehd.png",
|
||||||
"categories": ["tvshow"],
|
"categories": ["tvshow"],
|
||||||
"settings": []
|
"settings": [],
|
||||||
|
"cloudflare": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,5 +42,6 @@
|
|||||||
"visible": false
|
"visible": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"thumbnail": "server_akvideo.png"
|
"thumbnail": "server_akvideo.png",
|
||||||
|
"cloudflare": true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,5 +42,6 @@
|
|||||||
"type": "list",
|
"type": "list",
|
||||||
"visible": false
|
"visible": false
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"cloudflare": true
|
||||||
}
|
}
|
||||||
|
|||||||
+29
-2
@@ -5,8 +5,7 @@
|
|||||||
|
|
||||||
import datetime, imp, math, threading, traceback, sys, glob
|
import datetime, imp, math, threading, traceback, sys, glob
|
||||||
|
|
||||||
|
import channelselector
|
||||||
|
|
||||||
from platformcode import config
|
from platformcode import config
|
||||||
try:
|
try:
|
||||||
import xbmc, os
|
import xbmc, os
|
||||||
@@ -333,7 +332,35 @@ def monitor_update():
|
|||||||
# config.set_setting(name=data[channel_file], value="value", channel=channel_file)
|
# config.set_setting(name=data[channel_file], value="value", channel=channel_file)
|
||||||
# except: pass #channel not in json
|
# except: pass #channel not in json
|
||||||
|
|
||||||
|
# always bypass al websites that use cloudflare at startup, so there's no need to wait 5 seconds when opened
|
||||||
|
def callCloudflare():
|
||||||
|
from core import httptools, support
|
||||||
|
import json
|
||||||
|
channels_path = os.path.join(config.get_runtime_path(), "channels", '*.json')
|
||||||
|
channel_files = [os.path.splitext(os.path.basename(c))[0] for c in glob.glob(channels_path)]
|
||||||
|
for channel_name in channel_files:
|
||||||
|
channel_parameters = channeltools.get_channel_parameters(channel_name)
|
||||||
|
if 'cloudflare' in channel_parameters and channel_parameters["cloudflare"]:
|
||||||
|
channel = __import__('channels.%s' % channel_name, fromlist=["channels.%s" % channel_name])
|
||||||
|
try:
|
||||||
|
channel.findhost()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
httptools.downloadpage(channel.host)
|
||||||
|
|
||||||
|
servers_path = os.path.join(config.get_runtime_path(), "servers", '*.json')
|
||||||
|
servers_files = glob.glob(servers_path)
|
||||||
|
for server in servers_files:
|
||||||
|
with open(server) as server:
|
||||||
|
server_parameters = json.load(server)
|
||||||
|
if 'cloudflare' in server_parameters and server_parameters["cloudflare"]:
|
||||||
|
patternUrl = server_parameters["find_videos"]["patterns"][0]["url"]
|
||||||
|
url = '/'.join(patternUrl.split('/')[:3])
|
||||||
|
httptools.downloadpage(url)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
threading.Thread(target=callCloudflare())
|
||||||
# Se ejecuta en cada inicio
|
# Se ejecuta en cada inicio
|
||||||
import xbmc
|
import xbmc
|
||||||
import time
|
import time
|
||||||
|
|||||||
Reference in New Issue
Block a user