Skip to content

Commit 07e2b84

Browse files
committed
fix: jellyfin updating using wrong endpoint
1 parent 28be3d7 commit 07e2b84

File tree

1 file changed

+12
-44
lines changed

1 file changed

+12
-44
lines changed

src/program/services/updaters/jellyfin.py

+12-44
Original file line numberDiff line numberDiff line change
@@ -57,54 +57,22 @@ def validate(self) -> bool:
5757

5858
def run(self, item: MediaItem) -> Generator[MediaItem, None, None]:
5959
"""Update Jellyfin library for a single item or a season with its episodes"""
60-
items_to_update = []
61-
62-
if item.type in ["movie", "episode"]:
63-
items_to_update = [item]
64-
elif item.type == "show":
65-
for season in item.seasons:
66-
items_to_update += [e for e in season.episodes if e.symlinked and e.update_folder != "updated"]
67-
elif item.type == "season":
68-
items_to_update = [e for e in item.episodes if e.symlinked and e.update_folder != "updated"]
69-
70-
if not items_to_update:
71-
logger.debug(f"No items to update for {item.log_string}")
72-
return
73-
74-
updated = False
75-
updated_episodes = []
76-
77-
for item_to_update in items_to_update:
78-
if self.update_item(item_to_update):
79-
updated_episodes.append(item_to_update)
80-
updated = True
81-
82-
if updated:
83-
if item.type in ["show", "season"]:
84-
if len(updated_episodes) == len(items_to_update):
85-
logger.log("JELLYFIN", f"Updated all episodes for {item.log_string}")
86-
else:
87-
updated_episodes_log = ", ".join([str(ep.number) for ep in updated_episodes])
88-
logger.log("JELLYFIN", f"Updated episodes {updated_episodes_log} in {item.log_string}")
89-
else:
90-
logger.log("JELLYFIN", f"Updated {item.log_string}")
91-
60+
self.update_item()
61+
logger.log("JELLYFIN", f"Updated {item.log_string}")
9262
yield item
9363

9464

95-
def update_item(self, item: MediaItem) -> bool:
65+
def update_item(self) -> bool:
9666
"""Update the Jellyfin item"""
97-
if item.symlinked and item.update_folder != "updated" and item.symlink_path:
98-
try:
99-
response = self.request_handler.execute(HttpMethod.POST,
100-
f"{self.settings.url}/Library/Media/Updated",
101-
json={"Updates": [{"Path": item.symlink_path, "UpdateType": "Created"}]},
102-
params={"api_key": self.settings.api_key},
103-
)
104-
if response.is_ok:
105-
return True
106-
except Exception as e:
107-
logger.error(f"Failed to update Jellyfin item: {e}")
67+
try:
68+
response = self.request_handler.execute(HttpMethod.POST,
69+
f"{self.settings.url}/Library/Refresh",
70+
params={"api_key": self.settings.api_key},
71+
)
72+
if response.is_ok:
73+
return True
74+
except Exception as e:
75+
logger.error(f"Failed to update Jellyfin item: {e}")
10876
return False
10977

11078
# not needed to update, but maybe useful in the future?

0 commit comments

Comments
 (0)