mirror of
https://github.com/rwinkhart/reflexify.git
synced 2026-08-28 04:46:39 -04:00
Bypass IndexError when running without having a file in each slot for all categories
This commit is contained in:
+60
-52
@@ -19,59 +19,67 @@ sorted_dir = args.sorted_dir[0].rstrip('/') + '/'
|
|||||||
for i in range(1, 9):
|
for i in range(1, 9):
|
||||||
# national
|
# national
|
||||||
options = [f.path for f in scandir(sorted_dir + 'National/' + str(i)) if f.is_dir()]
|
options = [f.path for f in scandir(sorted_dir + 'National/' + str(i)) if f.is_dir()]
|
||||||
track = choice(options)
|
try:
|
||||||
if islink(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.database"):
|
track = choice(options)
|
||||||
remove(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.database")
|
if islink(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.database"):
|
||||||
if islink(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.level"):
|
remove(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.database")
|
||||||
remove(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.level")
|
if islink(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.level"):
|
||||||
if islink(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.package"):
|
remove(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.level")
|
||||||
remove(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.package")
|
if islink(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.package"):
|
||||||
if islink(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.scene"):
|
remove(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.package")
|
||||||
remove(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.scene")
|
if islink(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.scene"):
|
||||||
symlink(f"{track}/Beta_Nat_Track_Slot_{str(i)}.dx9.database",
|
remove(f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.scene")
|
||||||
f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.database")
|
symlink(f"{track}/Beta_Nat_Track_Slot_{str(i)}.dx9.database",
|
||||||
symlink(f"{track}/Beta_Nat_Track_Slot_{str(i)}.dx9.level",
|
f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.database")
|
||||||
f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.level")
|
symlink(f"{track}/Beta_Nat_Track_Slot_{str(i)}.dx9.level",
|
||||||
symlink(f"{track}/Beta_Nat_Track_Slot_{str(i)}.dx9.package",
|
f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.level")
|
||||||
f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.package")
|
symlink(f"{track}/Beta_Nat_Track_Slot_{str(i)}.dx9.package",
|
||||||
symlink(f"{track}/Beta_Nat_Track_Slot_{str(i)}.dx9.scene",
|
f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.package")
|
||||||
f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.scene")
|
symlink(f"{track}/Beta_Nat_Track_Slot_{str(i)}.dx9.scene",
|
||||||
|
f"{database_dir}Beta_Nat_Track_Slot_{str(i)}.dx9.scene")
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
# supercross
|
# supercross
|
||||||
options = [f.path for f in scandir(sorted_dir + 'Supercross/' + str(i)) if f.is_dir()]
|
options = [f.path for f in scandir(sorted_dir + 'Supercross/' + str(i)) if f.is_dir()]
|
||||||
track = choice(options)
|
try:
|
||||||
if islink(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.database"):
|
track = choice(options)
|
||||||
remove(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.database")
|
if islink(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.database"):
|
||||||
if islink(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.level"):
|
remove(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.database")
|
||||||
remove(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.level")
|
if islink(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.level"):
|
||||||
if islink(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.package"):
|
remove(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.level")
|
||||||
remove(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.package")
|
if islink(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.package"):
|
||||||
if islink(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.scene"):
|
remove(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.package")
|
||||||
remove(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.scene")
|
if islink(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.scene"):
|
||||||
symlink(f"{track}/Beta_Sx_Track_Slot_{str(i)}.dx9.database",
|
remove(f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.scene")
|
||||||
f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.database")
|
symlink(f"{track}/Beta_Sx_Track_Slot_{str(i)}.dx9.database",
|
||||||
symlink(f"{track}/Beta_Sx_Track_Slot_{str(i)}.dx9.level",
|
f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.database")
|
||||||
f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.level")
|
symlink(f"{track}/Beta_Sx_Track_Slot_{str(i)}.dx9.level",
|
||||||
symlink(f"{track}/Beta_Sx_Track_Slot_{str(i)}.dx9.package",
|
f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.level")
|
||||||
f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.package")
|
symlink(f"{track}/Beta_Sx_Track_Slot_{str(i)}.dx9.package",
|
||||||
symlink(f"{track}/Beta_Sx_Track_Slot_{str(i)}.dx9.scene",
|
f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.package")
|
||||||
f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.scene")
|
symlink(f"{track}/Beta_Sx_Track_Slot_{str(i)}.dx9.scene",
|
||||||
|
f"{database_dir}Beta_Sx_Track_Slot_{str(i)}.dx9.scene")
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
# free ride
|
# free ride
|
||||||
options = [f.path for f in scandir(sorted_dir + 'Free Ride/' + str(i)) if f.is_dir()]
|
options = [f.path for f in scandir(sorted_dir + 'Free Ride/' + str(i)) if f.is_dir()]
|
||||||
track = choice(options)
|
try:
|
||||||
if islink(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.database"):
|
track = choice(options)
|
||||||
remove(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.database")
|
if islink(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.database"):
|
||||||
if islink(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.level"):
|
remove(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.database")
|
||||||
remove(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.level")
|
if islink(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.level"):
|
||||||
if islink(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.package"):
|
remove(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.level")
|
||||||
remove(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.package")
|
if islink(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.package"):
|
||||||
if islink(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.scene"):
|
remove(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.package")
|
||||||
remove(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.scene")
|
if islink(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.scene"):
|
||||||
symlink(f"{track}/Beta_Track_Slot_{str(i)}.dx9.database",
|
remove(f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.scene")
|
||||||
f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.database")
|
symlink(f"{track}/Beta_Track_Slot_{str(i)}.dx9.database",
|
||||||
symlink(f"{track}/Beta_Track_Slot_{str(i)}.dx9.level",
|
f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.database")
|
||||||
f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.level")
|
symlink(f"{track}/Beta_Track_Slot_{str(i)}.dx9.level",
|
||||||
symlink(f"{track}/Beta_Track_Slot_{str(i)}.dx9.package",
|
f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.level")
|
||||||
f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.package")
|
symlink(f"{track}/Beta_Track_Slot_{str(i)}.dx9.package",
|
||||||
symlink(f"{track}/Beta_Track_Slot_{str(i)}.dx9.scene",
|
f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.package")
|
||||||
f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.scene")
|
symlink(f"{track}/Beta_Track_Slot_{str(i)}.dx9.scene",
|
||||||
|
f"{database_dir}Beta_Track_Slot_{str(i)}.dx9.scene")
|
||||||
|
except IndexError:
|
||||||
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user