Compare commits
81 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
46b60bb866 | ||
|
|
5670c3ad97 | ||
|
|
7e0f4babda | ||
|
|
d5c36c61ec | ||
|
|
69cd73d965 | ||
|
|
229ab59b44 | ||
|
|
3e474a4593 | ||
|
|
69958a257b | ||
|
|
64c1823e5b | ||
|
|
446f6df470 | ||
|
|
91ea5d76f6 | ||
|
|
dc26b9a7b1 | ||
|
|
d98b7c3e09 | ||
|
|
93d9471333 | ||
|
|
e6fa8ae745 | ||
|
|
5b644a54a2 | ||
|
|
5a17c5f7a1 | ||
|
|
61e3dddd6b | ||
|
|
aaaa7eba70 | ||
|
|
991355716d | ||
|
|
54bd6e836f | ||
|
|
57c41f41bc | ||
|
|
ea85a31d9c | ||
|
|
80d5c9e54c | ||
|
|
5828701944 | ||
|
|
81ba9bd7f9 | ||
|
|
d15759570e | ||
|
|
1b88ecf2eb | ||
|
|
c62809c615 | ||
|
|
899a6b05a4 | ||
|
|
fcd6103e17 | ||
|
|
ac5be474f8 | ||
|
|
d15f29b772 | ||
|
|
c9944866f8 | ||
|
|
846e18fffe | ||
|
|
eb09de2bdf | ||
|
|
c0e207924c | ||
|
|
e48533dfbd | ||
|
|
8503b087b2 | ||
|
|
305fea8f9a | ||
|
|
588c23ce41 | ||
|
|
8f4a2e2690 | ||
|
|
38e65f5a17 | ||
|
|
de32d59aa1 | ||
|
|
998f2b1209 | ||
|
|
0b02f531c1 | ||
|
|
e589935b37 | ||
|
|
031d43e980 | ||
|
|
ba6cad13f6 | ||
|
|
f3801a0bd2 | ||
|
|
196a49fca4 | ||
|
|
4d0f1d303f | ||
|
|
ce5b810a5b | ||
|
|
a1e1ccde42 | ||
|
|
bf633c75d1 | ||
|
|
46fa5e7c9a | ||
|
|
170757aca1 | ||
|
|
9786e9e27d | ||
|
|
8b691b7bfa | ||
|
|
e1c65fc082 | ||
|
|
58749a4fb8 | ||
|
|
51ec69f651 | ||
|
|
4771f736b0 | ||
|
|
8d7436579e | ||
|
|
43e1df98b1 | ||
|
|
3017030f52 | ||
|
|
348a0b8226 | ||
|
|
4e60c08120 | ||
|
|
10b58379cd | ||
|
|
fa9201b20f | ||
|
|
86f72997b4 | ||
|
|
62d0319aad | ||
|
|
a096a09eb7 | ||
|
|
7294241fed | ||
|
|
a5995d3999 | ||
|
|
30f31b2f3f | ||
|
|
bc09c873e9 | ||
|
|
8428be9dda | ||
|
|
6a45ad18f9 | ||
|
|
023b638729 | ||
|
|
4a4c9f9ccf |
@@ -1,3 +1,4 @@
|
||||
.venv
|
||||
.dockerignore
|
||||
.env
|
||||
.env.sample
|
||||
@@ -9,7 +10,4 @@
|
||||
|
||||
Dockerfile*
|
||||
README.md
|
||||
|
||||
test
|
||||
|
||||
venv
|
||||
@@ -35,7 +35,7 @@ GENERATE_GUIDS = "True"
|
||||
GENERATE_LOCATIONS = "True"
|
||||
|
||||
## Max threads for processing
|
||||
MAX_THREADS = 32
|
||||
MAX_THREADS = 2
|
||||
|
||||
## Map usernames between servers in the event that they are different, order does not matter
|
||||
## Comma separated for multiple options
|
||||
|
||||
15
.github/FUNDING.yml
vendored
Normal file
15
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [Luigi311]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
|
||||
polar: # Replace with a single Polar username
|
||||
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
|
||||
thanks_dev: # Replace with a single thanks.dev username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
51
.github/workflows/ci.yml
vendored
51
.github/workflows/ci.yml
vendored
@@ -10,26 +10,45 @@ on:
|
||||
- .gitignore
|
||||
- "*.md"
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: '3.13'
|
||||
|
||||
jobs:
|
||||
pytest:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
|
||||
- name: "Set up Python"
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version-file: ".python-version"
|
||||
|
||||
- name: "Install dependencies"
|
||||
run: pip install -r requirements.txt && pip install -r test/requirements.txt
|
||||
run: uv sync --all-extras --dev
|
||||
|
||||
- name: "Run tests"
|
||||
run: pytest -vvv
|
||||
run: uv run pytest -vvv
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v5
|
||||
|
||||
- name: "Set up Python"
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version-file: ".python-version"
|
||||
|
||||
- name: "Install dependencies"
|
||||
run: |
|
||||
pip install -r requirements.txt
|
||||
uv sync --all-extras --dev
|
||||
sudo apt update && sudo apt install -y docker-compose
|
||||
|
||||
- name: "Checkout JellyPlex-Watched-CI"
|
||||
@@ -52,40 +71,40 @@ jobs:
|
||||
- name: "Test Plex"
|
||||
run: |
|
||||
mv test/ci_plex.env .env
|
||||
python main.py
|
||||
python test/validate_ci_marklog.py --plex
|
||||
uv run main.py
|
||||
uv run test/validate_ci_marklog.py --plex
|
||||
|
||||
rm mark.log
|
||||
|
||||
- name: "Test Jellyfin"
|
||||
run: |
|
||||
mv test/ci_jellyfin.env .env
|
||||
python main.py
|
||||
python test/validate_ci_marklog.py --jellyfin
|
||||
uv run main.py
|
||||
uv run test/validate_ci_marklog.py --jellyfin
|
||||
|
||||
rm mark.log
|
||||
|
||||
- name: "Test Emby"
|
||||
run: |
|
||||
mv test/ci_emby.env .env
|
||||
python main.py
|
||||
python test/validate_ci_marklog.py --emby
|
||||
uv run main.py
|
||||
uv run test/validate_ci_marklog.py --emby
|
||||
|
||||
rm mark.log
|
||||
|
||||
- name: "Test Guids"
|
||||
run: |
|
||||
mv test/ci_guids.env .env
|
||||
python main.py
|
||||
python test/validate_ci_marklog.py --dry
|
||||
uv run main.py
|
||||
uv run test/validate_ci_marklog.py --guids
|
||||
|
||||
rm mark.log
|
||||
|
||||
- name: "Test Locations"
|
||||
run: |
|
||||
mv test/ci_locations.env .env
|
||||
python main.py
|
||||
python test/validate_ci_marklog.py --dry
|
||||
uv run main.py
|
||||
uv run test/validate_ci_marklog.py --locations
|
||||
|
||||
rm mark.log
|
||||
|
||||
@@ -93,12 +112,12 @@ jobs:
|
||||
run: |
|
||||
# Test writing to the servers
|
||||
mv test/ci_write.env .env
|
||||
python main.py
|
||||
uv run main.py
|
||||
|
||||
# Test again to test if it can handle existing data
|
||||
python main.py
|
||||
uv run main.py
|
||||
|
||||
python test/validate_ci_marklog.py --write
|
||||
uv run test/validate_ci_marklog.py --write
|
||||
|
||||
rm mark.log
|
||||
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -84,9 +84,6 @@ target/
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
|
||||
1
.python-version
Normal file
1
.python-version
Normal file
@@ -0,0 +1 @@
|
||||
3.13
|
||||
4
.vscode/launch.json
vendored
4
.vscode/launch.json
vendored
@@ -6,7 +6,7 @@
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Python: Main",
|
||||
"type": "python",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"program": "main.py",
|
||||
"console": "integratedTerminal",
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
{
|
||||
"name": "Pytest",
|
||||
"type": "python",
|
||||
"type": "debugpy",
|
||||
"request": "launch",
|
||||
"module": "pytest",
|
||||
"args": [
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM python:3.11-alpine
|
||||
FROM ghcr.io/astral-sh/uv:python3.13-alpine
|
||||
|
||||
ENV PUID=1000
|
||||
ENV PGID=1000
|
||||
@@ -36,14 +36,72 @@ RUN set -eux; \
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./requirements.txt ./
|
||||
# Enable bytecode compilation
|
||||
ENV UV_COMPILE_BYTECODE=1
|
||||
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
ENV UV_LINK_MODE=copy
|
||||
|
||||
# Set the cache directory to /tmp instead of root
|
||||
ENV UV_CACHE_DIR=/tmp/.cache/uv
|
||||
|
||||
# Install the project's dependencies using the lockfile and settings
|
||||
RUN --mount=type=cache,target=/tmp/.cache/uv \
|
||||
--mount=type=bind,source=uv.lock,target=uv.lock \
|
||||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
||||
uv sync --frozen --no-install-project --no-dev
|
||||
|
||||
# Then, add the rest of the project source code and install it
|
||||
# Installing separately from its dependencies allows optimal layer caching
|
||||
COPY . /app
|
||||
RUN --mount=type=cache,target=/tmp/.cache/uv \
|
||||
uv sync --frozen --no-dev
|
||||
|
||||
# Place executables in the environment at the front of the path
|
||||
ENV PATH="/app/.venv/bin:$PATH"
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN chmod +x *.sh && \
|
||||
dos2unix *.sh
|
||||
|
||||
# Set default values to prevent issues
|
||||
ENV DRYRUN="True"
|
||||
ENV DEBUG_LEVEL="INFO"
|
||||
ENV RUN_ONLY_ONCE="False"
|
||||
ENV SLEEP_DURATION=3600
|
||||
ENV LOG_FILE="log.log"
|
||||
ENV MARK_FILE="mark.log"
|
||||
ENV REQUEST_TIME=300
|
||||
ENV GENERATE_GUIDS="True"
|
||||
ENV GENERATE_LOCATIONS="True"
|
||||
ENV MAX_THREADS=1
|
||||
ENV USER_MAPPING=""
|
||||
ENV LIBRARY_MAPPING=""
|
||||
ENV BLACKLIST_LIBRARY=""
|
||||
ENV WHITELIST_LIBRARY=""
|
||||
ENV BLACKLIST_LIBRARY_TYPE=""
|
||||
ENV WHITELIST_LIBRARY_TYPE=""
|
||||
ENV BLACKLIST_USERS=""
|
||||
ENV WHITELIST_USERS=""
|
||||
ENV PLEX_BASEURL=""
|
||||
ENV PLEX_TOKEN=""
|
||||
ENV PLEX_USERNAME=""
|
||||
ENV PLEX_PASSWORD=""
|
||||
ENV PLEX_SERVERNAME=""
|
||||
ENV SSL_BYPASS="False"
|
||||
ENV JELLYFIN_BASEURL=""
|
||||
ENV JELLYFIN_TOKEN=""
|
||||
ENV EMBY_BASEURL=""
|
||||
ENV EMBY_TOKEN=""
|
||||
ENV SYNC_FROM_PLEX_TO_JELLYFIN="True"
|
||||
ENV SYNC_FROM_PLEX_TO_PLEX="True"
|
||||
ENV SYNC_FROM_PLEX_TO_EMBY="True"
|
||||
ENV SYNC_FROM_JELLYFIN_TO_PLEX="True"
|
||||
ENV SYNC_FROM_JELLYFIN_TO_JELLYFIN="True"
|
||||
ENV SYNC_FROM_JELLYFIN_TO_EMBY="True"
|
||||
ENV SYNC_FROM_EMBY_TO_PLEX="True"
|
||||
ENV SYNC_FROM_EMBY_TO_JELLYFIN="True"
|
||||
ENV SYNC_FROM_EMBY_TO_EMBY="True"
|
||||
|
||||
ENTRYPOINT ["tini", "--", "/app/entrypoint.sh"]
|
||||
CMD ["python", "-u", "main.py"]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
FROM python:3.11-slim
|
||||
FROM ghcr.io/astral-sh/uv:bookworm-slim
|
||||
|
||||
ENV PUID=1000
|
||||
ENV PGID=1000
|
||||
@@ -10,14 +10,72 @@ RUN apt-get update && \
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./requirements.txt ./
|
||||
# Enable bytecode compilation
|
||||
ENV UV_COMPILE_BYTECODE=1
|
||||
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
ENV UV_LINK_MODE=copy
|
||||
|
||||
COPY . .
|
||||
# Set the cache directory to /tmp instead of root
|
||||
ENV UV_CACHE_DIR=/tmp/.cache/uv
|
||||
|
||||
ENV UV_PYTHON_INSTALL_DIR=/app/.bin
|
||||
|
||||
# Install the project's dependencies using the lockfile and settings
|
||||
RUN --mount=type=cache,target=/tmp/.cache/uv \
|
||||
--mount=type=bind,source=uv.lock,target=uv.lock \
|
||||
--mount=type=bind,source=pyproject.toml,target=pyproject.toml \
|
||||
uv sync --frozen --no-install-project --no-dev
|
||||
|
||||
# Then, add the rest of the project source code and install it
|
||||
# Installing separately from its dependencies allows optimal layer caching
|
||||
COPY . /app
|
||||
RUN --mount=type=cache,target=/tmp/.cache/uv \
|
||||
uv sync --frozen --no-dev
|
||||
|
||||
# Place executables in the environment at the front of the path
|
||||
ENV PATH="/app/.venv/bin:$PATH"
|
||||
|
||||
RUN chmod +x *.sh && \
|
||||
dos2unix *.sh
|
||||
|
||||
# Set default values to prevent issues
|
||||
ENV DRYRUN="True"
|
||||
ENV DEBUG_LEVEL="INFO"
|
||||
ENV RUN_ONLY_ONCE="False"
|
||||
ENV SLEEP_DURATION=3600
|
||||
ENV LOG_FILE="log.log"
|
||||
ENV MARK_FILE="mark.log"
|
||||
ENV REQUEST_TIME=300
|
||||
ENV GENERATE_GUIDS="True"
|
||||
ENV GENERATE_LOCATIONS="True"
|
||||
ENV MAX_THREADS=1
|
||||
ENV USER_MAPPING=""
|
||||
ENV LIBRARY_MAPPING=""
|
||||
ENV BLACKLIST_LIBRARY=""
|
||||
ENV WHITELIST_LIBRARY=""
|
||||
ENV BLACKLIST_LIBRARY_TYPE=""
|
||||
ENV WHITELIST_LIBRARY_TYPE=""
|
||||
ENV BLACKLIST_USERS=""
|
||||
ENV WHITELIST_USERS=""
|
||||
ENV PLEX_BASEURL=""
|
||||
ENV PLEX_TOKEN=""
|
||||
ENV PLEX_USERNAME=""
|
||||
ENV PLEX_PASSWORD=""
|
||||
ENV PLEX_SERVERNAME=""
|
||||
ENV SSL_BYPASS="False"
|
||||
ENV JELLYFIN_BASEURL=""
|
||||
ENV JELLYFIN_TOKEN=""
|
||||
ENV EMBY_BASEURL=""
|
||||
ENV EMBY_TOKEN=""
|
||||
ENV SYNC_FROM_PLEX_TO_JELLYFIN="True"
|
||||
ENV SYNC_FROM_PLEX_TO_PLEX="True"
|
||||
ENV SYNC_FROM_PLEX_TO_EMBY="True"
|
||||
ENV SYNC_FROM_JELLYFIN_TO_PLEX="True"
|
||||
ENV SYNC_FROM_JELLYFIN_TO_JELLYFIN="True"
|
||||
ENV SYNC_FROM_JELLYFIN_TO_EMBY="True"
|
||||
ENV SYNC_FROM_EMBY_TO_PLEX="True"
|
||||
ENV SYNC_FROM_EMBY_TO_JELLYFIN="True"
|
||||
ENV SYNC_FROM_EMBY_TO_EMBY="True"
|
||||
|
||||
ENTRYPOINT ["/bin/tini", "--", "/app/entrypoint.sh"]
|
||||
CMD ["python", "-u", "main.py"]
|
||||
|
||||
13
README.md
13
README.md
@@ -48,20 +48,14 @@ Full list of configuration options can be found in the [.env.sample](.env.sample
|
||||
|
||||
### Baremetal
|
||||
|
||||
- Setup virtualenv of your choice
|
||||
- [Install uv](https://docs.astral.sh/uv/getting-started/installation/)
|
||||
|
||||
- Install dependencies
|
||||
|
||||
```bash
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
- Create a .env file similar to .env.sample, uncomment whitelist and blacklist if needed, fill in baseurls and tokens
|
||||
- Create a .env file similar to .env.sample; fill in baseurls and tokens, **remember to uncomment anything you wish to use** (e.g., user mapping, library mapping, black/whitelist, etc.)
|
||||
|
||||
- Run
|
||||
|
||||
```bash
|
||||
python main.py
|
||||
uv run main.py
|
||||
```
|
||||
|
||||
### Docker
|
||||
@@ -104,6 +98,7 @@ Full list of configuration options can be found in the [.env.sample](.env.sample
|
||||
|
||||
- Configuration
|
||||
- Do not use quotes around variables in docker compose
|
||||
- If you are not running all 3 supported servers, that is, Plex, Jellyfin, and Emby simultaneously, make sure to comment out the server url and token of the server you aren't using.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -50,12 +50,13 @@ echo "Starting JellyPlex-Watched with UID: $PUID and GID: $PGID"
|
||||
|
||||
# If root run as the created user
|
||||
if [ "$(id -u)" = '0' ]; then
|
||||
chown -R "$PUID:$PGID" /app/.venv
|
||||
chown -R "$PUID:$PGID" "$LOG_DIR"
|
||||
chown -R "$PUID:$PGID" "$MARK_DIR"
|
||||
|
||||
# Run the application as the created user
|
||||
exec gosu "$PUID:$PGID" "$@"
|
||||
else
|
||||
# Run the application as the current user
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Run the application as the current user
|
||||
exec "$@"
|
||||
|
||||
6
main.py
6
main.py
@@ -1,9 +1,9 @@
|
||||
import sys
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Check python version 3.9 or higher
|
||||
if not (3, 9) <= tuple(map(int, sys.version_info[:2])):
|
||||
print("This script requires Python 3.9 or higher")
|
||||
# Check python version 3.12 or higher
|
||||
if not (3, 12) <= tuple(map(int, sys.version_info[:2])):
|
||||
print("This script requires Python 3.12 or higher")
|
||||
sys.exit(1)
|
||||
|
||||
from src.main import main
|
||||
|
||||
24
pyproject.toml
Normal file
24
pyproject.toml
Normal file
@@ -0,0 +1,24 @@
|
||||
[project]
|
||||
name = "jellyplex-watched"
|
||||
version = "7.0.4"
|
||||
description = "Sync watched between media servers locally"
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.12"
|
||||
dependencies = [
|
||||
"loguru>=0.7.3",
|
||||
"packaging==25.0",
|
||||
"plexapi==4.17.0",
|
||||
"pydantic==2.11.4",
|
||||
"python-dotenv==1.1.0",
|
||||
"requests==2.32.3",
|
||||
]
|
||||
|
||||
[dependency-groups]
|
||||
lint = [
|
||||
"ruff>=0.11.10",
|
||||
]
|
||||
dev = [
|
||||
"mypy>=1.15.0",
|
||||
"pytest>=8.3.5",
|
||||
"types-requests>=2.32.0.20250515",
|
||||
]
|
||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
@@ -1,16 +1,18 @@
|
||||
from src.functions import logger, search_mapping
|
||||
from loguru import logger
|
||||
|
||||
from src.functions import search_mapping
|
||||
|
||||
|
||||
def setup_black_white_lists(
|
||||
blacklist_library: str,
|
||||
whitelist_library: str,
|
||||
blacklist_library_type: str,
|
||||
whitelist_library_type: str,
|
||||
blacklist_users: str,
|
||||
whitelist_users: str,
|
||||
library_mapping=None,
|
||||
user_mapping=None,
|
||||
):
|
||||
blacklist_library: list[str] | None,
|
||||
whitelist_library: list[str] | None,
|
||||
blacklist_library_type: list[str] | None,
|
||||
whitelist_library_type: list[str] | None,
|
||||
blacklist_users: list[str] | None,
|
||||
whitelist_users: list[str] | None,
|
||||
library_mapping: dict[str, str] | None = None,
|
||||
user_mapping: dict[str, str] | None = None,
|
||||
) -> tuple[list[str], list[str], list[str], list[str], list[str], list[str]]:
|
||||
blacklist_library, blacklist_library_type, blacklist_users = setup_x_lists(
|
||||
blacklist_library,
|
||||
blacklist_library_type,
|
||||
@@ -40,53 +42,44 @@ def setup_black_white_lists(
|
||||
|
||||
|
||||
def setup_x_lists(
|
||||
xlist_library,
|
||||
xlist_library_type,
|
||||
xlist_users,
|
||||
xlist_type,
|
||||
library_mapping=None,
|
||||
user_mapping=None,
|
||||
):
|
||||
xlist_library: list[str] | None,
|
||||
xlist_library_type: list[str] | None,
|
||||
xlist_users: list[str] | None,
|
||||
xlist_type: str | None,
|
||||
library_mapping: dict[str, str] | None = None,
|
||||
user_mapping: dict[str, str] | None = None,
|
||||
) -> tuple[list[str], list[str], list[str]]:
|
||||
out_library: list[str] = []
|
||||
if xlist_library:
|
||||
if len(xlist_library) > 0:
|
||||
xlist_library = xlist_library.split(",")
|
||||
xlist_library = [x.strip() for x in xlist_library]
|
||||
if library_mapping:
|
||||
temp_library = []
|
||||
for library in xlist_library:
|
||||
library_other = search_mapping(library_mapping, library)
|
||||
if library_other:
|
||||
temp_library.append(library_other)
|
||||
out_library = [x.strip() for x in xlist_library]
|
||||
if library_mapping:
|
||||
temp_library: list[str] = []
|
||||
for library in xlist_library:
|
||||
library_other = search_mapping(library_mapping, library)
|
||||
if library_other:
|
||||
temp_library.append(library_other)
|
||||
|
||||
xlist_library = xlist_library + temp_library
|
||||
else:
|
||||
xlist_library = []
|
||||
logger(f"{xlist_type}list Library: {xlist_library}", 1)
|
||||
out_library = out_library + temp_library
|
||||
logger.info(f"{xlist_type}list Library: {xlist_library}")
|
||||
|
||||
out_library_type: list[str] = []
|
||||
if xlist_library_type:
|
||||
if len(xlist_library_type) > 0:
|
||||
xlist_library_type = xlist_library_type.split(",")
|
||||
xlist_library_type = [x.lower().strip() for x in xlist_library_type]
|
||||
else:
|
||||
xlist_library_type = []
|
||||
logger(f"{xlist_type}list Library Type: {xlist_library_type}", 1)
|
||||
out_library_type = [x.lower().strip() for x in xlist_library_type]
|
||||
|
||||
logger.info(f"{xlist_type}list Library Type: {out_library_type}")
|
||||
|
||||
out_users: list[str] = []
|
||||
if xlist_users:
|
||||
if len(xlist_users) > 0:
|
||||
xlist_users = xlist_users.split(",")
|
||||
xlist_users = [x.lower().strip() for x in xlist_users]
|
||||
if user_mapping:
|
||||
temp_users = []
|
||||
for user in xlist_users:
|
||||
user_other = search_mapping(user_mapping, user)
|
||||
if user_other:
|
||||
temp_users.append(user_other)
|
||||
out_users = [x.lower().strip() for x in xlist_users]
|
||||
if user_mapping:
|
||||
temp_users: list[str] = []
|
||||
for user in out_users:
|
||||
user_other = search_mapping(user_mapping, user)
|
||||
if user_other:
|
||||
temp_users.append(user_other)
|
||||
|
||||
xlist_users = xlist_users + temp_users
|
||||
else:
|
||||
xlist_users = []
|
||||
else:
|
||||
xlist_users = []
|
||||
logger(f"{xlist_type}list Users: {xlist_users}", 1)
|
||||
out_users = out_users + temp_users
|
||||
|
||||
return xlist_library, xlist_library_type, xlist_users
|
||||
logger.info(f"{xlist_type}list Users: {out_users}")
|
||||
|
||||
return out_library, out_library_type, out_users
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import os
|
||||
from typing import Literal
|
||||
from dotenv import load_dotenv
|
||||
from loguru import logger
|
||||
|
||||
from src.functions import logger, str_to_bool
|
||||
from src.functions import str_to_bool
|
||||
from src.plex import Plex
|
||||
from src.jellyfin import Jellyfin
|
||||
from src.emby import Emby
|
||||
@@ -9,60 +11,53 @@ from src.emby import Emby
|
||||
load_dotenv(override=True)
|
||||
|
||||
|
||||
def jellyfin_emby_server_connection(server_baseurl, server_token, server_type):
|
||||
servers = []
|
||||
def jellyfin_emby_server_connection(
|
||||
server_baseurl: str, server_token: str, server_type: Literal["jellyfin", "emby"]
|
||||
) -> list[Jellyfin | Emby]:
|
||||
servers: list[Jellyfin | Emby] = []
|
||||
server: Jellyfin | Emby
|
||||
|
||||
server_baseurl = server_baseurl.split(",")
|
||||
server_token = server_token.split(",")
|
||||
server_baseurls = server_baseurl.split(",")
|
||||
server_tokens = server_token.split(",")
|
||||
|
||||
if len(server_baseurl) != len(server_token):
|
||||
if len(server_baseurls) != len(server_tokens):
|
||||
raise Exception(
|
||||
f"{server_type.upper()}_BASEURL and {server_type.upper()}_TOKEN must have the same number of entries"
|
||||
)
|
||||
|
||||
for i, baseurl in enumerate(server_baseurl):
|
||||
baseurl = baseurl.strip()
|
||||
if baseurl[-1] == "/":
|
||||
baseurl = baseurl[:-1]
|
||||
for i, base_url in enumerate(server_baseurls):
|
||||
base_url = base_url.strip()
|
||||
if base_url[-1] == "/":
|
||||
base_url = base_url[:-1]
|
||||
|
||||
if server_type == "jellyfin":
|
||||
server = Jellyfin(baseurl=baseurl, token=server_token[i].strip())
|
||||
servers.append(
|
||||
(
|
||||
"jellyfin",
|
||||
server,
|
||||
)
|
||||
)
|
||||
server = Jellyfin(base_url=base_url, token=server_tokens[i].strip())
|
||||
servers.append(server)
|
||||
|
||||
elif server_type == "emby":
|
||||
server = Emby(baseurl=baseurl, token=server_token[i].strip())
|
||||
servers.append(
|
||||
(
|
||||
"emby",
|
||||
server,
|
||||
)
|
||||
)
|
||||
server = Emby(base_url=base_url, token=server_tokens[i].strip())
|
||||
servers.append(server)
|
||||
else:
|
||||
raise Exception("Unknown server type")
|
||||
|
||||
logger(f"{server_type} Server {i} info: {server.info()}", 3)
|
||||
logger.debug(f"{server_type} Server {i} info: {server.info()}")
|
||||
|
||||
return servers
|
||||
|
||||
|
||||
def generate_server_connections():
|
||||
servers = []
|
||||
def generate_server_connections() -> list[Plex | Jellyfin | Emby]:
|
||||
servers: list[Plex | Jellyfin | Emby] = []
|
||||
|
||||
plex_baseurl = os.getenv("PLEX_BASEURL", None)
|
||||
plex_token = os.getenv("PLEX_TOKEN", None)
|
||||
plex_username = os.getenv("PLEX_USERNAME", None)
|
||||
plex_password = os.getenv("PLEX_PASSWORD", None)
|
||||
plex_servername = os.getenv("PLEX_SERVERNAME", None)
|
||||
plex_baseurl_str: str | None = os.getenv("PLEX_BASEURL", None)
|
||||
plex_token_str: str | None = os.getenv("PLEX_TOKEN", None)
|
||||
plex_username_str: str | None = os.getenv("PLEX_USERNAME", None)
|
||||
plex_password_str: str | None = os.getenv("PLEX_PASSWORD", None)
|
||||
plex_servername_str: str | None = os.getenv("PLEX_SERVERNAME", None)
|
||||
ssl_bypass = str_to_bool(os.getenv("SSL_BYPASS", "False"))
|
||||
|
||||
if plex_baseurl and plex_token:
|
||||
plex_baseurl = plex_baseurl.split(",")
|
||||
plex_token = plex_token.split(",")
|
||||
if plex_baseurl_str and plex_token_str:
|
||||
plex_baseurl = plex_baseurl_str.split(",")
|
||||
plex_token = plex_token_str.split(",")
|
||||
|
||||
if len(plex_baseurl) != len(plex_token):
|
||||
raise Exception(
|
||||
@@ -71,27 +66,22 @@ def generate_server_connections():
|
||||
|
||||
for i, url in enumerate(plex_baseurl):
|
||||
server = Plex(
|
||||
baseurl=url.strip(),
|
||||
base_url=url.strip(),
|
||||
token=plex_token[i].strip(),
|
||||
username=None,
|
||||
user_name=None,
|
||||
password=None,
|
||||
servername=None,
|
||||
server_name=None,
|
||||
ssl_bypass=ssl_bypass,
|
||||
)
|
||||
|
||||
logger(f"Plex Server {i} info: {server.info()}", 3)
|
||||
logger.debug(f"Plex Server {i} info: {server.info()}")
|
||||
|
||||
servers.append(
|
||||
(
|
||||
"plex",
|
||||
server,
|
||||
)
|
||||
)
|
||||
servers.append(server)
|
||||
|
||||
if plex_username and plex_password and plex_servername:
|
||||
plex_username = plex_username.split(",")
|
||||
plex_password = plex_password.split(",")
|
||||
plex_servername = plex_servername.split(",")
|
||||
if plex_username_str and plex_password_str and plex_servername_str:
|
||||
plex_username = plex_username_str.split(",")
|
||||
plex_password = plex_password_str.split(",")
|
||||
plex_servername = plex_servername_str.split(",")
|
||||
|
||||
if len(plex_username) != len(plex_password) or len(plex_username) != len(
|
||||
plex_servername
|
||||
@@ -102,25 +92,19 @@ def generate_server_connections():
|
||||
|
||||
for i, username in enumerate(plex_username):
|
||||
server = Plex(
|
||||
baseurl=None,
|
||||
base_url=None,
|
||||
token=None,
|
||||
username=username.strip(),
|
||||
user_name=username.strip(),
|
||||
password=plex_password[i].strip(),
|
||||
servername=plex_servername[i].strip(),
|
||||
server_name=plex_servername[i].strip(),
|
||||
ssl_bypass=ssl_bypass,
|
||||
)
|
||||
|
||||
logger(f"Plex Server {i} info: {server.info()}", 3)
|
||||
servers.append(
|
||||
(
|
||||
"plex",
|
||||
server,
|
||||
)
|
||||
)
|
||||
logger.debug(f"Plex Server {i} info: {server.info()}")
|
||||
servers.append(server)
|
||||
|
||||
jellyfin_baseurl = os.getenv("JELLYFIN_BASEURL", None)
|
||||
jellyfin_token = os.getenv("JELLYFIN_TOKEN", None)
|
||||
|
||||
if jellyfin_baseurl and jellyfin_token:
|
||||
servers.extend(
|
||||
jellyfin_emby_server_connection(
|
||||
@@ -130,7 +114,6 @@ def generate_server_connections():
|
||||
|
||||
emby_baseurl = os.getenv("EMBY_BASEURL", None)
|
||||
emby_token = os.getenv("EMBY_TOKEN", None)
|
||||
|
||||
if emby_baseurl and emby_token:
|
||||
servers.extend(
|
||||
jellyfin_emby_server_connection(emby_baseurl, emby_token, "emby")
|
||||
|
||||
17
src/emby.py
17
src/emby.py
@@ -1,9 +1,10 @@
|
||||
from src.jellyfin_emby import JellyfinEmby
|
||||
from packaging import version
|
||||
from packaging.version import parse, Version
|
||||
from loguru import logger
|
||||
|
||||
|
||||
class Emby(JellyfinEmby):
|
||||
def __init__(self, baseurl, token):
|
||||
def __init__(self, base_url: str, token: str) -> None:
|
||||
authorization = (
|
||||
"Emby , "
|
||||
'Client="JellyPlex-Watched", '
|
||||
@@ -18,8 +19,14 @@ class Emby(JellyfinEmby):
|
||||
}
|
||||
|
||||
super().__init__(
|
||||
server_type="Emby", baseurl=baseurl, token=token, headers=headers
|
||||
server_type="Emby", base_url=base_url, token=token, headers=headers
|
||||
)
|
||||
|
||||
def is_partial_update_supported(self, server_version):
|
||||
return server_version > version.parse("4.4")
|
||||
def is_partial_update_supported(self, server_version: Version) -> bool:
|
||||
if not server_version >= parse("4.4"):
|
||||
logger.info(
|
||||
f"{self.server_type}: Server version {server_version} does not support updating playback position.",
|
||||
)
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
120
src/functions.py
120
src/functions.py
@@ -1,48 +1,23 @@
|
||||
import os
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from concurrent.futures import Future, ThreadPoolExecutor
|
||||
from typing import Any, Callable
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv(override=True)
|
||||
|
||||
log_file = os.getenv("LOG_FILE", os.getenv("LOGFILE", "log.log"))
|
||||
mark_file = os.getenv("MARK_FILE", os.getenv("MARKFILE", "mark.log"))
|
||||
|
||||
|
||||
def logger(message: str, log_type=0):
|
||||
debug = str_to_bool(os.getenv("DEBUG", "False"))
|
||||
debug_level = os.getenv("DEBUG_LEVEL", "info").lower()
|
||||
|
||||
output = str(message)
|
||||
if log_type == 0:
|
||||
pass
|
||||
elif log_type == 1 and (debug and debug_level in ("info", "debug")):
|
||||
output = f"[INFO]: {output}"
|
||||
elif log_type == 2:
|
||||
output = f"[ERROR]: {output}"
|
||||
elif log_type == 3 and (debug and debug_level == "debug"):
|
||||
output = f"[DEBUG]: {output}"
|
||||
elif log_type == 4:
|
||||
output = f"[WARNING]: {output}"
|
||||
elif log_type == 5:
|
||||
output = f"[MARK]: {output}"
|
||||
elif log_type == 6:
|
||||
output = f"[DRYRUN]: {output}"
|
||||
else:
|
||||
output = None
|
||||
|
||||
if output is not None:
|
||||
print(output)
|
||||
with open(f"{log_file}", "a", encoding="utf-8") as file:
|
||||
file.write(output + "\n")
|
||||
|
||||
|
||||
def log_marked(
|
||||
username: str, library: str, movie_show: str, episode: str = None, duration=None
|
||||
):
|
||||
if mark_file is None:
|
||||
return
|
||||
|
||||
output = f"{username}/{library}/{movie_show}"
|
||||
server_type: str,
|
||||
server_name: str,
|
||||
username: str,
|
||||
library: str,
|
||||
movie_show: str,
|
||||
episode: str | None = None,
|
||||
duration: float | None = None,
|
||||
) -> None:
|
||||
output = f"{server_type}/{server_name}/{username}/{library}/{movie_show}"
|
||||
|
||||
if episode:
|
||||
output += f"/{episode}"
|
||||
@@ -50,35 +25,20 @@ def log_marked(
|
||||
if duration:
|
||||
output += f"/{duration}"
|
||||
|
||||
with open(f"{mark_file}", "a", encoding="utf-8") as file:
|
||||
with open(mark_file, "a", encoding="utf-8") as file:
|
||||
file.write(output + "\n")
|
||||
|
||||
|
||||
# Reimplementation of distutils.util.strtobool due to it being deprecated
|
||||
# Source: https://github.com/PostHog/posthog/blob/01e184c29d2c10c43166f1d40a334abbc3f99d8a/posthog/utils.py#L668
|
||||
def str_to_bool(value: any) -> bool:
|
||||
def str_to_bool(value: str) -> bool:
|
||||
if not value:
|
||||
return False
|
||||
return str(value).lower() in ("y", "yes", "t", "true", "on", "1")
|
||||
|
||||
|
||||
# Search for nested element in list
|
||||
def contains_nested(element, lst):
|
||||
if lst is None:
|
||||
return None
|
||||
|
||||
for i, item in enumerate(lst):
|
||||
if item is None:
|
||||
continue
|
||||
if element in item:
|
||||
return i
|
||||
elif element == item:
|
||||
return i
|
||||
return None
|
||||
|
||||
|
||||
# Get mapped value
|
||||
def search_mapping(dictionary: dict, key_value: str):
|
||||
def search_mapping(dictionary: dict[str, str], key_value: str) -> str | None:
|
||||
if key_value in dictionary.keys():
|
||||
return dictionary[key_value]
|
||||
elif key_value.lower() in dictionary.keys():
|
||||
@@ -93,36 +53,66 @@ def search_mapping(dictionary: dict, key_value: str):
|
||||
return None
|
||||
|
||||
|
||||
# Return list of objects that exist in both lists including mappings
|
||||
def match_list(
|
||||
list1: list[str], list2: list[str], list_mapping: dict[str, str] | None = None
|
||||
) -> list[str]:
|
||||
output: list[str] = []
|
||||
for element in list1:
|
||||
if element in list2:
|
||||
output.append(element)
|
||||
elif list_mapping:
|
||||
element_other = search_mapping(list_mapping, element)
|
||||
if element_other in list2:
|
||||
output.append(element)
|
||||
|
||||
return output
|
||||
|
||||
|
||||
def future_thread_executor(
|
||||
args: list, threads: int = None, override_threads: bool = False
|
||||
):
|
||||
futures_list = []
|
||||
results = []
|
||||
args: list[tuple[Callable[..., Any], ...]],
|
||||
threads: int | None = None,
|
||||
override_threads: bool = False,
|
||||
) -> list[Any]:
|
||||
results: list[Any] = []
|
||||
|
||||
workers = min(int(os.getenv("MAX_THREADS", 32)), os.cpu_count() * 2)
|
||||
if threads:
|
||||
# Determine the number of workers, defaulting to 1 if os.cpu_count() returns None
|
||||
max_threads_env: int = int(os.getenv("MAX_THREADS", 32))
|
||||
cpu_threads: int = os.cpu_count() or 1 # Default to 1 if os.cpu_count() is None
|
||||
workers: int = min(max_threads_env, cpu_threads * 2)
|
||||
|
||||
# Adjust workers based on threads parameter and override_threads flag
|
||||
if threads is not None:
|
||||
workers = min(threads, workers)
|
||||
|
||||
if override_threads:
|
||||
workers = threads
|
||||
workers = threads if threads is not None else workers
|
||||
|
||||
# If only one worker, run in main thread to avoid overhead
|
||||
if workers == 1:
|
||||
results = []
|
||||
for arg in args:
|
||||
results.append(arg[0](*arg[1:]))
|
||||
return results
|
||||
|
||||
with ThreadPoolExecutor(max_workers=workers) as executor:
|
||||
futures_list: list[Future[Any]] = []
|
||||
|
||||
for arg in args:
|
||||
# * arg unpacks the list into actual arguments
|
||||
futures_list.append(executor.submit(*arg))
|
||||
|
||||
for future in futures_list:
|
||||
for out in futures_list:
|
||||
try:
|
||||
result = future.result()
|
||||
result = out.result()
|
||||
results.append(result)
|
||||
except Exception as e:
|
||||
raise Exception(e)
|
||||
|
||||
return results
|
||||
|
||||
|
||||
def parse_string_to_list(string: str | None) -> list[str]:
|
||||
output: list[str] = []
|
||||
if string and len(string) > 0:
|
||||
output = string.split(",")
|
||||
|
||||
return output
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
from src.jellyfin_emby import JellyfinEmby
|
||||
from packaging import version
|
||||
from packaging.version import parse, Version
|
||||
from loguru import logger
|
||||
|
||||
|
||||
class Jellyfin(JellyfinEmby):
|
||||
def __init__(self, baseurl, token):
|
||||
def __init__(self, base_url: str, token: str) -> None:
|
||||
authorization = (
|
||||
"MediaBrowser , "
|
||||
'Client="JellyPlex-Watched", '
|
||||
@@ -18,8 +19,14 @@ class Jellyfin(JellyfinEmby):
|
||||
}
|
||||
|
||||
super().__init__(
|
||||
server_type="Jellyfin", baseurl=baseurl, token=token, headers=headers
|
||||
server_type="Jellyfin", base_url=base_url, token=token, headers=headers
|
||||
)
|
||||
|
||||
def is_partial_update_supported(self, server_version):
|
||||
return server_version >= version.parse("10.9.0")
|
||||
def is_partial_update_supported(self, server_version: Version) -> bool:
|
||||
if not server_version >= parse("10.9.0"):
|
||||
logger.info(
|
||||
f"{self.server_type}: Server version {server_version} does not support updating playback position.",
|
||||
)
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
1181
src/jellyfin_emby.py
1181
src/jellyfin_emby.py
File diff suppressed because it is too large
Load Diff
237
src/library.py
237
src/library.py
@@ -1,18 +1,24 @@
|
||||
from loguru import logger
|
||||
|
||||
from src.functions import (
|
||||
logger,
|
||||
match_list,
|
||||
search_mapping,
|
||||
)
|
||||
|
||||
from src.emby import Emby
|
||||
from src.jellyfin import Jellyfin
|
||||
from src.plex import Plex
|
||||
|
||||
|
||||
def check_skip_logic(
|
||||
library_title,
|
||||
library_type,
|
||||
blacklist_library,
|
||||
whitelist_library,
|
||||
blacklist_library_type,
|
||||
whitelist_library_type,
|
||||
library_mapping=None,
|
||||
):
|
||||
library_title: str,
|
||||
library_type: str,
|
||||
blacklist_library: list[str],
|
||||
whitelist_library: list[str],
|
||||
blacklist_library_type: list[str],
|
||||
whitelist_library_type: list[str],
|
||||
library_mapping: dict[str, str] | None = None,
|
||||
) -> str | None:
|
||||
skip_reason = None
|
||||
library_other = None
|
||||
if library_mapping:
|
||||
@@ -47,12 +53,12 @@ def check_skip_logic(
|
||||
|
||||
|
||||
def check_blacklist_logic(
|
||||
library_title,
|
||||
library_type,
|
||||
blacklist_library,
|
||||
blacklist_library_type,
|
||||
library_other=None,
|
||||
):
|
||||
library_title: str,
|
||||
library_type: str,
|
||||
blacklist_library: list[str],
|
||||
blacklist_library_type: list[str],
|
||||
library_other: str | None = None,
|
||||
) -> str | None:
|
||||
skip_reason = None
|
||||
if isinstance(library_type, (list, tuple, set)):
|
||||
for library_type_item in library_type:
|
||||
@@ -83,12 +89,12 @@ def check_blacklist_logic(
|
||||
|
||||
|
||||
def check_whitelist_logic(
|
||||
library_title,
|
||||
library_type,
|
||||
whitelist_library,
|
||||
whitelist_library_type,
|
||||
library_other=None,
|
||||
):
|
||||
library_title: str,
|
||||
library_type: str,
|
||||
whitelist_library: list[str],
|
||||
whitelist_library_type: list[str],
|
||||
library_other: str | None = None,
|
||||
) -> str | None:
|
||||
skip_reason = None
|
||||
if len(whitelist_library_type) > 0:
|
||||
if isinstance(library_type, (list, tuple, set)):
|
||||
@@ -129,140 +135,73 @@ def check_whitelist_logic(
|
||||
return skip_reason
|
||||
|
||||
|
||||
def show_title_dict(user_list: dict):
|
||||
try:
|
||||
show_output_dict = {}
|
||||
show_output_dict["locations"] = []
|
||||
show_counter = 0 # Initialize a counter for the current show position
|
||||
def filter_libaries(
|
||||
server_libraries: dict[str, str],
|
||||
blacklist_library: list[str],
|
||||
blacklist_library_type: list[str],
|
||||
whitelist_library: list[str],
|
||||
whitelist_library_type: list[str],
|
||||
library_mapping: dict[str, str] | None = None,
|
||||
) -> list[str]:
|
||||
filtered_libaries: list[str] = []
|
||||
for library in server_libraries:
|
||||
skip_reason = check_skip_logic(
|
||||
library,
|
||||
server_libraries[library],
|
||||
blacklist_library,
|
||||
whitelist_library,
|
||||
blacklist_library_type,
|
||||
whitelist_library_type,
|
||||
library_mapping,
|
||||
)
|
||||
|
||||
show_output_keys = user_list.keys()
|
||||
show_output_keys = [dict(x) for x in list(show_output_keys)]
|
||||
for show_key in show_output_keys:
|
||||
for provider_key, provider_value in show_key.items():
|
||||
# Skip title
|
||||
if provider_key.lower() == "title":
|
||||
continue
|
||||
if provider_key.lower() not in show_output_dict:
|
||||
show_output_dict[provider_key.lower()] = [None] * show_counter
|
||||
if provider_key.lower() == "locations":
|
||||
show_output_dict[provider_key.lower()].append(provider_value)
|
||||
else:
|
||||
show_output_dict[provider_key.lower()].append(
|
||||
provider_value.lower()
|
||||
)
|
||||
if skip_reason:
|
||||
logger.info(f"Skipping library {library}: {skip_reason}")
|
||||
continue
|
||||
|
||||
show_counter += 1
|
||||
for key in show_output_dict:
|
||||
if len(show_output_dict[key]) < show_counter:
|
||||
show_output_dict[key].append(None)
|
||||
filtered_libaries.append(library)
|
||||
|
||||
return show_output_dict
|
||||
except Exception:
|
||||
logger("Skipping show_output_dict ", 1)
|
||||
return {}
|
||||
return filtered_libaries
|
||||
|
||||
|
||||
def episode_title_dict(user_list: dict):
|
||||
try:
|
||||
episode_output_dict = {}
|
||||
episode_output_dict["completed"] = []
|
||||
episode_output_dict["time"] = []
|
||||
episode_output_dict["locations"] = []
|
||||
episode_output_dict["show"] = []
|
||||
episode_counter = 0 # Initialize a counter for the current episode position
|
||||
def setup_libraries(
|
||||
server_1: Plex | Jellyfin | Emby,
|
||||
server_2: Plex | Jellyfin | Emby,
|
||||
blacklist_library: list[str],
|
||||
blacklist_library_type: list[str],
|
||||
whitelist_library: list[str],
|
||||
whitelist_library_type: list[str],
|
||||
library_mapping: dict[str, str] | None = None,
|
||||
) -> tuple[list[str], list[str]]:
|
||||
server_1_libraries = server_1.get_libraries()
|
||||
server_2_libraries = server_2.get_libraries()
|
||||
|
||||
# Iterate through the shows and episodes in user_list
|
||||
for show in user_list:
|
||||
logger.debug(f"{server_1.server_type}: Libraries and types {server_1_libraries}")
|
||||
logger.debug(f"{server_2.server_type}: Libraries and types {server_2_libraries}")
|
||||
|
||||
for episode in user_list[show]:
|
||||
# Add the show title to the episode_output_dict if it doesn't exist
|
||||
if "show" not in episode_output_dict:
|
||||
episode_output_dict["show"] = [None] * episode_counter
|
||||
# Filter out all blacklist, whitelist libaries
|
||||
filtered_server_1_libraries = filter_libaries(
|
||||
server_1_libraries,
|
||||
blacklist_library,
|
||||
blacklist_library_type,
|
||||
whitelist_library,
|
||||
whitelist_library_type,
|
||||
library_mapping,
|
||||
)
|
||||
filtered_server_2_libraries = filter_libaries(
|
||||
server_2_libraries,
|
||||
blacklist_library,
|
||||
blacklist_library_type,
|
||||
whitelist_library,
|
||||
whitelist_library_type,
|
||||
library_mapping,
|
||||
)
|
||||
|
||||
# Add the show title to the episode_output_dict
|
||||
episode_output_dict["show"].append(dict(show))
|
||||
output_server_1_libaries = match_list(
|
||||
filtered_server_1_libraries, filtered_server_2_libraries, library_mapping
|
||||
)
|
||||
output_server_2_libaries = match_list(
|
||||
filtered_server_2_libraries, filtered_server_1_libraries, library_mapping
|
||||
)
|
||||
|
||||
# Iterate through the keys and values in each episode
|
||||
for episode_key, episode_value in episode.items():
|
||||
# If the key is not "status", add the key to episode_output_dict if it doesn't exist
|
||||
if episode_key != "status":
|
||||
if episode_key.lower() not in episode_output_dict:
|
||||
# Initialize the list with None values up to the current episode position
|
||||
episode_output_dict[episode_key.lower()] = [
|
||||
None
|
||||
] * episode_counter
|
||||
|
||||
# If the key is "locations", append each location to the list
|
||||
if episode_key == "locations":
|
||||
episode_output_dict[episode_key.lower()].append(episode_value)
|
||||
|
||||
# If the key is "status", append the "completed" and "time" values
|
||||
elif episode_key == "status":
|
||||
episode_output_dict["completed"].append(
|
||||
episode_value["completed"]
|
||||
)
|
||||
episode_output_dict["time"].append(episode_value["time"])
|
||||
|
||||
# For other keys, append the value to the list
|
||||
else:
|
||||
episode_output_dict[episode_key.lower()].append(
|
||||
episode_value.lower()
|
||||
)
|
||||
|
||||
# Increment the episode_counter
|
||||
episode_counter += 1
|
||||
|
||||
# Extend the lists in episode_output_dict with None values to match the current episode_counter
|
||||
for key in episode_output_dict:
|
||||
if len(episode_output_dict[key]) < episode_counter:
|
||||
episode_output_dict[key].append(None)
|
||||
|
||||
return episode_output_dict
|
||||
except Exception:
|
||||
logger("Skipping episode_output_dict", 1)
|
||||
return {}
|
||||
|
||||
|
||||
def movies_title_dict(user_list: dict):
|
||||
try:
|
||||
movies_output_dict = {}
|
||||
movies_output_dict["completed"] = []
|
||||
movies_output_dict["time"] = []
|
||||
movies_output_dict["locations"] = []
|
||||
movie_counter = 0 # Initialize a counter for the current movie position
|
||||
|
||||
for movie in user_list:
|
||||
for movie_key, movie_value in movie.items():
|
||||
if movie_key != "status":
|
||||
if movie_key.lower() not in movies_output_dict:
|
||||
movies_output_dict[movie_key.lower()] = []
|
||||
|
||||
if movie_key == "locations":
|
||||
movies_output_dict[movie_key.lower()].append(movie_value)
|
||||
elif movie_key == "status":
|
||||
movies_output_dict["completed"].append(movie_value["completed"])
|
||||
movies_output_dict["time"].append(movie_value["time"])
|
||||
else:
|
||||
movies_output_dict[movie_key.lower()].append(movie_value.lower())
|
||||
|
||||
movie_counter += 1
|
||||
for key in movies_output_dict:
|
||||
if len(movies_output_dict[key]) < movie_counter:
|
||||
movies_output_dict[key].append(None)
|
||||
|
||||
return movies_output_dict
|
||||
except Exception:
|
||||
logger("Skipping movies_output_dict failed", 1)
|
||||
return {}
|
||||
|
||||
|
||||
def generate_library_guids_dict(user_list: dict):
|
||||
# Handle the case where user_list is empty or does not contain the expected keys and values
|
||||
if not user_list:
|
||||
return {}, {}, {}
|
||||
|
||||
show_output_dict = show_title_dict(user_list)
|
||||
episode_output_dict = episode_title_dict(user_list)
|
||||
movies_output_dict = movies_title_dict(user_list)
|
||||
|
||||
return show_output_dict, episode_output_dict, movies_output_dict
|
||||
return output_server_1_libaries, output_server_2_libaries
|
||||
|
||||
212
src/main.py
212
src/main.py
@@ -1,9 +1,17 @@
|
||||
import os, traceback, json
|
||||
import os
|
||||
import traceback
|
||||
import json
|
||||
import sys
|
||||
from dotenv import load_dotenv
|
||||
from time import sleep, perf_counter
|
||||
from loguru import logger
|
||||
|
||||
from src.emby import Emby
|
||||
from src.jellyfin import Jellyfin
|
||||
from src.plex import Plex
|
||||
from src.library import setup_libraries
|
||||
from src.functions import (
|
||||
logger,
|
||||
parse_string_to_list,
|
||||
str_to_bool,
|
||||
)
|
||||
from src.users import setup_users
|
||||
@@ -15,8 +23,30 @@ from src.connection import generate_server_connections
|
||||
|
||||
load_dotenv(override=True)
|
||||
|
||||
log_file = os.getenv("LOG_FILE", os.getenv("LOGFILE", "log.log"))
|
||||
level = os.getenv("DEBUG_LEVEL", "INFO").upper()
|
||||
|
||||
def should_sync_server(server_1_type, server_2_type):
|
||||
|
||||
def configure_logger() -> None:
|
||||
# Remove default logger to configure our own
|
||||
logger.remove()
|
||||
|
||||
# Choose log level based on environment
|
||||
# If in debug mode with a "debug" level, use DEBUG; otherwise, default to INFO.
|
||||
|
||||
if level not in ["INFO", "DEBUG", "TRACE"]:
|
||||
logger.add(sys.stdout)
|
||||
raise Exception("Invalid DEBUG_LEVEL, please choose between INFO, DEBUG, TRACE")
|
||||
|
||||
# Add a sink for file logging and the console.
|
||||
logger.add(log_file, level=level, mode="w")
|
||||
logger.add(sys.stdout, level=level)
|
||||
|
||||
|
||||
def should_sync_server(
|
||||
server_1: Plex | Jellyfin | Emby,
|
||||
server_2: Plex | Jellyfin | Emby,
|
||||
) -> bool:
|
||||
sync_from_plex_to_jellyfin = str_to_bool(
|
||||
os.getenv("SYNC_FROM_PLEX_TO_JELLYFIN", "True")
|
||||
)
|
||||
@@ -39,75 +69,76 @@ def should_sync_server(server_1_type, server_2_type):
|
||||
)
|
||||
sync_from_emby_to_emby = str_to_bool(os.getenv("SYNC_FROM_EMBY_TO_EMBY", "True"))
|
||||
|
||||
if server_1_type == "plex":
|
||||
if server_2_type == "jellyfin" and not sync_from_plex_to_jellyfin:
|
||||
logger("Sync from plex -> jellyfin is disabled", 1)
|
||||
if isinstance(server_1, Plex):
|
||||
if isinstance(server_2, Jellyfin) and not sync_from_plex_to_jellyfin:
|
||||
logger.info("Sync from plex -> jellyfin is disabled")
|
||||
return False
|
||||
|
||||
if server_2_type == "emby" and not sync_from_plex_to_emby:
|
||||
logger("Sync from plex -> emby is disabled", 1)
|
||||
if isinstance(server_2, Emby) and not sync_from_plex_to_emby:
|
||||
logger.info("Sync from plex -> emby is disabled")
|
||||
return False
|
||||
|
||||
if server_2_type == "plex" and not sync_from_plex_to_plex:
|
||||
logger("Sync from plex -> plex is disabled", 1)
|
||||
if isinstance(server_2, Plex) and not sync_from_plex_to_plex:
|
||||
logger.info("Sync from plex -> plex is disabled")
|
||||
return False
|
||||
|
||||
if server_1_type == "jellyfin":
|
||||
if server_2_type == "plex" and not sync_from_jelly_to_plex:
|
||||
logger("Sync from jellyfin -> plex is disabled", 1)
|
||||
if isinstance(server_1, Jellyfin):
|
||||
if isinstance(server_2, Plex) and not sync_from_jelly_to_plex:
|
||||
logger.info("Sync from jellyfin -> plex is disabled")
|
||||
return False
|
||||
|
||||
if server_2_type == "jellyfin" and not sync_from_jelly_to_jellyfin:
|
||||
logger("Sync from jellyfin -> jellyfin is disabled", 1)
|
||||
if isinstance(server_2, Jellyfin) and not sync_from_jelly_to_jellyfin:
|
||||
logger.info("Sync from jellyfin -> jellyfin is disabled")
|
||||
return False
|
||||
|
||||
if server_2_type == "emby" and not sync_from_jelly_to_emby:
|
||||
logger("Sync from jellyfin -> emby is disabled", 1)
|
||||
if isinstance(server_2, Emby) and not sync_from_jelly_to_emby:
|
||||
logger.info("Sync from jellyfin -> emby is disabled")
|
||||
return False
|
||||
|
||||
if server_1_type == "emby":
|
||||
if server_2_type == "plex" and not sync_from_emby_to_plex:
|
||||
logger("Sync from emby -> plex is disabled", 1)
|
||||
if isinstance(server_1, Emby):
|
||||
if isinstance(server_2, Plex) and not sync_from_emby_to_plex:
|
||||
logger.info("Sync from emby -> plex is disabled")
|
||||
return False
|
||||
|
||||
if server_2_type == "jellyfin" and not sync_from_emby_to_jellyfin:
|
||||
logger("Sync from emby -> jellyfin is disabled", 1)
|
||||
if isinstance(server_2, Jellyfin) and not sync_from_emby_to_jellyfin:
|
||||
logger.info("Sync from emby -> jellyfin is disabled")
|
||||
return False
|
||||
|
||||
if server_2_type == "emby" and not sync_from_emby_to_emby:
|
||||
logger("Sync from emby -> emby is disabled", 1)
|
||||
if isinstance(server_2, Emby) and not sync_from_emby_to_emby:
|
||||
logger.info("Sync from emby -> emby is disabled")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def main_loop():
|
||||
log_file = os.getenv("LOG_FILE", os.getenv("LOGFILE", "log.log"))
|
||||
# Delete log_file if it exists
|
||||
if os.path.exists(log_file):
|
||||
os.remove(log_file)
|
||||
|
||||
def main_loop() -> None:
|
||||
dryrun = str_to_bool(os.getenv("DRYRUN", "False"))
|
||||
logger(f"Dryrun: {dryrun}", 1)
|
||||
logger.info(f"Dryrun: {dryrun}")
|
||||
|
||||
user_mapping = os.getenv("USER_MAPPING")
|
||||
if user_mapping:
|
||||
user_mapping = json.loads(user_mapping.lower())
|
||||
logger(f"User Mapping: {user_mapping}", 1)
|
||||
user_mapping_env = os.getenv("USER_MAPPING", None)
|
||||
user_mapping = None
|
||||
if user_mapping_env:
|
||||
user_mapping = json.loads(user_mapping_env.lower())
|
||||
logger.info(f"User Mapping: {user_mapping}")
|
||||
|
||||
library_mapping = os.getenv("LIBRARY_MAPPING")
|
||||
if library_mapping:
|
||||
library_mapping = json.loads(library_mapping)
|
||||
logger(f"Library Mapping: {library_mapping}", 1)
|
||||
library_mapping_env = os.getenv("LIBRARY_MAPPING", None)
|
||||
library_mapping = None
|
||||
if library_mapping_env:
|
||||
library_mapping = json.loads(library_mapping_env)
|
||||
logger.info(f"Library Mapping: {library_mapping}")
|
||||
|
||||
# Create (black/white)lists
|
||||
logger("Creating (black/white)lists", 1)
|
||||
blacklist_library = os.getenv("BLACKLIST_LIBRARY", None)
|
||||
whitelist_library = os.getenv("WHITELIST_LIBRARY", None)
|
||||
blacklist_library_type = os.getenv("BLACKLIST_LIBRARY_TYPE", None)
|
||||
whitelist_library_type = os.getenv("WHITELIST_LIBRARY_TYPE", None)
|
||||
blacklist_users = os.getenv("BLACKLIST_USERS", None)
|
||||
whitelist_users = os.getenv("WHITELIST_USERS", None)
|
||||
logger.info("Creating (black/white)lists")
|
||||
blacklist_library = parse_string_to_list(os.getenv("BLACKLIST_LIBRARY", None))
|
||||
whitelist_library = parse_string_to_list(os.getenv("WHITELIST_LIBRARY", None))
|
||||
blacklist_library_type = parse_string_to_list(
|
||||
os.getenv("BLACKLIST_LIBRARY_TYPE", None)
|
||||
)
|
||||
whitelist_library_type = parse_string_to_list(
|
||||
os.getenv("WHITELIST_LIBRARY_TYPE", None)
|
||||
)
|
||||
blacklist_users = parse_string_to_list(os.getenv("BLACKLIST_USERS", None))
|
||||
whitelist_users = parse_string_to_list(os.getenv("WHITELIST_USERS", None))
|
||||
|
||||
(
|
||||
blacklist_library,
|
||||
@@ -128,7 +159,7 @@ def main_loop():
|
||||
)
|
||||
|
||||
# Create server connections
|
||||
logger("Creating server connections", 1)
|
||||
logger.info("Creating server connections")
|
||||
servers = generate_server_connections()
|
||||
|
||||
for server_1 in servers:
|
||||
@@ -139,75 +170,71 @@ def main_loop():
|
||||
# Start server_2 at the next server in the list
|
||||
for server_2 in servers[servers.index(server_1) + 1 :]:
|
||||
# Check if server 1 and server 2 are going to be synced in either direction, skip if not
|
||||
if not should_sync_server(
|
||||
server_1[0], server_2[0]
|
||||
) and not should_sync_server(server_2[0], server_1[0]):
|
||||
if not should_sync_server(server_1, server_2) and not should_sync_server(
|
||||
server_2, server_1
|
||||
):
|
||||
continue
|
||||
|
||||
logger(f"Server 1: {server_1[0].capitalize()}: {server_1[1].info()}", 0)
|
||||
logger(f"Server 2: {server_2[0].capitalize()}: {server_2[1].info()}", 0)
|
||||
logger.info(f"Server 1: {type(server_1)}: {server_1.info()}")
|
||||
logger.info(f"Server 2: {type(server_2)}: {server_2.info()}")
|
||||
|
||||
# Create users list
|
||||
logger("Creating users list", 1)
|
||||
logger.info("Creating users list")
|
||||
server_1_users, server_2_users = setup_users(
|
||||
server_1, server_2, blacklist_users, whitelist_users, user_mapping
|
||||
)
|
||||
|
||||
logger("Creating watched lists", 1)
|
||||
server_1_watched = server_1[1].get_watched(
|
||||
server_1_users,
|
||||
server_1_libraries, server_2_libraries = setup_libraries(
|
||||
server_1,
|
||||
server_2,
|
||||
blacklist_library,
|
||||
whitelist_library,
|
||||
blacklist_library_type,
|
||||
whitelist_library,
|
||||
whitelist_library_type,
|
||||
library_mapping,
|
||||
)
|
||||
logger("Finished creating watched list server 1", 1)
|
||||
logger.info(f"Server 1 syncing libraries: {server_1_libraries}")
|
||||
logger.info(f"Server 2 syncing libraries: {server_2_libraries}")
|
||||
|
||||
server_2_watched = server_2[1].get_watched(
|
||||
server_2_users,
|
||||
blacklist_library,
|
||||
whitelist_library,
|
||||
blacklist_library_type,
|
||||
whitelist_library_type,
|
||||
library_mapping,
|
||||
)
|
||||
logger("Finished creating watched list server 2", 1)
|
||||
logger.info("Creating watched lists", 1)
|
||||
server_1_watched = server_1.get_watched(server_1_users, server_1_libraries)
|
||||
logger.info("Finished creating watched list server 1")
|
||||
|
||||
logger(f"Server 1 watched: {server_1_watched}", 3)
|
||||
logger(f"Server 2 watched: {server_2_watched}", 3)
|
||||
server_2_watched = server_2.get_watched(server_2_users, server_2_libraries)
|
||||
logger.info("Finished creating watched list server 2")
|
||||
|
||||
logger("Cleaning Server 1 Watched", 1)
|
||||
logger.trace(f"Server 1 watched: {server_1_watched}")
|
||||
logger.trace(f"Server 2 watched: {server_2_watched}")
|
||||
|
||||
logger.info("Cleaning Server 1 Watched", 1)
|
||||
server_1_watched_filtered = cleanup_watched(
|
||||
server_1_watched, server_2_watched, user_mapping, library_mapping
|
||||
)
|
||||
|
||||
logger("Cleaning Server 2 Watched", 1)
|
||||
logger.info("Cleaning Server 2 Watched", 1)
|
||||
server_2_watched_filtered = cleanup_watched(
|
||||
server_2_watched, server_1_watched, user_mapping, library_mapping
|
||||
)
|
||||
|
||||
logger(
|
||||
logger.debug(
|
||||
f"server 1 watched that needs to be synced to server 2:\n{server_1_watched_filtered}",
|
||||
1,
|
||||
)
|
||||
logger(
|
||||
logger.debug(
|
||||
f"server 2 watched that needs to be synced to server 1:\n{server_2_watched_filtered}",
|
||||
1,
|
||||
)
|
||||
|
||||
if should_sync_server(server_2[0], server_1[0]):
|
||||
logger(f"Syncing {server_2[1].info()} -> {server_1[1].info()}", 0)
|
||||
server_1[1].update_watched(
|
||||
if should_sync_server(server_2, server_1):
|
||||
logger.info(f"Syncing {server_2.info()} -> {server_1.info()}")
|
||||
server_1.update_watched(
|
||||
server_2_watched_filtered,
|
||||
user_mapping,
|
||||
library_mapping,
|
||||
dryrun,
|
||||
)
|
||||
|
||||
if should_sync_server(server_1[0], server_2[0]):
|
||||
logger(f"Syncing {server_1[1].info()} -> {server_2[1].info()}", 0)
|
||||
server_2[1].update_watched(
|
||||
if should_sync_server(server_1, server_2):
|
||||
logger.info(f"Syncing {server_1.info()} -> {server_2.info()}")
|
||||
server_2.update_watched(
|
||||
server_1_watched_filtered,
|
||||
user_mapping,
|
||||
library_mapping,
|
||||
@@ -215,43 +242,46 @@ def main_loop():
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
@logger.catch
|
||||
def main() -> None:
|
||||
run_only_once = str_to_bool(os.getenv("RUN_ONLY_ONCE", "False"))
|
||||
sleep_duration = float(os.getenv("SLEEP_DURATION", "3600"))
|
||||
times = []
|
||||
times: list[float] = []
|
||||
while True:
|
||||
try:
|
||||
start = perf_counter()
|
||||
# Reconfigure the logger on each loop so the logs are rotated on each run
|
||||
configure_logger()
|
||||
main_loop()
|
||||
end = perf_counter()
|
||||
times.append(end - start)
|
||||
|
||||
if len(times) > 0:
|
||||
logger(f"Average time: {sum(times) / len(times)}", 0)
|
||||
logger.info(f"Average time: {sum(times) / len(times)}")
|
||||
|
||||
if run_only_once:
|
||||
break
|
||||
|
||||
logger(f"Looping in {sleep_duration}")
|
||||
logger.info(f"Looping in {sleep_duration}")
|
||||
sleep(sleep_duration)
|
||||
|
||||
except Exception as error:
|
||||
if isinstance(error, list):
|
||||
for message in error:
|
||||
logger(message, log_type=2)
|
||||
logger.error(message)
|
||||
else:
|
||||
logger(error, log_type=2)
|
||||
logger.error(error)
|
||||
|
||||
logger(traceback.format_exc(), 2)
|
||||
logger.error(traceback.format_exc())
|
||||
|
||||
if run_only_once:
|
||||
break
|
||||
|
||||
logger(f"Retrying in {sleep_duration}", log_type=0)
|
||||
logger.info(f"Retrying in {sleep_duration}")
|
||||
sleep(sleep_duration)
|
||||
|
||||
except KeyboardInterrupt:
|
||||
if len(times) > 0:
|
||||
logger(f"Average time: {sum(times) / len(times)}", 0)
|
||||
logger("Exiting", log_type=0)
|
||||
logger.info(f"Average time: {sum(times) / len(times)}")
|
||||
logger.info("Exiting")
|
||||
os._exit(0)
|
||||
|
||||
905
src/plex.py
905
src/plex.py
File diff suppressed because it is too large
Load Diff
101
src/users.py
101
src/users.py
@@ -1,30 +1,35 @@
|
||||
from src.functions import (
|
||||
logger,
|
||||
search_mapping,
|
||||
)
|
||||
from plexapi.myplex import MyPlexAccount, MyPlexUser
|
||||
from loguru import logger
|
||||
|
||||
from src.emby import Emby
|
||||
from src.jellyfin import Jellyfin
|
||||
from src.plex import Plex
|
||||
from src.functions import search_mapping
|
||||
|
||||
|
||||
def generate_user_list(server):
|
||||
def generate_user_list(server: Plex | Jellyfin | Emby) -> list[str]:
|
||||
# generate list of users from server 1 and server 2
|
||||
server_type = server[0]
|
||||
server_connection = server[1]
|
||||
|
||||
server_users = []
|
||||
if server_type == "plex":
|
||||
for user in server_connection.users:
|
||||
server_users: list[str] = []
|
||||
if isinstance(server, Plex):
|
||||
for user in server.users:
|
||||
server_users.append(
|
||||
user.username.lower() if user.username else user.title.lower()
|
||||
)
|
||||
|
||||
elif server_type in ["jellyfin", "emby"]:
|
||||
server_users = [key.lower() for key in server_connection.users.keys()]
|
||||
elif isinstance(server, (Jellyfin, Emby)):
|
||||
server_users = [key.lower() for key in server.users.keys()]
|
||||
|
||||
return server_users
|
||||
|
||||
|
||||
def combine_user_lists(server_1_users, server_2_users, user_mapping):
|
||||
def combine_user_lists(
|
||||
server_1_users: list[str],
|
||||
server_2_users: list[str],
|
||||
user_mapping: dict[str, str] | None,
|
||||
) -> dict[str, str]:
|
||||
# combined list of overlapping users from plex and jellyfin
|
||||
users = {}
|
||||
users: dict[str, str] = {}
|
||||
|
||||
for server_1_user in server_1_users:
|
||||
if user_mapping:
|
||||
@@ -49,13 +54,15 @@ def combine_user_lists(server_1_users, server_2_users, user_mapping):
|
||||
return users
|
||||
|
||||
|
||||
def filter_user_lists(users, blacklist_users, whitelist_users):
|
||||
users_filtered = {}
|
||||
def filter_user_lists(
|
||||
users: dict[str, str], blacklist_users: list[str], whitelist_users: list[str]
|
||||
) -> dict[str, str]:
|
||||
users_filtered: dict[str, str] = {}
|
||||
for user in users:
|
||||
# whitelist_user is not empty and user lowercase is not in whitelist lowercase
|
||||
if len(whitelist_users) > 0:
|
||||
if user not in whitelist_users and users[user] not in whitelist_users:
|
||||
logger(f"{user} or {users[user]} is not in whitelist", 1)
|
||||
logger.info(f"{user} or {users[user]} is not in whitelist")
|
||||
continue
|
||||
|
||||
if user not in blacklist_users and users[user] not in blacklist_users:
|
||||
@@ -64,12 +71,13 @@ def filter_user_lists(users, blacklist_users, whitelist_users):
|
||||
return users_filtered
|
||||
|
||||
|
||||
def generate_server_users(server, users):
|
||||
server_users = None
|
||||
|
||||
if server[0] == "plex":
|
||||
server_users = []
|
||||
for plex_user in server[1].users:
|
||||
def generate_server_users(
|
||||
server: Plex | Jellyfin | Emby,
|
||||
users: dict[str, str],
|
||||
) -> list[MyPlexAccount] | dict[str, str] | None:
|
||||
if isinstance(server, Plex):
|
||||
plex_server_users: list[MyPlexAccount] = []
|
||||
for plex_user in server.users:
|
||||
username_title = (
|
||||
plex_user.username if plex_user.username else plex_user.title
|
||||
)
|
||||
@@ -78,45 +86,56 @@ def generate_server_users(server, users):
|
||||
username_title.lower() in users.keys()
|
||||
or username_title.lower() in users.values()
|
||||
):
|
||||
server_users.append(plex_user)
|
||||
elif server[0] in ["jellyfin", "emby"]:
|
||||
server_users = {}
|
||||
for jellyfin_user, jellyfin_id in server[1].users.items():
|
||||
plex_server_users.append(plex_user)
|
||||
|
||||
return plex_server_users
|
||||
elif isinstance(server, (Jellyfin, Emby)):
|
||||
jelly_emby_server_users: dict[str, str] = {}
|
||||
for jellyfin_user, jellyfin_id in server.users.items():
|
||||
if (
|
||||
jellyfin_user.lower() in users.keys()
|
||||
or jellyfin_user.lower() in users.values()
|
||||
):
|
||||
server_users[jellyfin_user] = jellyfin_id
|
||||
jelly_emby_server_users[jellyfin_user] = jellyfin_id
|
||||
|
||||
return server_users
|
||||
return jelly_emby_server_users
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def setup_users(
|
||||
server_1, server_2, blacklist_users, whitelist_users, user_mapping=None
|
||||
):
|
||||
server_1: Plex | Jellyfin | Emby,
|
||||
server_2: Plex | Jellyfin | Emby,
|
||||
blacklist_users: list[str],
|
||||
whitelist_users: list[str],
|
||||
user_mapping: dict[str, str] | None = None,
|
||||
) -> tuple[
|
||||
list[MyPlexAccount | MyPlexUser] | dict[str, str],
|
||||
list[MyPlexAccount | MyPlexUser] | dict[str, str],
|
||||
]:
|
||||
server_1_users = generate_user_list(server_1)
|
||||
server_2_users = generate_user_list(server_2)
|
||||
logger(f"Server 1 users: {server_1_users}", 1)
|
||||
logger(f"Server 2 users: {server_2_users}", 1)
|
||||
logger.debug(f"Server 1 users: {server_1_users}")
|
||||
logger.debug(f"Server 2 users: {server_2_users}")
|
||||
|
||||
users = combine_user_lists(server_1_users, server_2_users, user_mapping)
|
||||
logger(f"User list that exist on both servers {users}", 1)
|
||||
logger.debug(f"User list that exist on both servers {users}")
|
||||
|
||||
users_filtered = filter_user_lists(users, blacklist_users, whitelist_users)
|
||||
logger(f"Filtered user list {users_filtered}", 1)
|
||||
logger.debug(f"Filtered user list {users_filtered}")
|
||||
|
||||
output_server_1_users = generate_server_users(server_1, users_filtered)
|
||||
output_server_2_users = generate_server_users(server_2, users_filtered)
|
||||
|
||||
# Check if users is none or empty
|
||||
if output_server_1_users is None or len(output_server_1_users) == 0:
|
||||
logger(
|
||||
f"No users found for server 1 {server_1[0]}, users: {server_1_users}, overlapping users {users}, filtered users {users_filtered}, server 1 users {server_1[1].users}"
|
||||
logger.warning(
|
||||
f"No users found for server 1 {type(server_1)}, users: {server_1_users}, overlapping users {users}, filtered users {users_filtered}, server 1 users {server_1.users}"
|
||||
)
|
||||
|
||||
if output_server_2_users is None or len(output_server_2_users) == 0:
|
||||
logger(
|
||||
f"No users found for server 2 {server_2[0]}, users: {server_2_users}, overlapping users {users} filtered users {users_filtered}, server 2 users {server_2[1].users}"
|
||||
logger.warning(
|
||||
f"No users found for server 2 {type(server_2)}, users: {server_2_users}, overlapping users {users} filtered users {users_filtered}, server 2 users {server_2.users}"
|
||||
)
|
||||
|
||||
if (
|
||||
@@ -127,7 +146,7 @@ def setup_users(
|
||||
):
|
||||
raise Exception("No users found for one or both servers")
|
||||
|
||||
logger(f"Server 1 users: {output_server_1_users}", 1)
|
||||
logger(f"Server 2 users: {output_server_2_users}", 1)
|
||||
logger.info(f"Server 1 users: {output_server_1_users}")
|
||||
logger.info(f"Server 2 users: {output_server_2_users}")
|
||||
|
||||
return output_server_1_users, output_server_2_users
|
||||
|
||||
408
src/watched.py
408
src/watched.py
@@ -1,82 +1,112 @@
|
||||
import copy
|
||||
from pydantic import BaseModel, Field
|
||||
from loguru import logger
|
||||
from typing import Any
|
||||
|
||||
from src.functions import logger, search_mapping, contains_nested
|
||||
|
||||
from src.library import generate_library_guids_dict
|
||||
from src.functions import search_mapping
|
||||
|
||||
|
||||
def combine_watched_dicts(dicts: list):
|
||||
# Ensure that the input is a list of dictionaries
|
||||
if not all(isinstance(d, dict) for d in dicts):
|
||||
raise ValueError("Input must be a list of dictionaries")
|
||||
class MediaIdentifiers(BaseModel):
|
||||
title: str | None = None
|
||||
|
||||
combined_dict = {}
|
||||
# File information, will be folder for series and media file for episode/movie
|
||||
locations: tuple[str, ...] = tuple()
|
||||
|
||||
for single_dict in dicts:
|
||||
for key, value in single_dict.items():
|
||||
if key not in combined_dict:
|
||||
combined_dict[key] = {}
|
||||
|
||||
for subkey, subvalue in value.items():
|
||||
if subkey in combined_dict[key]:
|
||||
# If the subkey already exists in the combined dictionary,
|
||||
# check if the values are different and raise an exception if they are
|
||||
if combined_dict[key][subkey] != subvalue:
|
||||
raise ValueError(
|
||||
f"Conflicting values for subkey '{subkey}' under key '{key}'"
|
||||
)
|
||||
else:
|
||||
# If the subkey does not exist in the combined dictionary, add it
|
||||
combined_dict[key][subkey] = subvalue
|
||||
|
||||
return combined_dict
|
||||
# Guids
|
||||
imdb_id: str | None = None
|
||||
tvdb_id: str | None = None
|
||||
tmdb_id: str | None = None
|
||||
|
||||
|
||||
def check_remove_entry(video, library, video_index, library_watched_list_2):
|
||||
if video_index is not None:
|
||||
if (
|
||||
library_watched_list_2["completed"][video_index]
|
||||
== video["status"]["completed"]
|
||||
) and (library_watched_list_2["time"][video_index] == video["status"]["time"]):
|
||||
logger(
|
||||
f"Removing {video['title']} from {library} due to exact match",
|
||||
3,
|
||||
)
|
||||
return True
|
||||
elif (
|
||||
library_watched_list_2["completed"][video_index] == True
|
||||
and video["status"]["completed"] == False
|
||||
):
|
||||
logger(
|
||||
f"Removing {video['title']} from {library} due to being complete in one library and not the other",
|
||||
3,
|
||||
)
|
||||
return True
|
||||
elif (
|
||||
library_watched_list_2["completed"][video_index] == False
|
||||
and video["status"]["completed"] == False
|
||||
) and (video["status"]["time"] < library_watched_list_2["time"][video_index]):
|
||||
logger(
|
||||
f"Removing {video['title']} from {library} due to more time watched in one library than the other",
|
||||
3,
|
||||
)
|
||||
return True
|
||||
elif (
|
||||
library_watched_list_2["completed"][video_index] == True
|
||||
and video["status"]["completed"] == True
|
||||
):
|
||||
logger(
|
||||
f"Removing {video['title']} from {library} due to being complete in both libraries",
|
||||
3,
|
||||
)
|
||||
class WatchedStatus(BaseModel):
|
||||
completed: bool
|
||||
time: int
|
||||
|
||||
|
||||
class MediaItem(BaseModel):
|
||||
identifiers: MediaIdentifiers
|
||||
status: WatchedStatus
|
||||
|
||||
|
||||
class Series(BaseModel):
|
||||
identifiers: MediaIdentifiers
|
||||
episodes: list[MediaItem] = Field(default_factory=list)
|
||||
|
||||
|
||||
class LibraryData(BaseModel):
|
||||
title: str
|
||||
movies: list[MediaItem] = Field(default_factory=list)
|
||||
series: list[Series] = Field(default_factory=list)
|
||||
|
||||
|
||||
class UserData(BaseModel):
|
||||
libraries: dict[str, LibraryData] = Field(default_factory=dict)
|
||||
|
||||
|
||||
def check_same_identifiers(item1: MediaIdentifiers, item2: MediaIdentifiers) -> bool:
|
||||
# Check for duplicate based on file locations:
|
||||
if item1.locations and item2.locations:
|
||||
if set(item1.locations) & set(item2.locations):
|
||||
return True
|
||||
|
||||
# Check for duplicate based on GUIDs:
|
||||
if (
|
||||
(item1.imdb_id and item2.imdb_id and item1.imdb_id == item2.imdb_id)
|
||||
or (item1.tvdb_id and item2.tvdb_id and item1.tvdb_id == item2.tvdb_id)
|
||||
or (item1.tmdb_id and item2.tmdb_id and item1.tmdb_id == item2.tmdb_id)
|
||||
):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def check_remove_entry(item1: MediaItem, item2: MediaItem) -> bool:
|
||||
"""
|
||||
Returns True if item1 (from watched_list_1) should be removed
|
||||
in favor of item2 (from watched_list_2), based on:
|
||||
- Duplicate criteria:
|
||||
* They match if any file location is shared OR
|
||||
at least one of imdb_id, tvdb_id, or tmdb_id matches.
|
||||
- Watched status:
|
||||
* If one is complete and the other is not, remove the incomplete one.
|
||||
* If both are incomplete, remove the one with lower progress (time).
|
||||
* If both are complete, remove item1 as duplicate.
|
||||
"""
|
||||
if not check_same_identifiers(item1.identifiers, item2.identifiers):
|
||||
return False
|
||||
|
||||
# Compare watched statuses.
|
||||
status1 = item1.status
|
||||
status2 = item2.status
|
||||
|
||||
# If one is complete and the other isn't, remove the one that's not complete.
|
||||
if status1.completed != status2.completed:
|
||||
if not status1.completed and status2.completed:
|
||||
return True # Remove item1 since it's not complete.
|
||||
else:
|
||||
return False # Do not remove item1; it's complete.
|
||||
|
||||
# Both have the same completed status.
|
||||
if not status1.completed and not status2.completed:
|
||||
# Both incomplete: remove the one with lower progress (time)
|
||||
if status1.time < status2.time:
|
||||
return True # Remove item1 because it has watched less.
|
||||
elif status1.time > status2.time:
|
||||
return False # Keep item1 because it has more progress.
|
||||
else:
|
||||
# Same progress; Remove duplicate
|
||||
return True
|
||||
|
||||
# If both are complete, consider item1 the duplicate and remove it.
|
||||
return True
|
||||
|
||||
|
||||
def cleanup_watched(
|
||||
watched_list_1, watched_list_2, user_mapping=None, library_mapping=None
|
||||
):
|
||||
watched_list_1: dict[str, UserData],
|
||||
watched_list_2: dict[str, UserData],
|
||||
user_mapping: dict[str, str] | None = None,
|
||||
library_mapping: dict[str, str] | None = None,
|
||||
) -> dict[str, UserData]:
|
||||
modified_watched_list_1 = copy.deepcopy(watched_list_1)
|
||||
|
||||
# remove entries from watched_list_1 that are in watched_list_2
|
||||
@@ -88,195 +118,99 @@ def cleanup_watched(
|
||||
if user_2 is None:
|
||||
continue
|
||||
|
||||
for library_1 in watched_list_1[user_1]:
|
||||
for library_1_key in watched_list_1[user_1].libraries:
|
||||
library_other = None
|
||||
if library_mapping:
|
||||
library_other = search_mapping(library_mapping, library_1)
|
||||
library_2 = get_other(watched_list_2[user_2], library_1, library_other)
|
||||
if library_2 is None:
|
||||
library_other = search_mapping(library_mapping, library_1_key)
|
||||
library_2_key = get_other(
|
||||
watched_list_2[user_2].libraries, library_1_key, library_other
|
||||
)
|
||||
if library_2_key is None:
|
||||
continue
|
||||
|
||||
(
|
||||
_,
|
||||
episode_watched_list_2_keys_dict,
|
||||
movies_watched_list_2_keys_dict,
|
||||
) = generate_library_guids_dict(watched_list_2[user_2][library_2])
|
||||
library_1 = watched_list_1[user_1].libraries[library_1_key]
|
||||
library_2 = watched_list_2[user_2].libraries[library_2_key]
|
||||
|
||||
# Movies
|
||||
if isinstance(watched_list_1[user_1][library_1], list):
|
||||
for movie in watched_list_1[user_1][library_1]:
|
||||
movie_index = get_movie_index_in_dict(
|
||||
movie, movies_watched_list_2_keys_dict
|
||||
)
|
||||
if movie_index is not None:
|
||||
if check_remove_entry(
|
||||
movie,
|
||||
library_1,
|
||||
movie_index,
|
||||
movies_watched_list_2_keys_dict,
|
||||
):
|
||||
modified_watched_list_1[user_1][library_1].remove(movie)
|
||||
filtered_movies = []
|
||||
for movie in library_1.movies:
|
||||
remove_flag = False
|
||||
for movie2 in library_2.movies:
|
||||
if check_remove_entry(movie, movie2):
|
||||
logger.trace(f"Removing movie: {movie.identifiers.title}")
|
||||
remove_flag = True
|
||||
break
|
||||
|
||||
if not remove_flag:
|
||||
filtered_movies.append(movie)
|
||||
|
||||
modified_watched_list_1[user_1].libraries[
|
||||
library_1_key
|
||||
].movies = filtered_movies
|
||||
|
||||
# TV Shows
|
||||
elif isinstance(watched_list_1[user_1][library_1], dict):
|
||||
for show_key_1 in watched_list_1[user_1][library_1].keys():
|
||||
show_key_dict = dict(show_key_1)
|
||||
filtered_series_list = []
|
||||
for series1 in library_1.series:
|
||||
matching_series = None
|
||||
for series2 in library_2.series:
|
||||
if check_same_identifiers(series1.identifiers, series2.identifiers):
|
||||
matching_series = series2
|
||||
break
|
||||
|
||||
# Filter the episode_watched_list_2_keys_dict dictionary to handle cases
|
||||
# where episode location names are not unique such as S01E01.mkv
|
||||
filtered_episode_watched_list_2_keys_dict = (
|
||||
filter_episode_watched_list_2_keys_dict(
|
||||
episode_watched_list_2_keys_dict, show_key_dict
|
||||
if matching_series is None:
|
||||
# No matching show in watched_list_2; keep the series as is.
|
||||
filtered_series_list.append(series1)
|
||||
else:
|
||||
# We have a matching show; now clean up the episodes.
|
||||
filtered_episodes = []
|
||||
for ep1 in series1.episodes:
|
||||
remove_flag = False
|
||||
for ep2 in matching_series.episodes:
|
||||
if check_remove_entry(ep1, ep2):
|
||||
logger.trace(
|
||||
f"Removing episode '{ep1.identifiers.title}' from show '{series1.identifiers.title}'",
|
||||
)
|
||||
remove_flag = True
|
||||
break
|
||||
if not remove_flag:
|
||||
filtered_episodes.append(ep1)
|
||||
|
||||
# Only keep the series if there are remaining episodes.
|
||||
if filtered_episodes:
|
||||
modified_series1 = copy.deepcopy(series1)
|
||||
modified_series1.episodes = filtered_episodes
|
||||
filtered_series_list.append(modified_series1)
|
||||
else:
|
||||
logger.trace(
|
||||
f"Removing entire show '{series1.identifiers.title}' as no episodes remain after cleanup.",
|
||||
)
|
||||
)
|
||||
for episode in watched_list_1[user_1][library_1][show_key_1]:
|
||||
episode_index = get_episode_index_in_dict(
|
||||
episode, filtered_episode_watched_list_2_keys_dict
|
||||
)
|
||||
if episode_index is not None:
|
||||
if check_remove_entry(
|
||||
episode,
|
||||
library_1,
|
||||
episode_index,
|
||||
episode_watched_list_2_keys_dict,
|
||||
):
|
||||
modified_watched_list_1[user_1][library_1][
|
||||
show_key_1
|
||||
].remove(episode)
|
||||
modified_watched_list_1[user_1].libraries[
|
||||
library_1_key
|
||||
].series = filtered_series_list
|
||||
|
||||
# Remove empty shows
|
||||
if len(modified_watched_list_1[user_1][library_1][show_key_1]) == 0:
|
||||
if show_key_1 in modified_watched_list_1[user_1][library_1]:
|
||||
logger(
|
||||
f"Removing {show_key_dict['title']} because it is empty",
|
||||
3,
|
||||
)
|
||||
del modified_watched_list_1[user_1][library_1][show_key_1]
|
||||
|
||||
for user_1 in watched_list_1:
|
||||
for library_1 in watched_list_1[user_1]:
|
||||
if library_1 in modified_watched_list_1[user_1]:
|
||||
# If library is empty then remove it
|
||||
if len(modified_watched_list_1[user_1][library_1]) == 0:
|
||||
logger(f"Removing {library_1} from {user_1} because it is empty", 1)
|
||||
del modified_watched_list_1[user_1][library_1]
|
||||
|
||||
if user_1 in modified_watched_list_1:
|
||||
# If user is empty delete user
|
||||
if len(modified_watched_list_1[user_1]) == 0:
|
||||
logger(f"Removing {user_1} from watched list 1 because it is empty", 1)
|
||||
del modified_watched_list_1[user_1]
|
||||
# After processing, remove any library that is completely empty.
|
||||
for user, user_data in modified_watched_list_1.items():
|
||||
new_libraries = {}
|
||||
for lib_key, library in user_data.libraries.items():
|
||||
if library.movies or library.series:
|
||||
new_libraries[lib_key] = library
|
||||
else:
|
||||
logger.trace(f"Removing empty library '{lib_key}' for user '{user}'")
|
||||
user_data.libraries = new_libraries
|
||||
|
||||
return modified_watched_list_1
|
||||
|
||||
|
||||
def get_other(watched_list, object_1, object_2):
|
||||
def get_other(
|
||||
watched_list: dict[str, Any], object_1: str, object_2: str | None
|
||||
) -> str | None:
|
||||
if object_1 in watched_list:
|
||||
return object_1
|
||||
elif object_2 in watched_list:
|
||||
|
||||
if object_2 and object_2 in watched_list:
|
||||
return object_2
|
||||
else:
|
||||
logger(f"{object_1} and {object_2} not found in watched list 2", 1)
|
||||
return None
|
||||
|
||||
logger.info(
|
||||
f"{object_1}{' and ' + object_2 if object_2 else ''} not found in watched list 2"
|
||||
)
|
||||
|
||||
def get_movie_index_in_dict(movie, movies_watched_list_2_keys_dict):
|
||||
# Iterate through the keys and values of the movie dictionary
|
||||
for movie_key, movie_value in movie.items():
|
||||
# If the key is "locations", check if the "locations" key is present in the movies_watched_list_2_keys_dict dictionary
|
||||
if movie_key == "locations":
|
||||
if "locations" in movies_watched_list_2_keys_dict.keys():
|
||||
# Iterate through the locations in the movie dictionary
|
||||
for location in movie_value:
|
||||
# If the location is in the movies_watched_list_2_keys_dict dictionary, return index of the key
|
||||
return contains_nested(
|
||||
location, movies_watched_list_2_keys_dict["locations"]
|
||||
)
|
||||
|
||||
# If the key is not "locations", check if the movie_key is present in the movies_watched_list_2_keys_dict dictionary
|
||||
else:
|
||||
if movie_key in movies_watched_list_2_keys_dict.keys():
|
||||
# If the movie_value is in the movies_watched_list_2_keys_dict dictionary, return True
|
||||
if movie_value in movies_watched_list_2_keys_dict[movie_key]:
|
||||
return movies_watched_list_2_keys_dict[movie_key].index(movie_value)
|
||||
|
||||
# If the loop completes without finding a match, return False
|
||||
return None
|
||||
|
||||
|
||||
def filter_episode_watched_list_2_keys_dict(
|
||||
episode_watched_list_2_keys_dict, show_key_dict
|
||||
):
|
||||
# If the episode_watched_list_2_keys_dict dictionary is empty, missing show then return an empty dictionary
|
||||
if (
|
||||
len(episode_watched_list_2_keys_dict) == 0
|
||||
or "show" not in episode_watched_list_2_keys_dict.keys()
|
||||
):
|
||||
return {}
|
||||
|
||||
# Filter the episode_watched_list_2_keys_dict dictionary to only include values for the correct show
|
||||
filtered_episode_watched_list_2_keys_dict = {}
|
||||
show_indecies = []
|
||||
|
||||
# Iterate through episode_watched_list_2_keys_dict["show"] and find the indecies that match show_key_dict
|
||||
for show_index, show_value in enumerate(episode_watched_list_2_keys_dict["show"]):
|
||||
# Iterate through the keys and values of the show_value dictionary and check if they match show_key_dict
|
||||
for show_key, show_key_value in show_value.items():
|
||||
if show_key == "locations":
|
||||
# Iterate through the locations in the show_value dictionary
|
||||
for location in show_key_value:
|
||||
# If the location is in the episode_watched_list_2_keys_dict dictionary, return index of the key
|
||||
if (
|
||||
contains_nested(location, show_key_dict["locations"])
|
||||
is not None
|
||||
):
|
||||
show_indecies.append(show_index)
|
||||
break
|
||||
else:
|
||||
if show_key in show_key_dict.keys():
|
||||
if show_key_value == show_key_dict[show_key]:
|
||||
show_indecies.append(show_index)
|
||||
break
|
||||
|
||||
# lists
|
||||
indecies = list(set(show_indecies))
|
||||
|
||||
# If there are no indecies that match the show, return an empty dictionary
|
||||
if len(indecies) == 0:
|
||||
return {}
|
||||
|
||||
# Create a copy of the dictionary with indecies that match the show and none that don't
|
||||
for key, value in episode_watched_list_2_keys_dict.items():
|
||||
if key not in filtered_episode_watched_list_2_keys_dict:
|
||||
filtered_episode_watched_list_2_keys_dict[key] = []
|
||||
|
||||
for index, _ in enumerate(value):
|
||||
if index in indecies:
|
||||
filtered_episode_watched_list_2_keys_dict[key].append(value[index])
|
||||
else:
|
||||
filtered_episode_watched_list_2_keys_dict[key].append(None)
|
||||
|
||||
return filtered_episode_watched_list_2_keys_dict
|
||||
|
||||
|
||||
def get_episode_index_in_dict(episode, episode_watched_list_2_keys_dict):
|
||||
# Iterate through the keys and values of the episode dictionary
|
||||
for episode_key, episode_value in episode.items():
|
||||
if episode_key in episode_watched_list_2_keys_dict.keys():
|
||||
if episode_key == "locations":
|
||||
# Iterate through the locations in the episode dictionary
|
||||
for location in episode_value:
|
||||
# If the location is in the episode_watched_list_2_keys_dict dictionary, return index of the key
|
||||
return contains_nested(
|
||||
location, episode_watched_list_2_keys_dict["locations"]
|
||||
)
|
||||
|
||||
else:
|
||||
# If the episode_value is in the episode_watched_list_2_keys_dict dictionary, return True
|
||||
if episode_value in episode_watched_list_2_keys_dict[episode_key]:
|
||||
return episode_watched_list_2_keys_dict[episode_key].index(
|
||||
episode_value
|
||||
)
|
||||
|
||||
# If the loop completes without finding a match, return False
|
||||
return None
|
||||
|
||||
@@ -3,11 +3,8 @@
|
||||
## Do not mark any shows/movies as played and instead just output to log if they would of been marked.
|
||||
DRYRUN = "True"
|
||||
|
||||
## Additional logging information
|
||||
DEBUG = "True"
|
||||
|
||||
## Debugging level, "info" is default, "debug" is more verbose
|
||||
DEBUG_LEVEL = "info"
|
||||
DEBUG_LEVEL = "trace"
|
||||
|
||||
## If set to true then the script will only run once and then exit
|
||||
RUN_ONLY_ONCE = "True"
|
||||
@@ -66,7 +63,7 @@ PLEX_BASEURL = "http://localhost:32400"
|
||||
|
||||
## Plex token https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
|
||||
## Comma seperated list for multiple servers
|
||||
PLEX_TOKEN = "mVaCzSyd78uoWkCBzZ_Y"
|
||||
PLEX_TOKEN = "6S28yhwKg4y-vAXYMi1c"
|
||||
|
||||
## If not using plex token then use username and password of the server admin along with the servername
|
||||
## Comma seperated for multiple options
|
||||
|
||||
@@ -3,11 +3,8 @@
|
||||
## Do not mark any shows/movies as played and instead just output to log if they would of been marked.
|
||||
DRYRUN = "True"
|
||||
|
||||
## Additional logging information
|
||||
DEBUG = "True"
|
||||
|
||||
## Debugging level, "info" is default, "debug" is more verbose
|
||||
DEBUG_LEVEL = "info"
|
||||
DEBUG_LEVEL = "trace"
|
||||
|
||||
## If set to true then the script will only run once and then exit
|
||||
RUN_ONLY_ONCE = "True"
|
||||
@@ -66,7 +63,7 @@ PLEX_BASEURL = "http://localhost:32400"
|
||||
|
||||
## Plex token https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
|
||||
## Comma seperated list for multiple servers
|
||||
PLEX_TOKEN = "mVaCzSyd78uoWkCBzZ_Y"
|
||||
PLEX_TOKEN = "6S28yhwKg4y-vAXYMi1c"
|
||||
|
||||
## If not using plex token then use username and password of the server admin along with the servername
|
||||
## Comma seperated for multiple options
|
||||
|
||||
@@ -3,11 +3,8 @@
|
||||
## Do not mark any shows/movies as played and instead just output to log if they would of been marked.
|
||||
DRYRUN = "True"
|
||||
|
||||
## Additional logging information
|
||||
DEBUG = "True"
|
||||
|
||||
## Debugging level, "info" is default, "debug" is more verbose
|
||||
DEBUG_LEVEL = "info"
|
||||
DEBUG_LEVEL = "trace"
|
||||
|
||||
## If set to true then the script will only run once and then exit
|
||||
RUN_ONLY_ONCE = "True"
|
||||
@@ -66,7 +63,7 @@ PLEX_BASEURL = "http://localhost:32400"
|
||||
|
||||
## Plex token https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
|
||||
## Comma seperated list for multiple servers
|
||||
PLEX_TOKEN = "mVaCzSyd78uoWkCBzZ_Y"
|
||||
PLEX_TOKEN = "6S28yhwKg4y-vAXYMi1c"
|
||||
|
||||
## If not using plex token then use username and password of the server admin along with the servername
|
||||
## Comma seperated for multiple options
|
||||
|
||||
@@ -3,11 +3,8 @@
|
||||
## Do not mark any shows/movies as played and instead just output to log if they would of been marked.
|
||||
DRYRUN = "True"
|
||||
|
||||
## Additional logging information
|
||||
DEBUG = "True"
|
||||
|
||||
## Debugging level, "info" is default, "debug" is more verbose
|
||||
DEBUG_LEVEL = "info"
|
||||
DEBUG_LEVEL = "trace"
|
||||
|
||||
## If set to true then the script will only run once and then exit
|
||||
RUN_ONLY_ONCE = "True"
|
||||
@@ -66,7 +63,7 @@ PLEX_BASEURL = "http://localhost:32400"
|
||||
|
||||
## Plex token https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
|
||||
## Comma seperated list for multiple servers
|
||||
PLEX_TOKEN = "mVaCzSyd78uoWkCBzZ_Y"
|
||||
PLEX_TOKEN = "6S28yhwKg4y-vAXYMi1c"
|
||||
|
||||
## If not using plex token then use username and password of the server admin along with the servername
|
||||
## Comma seperated for multiple options
|
||||
|
||||
@@ -3,11 +3,8 @@
|
||||
## Do not mark any shows/movies as played and instead just output to log if they would of been marked.
|
||||
DRYRUN = "True"
|
||||
|
||||
## Additional logging information
|
||||
DEBUG = "True"
|
||||
|
||||
## Debugging level, "info" is default, "debug" is more verbose
|
||||
DEBUG_LEVEL = "info"
|
||||
DEBUG_LEVEL = "trace"
|
||||
|
||||
## If set to true then the script will only run once and then exit
|
||||
RUN_ONLY_ONCE = "True"
|
||||
@@ -66,7 +63,7 @@ PLEX_BASEURL = "http://localhost:32400"
|
||||
|
||||
## Plex token https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
|
||||
## Comma seperated list for multiple servers
|
||||
PLEX_TOKEN = "mVaCzSyd78uoWkCBzZ_Y"
|
||||
PLEX_TOKEN = "6S28yhwKg4y-vAXYMi1c"
|
||||
|
||||
## If not using plex token then use username and password of the server admin along with the servername
|
||||
## Comma seperated for multiple options
|
||||
|
||||
@@ -3,11 +3,8 @@
|
||||
## Do not mark any shows/movies as played and instead just output to log if they would of been marked.
|
||||
DRYRUN = "False"
|
||||
|
||||
## Additional logging information
|
||||
DEBUG = "True"
|
||||
|
||||
## Debugging level, "info" is default, "debug" is more verbose
|
||||
DEBUG_LEVEL = "info"
|
||||
DEBUG_LEVEL = "trace"
|
||||
|
||||
## If set to true then the script will only run once and then exit
|
||||
RUN_ONLY_ONCE = "True"
|
||||
@@ -66,7 +63,7 @@ PLEX_BASEURL = "http://localhost:32400"
|
||||
|
||||
## Plex token https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
|
||||
## Comma seperated list for multiple servers
|
||||
PLEX_TOKEN = "mVaCzSyd78uoWkCBzZ_Y"
|
||||
PLEX_TOKEN = "6S28yhwKg4y-vAXYMi1c"
|
||||
|
||||
## If not using plex token then use username and password of the server admin along with the servername
|
||||
## Comma seperated for multiple options
|
||||
|
||||
@@ -18,12 +18,12 @@ from src.black_white import setup_black_white_lists
|
||||
|
||||
def test_setup_black_white_lists():
|
||||
# Simple
|
||||
blacklist_library = "library1, library2"
|
||||
whitelist_library = "library1, library2"
|
||||
blacklist_library_type = "library_type1, library_type2"
|
||||
whitelist_library_type = "library_type1, library_type2"
|
||||
blacklist_users = "user1, user2"
|
||||
whitelist_users = "user1, user2"
|
||||
blacklist_library = ["library1", "library2"]
|
||||
whitelist_library = ["library1", "library2"]
|
||||
blacklist_library_type = ["library_type1", "library_type2"]
|
||||
whitelist_library_type = ["library_type1", "library_type2"]
|
||||
blacklist_users = ["user1", "user2"]
|
||||
whitelist_users = ["user1", "user2"]
|
||||
|
||||
(
|
||||
results_blacklist_library,
|
||||
@@ -48,6 +48,15 @@ def test_setup_black_white_lists():
|
||||
assert return_blacklist_users == ["user1", "user2"]
|
||||
assert return_whitelist_users == ["user1", "user2"]
|
||||
|
||||
|
||||
def test_library_mapping_black_white_list():
|
||||
blacklist_library = ["library1", "library2"]
|
||||
whitelist_library = ["library1", "library2"]
|
||||
blacklist_library_type = ["library_type1", "library_type2"]
|
||||
whitelist_library_type = ["library_type1", "library_type2"]
|
||||
blacklist_users = ["user1", "user2"]
|
||||
whitelist_users = ["user1", "user2"]
|
||||
|
||||
# Library Mapping and user mapping
|
||||
library_mapping = {"library1": "library3"}
|
||||
user_mapping = {"user1": "user3"}
|
||||
|
||||
@@ -21,10 +21,6 @@ from src.library import (
|
||||
check_skip_logic,
|
||||
check_blacklist_logic,
|
||||
check_whitelist_logic,
|
||||
show_title_dict,
|
||||
episode_title_dict,
|
||||
movies_title_dict,
|
||||
generate_library_guids_dict,
|
||||
)
|
||||
|
||||
blacklist_library = ["TV Shows"]
|
||||
@@ -280,45 +276,3 @@ def test_check_whitelist_logic():
|
||||
)
|
||||
|
||||
assert skip_reason is None
|
||||
|
||||
|
||||
def test_show_title_dict():
|
||||
show_titles_dict = show_title_dict(show_list)
|
||||
|
||||
assert show_titles_dict == show_titles
|
||||
|
||||
|
||||
def test_episode_title_dict():
|
||||
episode_titles_dict = episode_title_dict(show_list)
|
||||
|
||||
assert episode_titles_dict == episode_titles
|
||||
|
||||
|
||||
def test_movies_title_dict():
|
||||
movies_titles_dict = movies_title_dict(movie_list)
|
||||
|
||||
assert movies_titles_dict == movie_titles
|
||||
|
||||
|
||||
def test_generate_library_guids_dict():
|
||||
# Test with shows
|
||||
(
|
||||
show_titles_dict,
|
||||
episode_titles_dict,
|
||||
movies_titles_dict,
|
||||
) = generate_library_guids_dict(show_list)
|
||||
|
||||
assert show_titles_dict == show_titles
|
||||
assert episode_titles_dict == episode_titles
|
||||
assert movies_titles_dict == {}
|
||||
|
||||
# Test with movies
|
||||
(
|
||||
show_titles_dict,
|
||||
episode_titles_dict,
|
||||
movies_titles_dict,
|
||||
) = generate_library_guids_dict(movie_list)
|
||||
|
||||
assert show_titles_dict == {}
|
||||
assert episode_titles_dict == {}
|
||||
assert movies_titles_dict == movie_titles
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
import sys
|
||||
import os
|
||||
|
||||
# getting the name of the directory
|
||||
# where the this file is present.
|
||||
current = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
# Getting the parent directory name
|
||||
# where the current directory is present.
|
||||
parent = os.path.dirname(current)
|
||||
|
||||
# adding the parent directory to
|
||||
# the sys.path.
|
||||
sys.path.append(parent)
|
||||
|
||||
from src.black_white import setup_black_white_lists
|
||||
|
||||
|
||||
def test_setup_black_white_lists():
|
||||
# Simple
|
||||
blacklist_library = "library1, library2"
|
||||
whitelist_library = "library1, library2"
|
||||
blacklist_library_type = "library_type1, library_type2"
|
||||
whitelist_library_type = "library_type1, library_type2"
|
||||
blacklist_users = "user1, user2"
|
||||
whitelist_users = "user1, user2"
|
||||
|
||||
(
|
||||
results_blacklist_library,
|
||||
return_whitelist_library,
|
||||
return_blacklist_library_type,
|
||||
return_whitelist_library_type,
|
||||
return_blacklist_users,
|
||||
return_whitelist_users,
|
||||
) = setup_black_white_lists(
|
||||
blacklist_library,
|
||||
whitelist_library,
|
||||
blacklist_library_type,
|
||||
whitelist_library_type,
|
||||
blacklist_users,
|
||||
whitelist_users,
|
||||
)
|
||||
|
||||
assert results_blacklist_library == ["library1", "library2"]
|
||||
assert return_whitelist_library == ["library1", "library2"]
|
||||
assert return_blacklist_library_type == ["library_type1", "library_type2"]
|
||||
assert return_whitelist_library_type == ["library_type1", "library_type2"]
|
||||
assert return_blacklist_users == ["user1", "user2"]
|
||||
assert return_whitelist_users == ["user1", "user2"]
|
||||
|
||||
# Library Mapping and user mapping
|
||||
library_mapping = {"library1": "library3"}
|
||||
user_mapping = {"user1": "user3"}
|
||||
|
||||
(
|
||||
results_blacklist_library,
|
||||
return_whitelist_library,
|
||||
return_blacklist_library_type,
|
||||
return_whitelist_library_type,
|
||||
return_blacklist_users,
|
||||
return_whitelist_users,
|
||||
) = setup_black_white_lists(
|
||||
blacklist_library,
|
||||
whitelist_library,
|
||||
blacklist_library_type,
|
||||
whitelist_library_type,
|
||||
blacklist_users,
|
||||
whitelist_users,
|
||||
library_mapping,
|
||||
user_mapping,
|
||||
)
|
||||
|
||||
assert results_blacklist_library == ["library1", "library2", "library3"]
|
||||
assert return_whitelist_library == ["library1", "library2", "library3"]
|
||||
assert return_blacklist_library_type == ["library_type1", "library_type2"]
|
||||
assert return_whitelist_library_type == ["library_type1", "library_type2"]
|
||||
assert return_blacklist_users == ["user1", "user2", "user3"]
|
||||
assert return_whitelist_users == ["user1", "user2", "user3"]
|
||||
1267
test/test_watched.py
1267
test/test_watched.py
File diff suppressed because it is too large
Load Diff
@@ -1,25 +1,37 @@
|
||||
# Check the mark.log file that is generated by the CI to make sure it contains the expected values
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
from loguru import logger
|
||||
from collections import Counter
|
||||
|
||||
import os, argparse
|
||||
|
||||
class MarkLogError(Exception):
|
||||
"""Custom exception for mark.log validation failures."""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Check the mark.log file that is generated by the CI to make sure it contains the expected values"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--dry", action="store_true", help="Check the mark.log file for dry-run"
|
||||
group = parser.add_mutually_exclusive_group(required=True)
|
||||
group.add_argument(
|
||||
"--guids", action="store_true", help="Check the mark.log file for guids"
|
||||
)
|
||||
parser.add_argument(
|
||||
group.add_argument(
|
||||
"--locations", action="store_true", help="Check the mark.log file for locations"
|
||||
)
|
||||
group.add_argument(
|
||||
"--write", action="store_true", help="Check the mark.log file for write-run"
|
||||
)
|
||||
parser.add_argument(
|
||||
group.add_argument(
|
||||
"--plex", action="store_true", help="Check the mark.log file for Plex"
|
||||
)
|
||||
parser.add_argument(
|
||||
group.add_argument(
|
||||
"--jellyfin", action="store_true", help="Check the mark.log file for Jellyfin"
|
||||
)
|
||||
parser.add_argument(
|
||||
group.add_argument(
|
||||
"--emby", action="store_true", help="Check the mark.log file for Emby"
|
||||
)
|
||||
|
||||
@@ -28,146 +40,177 @@ def parse_args():
|
||||
|
||||
def read_marklog():
|
||||
marklog = os.path.join(os.getcwd(), "mark.log")
|
||||
with open(marklog, "r") as f:
|
||||
lines = f.readlines()
|
||||
return lines
|
||||
try:
|
||||
with open(marklog, "r") as f:
|
||||
lines = [line.strip() for line in f if line.strip()]
|
||||
return lines
|
||||
except Exception as e:
|
||||
raise MarkLogError(f"Error reading {marklog}: {e}")
|
||||
|
||||
|
||||
def check_marklog(lines, expected_values):
|
||||
try:
|
||||
# Check to make sure the marklog contains all the expected values and nothing else
|
||||
found_values = []
|
||||
for line in lines:
|
||||
# Remove the newline character
|
||||
line = line.strip()
|
||||
if line not in expected_values:
|
||||
raise Exception("Line not found in marklog: " + line)
|
||||
found_counter = Counter(lines)
|
||||
expected_counter = Counter(expected_values)
|
||||
|
||||
found_values.append(line)
|
||||
# Determine missing and extra items by comparing counts
|
||||
missing = expected_counter - found_counter
|
||||
extra = found_counter - expected_counter
|
||||
|
||||
# Check to make sure the marklog contains the same number of values as the expected values
|
||||
if len(found_values) != len(expected_values):
|
||||
raise Exception(
|
||||
"Marklog did not contain the same number of values as the expected values, found "
|
||||
+ str(len(found_values))
|
||||
+ " values, expected "
|
||||
+ str(len(expected_values))
|
||||
+ " values\n"
|
||||
+ "\n".join(found_values)
|
||||
)
|
||||
if missing or extra:
|
||||
if missing:
|
||||
logger.error("Missing expected entries (with counts):")
|
||||
for entry, count in missing.items():
|
||||
logger.error(f" {entry}: missing {count} time(s)")
|
||||
if extra:
|
||||
logger.error("Unexpected extra entries found (with counts):")
|
||||
for entry, count in extra.items():
|
||||
logger.error(f" {entry}: found {count} extra time(s)")
|
||||
|
||||
# Check that the two lists contain the same values
|
||||
if sorted(found_values) != sorted(expected_values):
|
||||
raise Exception(
|
||||
"Marklog did not contain the same values as the expected values, found:\n"
|
||||
+ "\n".join(sorted(found_values))
|
||||
+ "\n\nExpected:\n"
|
||||
+ "\n".join(sorted(expected_values))
|
||||
)
|
||||
logger.error(
|
||||
f"Entry count mismatch: found {len(lines)} entries, expected {len(expected_values)} entries."
|
||||
)
|
||||
logger.error("Full mark.log content:")
|
||||
for line in sorted(lines):
|
||||
logger.error(f" {line}")
|
||||
raise MarkLogError("mark.log validation failed.")
|
||||
|
||||
return True
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
|
||||
# Expected values defined for each check
|
||||
expected_jellyfin = [
|
||||
"jellyplex_watched/Movies/Five Nights at Freddy's",
|
||||
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/301215",
|
||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
|
||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/300670",
|
||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Aftermath",
|
||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/300741",
|
||||
"jellyplex_watched/Movies/The Family Plan",
|
||||
"jellyplex_watched/Movies/Five Nights at Freddy's",
|
||||
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/5",
|
||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
|
||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/5",
|
||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/5",
|
||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/The Way Out",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/Custom Movies/Movie Two (2021)",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/Custom TV Shows/Greatest Show Ever 3000/Episode 2",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/Movies/Five Nights at Freddy's",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/301215",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/300670",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Aftermath",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/300741",
|
||||
"Emby/Emby-Server/jellyplex_watched/Custom Movies/Movie Two",
|
||||
"Emby/Emby-Server/jellyplex_watched/Custom TV Shows/Greatest Show Ever (3000)/S01E02",
|
||||
"Emby/Emby-Server/jellyplex_watched/Movies/The Family Plan",
|
||||
"Emby/Emby-Server/jellyplex_watched/Movies/Five Nights at Freddy's",
|
||||
"Emby/Emby-Server/jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/5",
|
||||
"Emby/Emby-Server/jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
|
||||
"Emby/Emby-Server/jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/5",
|
||||
"Emby/Emby-Server/jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/5",
|
||||
"Emby/Emby-Server/jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/The Way Out",
|
||||
]
|
||||
expected_emby = [
|
||||
"jellyplex_watched/Movies/Tears of Steel",
|
||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Aftermath",
|
||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Parallels and Interiors/240429",
|
||||
"JellyUser/Movies/Tears of Steel",
|
||||
"JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/Custom Movies/Movie Three (2022)",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/Custom TV Shows/Greatest Show Ever 3000/Episode 3",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/Movies/Tears of Steel",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Aftermath",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Parallels and Interiors/240429",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Custom Movies/Movie Three (2022)",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Custom TV Shows/Greatest Show Ever (3000)/S01E03",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Movies/Tears of Steel",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4",
|
||||
]
|
||||
expected_plex = [
|
||||
"JellyUser/Movies/Big Buck Bunny",
|
||||
"JellyUser/Movies/Killers of the Flower Moon/4",
|
||||
"JellyUser/Shows/Doctor Who/The Unquiet Dead",
|
||||
"JellyUser/Shows/Doctor Who/Aliens of London (1)/4",
|
||||
"JellyUser/Shows/Monarch: Legacy of Monsters/Secrets and Lies",
|
||||
"JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4",
|
||||
"jellyplex_watched/Movies/Big Buck Bunny",
|
||||
"jellyplex_watched/Movies/The Family Plan",
|
||||
"jellyplex_watched/Movies/Killers of the Flower Moon/4",
|
||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/The Unquiet Dead",
|
||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/Aliens of London (1)/4",
|
||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Secrets and Lies",
|
||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/The Way Out",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Movies/Big Buck Bunny",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Movies/Killers of the Flower Moon/4",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Custom TV Shows/Greatest Show Ever (3000)/S01E01",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Shows/Doctor Who/The Unquiet Dead",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Shows/Doctor Who/Aliens of London (1)/4",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Shows/Monarch: Legacy of Monsters/Secrets and Lies",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Custom Movies/Movie One (2020)",
|
||||
"Emby/Emby-Server/jellyplex_watched/Movies/Big Buck Bunny",
|
||||
"Emby/Emby-Server/jellyplex_watched/Movies/The Family Plan",
|
||||
"Emby/Emby-Server/jellyplex_watched/Movies/Killers of the Flower Moon/4",
|
||||
"Emby/Emby-Server/jellyplex_watched/Custom TV Shows/Greatest Show Ever (3000)/S01E01",
|
||||
"Emby/Emby-Server/jellyplex_watched/TV Shows/Doctor Who (2005)/The Unquiet Dead",
|
||||
"Emby/Emby-Server/jellyplex_watched/TV Shows/Doctor Who (2005)/Aliens of London (1)/4",
|
||||
"Emby/Emby-Server/jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Secrets and Lies",
|
||||
"Emby/Emby-Server/jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/The Way Out",
|
||||
"Emby/Emby-Server/jellyplex_watched/Custom Movies/Movie One",
|
||||
]
|
||||
|
||||
expected_dry = expected_emby + expected_plex + expected_jellyfin
|
||||
expected_locations = expected_emby + expected_plex + expected_jellyfin
|
||||
# Remove Custom Movies/TV Shows as they should not have guids
|
||||
expected_guids = [item for item in expected_locations if "Custom" not in item]
|
||||
|
||||
expected_write = [
|
||||
"jellyplex_watched/Movies/Five Nights at Freddy's",
|
||||
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/301215",
|
||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
|
||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/300670",
|
||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Aftermath",
|
||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/300741",
|
||||
"JellyUser/Movies/Big Buck Bunny",
|
||||
"JellyUser/Movies/Killers of the Flower Moon/4",
|
||||
"JellyUser/Shows/Doctor Who/The Unquiet Dead",
|
||||
"JellyUser/Shows/Doctor Who/Aliens of London (1)/4",
|
||||
"JellyUser/Shows/Monarch: Legacy of Monsters/Secrets and Lies",
|
||||
"JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4",
|
||||
"jellyplex_watched/Movies/Tears of Steel",
|
||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Parallels and Interiors/240429",
|
||||
"jellyplex_watched/Movies/Big Buck Bunny",
|
||||
"jellyplex_watched/Movies/The Family Plan",
|
||||
"jellyplex_watched/Movies/Five Nights at Freddy's",
|
||||
"jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/5",
|
||||
"jellyplex_watched/Movies/Killers of the Flower Moon/4",
|
||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
|
||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/5",
|
||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/The Unquiet Dead",
|
||||
"jellyplex_watched/TV Shows/Doctor Who (2005)/Aliens of London (1)/4",
|
||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/5",
|
||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Secrets and Lies",
|
||||
"jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/The Way Out",
|
||||
"JellyUser/Movies/Tears of Steel",
|
||||
"JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/Custom Movies/Movie Two (2021)",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/Custom TV Shows/Greatest Show Ever 3000/Episode 2",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/Movies/Five Nights at Freddy's",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/301215",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/300670",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Aftermath",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/300741",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Movies/Big Buck Bunny",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Movies/Killers of the Flower Moon/4",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Custom TV Shows/Greatest Show Ever (3000)/S01E01",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Shows/Doctor Who/The Unquiet Dead",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Shows/Doctor Who/Aliens of London (1)/4",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Shows/Monarch: Legacy of Monsters/Secrets and Lies",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Custom Movies/Movie One (2020)",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/Custom Movies/Movie Three (2022)",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/Custom TV Shows/Greatest Show Ever 3000/Episode 3",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/Movies/Tears of Steel",
|
||||
"Plex/JellyPlex-CI/jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Parallels and Interiors/240429",
|
||||
"Emby/Emby-Server/jellyplex_watched/Movies/Big Buck Bunny",
|
||||
"Emby/Emby-Server/jellyplex_watched/Movies/The Family Plan",
|
||||
"Emby/Emby-Server/jellyplex_watched/Movies/Five Nights at Freddy's",
|
||||
"Emby/Emby-Server/jellyplex_watched/Movies/The Hunger Games: The Ballad of Songbirds & Snakes/5",
|
||||
"Emby/Emby-Server/jellyplex_watched/Movies/Killers of the Flower Moon/4",
|
||||
"Emby/Emby-Server/jellyplex_watched/Custom TV Shows/Greatest Show Ever (3000)/S01E01",
|
||||
"Emby/Emby-Server/jellyplex_watched/Custom TV Shows/Greatest Show Ever (3000)/S01E02",
|
||||
"Emby/Emby-Server/jellyplex_watched/TV Shows/Doctor Who (2005)/Rose",
|
||||
"Emby/Emby-Server/jellyplex_watched/TV Shows/Doctor Who (2005)/The End of the World/5",
|
||||
"Emby/Emby-Server/jellyplex_watched/TV Shows/Doctor Who (2005)/The Unquiet Dead",
|
||||
"Emby/Emby-Server/jellyplex_watched/TV Shows/Doctor Who (2005)/Aliens of London (1)/4",
|
||||
"Emby/Emby-Server/jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Departure/5",
|
||||
"Emby/Emby-Server/jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/Secrets and Lies",
|
||||
"Emby/Emby-Server/jellyplex_watched/TV Shows/Monarch: Legacy of Monsters/The Way Out",
|
||||
"Emby/Emby-Server/jellyplex_watched/Custom Movies/Movie One",
|
||||
"Emby/Emby-Server/jellyplex_watched/Custom Movies/Movie Two",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Custom Movies/Movie Three (2022)",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Custom TV Shows/Greatest Show Ever (3000)/S01E03",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Movies/Tears of Steel",
|
||||
"Jellyfin/Jellyfin-Server/JellyUser/Shows/Monarch: Legacy of Monsters/Parallels and Interiors/4",
|
||||
]
|
||||
|
||||
# Expected values for the mark.log file, dry-run is slightly different than write-run
|
||||
# due to some of the items being copied over from one server to another and now being there
|
||||
# for the next server run.
|
||||
if args.dry:
|
||||
expected_values = expected_dry
|
||||
# Determine which expected values to use based on the command-line flag
|
||||
if args.guids:
|
||||
expected_values = expected_guids
|
||||
check_type = "GUIDs"
|
||||
elif args.locations:
|
||||
expected_values = expected_locations
|
||||
check_type = "locations"
|
||||
elif args.write:
|
||||
expected_values = expected_write
|
||||
check_type = "write-run"
|
||||
elif args.plex:
|
||||
expected_values = expected_plex
|
||||
check_type = "Plex"
|
||||
elif args.jellyfin:
|
||||
expected_values = expected_jellyfin
|
||||
check_type = "Jellyfin"
|
||||
elif args.emby:
|
||||
expected_values = expected_emby
|
||||
check_type = "Emby"
|
||||
else:
|
||||
print("No server specified")
|
||||
exit(1)
|
||||
raise MarkLogError("No server specified")
|
||||
|
||||
lines = read_marklog()
|
||||
if not check_marklog(lines, expected_values):
|
||||
print("Failed to validate marklog")
|
||||
exit(1)
|
||||
logger.info(f"Validating mark.log for {check_type}...")
|
||||
|
||||
print("Successfully validated marklog")
|
||||
exit(0)
|
||||
try:
|
||||
lines = read_marklog()
|
||||
check_marklog(lines, expected_values)
|
||||
except MarkLogError as e:
|
||||
logger.error(e)
|
||||
sys.exit(1)
|
||||
|
||||
logger.success("Successfully validated mark.log")
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
372
uv.lock
generated
Normal file
372
uv.lock
generated
Normal file
@@ -0,0 +1,372 @@
|
||||
version = 1
|
||||
requires-python = ">=3.12"
|
||||
|
||||
[[package]]
|
||||
name = "annotated-types"
|
||||
version = "0.7.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ee/67/531ea369ba64dcff5ec9c3402f9f51bf748cec26dde048a2f973a4eea7f5/annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89", size = 16081 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "certifi"
|
||||
version = "2025.4.26"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/e8/9e/c05b3920a3b7d20d3d3310465f50348e5b3694f4f88c6daf736eef3024c4/certifi-2025.4.26.tar.gz", hash = "sha256:0a816057ea3cdefcef70270d2c515e4506bbc954f417fa5ade2021213bb8f0c6", size = 160705 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/4a/7e/3db2bd1b1f9e95f7cddca6d6e75e2f2bd9f51b1246e546d88addca0106bd/certifi-2025.4.26-py3-none-any.whl", hash = "sha256:30350364dfe371162649852c63336a15c70c6510c2ad5015b21c2345311805f3", size = 159618 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "charset-normalizer"
|
||||
version = "3.4.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/e4/33/89c2ced2b67d1c2a61c19c6751aa8902d46ce3dacb23600a283619f5a12d/charset_normalizer-3.4.2.tar.gz", hash = "sha256:5baececa9ecba31eff645232d59845c07aa030f0c81ee70184a90d35099a0e63", size = 126367 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d7/a4/37f4d6035c89cac7930395a35cc0f1b872e652eaafb76a6075943754f095/charset_normalizer-3.4.2-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:0c29de6a1a95f24b9a1aa7aefd27d2487263f00dfd55a77719b530788f75cff7", size = 199936 },
|
||||
{ url = "https://files.pythonhosted.org/packages/ee/8a/1a5e33b73e0d9287274f899d967907cd0bf9c343e651755d9307e0dbf2b3/charset_normalizer-3.4.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cddf7bd982eaa998934a91f69d182aec997c6c468898efe6679af88283b498d3", size = 143790 },
|
||||
{ url = "https://files.pythonhosted.org/packages/66/52/59521f1d8e6ab1482164fa21409c5ef44da3e9f653c13ba71becdd98dec3/charset_normalizer-3.4.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fcbe676a55d7445b22c10967bceaaf0ee69407fbe0ece4d032b6eb8d4565982a", size = 153924 },
|
||||
{ url = "https://files.pythonhosted.org/packages/86/2d/fb55fdf41964ec782febbf33cb64be480a6b8f16ded2dbe8db27a405c09f/charset_normalizer-3.4.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d41c4d287cfc69060fa91cae9683eacffad989f1a10811995fa309df656ec214", size = 146626 },
|
||||
{ url = "https://files.pythonhosted.org/packages/8c/73/6ede2ec59bce19b3edf4209d70004253ec5f4e319f9a2e3f2f15601ed5f7/charset_normalizer-3.4.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4e594135de17ab3866138f496755f302b72157d115086d100c3f19370839dd3a", size = 148567 },
|
||||
{ url = "https://files.pythonhosted.org/packages/09/14/957d03c6dc343c04904530b6bef4e5efae5ec7d7990a7cbb868e4595ee30/charset_normalizer-3.4.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cf713fe9a71ef6fd5adf7a79670135081cd4431c2943864757f0fa3a65b1fafd", size = 150957 },
|
||||
{ url = "https://files.pythonhosted.org/packages/0d/c8/8174d0e5c10ccebdcb1b53cc959591c4c722a3ad92461a273e86b9f5a302/charset_normalizer-3.4.2-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:a370b3e078e418187da8c3674eddb9d983ec09445c99a3a263c2011993522981", size = 145408 },
|
||||
{ url = "https://files.pythonhosted.org/packages/58/aa/8904b84bc8084ac19dc52feb4f5952c6df03ffb460a887b42615ee1382e8/charset_normalizer-3.4.2-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:a955b438e62efdf7e0b7b52a64dc5c3396e2634baa62471768a64bc2adb73d5c", size = 153399 },
|
||||
{ url = "https://files.pythonhosted.org/packages/c2/26/89ee1f0e264d201cb65cf054aca6038c03b1a0c6b4ae998070392a3ce605/charset_normalizer-3.4.2-cp312-cp312-musllinux_1_2_ppc64le.whl", hash = "sha256:7222ffd5e4de8e57e03ce2cef95a4c43c98fcb72ad86909abdfc2c17d227fc1b", size = 156815 },
|
||||
{ url = "https://files.pythonhosted.org/packages/fd/07/68e95b4b345bad3dbbd3a8681737b4338ff2c9df29856a6d6d23ac4c73cb/charset_normalizer-3.4.2-cp312-cp312-musllinux_1_2_s390x.whl", hash = "sha256:bee093bf902e1d8fc0ac143c88902c3dfc8941f7ea1d6a8dd2bcb786d33db03d", size = 154537 },
|
||||
{ url = "https://files.pythonhosted.org/packages/77/1a/5eefc0ce04affb98af07bc05f3bac9094513c0e23b0562d64af46a06aae4/charset_normalizer-3.4.2-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:dedb8adb91d11846ee08bec4c8236c8549ac721c245678282dcb06b221aab59f", size = 149565 },
|
||||
{ url = "https://files.pythonhosted.org/packages/37/a0/2410e5e6032a174c95e0806b1a6585eb21e12f445ebe239fac441995226a/charset_normalizer-3.4.2-cp312-cp312-win32.whl", hash = "sha256:db4c7bf0e07fc3b7d89ac2a5880a6a8062056801b83ff56d8464b70f65482b6c", size = 98357 },
|
||||
{ url = "https://files.pythonhosted.org/packages/6c/4f/c02d5c493967af3eda9c771ad4d2bbc8df6f99ddbeb37ceea6e8716a32bc/charset_normalizer-3.4.2-cp312-cp312-win_amd64.whl", hash = "sha256:5a9979887252a82fefd3d3ed2a8e3b937a7a809f65dcb1e068b090e165bbe99e", size = 105776 },
|
||||
{ url = "https://files.pythonhosted.org/packages/ea/12/a93df3366ed32db1d907d7593a94f1fe6293903e3e92967bebd6950ed12c/charset_normalizer-3.4.2-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:926ca93accd5d36ccdabd803392ddc3e03e6d4cd1cf17deff3b989ab8e9dbcf0", size = 199622 },
|
||||
{ url = "https://files.pythonhosted.org/packages/04/93/bf204e6f344c39d9937d3c13c8cd5bbfc266472e51fc8c07cb7f64fcd2de/charset_normalizer-3.4.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:eba9904b0f38a143592d9fc0e19e2df0fa2e41c3c3745554761c5f6447eedabf", size = 143435 },
|
||||
{ url = "https://files.pythonhosted.org/packages/22/2a/ea8a2095b0bafa6c5b5a55ffdc2f924455233ee7b91c69b7edfcc9e02284/charset_normalizer-3.4.2-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:3fddb7e2c84ac87ac3a947cb4e66d143ca5863ef48e4a5ecb83bd48619e4634e", size = 153653 },
|
||||
{ url = "https://files.pythonhosted.org/packages/b6/57/1b090ff183d13cef485dfbe272e2fe57622a76694061353c59da52c9a659/charset_normalizer-3.4.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:98f862da73774290f251b9df8d11161b6cf25b599a66baf087c1ffe340e9bfd1", size = 146231 },
|
||||
{ url = "https://files.pythonhosted.org/packages/e2/28/ffc026b26f441fc67bd21ab7f03b313ab3fe46714a14b516f931abe1a2d8/charset_normalizer-3.4.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c9379d65defcab82d07b2a9dfbfc2e95bc8fe0ebb1b176a3190230a3ef0e07c", size = 148243 },
|
||||
{ url = "https://files.pythonhosted.org/packages/c0/0f/9abe9bd191629c33e69e47c6ef45ef99773320e9ad8e9cb08b8ab4a8d4cb/charset_normalizer-3.4.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:e635b87f01ebc977342e2697d05b56632f5f879a4f15955dfe8cef2448b51691", size = 150442 },
|
||||
{ url = "https://files.pythonhosted.org/packages/67/7c/a123bbcedca91d5916c056407f89a7f5e8fdfce12ba825d7d6b9954a1a3c/charset_normalizer-3.4.2-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:1c95a1e2902a8b722868587c0e1184ad5c55631de5afc0eb96bc4b0d738092c0", size = 145147 },
|
||||
{ url = "https://files.pythonhosted.org/packages/ec/fe/1ac556fa4899d967b83e9893788e86b6af4d83e4726511eaaad035e36595/charset_normalizer-3.4.2-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:ef8de666d6179b009dce7bcb2ad4c4a779f113f12caf8dc77f0162c29d20490b", size = 153057 },
|
||||
{ url = "https://files.pythonhosted.org/packages/2b/ff/acfc0b0a70b19e3e54febdd5301a98b72fa07635e56f24f60502e954c461/charset_normalizer-3.4.2-cp313-cp313-musllinux_1_2_ppc64le.whl", hash = "sha256:32fc0341d72e0f73f80acb0a2c94216bd704f4f0bce10aedea38f30502b271ff", size = 156454 },
|
||||
{ url = "https://files.pythonhosted.org/packages/92/08/95b458ce9c740d0645feb0e96cea1f5ec946ea9c580a94adfe0b617f3573/charset_normalizer-3.4.2-cp313-cp313-musllinux_1_2_s390x.whl", hash = "sha256:289200a18fa698949d2b39c671c2cc7a24d44096784e76614899a7ccf2574b7b", size = 154174 },
|
||||
{ url = "https://files.pythonhosted.org/packages/78/be/8392efc43487ac051eee6c36d5fbd63032d78f7728cb37aebcc98191f1ff/charset_normalizer-3.4.2-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4a476b06fbcf359ad25d34a057b7219281286ae2477cc5ff5e3f70a246971148", size = 149166 },
|
||||
{ url = "https://files.pythonhosted.org/packages/44/96/392abd49b094d30b91d9fbda6a69519e95802250b777841cf3bda8fe136c/charset_normalizer-3.4.2-cp313-cp313-win32.whl", hash = "sha256:aaeeb6a479c7667fbe1099af9617c83aaca22182d6cf8c53966491a0f1b7ffb7", size = 98064 },
|
||||
{ url = "https://files.pythonhosted.org/packages/e9/b0/0200da600134e001d91851ddc797809e2fe0ea72de90e09bec5a2fbdaccb/charset_normalizer-3.4.2-cp313-cp313-win_amd64.whl", hash = "sha256:aa6af9e7d59f9c12b33ae4e9450619cf2488e2bbe9b44030905877f0b2324980", size = 105641 },
|
||||
{ url = "https://files.pythonhosted.org/packages/20/94/c5790835a017658cbfabd07f3bfb549140c3ac458cfc196323996b10095a/charset_normalizer-3.4.2-py3-none-any.whl", hash = "sha256:7f56930ab0abd1c45cd15be65cc741c28b1c9a34876ce8c17a2fa107810c0af0", size = 52626 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "colorama"
|
||||
version = "0.4.6"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/d8/53/6f443c9a4a8358a93a6792e2acffb9d9d5cb0a5cfd8802644b7b1c9a02e4/colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44", size = 27697 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "idna"
|
||||
version = "3.10"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f1/70/7703c29685631f5a7590aa73f1f1d3fa9a380e654b86af429e0934a32f7d/idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9", size = 190490 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3", size = 70442 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "iniconfig"
|
||||
version = "2.1.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f2/97/ebf4da567aa6827c909642694d71c9fcf53e5b504f2d96afea02718862f3/iniconfig-2.1.0.tar.gz", hash = "sha256:3abbd2e30b36733fee78f9c7f7308f2d0050e88f0087fd25c2645f63c773e1c7", size = 4793 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/2c/e1/e6716421ea10d38022b952c159d5161ca1193197fb744506875fbb87ea7b/iniconfig-2.1.0-py3-none-any.whl", hash = "sha256:9deba5723312380e77435581c6bf4935c94cbfab9b1ed33ef8d238ea168eb760", size = 6050 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "jellyplex-watched"
|
||||
version = "7.0.4"
|
||||
source = { virtual = "." }
|
||||
dependencies = [
|
||||
{ name = "loguru" },
|
||||
{ name = "packaging" },
|
||||
{ name = "plexapi" },
|
||||
{ name = "pydantic" },
|
||||
{ name = "python-dotenv" },
|
||||
{ name = "requests" },
|
||||
]
|
||||
|
||||
[package.dev-dependencies]
|
||||
dev = [
|
||||
{ name = "mypy" },
|
||||
{ name = "pytest" },
|
||||
{ name = "types-requests" },
|
||||
]
|
||||
lint = [
|
||||
{ name = "ruff" },
|
||||
]
|
||||
|
||||
[package.metadata]
|
||||
requires-dist = [
|
||||
{ name = "loguru", specifier = ">=0.7.3" },
|
||||
{ name = "packaging", specifier = "==25.0" },
|
||||
{ name = "plexapi", specifier = "==4.17.0" },
|
||||
{ name = "pydantic", specifier = "==2.11.4" },
|
||||
{ name = "python-dotenv", specifier = "==1.1.0" },
|
||||
{ name = "requests", specifier = "==2.32.3" },
|
||||
]
|
||||
|
||||
[package.metadata.requires-dev]
|
||||
dev = [
|
||||
{ name = "mypy", specifier = ">=1.15.0" },
|
||||
{ name = "pytest", specifier = ">=8.3.5" },
|
||||
{ name = "types-requests", specifier = ">=2.32.0.20250515" },
|
||||
]
|
||||
lint = [{ name = "ruff", specifier = ">=0.11.10" }]
|
||||
|
||||
[[package]]
|
||||
name = "loguru"
|
||||
version = "0.7.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
||||
{ name = "win32-setctime", marker = "sys_platform == 'win32'" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/3a/05/a1dae3dffd1116099471c643b8924f5aa6524411dc6c63fdae648c4f1aca/loguru-0.7.3.tar.gz", hash = "sha256:19480589e77d47b8d85b2c827ad95d49bf31b0dcde16593892eb51dd18706eb6", size = 63559 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/0c/29/0348de65b8cc732daa3e33e67806420b2ae89bdce2b04af740289c5c6c8c/loguru-0.7.3-py3-none-any.whl", hash = "sha256:31a33c10c8e1e10422bfd431aeb5d351c7cf7fa671e3c4df004162264b28220c", size = 61595 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mypy"
|
||||
version = "1.15.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "mypy-extensions" },
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ce/43/d5e49a86afa64bd3839ea0d5b9c7103487007d728e1293f52525d6d5486a/mypy-1.15.0.tar.gz", hash = "sha256:404534629d51d3efea5c800ee7c42b72a6554d6c400e6a79eafe15d11341fd43", size = 3239717 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/98/3a/03c74331c5eb8bd025734e04c9840532226775c47a2c39b56a0c8d4f128d/mypy-1.15.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:aea39e0583d05124836ea645f412e88a5c7d0fd77a6d694b60d9b6b2d9f184fd", size = 10793981 },
|
||||
{ url = "https://files.pythonhosted.org/packages/f0/1a/41759b18f2cfd568848a37c89030aeb03534411eef981df621d8fad08a1d/mypy-1.15.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:2f2147ab812b75e5b5499b01ade1f4a81489a147c01585cda36019102538615f", size = 9749175 },
|
||||
{ url = "https://files.pythonhosted.org/packages/12/7e/873481abf1ef112c582db832740f4c11b2bfa510e829d6da29b0ab8c3f9c/mypy-1.15.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ce436f4c6d218a070048ed6a44c0bbb10cd2cc5e272b29e7845f6a2f57ee4464", size = 11455675 },
|
||||
{ url = "https://files.pythonhosted.org/packages/b3/d0/92ae4cde706923a2d3f2d6c39629134063ff64b9dedca9c1388363da072d/mypy-1.15.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:8023ff13985661b50a5928fc7a5ca15f3d1affb41e5f0a9952cb68ef090b31ee", size = 12410020 },
|
||||
{ url = "https://files.pythonhosted.org/packages/46/8b/df49974b337cce35f828ba6fda228152d6db45fed4c86ba56ffe442434fd/mypy-1.15.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:1124a18bc11a6a62887e3e137f37f53fbae476dc36c185d549d4f837a2a6a14e", size = 12498582 },
|
||||
{ url = "https://files.pythonhosted.org/packages/13/50/da5203fcf6c53044a0b699939f31075c45ae8a4cadf538a9069b165c1050/mypy-1.15.0-cp312-cp312-win_amd64.whl", hash = "sha256:171a9ca9a40cd1843abeca0e405bc1940cd9b305eaeea2dda769ba096932bb22", size = 9366614 },
|
||||
{ url = "https://files.pythonhosted.org/packages/6a/9b/fd2e05d6ffff24d912f150b87db9e364fa8282045c875654ce7e32fffa66/mypy-1.15.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:93faf3fdb04768d44bf28693293f3904bbb555d076b781ad2530214ee53e3445", size = 10788592 },
|
||||
{ url = "https://files.pythonhosted.org/packages/74/37/b246d711c28a03ead1fd906bbc7106659aed7c089d55fe40dd58db812628/mypy-1.15.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:811aeccadfb730024c5d3e326b2fbe9249bb7413553f15499a4050f7c30e801d", size = 9753611 },
|
||||
{ url = "https://files.pythonhosted.org/packages/a6/ac/395808a92e10cfdac8003c3de9a2ab6dc7cde6c0d2a4df3df1b815ffd067/mypy-1.15.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:98b7b9b9aedb65fe628c62a6dc57f6d5088ef2dfca37903a7d9ee374d03acca5", size = 11438443 },
|
||||
{ url = "https://files.pythonhosted.org/packages/d2/8b/801aa06445d2de3895f59e476f38f3f8d610ef5d6908245f07d002676cbf/mypy-1.15.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c43a7682e24b4f576d93072216bf56eeff70d9140241f9edec0c104d0c515036", size = 12402541 },
|
||||
{ url = "https://files.pythonhosted.org/packages/c7/67/5a4268782eb77344cc613a4cf23540928e41f018a9a1ec4c6882baf20ab8/mypy-1.15.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:baefc32840a9f00babd83251560e0ae1573e2f9d1b067719479bfb0e987c6357", size = 12494348 },
|
||||
{ url = "https://files.pythonhosted.org/packages/83/3e/57bb447f7bbbfaabf1712d96f9df142624a386d98fb026a761532526057e/mypy-1.15.0-cp313-cp313-win_amd64.whl", hash = "sha256:b9378e2c00146c44793c98b8d5a61039a048e31f429fb0eb546d93f4b000bedf", size = 9373648 },
|
||||
{ url = "https://files.pythonhosted.org/packages/09/4e/a7d65c7322c510de2c409ff3828b03354a7c43f5a8ed458a7a131b41c7b9/mypy-1.15.0-py3-none-any.whl", hash = "sha256:5469affef548bd1895d86d3bf10ce2b44e33d86923c29e4d675b3e323437ea3e", size = 2221777 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mypy-extensions"
|
||||
version = "1.1.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/a2/6e/371856a3fb9d31ca8dac321cda606860fa4548858c0cc45d9d1d4ca2628b/mypy_extensions-1.1.0.tar.gz", hash = "sha256:52e68efc3284861e772bbcd66823fde5ae21fd2fdb51c62a211403730b916558", size = 6343 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/79/7b/2c79738432f5c924bef5071f933bcc9efd0473bac3b4aa584a6f7c1c8df8/mypy_extensions-1.1.0-py3-none-any.whl", hash = "sha256:1be4cccdb0f2482337c4743e60421de3a356cd97508abadd57d47403e94f5505", size = 4963 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "packaging"
|
||||
version = "25.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/a1/d4/1fc4078c65507b51b96ca8f8c3ba19e6a61c8253c72794544580a7b6c24d/packaging-25.0.tar.gz", hash = "sha256:d443872c98d677bf60f6a1f2f8c1cb748e8fe762d2bf9d3148b5599295b0fc4f", size = 165727 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", size = 66469 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "plexapi"
|
||||
version = "4.17.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "requests" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/94/79/129a01479ae08d934782a4ae2ece5bb1eee7e9576c14cf41b467a403dcb6/plexapi-4.17.0.tar.gz", hash = "sha256:065ff984a9500e049a9cc30927ab3245e518e39edc2f4058e31528be1a0a2aef", size = 154599 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/24/42/400828990b1884bb3d18d6cdbd1c26f91f1ca256619d057bd5f5d8a9ec7b/plexapi-4.17.0-py3-none-any.whl", hash = "sha256:cf42a990205c0327a2ab1d2871087a91b50596e6e960b99a185bf657525e6938", size = 166667 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pluggy"
|
||||
version = "1.6.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f9/e2/3e91f31a7d2b083fe6ef3fa267035b518369d9511ffab804f839851d2779/pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3", size = 69412 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic"
|
||||
version = "2.11.4"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "annotated-types" },
|
||||
{ name = "pydantic-core" },
|
||||
{ name = "typing-extensions" },
|
||||
{ name = "typing-inspection" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/77/ab/5250d56ad03884ab5efd07f734203943c8a8ab40d551e208af81d0257bf2/pydantic-2.11.4.tar.gz", hash = "sha256:32738d19d63a226a52eed76645a98ee07c1f410ee41d93b4afbfa85ed8111c2d", size = 786540 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e7/12/46b65f3534d099349e38ef6ec98b1a5a81f42536d17e0ba382c28c67ba67/pydantic-2.11.4-py3-none-any.whl", hash = "sha256:d9615eaa9ac5a063471da949c8fc16376a84afb5024688b3ff885693506764eb", size = 443900 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pydantic-core"
|
||||
version = "2.33.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ad/88/5f2260bdfae97aabf98f1778d43f69574390ad787afb646292a638c923d4/pydantic_core-2.33.2.tar.gz", hash = "sha256:7cb8bc3605c29176e1b105350d2e6474142d7c1bd1d9327c4a9bdb46bf827acc", size = 435195 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/18/8a/2b41c97f554ec8c71f2a8a5f85cb56a8b0956addfe8b0efb5b3d77e8bdc3/pydantic_core-2.33.2-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:a7ec89dc587667f22b6a0b6579c249fca9026ce7c333fc142ba42411fa243cdc", size = 2009000 },
|
||||
{ url = "https://files.pythonhosted.org/packages/a1/02/6224312aacb3c8ecbaa959897af57181fb6cf3a3d7917fd44d0f2917e6f2/pydantic_core-2.33.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:3c6db6e52c6d70aa0d00d45cdb9b40f0433b96380071ea80b09277dba021ddf7", size = 1847996 },
|
||||
{ url = "https://files.pythonhosted.org/packages/d6/46/6dcdf084a523dbe0a0be59d054734b86a981726f221f4562aed313dbcb49/pydantic_core-2.33.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4e61206137cbc65e6d5256e1166f88331d3b6238e082d9f74613b9b765fb9025", size = 1880957 },
|
||||
{ url = "https://files.pythonhosted.org/packages/ec/6b/1ec2c03837ac00886ba8160ce041ce4e325b41d06a034adbef11339ae422/pydantic_core-2.33.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:eb8c529b2819c37140eb51b914153063d27ed88e3bdc31b71198a198e921e011", size = 1964199 },
|
||||
{ url = "https://files.pythonhosted.org/packages/2d/1d/6bf34d6adb9debd9136bd197ca72642203ce9aaaa85cfcbfcf20f9696e83/pydantic_core-2.33.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c52b02ad8b4e2cf14ca7b3d918f3eb0ee91e63b3167c32591e57c4317e134f8f", size = 2120296 },
|
||||
{ url = "https://files.pythonhosted.org/packages/e0/94/2bd0aaf5a591e974b32a9f7123f16637776c304471a0ab33cf263cf5591a/pydantic_core-2.33.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:96081f1605125ba0855dfda83f6f3df5ec90c61195421ba72223de35ccfb2f88", size = 2676109 },
|
||||
{ url = "https://files.pythonhosted.org/packages/f9/41/4b043778cf9c4285d59742281a769eac371b9e47e35f98ad321349cc5d61/pydantic_core-2.33.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8f57a69461af2a5fa6e6bbd7a5f60d3b7e6cebb687f55106933188e79ad155c1", size = 2002028 },
|
||||
{ url = "https://files.pythonhosted.org/packages/cb/d5/7bb781bf2748ce3d03af04d5c969fa1308880e1dca35a9bd94e1a96a922e/pydantic_core-2.33.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:572c7e6c8bb4774d2ac88929e3d1f12bc45714ae5ee6d9a788a9fb35e60bb04b", size = 2100044 },
|
||||
{ url = "https://files.pythonhosted.org/packages/fe/36/def5e53e1eb0ad896785702a5bbfd25eed546cdcf4087ad285021a90ed53/pydantic_core-2.33.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:db4b41f9bd95fbe5acd76d89920336ba96f03e149097365afe1cb092fceb89a1", size = 2058881 },
|
||||
{ url = "https://files.pythonhosted.org/packages/01/6c/57f8d70b2ee57fc3dc8b9610315949837fa8c11d86927b9bb044f8705419/pydantic_core-2.33.2-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:fa854f5cf7e33842a892e5c73f45327760bc7bc516339fda888c75ae60edaeb6", size = 2227034 },
|
||||
{ url = "https://files.pythonhosted.org/packages/27/b9/9c17f0396a82b3d5cbea4c24d742083422639e7bb1d5bf600e12cb176a13/pydantic_core-2.33.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:5f483cfb75ff703095c59e365360cb73e00185e01aaea067cd19acffd2ab20ea", size = 2234187 },
|
||||
{ url = "https://files.pythonhosted.org/packages/b0/6a/adf5734ffd52bf86d865093ad70b2ce543415e0e356f6cacabbc0d9ad910/pydantic_core-2.33.2-cp312-cp312-win32.whl", hash = "sha256:9cb1da0f5a471435a7bc7e439b8a728e8b61e59784b2af70d7c169f8dd8ae290", size = 1892628 },
|
||||
{ url = "https://files.pythonhosted.org/packages/43/e4/5479fecb3606c1368d496a825d8411e126133c41224c1e7238be58b87d7e/pydantic_core-2.33.2-cp312-cp312-win_amd64.whl", hash = "sha256:f941635f2a3d96b2973e867144fde513665c87f13fe0e193c158ac51bfaaa7b2", size = 1955866 },
|
||||
{ url = "https://files.pythonhosted.org/packages/0d/24/8b11e8b3e2be9dd82df4b11408a67c61bb4dc4f8e11b5b0fc888b38118b5/pydantic_core-2.33.2-cp312-cp312-win_arm64.whl", hash = "sha256:cca3868ddfaccfbc4bfb1d608e2ccaaebe0ae628e1416aeb9c4d88c001bb45ab", size = 1888894 },
|
||||
{ url = "https://files.pythonhosted.org/packages/46/8c/99040727b41f56616573a28771b1bfa08a3d3fe74d3d513f01251f79f172/pydantic_core-2.33.2-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:1082dd3e2d7109ad8b7da48e1d4710c8d06c253cbc4a27c1cff4fbcaa97a9e3f", size = 2015688 },
|
||||
{ url = "https://files.pythonhosted.org/packages/3a/cc/5999d1eb705a6cefc31f0b4a90e9f7fc400539b1a1030529700cc1b51838/pydantic_core-2.33.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:f517ca031dfc037a9c07e748cefd8d96235088b83b4f4ba8939105d20fa1dcd6", size = 1844808 },
|
||||
{ url = "https://files.pythonhosted.org/packages/6f/5e/a0a7b8885c98889a18b6e376f344da1ef323d270b44edf8174d6bce4d622/pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0a9f2c9dd19656823cb8250b0724ee9c60a82f3cdf68a080979d13092a3b0fef", size = 1885580 },
|
||||
{ url = "https://files.pythonhosted.org/packages/3b/2a/953581f343c7d11a304581156618c3f592435523dd9d79865903272c256a/pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:2b0a451c263b01acebe51895bfb0e1cc842a5c666efe06cdf13846c7418caa9a", size = 1973859 },
|
||||
{ url = "https://files.pythonhosted.org/packages/e6/55/f1a813904771c03a3f97f676c62cca0c0a4138654107c1b61f19c644868b/pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:1ea40a64d23faa25e62a70ad163571c0b342b8bf66d5fa612ac0dec4f069d916", size = 2120810 },
|
||||
{ url = "https://files.pythonhosted.org/packages/aa/c3/053389835a996e18853ba107a63caae0b9deb4a276c6b472931ea9ae6e48/pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0fb2d542b4d66f9470e8065c5469ec676978d625a8b7a363f07d9a501a9cb36a", size = 2676498 },
|
||||
{ url = "https://files.pythonhosted.org/packages/eb/3c/f4abd740877a35abade05e437245b192f9d0ffb48bbbbd708df33d3cda37/pydantic_core-2.33.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9fdac5d6ffa1b5a83bca06ffe7583f5576555e6c8b3a91fbd25ea7780f825f7d", size = 2000611 },
|
||||
{ url = "https://files.pythonhosted.org/packages/59/a7/63ef2fed1837d1121a894d0ce88439fe3e3b3e48c7543b2a4479eb99c2bd/pydantic_core-2.33.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:04a1a413977ab517154eebb2d326da71638271477d6ad87a769102f7c2488c56", size = 2107924 },
|
||||
{ url = "https://files.pythonhosted.org/packages/04/8f/2551964ef045669801675f1cfc3b0d74147f4901c3ffa42be2ddb1f0efc4/pydantic_core-2.33.2-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:c8e7af2f4e0194c22b5b37205bfb293d166a7344a5b0d0eaccebc376546d77d5", size = 2063196 },
|
||||
{ url = "https://files.pythonhosted.org/packages/26/bd/d9602777e77fc6dbb0c7db9ad356e9a985825547dce5ad1d30ee04903918/pydantic_core-2.33.2-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:5c92edd15cd58b3c2d34873597a1e20f13094f59cf88068adb18947df5455b4e", size = 2236389 },
|
||||
{ url = "https://files.pythonhosted.org/packages/42/db/0e950daa7e2230423ab342ae918a794964b053bec24ba8af013fc7c94846/pydantic_core-2.33.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:65132b7b4a1c0beded5e057324b7e16e10910c106d43675d9bd87d4f38dde162", size = 2239223 },
|
||||
{ url = "https://files.pythonhosted.org/packages/58/4d/4f937099c545a8a17eb52cb67fe0447fd9a373b348ccfa9a87f141eeb00f/pydantic_core-2.33.2-cp313-cp313-win32.whl", hash = "sha256:52fb90784e0a242bb96ec53f42196a17278855b0f31ac7c3cc6f5c1ec4811849", size = 1900473 },
|
||||
{ url = "https://files.pythonhosted.org/packages/a0/75/4a0a9bac998d78d889def5e4ef2b065acba8cae8c93696906c3a91f310ca/pydantic_core-2.33.2-cp313-cp313-win_amd64.whl", hash = "sha256:c083a3bdd5a93dfe480f1125926afcdbf2917ae714bdb80b36d34318b2bec5d9", size = 1955269 },
|
||||
{ url = "https://files.pythonhosted.org/packages/f9/86/1beda0576969592f1497b4ce8e7bc8cbdf614c352426271b1b10d5f0aa64/pydantic_core-2.33.2-cp313-cp313-win_arm64.whl", hash = "sha256:e80b087132752f6b3d714f041ccf74403799d3b23a72722ea2e6ba2e892555b9", size = 1893921 },
|
||||
{ url = "https://files.pythonhosted.org/packages/a4/7d/e09391c2eebeab681df2b74bfe6c43422fffede8dc74187b2b0bf6fd7571/pydantic_core-2.33.2-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:61c18fba8e5e9db3ab908620af374db0ac1baa69f0f32df4f61ae23f15e586ac", size = 1806162 },
|
||||
{ url = "https://files.pythonhosted.org/packages/f1/3d/847b6b1fed9f8ed3bb95a9ad04fbd0b212e832d4f0f50ff4d9ee5a9f15cf/pydantic_core-2.33.2-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:95237e53bb015f67b63c91af7518a62a8660376a6a0db19b89acc77a4d6199f5", size = 1981560 },
|
||||
{ url = "https://files.pythonhosted.org/packages/6f/9a/e73262f6c6656262b5fdd723ad90f518f579b7bc8622e43a942eec53c938/pydantic_core-2.33.2-cp313-cp313t-win_amd64.whl", hash = "sha256:c2fc0a768ef76c15ab9238afa6da7f69895bb5d1ee83aeea2e3509af4472d0b9", size = 1935777 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pytest"
|
||||
version = "8.3.5"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "colorama", marker = "sys_platform == 'win32'" },
|
||||
{ name = "iniconfig" },
|
||||
{ name = "packaging" },
|
||||
{ name = "pluggy" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/ae/3c/c9d525a414d506893f0cd8a8d0de7706446213181570cdbd766691164e40/pytest-8.3.5.tar.gz", hash = "sha256:f4efe70cc14e511565ac476b57c279e12a855b11f48f212af1080ef2263d3845", size = 1450891 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/30/3d/64ad57c803f1fa1e963a7946b6e0fea4a70df53c1a7fed304586539c2bac/pytest-8.3.5-py3-none-any.whl", hash = "sha256:c69214aa47deac29fad6c2a4f590b9c4a9fdb16a403176fe154b79c0b4d4d820", size = 343634 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "python-dotenv"
|
||||
version = "1.1.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/88/2c/7bb1416c5620485aa793f2de31d3df393d3686aa8a8506d11e10e13c5baf/python_dotenv-1.1.0.tar.gz", hash = "sha256:41f90bc6f5f177fb41f53e87666db362025010eb28f60a01c9143bfa33a2b2d5", size = 39920 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/1e/18/98a99ad95133c6a6e2005fe89faedf294a748bd5dc803008059409ac9b1e/python_dotenv-1.1.0-py3-none-any.whl", hash = "sha256:d7c01d9e2293916c18baf562d95698754b0dbbb5e74d457c45d4f6561fb9d55d", size = 20256 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "requests"
|
||||
version = "2.32.3"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "certifi" },
|
||||
{ name = "charset-normalizer" },
|
||||
{ name = "idna" },
|
||||
{ name = "urllib3" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/63/70/2bf7780ad2d390a8d301ad0b550f1581eadbd9a20f896afe06353c2a2913/requests-2.32.3.tar.gz", hash = "sha256:55365417734eb18255590a9ff9eb97e9e1da868d4ccd6402399eaf68af20a760", size = 131218 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/f9/9b/335f9764261e915ed497fcdeb11df5dfd6f7bf257d4a6a2a686d80da4d54/requests-2.32.3-py3-none-any.whl", hash = "sha256:70761cfe03c773ceb22aa2f671b4757976145175cdfca038c02654d061d6dcc6", size = 64928 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ruff"
|
||||
version = "0.11.10"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/e8/4c/4a3c5a97faaae6b428b336dcca81d03ad04779f8072c267ad2bd860126bf/ruff-0.11.10.tar.gz", hash = "sha256:d522fb204b4959909ecac47da02830daec102eeb100fb50ea9554818d47a5fa6", size = 4165632 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/2f/9f/596c628f8824a2ce4cd12b0f0b4c0629a62dfffc5d0f742c19a1d71be108/ruff-0.11.10-py3-none-linux_armv6l.whl", hash = "sha256:859a7bfa7bc8888abbea31ef8a2b411714e6a80f0d173c2a82f9041ed6b50f58", size = 10316243 },
|
||||
{ url = "https://files.pythonhosted.org/packages/3c/38/c1e0b77ab58b426f8c332c1d1d3432d9fc9a9ea622806e208220cb133c9e/ruff-0.11.10-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:968220a57e09ea5e4fd48ed1c646419961a0570727c7e069842edd018ee8afed", size = 11083636 },
|
||||
{ url = "https://files.pythonhosted.org/packages/23/41/b75e15961d6047d7fe1b13886e56e8413be8467a4e1be0a07f3b303cd65a/ruff-0.11.10-py3-none-macosx_11_0_arm64.whl", hash = "sha256:1067245bad978e7aa7b22f67113ecc6eb241dca0d9b696144256c3a879663bca", size = 10441624 },
|
||||
{ url = "https://files.pythonhosted.org/packages/b6/2c/e396b6703f131406db1811ea3d746f29d91b41bbd43ad572fea30da1435d/ruff-0.11.10-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f4854fd09c7aed5b1590e996a81aeff0c9ff51378b084eb5a0b9cd9518e6cff2", size = 10624358 },
|
||||
{ url = "https://files.pythonhosted.org/packages/bd/8c/ee6cca8bdaf0f9a3704796022851a33cd37d1340bceaf4f6e991eb164e2e/ruff-0.11.10-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:8b4564e9f99168c0f9195a0fd5fa5928004b33b377137f978055e40008a082c5", size = 10176850 },
|
||||
{ url = "https://files.pythonhosted.org/packages/e9/ce/4e27e131a434321b3b7c66512c3ee7505b446eb1c8a80777c023f7e876e6/ruff-0.11.10-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:5b6a9cc5b62c03cc1fea0044ed8576379dbaf751d5503d718c973d5418483641", size = 11759787 },
|
||||
{ url = "https://files.pythonhosted.org/packages/58/de/1e2e77fc72adc7cf5b5123fd04a59ed329651d3eab9825674a9e640b100b/ruff-0.11.10-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:607ecbb6f03e44c9e0a93aedacb17b4eb4f3563d00e8b474298a201622677947", size = 12430479 },
|
||||
{ url = "https://files.pythonhosted.org/packages/07/ed/af0f2340f33b70d50121628ef175523cc4c37619e98d98748c85764c8d88/ruff-0.11.10-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7b3a522fa389402cd2137df9ddefe848f727250535c70dafa840badffb56b7a4", size = 11919760 },
|
||||
{ url = "https://files.pythonhosted.org/packages/24/09/d7b3d3226d535cb89234390f418d10e00a157b6c4a06dfbe723e9322cb7d/ruff-0.11.10-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2f071b0deed7e9245d5820dac235cbdd4ef99d7b12ff04c330a241ad3534319f", size = 14041747 },
|
||||
{ url = "https://files.pythonhosted.org/packages/62/b3/a63b4e91850e3f47f78795e6630ee9266cb6963de8f0191600289c2bb8f4/ruff-0.11.10-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4a60e3a0a617eafba1f2e4186d827759d65348fa53708ca547e384db28406a0b", size = 11550657 },
|
||||
{ url = "https://files.pythonhosted.org/packages/46/63/a4f95c241d79402ccdbdb1d823d156c89fbb36ebfc4289dce092e6c0aa8f/ruff-0.11.10-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:da8ec977eaa4b7bf75470fb575bea2cb41a0e07c7ea9d5a0a97d13dbca697bf2", size = 10489671 },
|
||||
{ url = "https://files.pythonhosted.org/packages/6a/9b/c2238bfebf1e473495659c523d50b1685258b6345d5ab0b418ca3f010cd7/ruff-0.11.10-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:ddf8967e08227d1bd95cc0851ef80d2ad9c7c0c5aab1eba31db49cf0a7b99523", size = 10160135 },
|
||||
{ url = "https://files.pythonhosted.org/packages/ba/ef/ba7251dd15206688dbfba7d413c0312e94df3b31b08f5d695580b755a899/ruff-0.11.10-py3-none-musllinux_1_2_i686.whl", hash = "sha256:5a94acf798a82db188f6f36575d80609072b032105d114b0f98661e1679c9125", size = 11170179 },
|
||||
{ url = "https://files.pythonhosted.org/packages/73/9f/5c336717293203ba275dbfa2ea16e49b29a9fd9a0ea8b6febfc17e133577/ruff-0.11.10-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:3afead355f1d16d95630df28d4ba17fb2cb9c8dfac8d21ced14984121f639bad", size = 11626021 },
|
||||
{ url = "https://files.pythonhosted.org/packages/d9/2b/162fa86d2639076667c9aa59196c020dc6d7023ac8f342416c2f5ec4bda0/ruff-0.11.10-py3-none-win32.whl", hash = "sha256:dc061a98d32a97211af7e7f3fa1d4ca2fcf919fb96c28f39551f35fc55bdbc19", size = 10494958 },
|
||||
{ url = "https://files.pythonhosted.org/packages/24/f3/66643d8f32f50a4b0d09a4832b7d919145ee2b944d43e604fbd7c144d175/ruff-0.11.10-py3-none-win_amd64.whl", hash = "sha256:5cc725fbb4d25b0f185cb42df07ab6b76c4489b4bfb740a175f3a59c70e8a224", size = 11650285 },
|
||||
{ url = "https://files.pythonhosted.org/packages/95/3a/2e8704d19f376c799748ff9cb041225c1d59f3e7711bc5596c8cfdc24925/ruff-0.11.10-py3-none-win_arm64.whl", hash = "sha256:ef69637b35fb8b210743926778d0e45e1bffa850a7c61e428c6b971549b5f5d1", size = 10765278 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "types-requests"
|
||||
version = "2.32.0.20250515"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "urllib3" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/06/c1/cdc4f9b8cfd9130fbe6276db574f114541f4231fcc6fb29648289e6e3390/types_requests-2.32.0.20250515.tar.gz", hash = "sha256:09c8b63c11318cb2460813871aaa48b671002e59fda67ca909e9883777787581", size = 23012 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/fe/0f/68a997c73a129287785f418c1ebb6004f81e46b53b3caba88c0e03fcd04a/types_requests-2.32.0.20250515-py3-none-any.whl", hash = "sha256:f8eba93b3a892beee32643ff836993f15a785816acca21ea0ffa006f05ef0fb2", size = 20635 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typing-extensions"
|
||||
version = "4.13.2"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/f6/37/23083fcd6e35492953e8d2aaaa68b860eb422b34627b13f2ce3eb6106061/typing_extensions-4.13.2.tar.gz", hash = "sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef", size = 106967 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/8b/54/b1ae86c0973cc6f0210b53d508ca3641fb6d0c56823f288d108bc7ab3cc8/typing_extensions-4.13.2-py3-none-any.whl", hash = "sha256:a439e7c04b49fec3e5d3e2beaa21755cadbbdc391694e28ccdd36ca4a1408f8c", size = 45806 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "typing-inspection"
|
||||
version = "0.4.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
dependencies = [
|
||||
{ name = "typing-extensions" },
|
||||
]
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/82/5c/e6082df02e215b846b4b8c0b887a64d7d08ffaba30605502639d44c06b82/typing_inspection-0.4.0.tar.gz", hash = "sha256:9765c87de36671694a67904bf2c96e395be9c6439bb6c87b5142569dcdd65122", size = 76222 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/31/08/aa4fdfb71f7de5176385bd9e90852eaf6b5d622735020ad600f2bab54385/typing_inspection-0.4.0-py3-none-any.whl", hash = "sha256:50e72559fcd2a6367a19f7a7e610e6afcb9fac940c650290eed893d61386832f", size = 14125 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "urllib3"
|
||||
version = "2.4.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/8a/78/16493d9c386d8e60e442a35feac5e00f0913c0f4b7c217c11e8ec2ff53e0/urllib3-2.4.0.tar.gz", hash = "sha256:414bc6535b787febd7567804cc015fee39daab8ad86268f1310a9250697de466", size = 390672 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/6b/11/cc635220681e93a0183390e26485430ca2c7b5f9d33b15c74c2861cb8091/urllib3-2.4.0-py3-none-any.whl", hash = "sha256:4e16665048960a0900c702d4a66415956a584919c03361cac9f1df5c5dd7e813", size = 128680 },
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "win32-setctime"
|
||||
version = "1.2.0"
|
||||
source = { registry = "https://pypi.org/simple" }
|
||||
sdist = { url = "https://files.pythonhosted.org/packages/b3/8f/705086c9d734d3b663af0e9bb3d4de6578d08f46b1b101c2442fd9aecaa2/win32_setctime-1.2.0.tar.gz", hash = "sha256:ae1fdf948f5640aae05c511ade119313fb6a30d7eabe25fef9764dca5873c4c0", size = 4867 }
|
||||
wheels = [
|
||||
{ url = "https://files.pythonhosted.org/packages/e1/07/c6fe3ad3e685340704d314d765b7912993bcb8dc198f0e7a89382d37974b/win32_setctime-1.2.0-py3-none-any.whl", hash = "sha256:95d644c4e708aba81dc3704a116d8cbc974d70b3bdb8be1d150e36be6e9d1390", size = 4083 },
|
||||
]
|
||||
Reference in New Issue
Block a user