Skip to content

Commit

Permalink
Symlink fixes (#75)
Browse files Browse the repository at this point in the history
* Fix range index issues on episode check

* Fix docstring

---------

Co-authored-by: Dreu Lavelle <[email protected]>
  • Loading branch information
2 people authored and AyushSehrawat committed Dec 20, 2023
1 parent 370d1b3 commit c13b124
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions backend/program/symlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@


class Symlinker(threading.Thread):
"""Content class for mdblist"""
"""
A class that represents a symlinker thread.
Attributes:
media_items (MediaItemContainer): The container of media items.
running (bool): Flag indicating if the thread is running.
cache (dict): A dictionary to cache file paths.
mount_path (str): The absolute path of the container mount.
host_path (str): The absolute path of the host mount.
symlink_path (str): The path where the symlinks will be created.
cache_thread (ThreadRunner): The thread runner for updating the cache.
"""

def __init__(self, media_items: MediaItemContainer):
# Symlinking is required
Expand Down Expand Up @@ -95,9 +106,10 @@ def _run(self):
episode = obj["episode"]
if type(episode) == list:
for sub_episode in episode:
season.episodes[sub_episode - 1].set(
"file", file["filename"]
)
if sub_episode - 1 in range(len(season.episodes)):
season.episodes[sub_episode - 1].set(
"file", file["filename"]
)
else:
index = obj["episode"] - 1
if index in range(len(season.episodes)):
Expand Down

0 comments on commit c13b124

Please sign in to comment.