mirror of
https://github.com/Jonny007-MKD/OTR-SaneRename
synced 2025-01-22 08:49:48 +01:00
Catch exception when downloading EPG
This commit is contained in:
parent
a5b6136bf3
commit
e48cc4a690
1 changed files with 5 additions and 1 deletions
|
@ -256,7 +256,11 @@ def getEpgData(info: EpisodeInfo):
|
||||||
def downloadEpg():
|
def downloadEpg():
|
||||||
url = f"https://www.onlinetvrecorder.com/epg/csv/epg_{info.datetime.strftime('%Y_%m_%d')}.csv"
|
url = f"https://www.onlinetvrecorder.com/epg/csv/epg_{info.datetime.strftime('%Y_%m_%d')}.csv"
|
||||||
logging.debug(f" downloadEpg(): {url}")
|
logging.debug(f" downloadEpg(): {url}")
|
||||||
|
try:
|
||||||
request = urllib.request.urlopen(url)
|
request = urllib.request.urlopen(url)
|
||||||
|
except requests.exceptions.HTTPError as e:
|
||||||
|
logging.error(f" failed: {e}")
|
||||||
|
sys.exit(ExitCode.DownloadingEPGFailed)
|
||||||
if request.getcode() == 200:
|
if request.getcode() == 200:
|
||||||
data = request.read().decode('latin-1')
|
data = request.read().decode('latin-1')
|
||||||
with open(filepath, 'w') as f:
|
with open(filepath, 'w') as f:
|
||||||
|
|
Loading…
Reference in a new issue