Skip to content

Commit

Permalink
Merge pull request #114 from luigi311/dev
Browse files Browse the repository at this point in the history
Add markfile, Fix documentation, Add default variant, Non-root docker container
  • Loading branch information
luigi311 authored Nov 18, 2023
2 parents 3cd73e5 + 9cc1f96 commit 5baea97
Show file tree
Hide file tree
Showing 11 changed files with 258 additions and 224 deletions.
169 changes: 86 additions & 83 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,83 +1,86 @@
# Global Settings

## 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 = "False"

## Debugging level, "info" is default, "debug" is more verbose
DEBUG_LEVEL = "info"

## If set to true then the script will only run once and then exit
RUN_ONLY_ONCE = "False"

## How often to run the script in seconds
SLEEP_DURATION = "3600"

## Log file where all output will be written to
LOGFILE = "log.log"

## Timeout for requests for jellyfin
REQUEST_TIMEOUT = 300

## Max threads for processing
MAX_THREADS = 32

## Map usernames between servers in the event that they are different, order does not matter
## Comma separated for multiple options
#USER_MAPPING = { "testuser2": "testuser3", "testuser1":"testuser4" }

## Map libraries between servers in the even that they are different, order does not matter
## Comma separated for multiple options
#LIBRARY_MAPPING = { "Shows": "TV Shows", "Movie": "Movies" }

## Blacklisting/Whitelisting libraries, library types such as Movies/TV Shows, and users. Mappings apply so if the mapping for the user or library exist then both will be excluded.
## Comma separated for multiple options
#BLACKLIST_LIBRARY = ""
#WHITELIST_LIBRARY = ""
#BLACKLIST_LIBRARY_TYPE = ""
#WHITELIST_LIBRARY_TYPE = ""
#BLACKLIST_USERS = ""
WHITELIST_USERS = "testuser1,testuser2"



# Plex

## Recommended to use token as it is faster to connect as it is direct to the server instead of going through the plex servers
## URL of the plex server, use hostname or IP address if the hostname is not resolving correctly
## Comma separated list for multiple servers
PLEX_BASEURL = "http://localhost:32400, https://nas:32400"

## Plex token https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
## Comma separated list for multiple servers
PLEX_TOKEN = "SuperSecretToken, SuperSecretToken2"

## If not using plex token then use username and password of the server admin along with the servername
## Comma separated for multiple options
#PLEX_USERNAME = "PlexUser, PlexUser2"
#PLEX_PASSWORD = "SuperSecret, SuperSecret2"
#PLEX_SERVERNAME = "Plex Server1, Plex Server2"

## Skip hostname validation for ssl certificates.
## Set to True if running into ssl certificate errors
SSL_BYPASS = "False"

## control the direction of syncing. e.g. SYNC_FROM_PLEX_TO_JELLYFIN set to true will cause the updates from plex
## to be updated in jellyfin. SYNC_FROM_PLEX_TO_PLEX set to true will sync updates between multiple plex servers
SYNC_FROM_PLEX_TO_JELLYFIN = "True"
SYNC_FROM_JELLYFIN_TO_PLEX = "True"
SYNC_FROM_PLEX_TO_PLEX = "True"
SYNC_FROM_JELLYFIN_TO_JELLYFIN = "True"


# Jellyfin

## Jellyfin server URL, use hostname or IP address if the hostname is not resolving correctly
## Comma separated list for multiple servers
JELLYFIN_BASEURL = "http://localhost:8096, http://nas:8096"

## Jellyfin api token, created manually by logging in to the jellyfin server admin dashboard and creating an api key
## Comma separated list for multiple servers
JELLYFIN_TOKEN = "SuperSecretToken, SuperSecretToken2"
# Global Settings

## 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 = "False"

## Debugging level, "info" is default, "debug" is more verbose
DEBUG_LEVEL = "info"

## If set to true then the script will only run once and then exit
RUN_ONLY_ONCE = "False"

