Skip to content

Commit af6910a

Browse files
committed
simplified logic in merging
1 parent e7f4c5f commit af6910a

1 file changed

Lines changed: 16 additions & 36 deletions

File tree

logic.py

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -152,31 +152,21 @@ def mergeNewSkin(self):
152152
self.merge_skin_path, mania_sections[keycount])
153153

154154
missing_files = []
155-
for i in needed_files:
155+
for image in needed_files:
156156
found = False
157-
hd_image = IniParser.getHDImage(i)
158-
if os.path.exists(hd_image):
159-
shutil.copy(hd_image, key_folder)
160-
found = True
157+
hd_image = IniParser.getHDImage(image)
161158

162-
if os.path.exists(i):
163-
shutil.copy(i, key_folder)
164-
found = True
159+
images = [image, hd_image]
165160

166-
if IniParser.animationExists(hd_image) or IniParser.animationExists(i):
167-
if IniParser.animationExists(hd_image):
168-
for animation in IniParser.getAnimations(hd_image):
169-
shutil.copy(animation, key_folder)
161+
for i in images:
162+
if os.path.exists(i):
163+
shutil.copy(i, key_folder)
164+
found = True
170165

171166
if IniParser.animationExists(i):
172167
for animation in IniParser.getAnimations(i):
173168
shutil.copy(animation, key_folder)
174-
175-
found = True
176-
177-
if os.path.exists(i):
178-
shutil.copy(i, key_folder)
179-
found = True
169+
found = True
180170

181171
if not found:
182172
missing_files.append(os.path.basename(i))
@@ -256,31 +246,21 @@ def overwriteSkin(self):
256246

257247
missing_files = []
258248

259-
for i in needed_files:
249+
for image in needed_files:
260250
found = False
261-
hd_image = IniParser.getHDImage(i)
262-
if os.path.exists(hd_image):
263-
shutil.copy(hd_image, key_folder)
264-
found = True
251+
hd_image = IniParser.getHDImage(image)
265252

266-
if os.path.exists(i):
267-
shutil.copy(i, key_folder)
268-
found = True
253+
images = [image, hd_image]
269254

270-
if IniParser.animationExists(hd_image) or IniParser.animationExists(i):
271-
if IniParser.animationExists(hd_image):
272-
for animation in IniParser.getAnimations(hd_image):
273-
shutil.copy(animation, key_folder)
255+
for i in images:
256+
if os.path.exists(i):
257+
shutil.copy(i, key_folder)
258+
found = True
274259

275260
if IniParser.animationExists(i):
276261
for animation in IniParser.getAnimations(i):
277262
shutil.copy(animation, key_folder)
278-
279-
found = True
280-
281-
if os.path.exists(i):
282-
shutil.copy(i, key_folder)
283-
found = True
263+
found = True
284264

285265
if not found:
286266
missing_files.append(os.path.basename(i))

0 commit comments

Comments
 (0)