2019-06-08, 09:53
Hello,
i wrote in the autostart file of Kodi the following code:
he loads a file from my Server and move them to my place.
At the end of the code i try a "time.sleep(10)" because i need a little bit time before Kodi starts, he must have time to download and move the file.
"time.sleep()" dont works, kodi starts directly, gives a way to wait 10 seconds?
The Problem is the Firetv4k i dont find another way as the autoexec file of Kodi.
Perhaps someone has a idea......
i wrote in the autostart file of Kodi the following code:
python:import requests
import time
import os
# Datei wird heruntergeladen und kopiert
def LogMessage(msg):
f = open('/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/userdata/logepg.log', 'wt')
f.write(msg + ' ' + time.strftime('%d.%m.%Y %H:%M:%S'))
f.close()
# Alte guide-zatoo.xml loeschen
try:
os.remove('/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/userdata/guide-zatoo.xml')
except:
LogMessage('Die Datei konnte nicht geloescht werden!')
# Neue guide-zatoo.xml herunterladen und verschieben
try:
url = 'http://XXXX:XXXX@XXXXX/guide-zatoo.xml'
myfile = requests.get(url)
open('/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/userdata/guide-zatoo.xml', 'wb').write(myfile.content)
except:
LogMessage('Die Datei konnte nicht heruntergeladen werden!')
# pruefen ob heruntergeladene Datei existiert
exists = os.path.isfile('/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/userdata/guide-zatoo.xml')
if exists:
# Wird ausgefuehrt wenn Datei existiert
LogMessage('Die Datei wurde erfolgreich heruntergeladen!')
else:
# Wird ausgefuehrt wenn Datei nicht existiert
LogMessage('Die Datei konnte nicht heruntergeladen werden!')
time.sleep(10)
he loads a file from my Server and move them to my place.
At the end of the code i try a "time.sleep(10)" because i need a little bit time before Kodi starts, he must have time to download and move the file.
"time.sleep()" dont works, kodi starts directly, gives a way to wait 10 seconds?
The Problem is the Firetv4k i dont find another way as the autoexec file of Kodi.
Perhaps someone has a idea......