Initial commit: xStream Downloader
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
BASE=/home/matthiasberner/Schreibtisch/kodi/xstreamDownloader
|
||||
|
||||
# 1. Replace tools.py with fixed version
|
||||
cp "$BASE/xstream/resources/lib/_tools_fixed.py" "$BASE/xstream/resources/lib/tools.py"
|
||||
|
||||
# 2. Fix requestHandler.py - guard sUrl
|
||||
python3 -c "
|
||||
with open('$BASE/xstream/resources/lib/handler/requestHandler.py') as f:
|
||||
c = f.read()
|
||||
old = ' self._sUrl = self.__cleanupUrl(sUrl)'
|
||||
new = ' if not isinstance(sUrl, str): sUrl = \"\"\n self._sUrl = self.__cleanupUrl(sUrl)'
|
||||
if old in c and 'not isinstance' not in c:
|
||||
c = c.replace(old, new)
|
||||
with open('$BASE/xstream/resources/lib/handler/requestHandler.py', 'w') as f:
|
||||
f.write(c)
|
||||
print('requestHandler fixed')
|
||||
else:
|
||||
print('requestHandler already fixed')
|
||||
"
|
||||
|
||||
# 3. Fix mini_app.py - collecting_gui passthrough + openSettings
|
||||
python3 -c "
|
||||
with open('$BASE/mini_app.py') as f:
|
||||
c = f.read()
|
||||
|
||||
# Fix collecting_gui=False -> collecting_gui
|
||||
if 'site_mod.load(collecting_gui=False)' in c:
|
||||
c = c.replace('site_mod.load(collecting_gui=False)', 'site_mod.load(collecting_gui=collecting_gui)')
|
||||
print('Fixed collecting_gui passthrough')
|
||||
else:
|
||||
print('collecting_gui already fixed')
|
||||
|
||||
# Add openSettings to _MockAddon
|
||||
if 'def openSettings' not in c:
|
||||
c = c.replace(' def getAddonInfo(self, key):',
|
||||
' def openSettings(self, *args, **kwargs):\n pass\n\n def getAddonInfo(self, key):')
|
||||
print('Added openSettings')
|
||||
|
||||
with open('$BASE/mini_app.py', 'w') as f:
|
||||
f.write(c)
|
||||
"
|
||||
|
||||
# 4. Kill old server, start new
|
||||
fuser -k 8765/tcp 2>/dev/null
|
||||
sleep 1
|
||||
cd "$BASE"
|
||||
python3 mini_app.py > /tmp/server.log 2>&1 &
|
||||
SERVER_PID=$!
|
||||
sleep 3
|
||||
|
||||
# 5. Test
|
||||
echo "=== Server PID: $SERVER_PID ==="
|
||||
curl -s http://127.0.0.1:8765/api/sites | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'Sites OK: {len(d)} sites')" 2>&1
|
||||
curl -s http://127.0.0.1:8765/api/sites/hdfilme/entries | python3 -c "import sys,json; d=json.load(sys.stdin); print(f'Entries: {len(d)}')" 2>&1
|
||||
echo "=== Log tail ==="
|
||||
tail -5 /tmp/server.log
|
||||
Reference in New Issue
Block a user