## How often to run the script in seconds
SLEEP_DURATION = "3600"

## Log file where all output will be written to
LOGFILE = "log.log"

## Mark file where all shows/movies that have been marked as played will be written to
MARK_FILE = "mark.log"

## Timeout for requests for jellyfin
REQUEST_TIMEOUT = 300

## Max threads for processing
MAX_THREADS = 32

## Map usernames between servers in the event that they are different, order does not matter
## Comma separated for multiple options
#USER_MAPPING = { "testuser2": "testuser3", "testuser1":"testuser4" }

## Map libraries between servers in the event that they are different, order does not matter
## Comma separated for multiple options
#LIBRARY_MAPPING = { "Shows": "TV Shows", "Movie": "Movies" }

## Blacklisting/Whitelisting libraries, library types such as Movies/TV Shows, and users. Mappings apply so if the mapping for the user or library exist then both will be excluded.
## Comma separated for multiple options
#BLACKLIST_LIBRARY = ""
#WHITELIST_LIBRARY = ""
#BLACKLIST_LIBRARY_TYPE = ""
#WHITELIST_LIBRARY_TYPE = ""
#BLACKLIST_USERS = ""
WHITELIST_USERS = "testuser1,testuser2"



# Plex

## Recommended to use token as it is faster to connect as it is direct to the server instead of going through the plex servers
## URL of the plex server, use hostname or IP address if the hostname is not resolving correctly
## Comma separated list for multiple servers
PLEX_BASEURL = "http://localhost:32400, https://nas:32400"

## Plex token https://support.plex.tv/articles/204059436-finding-an-authentication-token-x-plex-token/
## Comma separated list for multiple servers
PLEX_TOKEN = "SuperSecretToken, SuperSecretToken2"

## If not using plex token then use username and password of the server admin along with the servername
## Comma separated for multiple options
#PLEX_USERNAME = "PlexUser, PlexUser2"
#PLEX_PASSWORD = "SuperSecret, SuperSecret2"
#PLEX_SERVERNAME = "Plex Server1, Plex Server2"

## Skip hostname validation for ssl certificates.
## Set to True if running into ssl certificate errors
SSL_BYPASS = "False"

## control the direction of syncing. e.g. SYNC_FROM_PLEX_TO_JELLYFIN set to true will cause the updates from plex
## to be updated in jellyfin. SYNC_FROM_PLEX_TO_PLEX set to true will sync updates between multiple plex servers
SYNC_FROM_PLEX_TO_JELLYFIN = "True"
SYNC_FROM_JELLYFIN_TO_PLEX = "True"
SYNC_FROM_PLEX_TO_PLEX = "True"
SYNC_FROM_JELLYFIN_TO_JELLYFIN = "True"


# Jellyfin

## Jellyfin server URL, use hostname or IP address if the hostname is not resolving correctly
## Comma separated list for multiple servers
JELLYFIN_BASEURL = "http://localhost:8096, http://nas:8096"

## Jellyfin api token, created manually by logging in to the jellyfin server admin dashboard and creating an api key
## Comma separated list for multiple servers
JELLYFIN_TOKEN = "SuperSecretToken, SuperSecretToken2"
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ If applicable, add logs to help explain your problem ideally with DEBUG set to t
**Type:**
- [ ] Docker Compose
- [ ] Docker
- [ ] Unraid
- [ ] Native

