Check to see any WADs were returned before trying to fetch them.
This commit is contained in:
parent
081b7e2dee
commit
a3a970a22f
1 changed files with 3 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ import json
|
||||||
import pathlib
|
import pathlib
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
|
|
@ -40,6 +41,8 @@ class Fetch(dcc.config.Base):
|
||||||
"https://www.doomworld.com/idgames/api/" +
|
"https://www.doomworld.com/idgames/api/" +
|
||||||
"api.php?action=search&query={}&out=json".format(wad)
|
"api.php?action=search&query={}&out=json".format(wad)
|
||||||
)
|
)
|
||||||
|
if "content" not in reply:
|
||||||
|
sys.exit(f"No WAD named {wad} found on idgames.")
|
||||||
files = reply["content"]["file"]
|
files = reply["content"]["file"]
|
||||||
if type(files) is dict: # One result.
|
if type(files) is dict: # One result.
|
||||||
return files["id"]
|
return files["id"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue