Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #135

Merged
merged 64 commits into from
Jan 6, 2024
Merged

Dev #135

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
f8ef4fe
Add docker-compose file
luigi311 Apr 30, 2023
fd281a5
Log both servers users instead of exiting immediately
luigi311 May 15, 2023
c4a2f8a
Users: Default to username and fall back to title
luigi311 May 15, 2023
43ead4b
Plex: Fix username/title selection
luigi311 May 15, 2023
e4b4c7b
plex: Fix username/title
luigi311 May 15, 2023
da808ba
CI: Add back in dev based on alpine
luigi311 May 15, 2023
945ffb2
Plex: Cleanup username_title
luigi311 May 17, 2023
d87542a
Bump requests from 2.28.2 to 2.31.0
dependabot[bot] May 23, 2023
e94a8fb
Jellyfin: Fix errors with missing matches
luigi311 May 22, 2023
da53609
Jellyfin: Remove reassigning jellyfin_episode_id
luigi311 May 23, 2023
a227c01
Fix a type
jianglai May 30, 2023
dd64617
Jellyfin: Handle missing paths
luigi311 Jun 28, 2023
7ef37fe
Jellyfin: Check for provider_source in episode
luigi311 Jun 28, 2023
d9e6a55
Disable fast fail
luigi311 Jun 28, 2023
e6b33f1
Jellyfin: Fix locations logic
luigi311 Jul 18, 2023
03617da
Jellyfin: Remove isPlayed, Use get for name
luigi311 Aug 17, 2023
e1fb365
Update apis
luigi311 Sep 28, 2023
116d50a
Add max_threads
luigi311 Sep 28, 2023
b53d7c9
Add docker compose to types
luigi311 Sep 28, 2023
43d6bc0
Timeout issues (#103)
luigi311 Sep 25, 2023
4de25a0
Print server info
luigi311 Sep 29, 2023
466f292
Typo in .env.sample
neofright Nov 3, 2023
58c1eb7
Improve README.md
neofright Nov 3, 2023
79325b8
Update README.md
neofright Nov 3, 2023
93bc94a
Pin to 3.11 due to 3.12 issues
luigi311 Nov 13, 2023
76ac264
Add example baseurl/token to docker-compose
luigi311 Nov 13, 2023
df13cef
Add mark list support
luigi311 Nov 13, 2023
b311bf2
Add MARK/DRYRUN logger levels
luigi311 Nov 13, 2023
1841b0d
Jellyfin: Remove headers append
luigi311 Nov 13, 2023
a1b11ab
Add unraid to type
luigi311 Nov 13, 2023
dbea28e
Docker: Add RUN_ONLY_ONCE and MARKFILE
luigi311 Nov 13, 2023
b8273f5
MARKFILE match LOGFILE
luigi311 Nov 13, 2023
3dc50ff
Docker-compose: Add markfile. Add user mapping ex
luigi311 Nov 13, 2023
0c1579b
Use non root for containers
luigi311 Nov 13, 2023
8e23847
README: Change configuration to point to .env.sample
luigi311 Nov 13, 2023
d5b6859
Action: Add default variant
luigi311 Nov 13, 2023
5472baa
Action: Limit ghcr push to luigi311
luigi311 Dec 6, 2023
6b7f8b0
Bump aiohttp from 3.8.6 to 3.9.0
dependabot[bot] Nov 28, 2023
c91ba0b
Action: Add test
luigi311 Dec 6, 2023
4b02aae
Show average time on exit
luigi311 Dec 8, 2023
2e0ec9a
Plex: Use updateTimeline instead of updateProgress
luigi311 Dec 8, 2023
03cad66
README: Add troubleshooting/Issues
luigi311 Dec 10, 2023
b8b627b
Use season number instead of season name
luigi311 Dec 10, 2023
bdf6476
Watched: combine_watched_dicts check types
luigi311 Dec 10, 2023
9739b27
Remove failed message from show/episode/movie dict
luigi311 Dec 11, 2023
a2b802a
Add tini for sigterm handling
janw Dec 14, 2023
4e25ae5
CI: Validate mark log
luigi311 Jan 3, 2024
5014748
CI: Speedup start containers
luigi311 Jan 3, 2024
ba480d2
CI: Add workflow dispatch
luigi311 Jan 3, 2024
de9180a
Handle episode names are not unique
luigi311 Jan 3, 2024
9375d48
CI: Improve mark validation
luigi311 Jan 3, 2024
26f4011
Bump minimum Python version to 3.9
Nicba1010 Apr 13, 2023
9498335
Deduplicate get_movie_guids and get_episode_guids
Nicba1010 Apr 13, 2023
2e4c2a6
Refactor get_user_library_watched_show
Nicba1010 Apr 14, 2023
26f1f80
Refactor get_user_library_watched
Nicba1010 Apr 14, 2023
64b2197
Remove unnecessary check
Nicba1010 Apr 14, 2023
8fa9351
Plex: Only partially watched more than 1 min
luigi311 Jan 3, 2024
98a824b
Plex: Format
luigi311 Jan 3, 2024
9dab9a4
Merge branch 'main' into dev
luigi311 Jan 5, 2024
1edfeca
Cleanup
luigi311 Jan 6, 2024
01fc13c
Merge branch 'dev' of github.com:luigi311/JellyPlex-Watched into dev
luigi311 Jan 6, 2024
f80c20d
Watched: Remove deepcopy due to performance
luigi311 Jan 6, 2024
7317e85
Watched: Use enumerate
luigi311 Jan 6, 2024
95f2a9a
If only one worker, run in main thread to avoid overhead
luigi311 Jan 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: CI
on:
workflow_dispatch:
push:
paths-ignore:
- .gitignore
Expand Down Expand Up @@ -44,10 +45,16 @@ jobs:

sudo chown -R $PUID:$PGID JellyPlex-Watched-CI

docker pull lscr.io/linuxserver/plex &
docker pull lscr.io/linuxserver/jellyfin &

wait

docker-compose -f JellyPlex-Watched-CI/plex/docker-compose.yml up -d
docker-compose -f JellyPlex-Watched-CI/jellyfin/docker-compose.yml up -d
# Wait for containers to start
sleep 15
sleep 5

docker-compose -f JellyPlex-Watched-CI/plex/docker-compose.yml logs
docker-compose -f JellyPlex-Watched-CI/jellyfin/docker-compose.yml logs

Expand All @@ -59,6 +66,7 @@ jobs:
python main.py

cat mark.log
python test/validate_ci_marklog.py

docker:
runs-on: ubuntu-latest
Expand Down
11 changes: 11 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@
"program": "main.py",
"console": "integratedTerminal",
"justMyCode": true
},
{
"name": "Pytest",
"type": "python",
"request": "launch",
"module": "pytest",
"args": [
"-vv"
],
"console": "integratedTerminal",
"justMyCode": true
}
]
}
4 changes: 3 additions & 1 deletion Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ ENV BLACKLIST_USERS ''
ENV WHITELIST_USERS ''


RUN addgroup --system jellyplex_user && \
RUN apk add --no-cache tini && \
addgroup --system jellyplex_user && \
adduser --system --no-create-home jellyplex_user --ingroup jellyplex_user && \
mkdir -p /app && \
chown -R jellyplex_user:jellyplex_user /app
Expand All @@ -48,4 +49,5 @@ COPY --chown=jellyplex_user:jellyplex_user . .

USER jellyplex_user

ENTRYPOINT ["/sbin/tini", "--"]
CMD ["python", "-u", "main.py"]
7 changes: 6 additions & 1 deletion Dockerfile.slim
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ ENV BLACKLIST_USERS ''
ENV WHITELIST_USERS ''


RUN addgroup --system jellyplex_user && \
RUN apt-get update && \
apt-get install tini --yes --no-install-recommends && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
addgroup --system jellyplex_user && \
adduser --system --no-create-home jellyplex_user --ingroup jellyplex_user && \
mkdir -p /app && \
chown -R jellyplex_user:jellyplex_user /app
Expand All @@ -48,4 +52,5 @@ COPY --chown=jellyplex_user:jellyplex_user . .

USER jellyplex_user

ENTRYPOINT ["/bin/tini", "--"]
CMD ["python", "-u", "main.py"]
6 changes: 3 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import sys

if __name__ == "__main__":
# Check python version 3.6 or higher
if not (3, 6) <= tuple(map(int, sys.version_info[:2])):
print("This script requires Python 3.6 or higher")
# 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")
sys.exit(1)

from src.main import main
Expand Down
14 changes: 14 additions & 0 deletions src/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,16 @@ def str_to_bool(value: any) -> bool:

# 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


Expand All @@ -92,6 +99,13 @@ def future_thread_executor(args: list, threads: int = 32):

workers = min(int(os.getenv("MAX_THREADS", 32)), os.cpu_count() * 2, threads)

# 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:
for arg in args:
# * arg unpacks the list into actual arguments
Expand Down
22 changes: 19 additions & 3 deletions src/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def show_title_dict(user_list: dict):

return show_output_dict
except Exception:
logger("Generating show_output_dict failed, skipping", 1)
logger("Skipping show_output_dict ", 1)
return {}


Expand All @@ -168,12 +168,28 @@ def episode_title_dict(user_list: dict):
episode_output_dict["completed"] = []
episode_output_dict["time"] = []
episode_output_dict["locations"] = []
episode_output_dict["show"] = []
episode_output_dict["season"] = []
episode_counter = 0 # Initialize a counter for the current episode position

# Iterate through the shows, seasons, and episodes in user_list
for show in user_list:
for season in user_list[show]:
for episode in user_list[show][season]:
# 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

# Add the season number to the episode_output_dict if it doesn't exist
if "season" not in episode_output_dict:
episode_output_dict["season"] = [None] * episode_counter

# Add the show title to the episode_output_dict
episode_output_dict["show"].append(dict(show))

# Add the season number to the episode_output_dict
episode_output_dict["season"].append(season)

# 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
Expand Down Expand Up @@ -213,7 +229,7 @@ def episode_title_dict(user_list: dict):

return episode_output_dict
except Exception:
logger("Generating episode_output_dict failed, skipping", 1)
logger("Skipping episode_output_dict", 1)
return {}


Expand Down Expand Up @@ -246,7 +262,7 @@ def movies_title_dict(user_list: dict):

return movies_output_dict
except Exception:
logger("Generating movies_output_dict failed, skipping", 1)
logger("Skipping movies_output_dict failed", 1)
return {}


Expand Down
Loading
Loading