**Additional context**
Expand Down
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
docker:
runs-on: ubuntu-latest
needs: pytest
env:
DEFAULT_VARIANT: alpine
strategy:
fail-fast: false
matrix:
Expand All @@ -45,14 +47,19 @@ jobs:
# Do not push to ghcr.io on PRs due to permission issues
ghcr.io/${{ github.repository }},enable=${{ github.event_name != 'pull_request' }}
tags: |
type=raw,value=latest,enable=${{ matrix.variant == 'alpine' && github.ref_name == github.event.repository.default_branch }}
type=raw,value=dev,enable=${{ matrix.variant == 'alpine' && github.ref_name == 'dev' }}
type=raw,value=latest,enable=${{ matrix.variant == env.DEFAULT_VARIANT && github.ref_name == github.event.repository.default_branch }}
type=raw,value=dev,enable=${{ matrix.variant == env.DEFAULT_VARIANT && github.ref_name == 'dev' }}
type=raw,value=latest,suffix=-${{ matrix.variant }},enable={{ is_default_branch }}
type=ref,event=branch,suffix=-${{ matrix.variant }}
type=ref,event=branch,enable=${{ matrix.variant == env.DEFAULT_VARIANT }}
type=ref,event=pr,suffix=-${{ matrix.variant }}
type=ref,event=pr,enable=${{ matrix.variant == env.DEFAULT_VARIANT }}
type=semver,pattern={{ version }},suffix=-${{ matrix.variant }}
type=semver,pattern={{ version }},enable=${{ matrix.variant == env.DEFAULT_VARIANT }}
type=semver,pattern={{ major }}.{{ minor }},suffix=-${{ matrix.variant }}
type=semver,pattern={{ major }}.{{ minor }},enable=${{ matrix.variant == env.DEFAULT_VARIANT }}
type=sha,suffix=-${{ matrix.variant }}
type=sha,enable=${{ matrix.variant == env.DEFAULT_VARIANT }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand Down
16 changes: 13 additions & 3 deletions Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
FROM python:3-alpine
FROM python:3.11-alpine

ENV DRYRUN 'True'
ENV DEBUG 'True'
ENV DEBUG_LEVEL 'INFO'
ENV RUN_ONLY_ONCE 'False'
ENV SLEEP_DURATION '3600'
ENV LOGFILE 'log.log'
ENV MARKFILE 'mark.log'

ENV USER_MAPPING ''
ENV LIBRARY_MAPPING ''
Expand All @@ -30,12 +32,20 @@ ENV WHITELIST_LIBRARY_TYPE ''
ENV BLACKLIST_USERS ''
ENV WHITELIST_USERS ''


RUN addgroup --system jellyplex_user && \
adduser --system --no-create-home jellyplex_user --ingroup jellyplex_user && \
mkdir -p /app && \
chown -R jellyplex_user:jellyplex_user /app

WORKDIR /app

COPY ./requirements.txt ./
COPY --chown=jellyplex_user:jellyplex_user ./requirements.txt ./

RUN pip install --no-cache-dir -r requirements.txt

COPY . .
COPY --chown=jellyplex_user:jellyplex_user . .

USER jellyplex_user

CMD ["python", "-u", "main.py"]
17 changes: 14 additions & 3 deletions Dockerfile.slim
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
FROM python:3-slim
FROM python:3.11-slim

ENV DRYRUN 'True'
ENV DEBUG 'True'
ENV DEBUG_LEVEL 'INFO'
ENV RUN_ONLY_ONCE 'False'
ENV SLEEP_DURATION '3600'
ENV LOGFILE 'log.log'
ENV MARKFILE 'mark.log'

ENV USER_MAPPING ''
ENV LIBRARY_MAPPING ''
Expand All @@ -30,11 +32,20 @@ ENV WHITELIST_LIBRARY_TYPE ''
ENV BLACKLIST_USERS ''
ENV WHITELIST_USERS ''


RUN addgroup --system jellyplex_user && \
adduser --system --no-create-home jellyplex_user --ingroup jellyplex_user && \
mkdir -p /app && \
chown -R jellyplex_user:jellyplex_user /app

WORKDIR /app

COPY ./requirements.txt ./
COPY --chown=jellyplex_user:jellyplex_user ./requirements.txt ./

RUN pip install --no-cache-dir -r requirements.txt

COPY . .
COPY --chown=jellyplex_user:jellyplex_user . .

USER jellyplex_user

CMD ["python", "-u", "main.py"]
Loading

0 comments on commit 5baea97

Please sign in to comment.