mirror of
https://github.com/barronwaffles/dwc_network_server_emulator.git
synced 2026-04-26 00:57:39 -05:00
Merge pull request #510 from sepalani/count_attr
DLS1: Fix filters on count action w/o list files
This commit is contained in:
commit
975ef50fe4
19
other/dlc.py
19
other/dlc.py
|
|
@ -153,20 +153,17 @@ def download_count(dlc_path, post):
|
||||||
"""Handle download count request."""
|
"""Handle download count request."""
|
||||||
if post["gamecd"] in gamecodes_return_random_file:
|
if post["gamecd"] in gamecodes_return_random_file:
|
||||||
return "1"
|
return "1"
|
||||||
elif os.path.exists(dlc_path):
|
if os.path.exists(dlc_path):
|
||||||
|
attr1 = post.get("attr1", None)
|
||||||
|
attr2 = post.get("attr2", None)
|
||||||
|
attr3 = post.get("attr3", None)
|
||||||
if os.path.isfile(os.path.join(dlc_path, "_list.txt")):
|
if os.path.isfile(os.path.join(dlc_path, "_list.txt")):
|
||||||
attr1 = post.get("attr1", None)
|
|
||||||
attr2 = post.get("attr2", None)
|
|
||||||
attr3 = post.get("attr3", None)
|
|
||||||
|
|
||||||
dlc_file = safeloadfi(dlc_path, "_list.txt")
|
dlc_file = safeloadfi(dlc_path, "_list.txt")
|
||||||
ls = filter_list(dlc_file, attr1, attr2, attr3)
|
ls = filter_list(dlc_file, attr1, attr2, attr3)
|
||||||
count = get_file_count(ls)
|
return "{}".format(get_file_count(ls))
|
||||||
else:
|
elif attr1 is None and attr2 is None and attr3 is None:
|
||||||
count = len(os.listdir(dlc_path))
|
return "{}".format(len(os.listdir(dlc_path)))
|
||||||
return "%d" % count
|
return "0"
|
||||||
else:
|
|
||||||
return "0"
|
|
||||||
|
|
||||||
|
|
||||||
def download_size(dlc_path, name):
|
def download_size(dlc_path, name):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user