Skip to content

Commit 0e5343d

Browse files
fix: small bug fixes
1 parent 9a3b4af commit 0e5343d

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

app/core/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ async def lifespan(app: FastAPI):
8686
async def configure_page(token: str | None = None):
8787
index_path = static_dir / "index.html"
8888
if index_path.exists():
89-
html_content = index_path.read_text(encoding="utf-8")
89+
with open(index_path, encoding="utf-8") as file:
90+
html_content = file.read()
9091
dynamic_announcement = os.getenv("ANNOUNCEMENT_HTML")
9192
if dynamic_announcement is None:
9293
dynamic_announcement = settings.ANNOUNCEMENT_HTML

app/core/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Settings(BaseSettings):
1717
PORT: int = 8000
1818
ADDON_ID: str = "com.bimal.watchly"
1919
ADDON_NAME: str = "Watchly"
20-
APP_VERSION: str = "0.1.3"
20+
APP_VERSION: str = "0.1.4"
2121
REDIS_URL: str = "redis://redis:6379/0"
2222
TOKEN_SALT: str = "change-me"
2323
TOKEN_TTL_SECONDS: int = 0 # 0 = never expire

app/services/stremio_service.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ async def get_library_items(self) -> dict[str, list[dict]]:
170170
]
171171
logger.info(f"Filtered {len(watched_items)} watched library items")
172172

173-
# Sort watched items by modification time (most recent first)
174-
watched_items.sort(key=lambda x: x.get("_mtime", ""), reverse=True)
173+
# Sort watched items by watched time (most recent first)
174+
watched_items.sort(key=lambda x: x.get("state", {}).get("lastWatched", ""), reverse=True)
175175

176176
# is_loved only until we find 10 movies and 10 series
177177
loved_items = []
@@ -225,7 +225,7 @@ async def get_library_items(self) -> dict[str, list[dict]]:
225225
{
226226
"type": item.get("type"),
227227
"_id": item.get("_id"),
228-
"_mtime": item.get("_mtime", ""),
228+
"_mtime": item.get("state", {}).get("lastWatched", ""),
229229
"name": item.get("name"),
230230
}
231231
)
@@ -237,7 +237,7 @@ async def get_library_items(self) -> dict[str, list[dict]]:
237237
{
238238
"type": item.get("type"),
239239
"_id": item.get("_id"),
240-
"_mtime": item.get("_mtime", ""),
240+
"_mtime": item.get("state", {}).get("lastWatched", ""),
241241
"name": item.get("name"),
242242
}
243243
)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "watchly"
3-
version = "0.1.0"
3+
version = "0.1.4"
44
description = "Add your description here"
55
readme = "README.md"
66
requires-python = ">=3.10"

0 commit comments

Comments
 (0)