Skip to content

Commit 9ca0914

Browse files
committed
hacky fix for ecfa 2019 pack, sigh...
1 parent f3760d7 commit 9ca0914

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

api/management/commands/scan_packs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ def save_notedata(chart):
291291
is_ssc = True
292292
chart_path = working_path + chart_filename
293293
if os.path.exists(chart_path):
294+
#print(chart_path)
294295
lines = read_lines_decoded(chart_path)
295296
# pull all of the notedata out and store it in the db
296297
for line in lines:
@@ -332,6 +333,10 @@ def save_notedata(chart):
332333
else:
333334
file_meter = 1
334335
else:
336+
#if line is empty, skip it (ECFA 2019 grrr)
337+
preview, lines = utils.peek(lines)
338+
if not preview.strip():
339+
next(lines, None)
335340
file_charttype = next(lines, None).strip().rstrip(':')
336341
file_description = next(lines, None).strip().rstrip(":")
337342
file_difficulty = next(lines, None).strip().rstrip(":")

api/management/scripts/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import re
77
import shutil
88
import subprocess
9+
import itertools
910
import hashlib
1011
import zipfile
1112
from concurrent.futures import ThreadPoolExecutor
@@ -158,4 +159,8 @@ def cleanup_dir(directory):
158159
elif os.path.isdir(file_path):
159160
shutil.rmtree(file_path)
160161
except Exception as e:
161-
print(f"Failed to delete {file_path}. Reason: {e}")
162+
print(f"Failed to delete {file_path}. Reason: {e}")
163+
164+
def peek(iterator):
165+
clone, preview = itertools.tee(iterator)
166+
return next(preview, None), clone

0 commit comments

Comments
 (0)