Skip to content

Commit

Permalink
🚑 hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
jurialmunkey committed May 18, 2024
1 parent 65d01ee commit fbbb038
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon id="script.skinvariables"
version="2.1.12"
version="2.1.13"
name="Skin Variables"
provider-name="jurialmunkey">
<requires>
Expand Down
25 changes: 11 additions & 14 deletions resources/lib/lists/filterdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,9 +649,6 @@ def get_directory(self, paths=None, library=None, no_label_dupes=False, dbtype=N
'video': DIRECTORY_PROPERTIES_VIDEO,
'music': DIRECTORY_PROPERTIES_MUSIC}.get(library) or []

seed_paths = paths.copy()
seed_names = names.copy()

def _make_item(i, path_name=None):
if not i:
return
Expand Down Expand Up @@ -692,42 +689,42 @@ def _get_sorting(i):
return (x, v) # Sorted will sort by first value in tuple, then second order afterwards

def _get_indexed_path(x=0):
paths = [seed_paths.pop(x)]
seed_paths = [paths.pop(x)]
try:
names = [seed_names.pop(x)]
seed_names = [names.pop(x)]
except (IndexError, TypeError):
names = None
return (paths, names)
seed_names = None
return (seed_paths, seed_names)

def _get_random_path():
import random
x = random.choice(range(len(seed_paths)))
x = random.choice(range(len(paths)))
return _get_indexed_path(x)

def _get_paths_names_tuple():
if not seed_paths or len(seed_paths) < 1:
if not paths or len(paths) < 1:
return (None, None)
if boolean(randomise):
return _get_random_path()
if boolean(fallback):
return _get_indexed_path(0)
return (seed_paths, seed_names)
return (paths, names)

def _get_items_from_paths():
items = []
paths, names = _get_paths_names_tuple()
seed_paths, seed_names = _get_paths_names_tuple()

for x, path in enumerate(paths):
for x, path in enumerate(seed_paths):
try:
path_name = names[x]
path_name = seed_names[x]
except (IndexError, TypeError):
path_name = ''
directory = get_directory(path, directory_properties)
with ParallelThread(directory, _make_item, path_name) as pt:
item_queue = pt.queue
items += [i for i in item_queue if i and (not no_label_dupes or _is_not_dupe(i))]

if not items and len(seed_paths) > 0:
if not items and len(paths) > 0:
if boolean(randomise) or boolean(fallback):
return _get_items_from_paths()

Expand Down

0 comments on commit fbbb038

Please sign in to comment.