-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from cmathews393/refactor
Refactor and rewrite
- Loading branch information
Showing
29 changed files
with
962 additions
and
479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.env | ||
.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ | |
*.log | ||
*.pyc | ||
*pycache* | ||
config.toml | ||
config.toml | ||
spotiplex.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,34 @@ | ||
FROM python:latest | ||
|
||
# Set environment variables | ||
ENV SRC_DIR /usr/bin/spotiplex/ | ||
COPY ./spotiplex ${SRC_DIR}/ | ||
ENV POETRY_VERSION=1.7.1 | ||
ENV PYTHONUNBUFFERED=1 | ||
ENV CRON_SCHEDULE=@daily | ||
ENV DOCKER=True | ||
# Install Poetry | ||
RUN pip install "poetry==$POETRY_VERSION" | ||
|
||
# Copy the application source code | ||
COPY ./spotiplex ${SRC_DIR}/spotiplex | ||
COPY pyproject.toml poetry.lock ${SRC_DIR}/ | ||
COPY README.md ${SRC_DIR}/ | ||
# Set the working directory | ||
WORKDIR ${SRC_DIR} | ||
|
||
ENV PYTHONUNBUFFERED=1 | ||
# Install dependencies with Poetry | ||
RUN poetry config virtualenvs.create false \ | ||
&& poetry install --no-interaction --no-ansi | ||
|
||
# Install supercronic | ||
RUN wget -O /usr/local/bin/supercronic https://github.com/aptible/supercronic/releases/download/v0.1.11/supercronic-linux-amd64 \ | ||
&& chmod +x /usr/local/bin/supercronic | ||
|
||
|
||
# Copy entrypoint script | ||
COPY entrypoint.sh /usr/local/bin/entrypoint.sh | ||
RUN chmod +x /usr/local/bin/entrypoint.sh | ||
|
||
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] | ||
|
||
|
||
RUN pip install -r requirements.txt | ||
CMD ["python", "main.py"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
version: "3.7" | ||
services: | ||
spotiplex: | ||
restart: unless-stopped | ||
image: docker.io/0xchloe/spotiplex:latest | ||
container_name: spotiplex-latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
SPOTIPLEX_LIDARR_SYNC=True | ||
USERS= | ||
WORKERS=5 | ||
REPLACE=False | ||
INTERVAL=86400 | ||
SPOTIPLEX_MANUAL_PLAYLISTS= | ||
SPOTIFY_API_KEY= | ||
SPOTIFY_API_ID= | ||
PLEX_URL= | ||
PLEX_TOKEN= | ||
LIDARR_IP= | ||
LIDARR_TOKEN= | ||
PLEX_API_KEY= | ||
PLEX_SERVER_URL= | ||
PLEX_REPLACE= | ||
LIDARR_API_KEY= | ||
LIDARR_API_URL= | ||
PLEX_USERS=user1,user2,user3 | ||
WORKER_COUNT=4 #unless you have issues, 4 is a safe default. | ||
# SECONDS_INTERVAL=60 !!--DEPRECATED--!! | ||
MANUAL_PLAYLISTS= | ||
LIDARR_SYNC=False | ||
CRON_SCHEDULE=0 1 * * * #Takes values that are compatible with supercronic. @daily recommended |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[spotify] | ||
client_id = "" | ||
api_key = "" | ||
|
||
[plex] | ||
url = "" | ||
api_key = "" | ||
|
||
|
||
[lidarr] | ||
url = "" | ||
api_key = "" | ||
|
||
[spotiplex] | ||
lidarr_sync = "true" | ||
plex_users = "" #COMMA SEPARATED LIST, NO SPACES! user1,user2 NOT user1, user2 | ||
worker_count = 16 | ||
seconds_interval = 60 #Deprecated, should be replaced with crontab generator | ||
manual_playlists = "" #No spaces, comma separated. Might work with a mix of IDs and URLs but best to pick one format |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Create the crontab file dynamically based on the passed environment variable | ||
echo "${CRON_SCHEDULE} poetry run spotiplex sync-lidarr-imports" > /etc/supercronic-cron | ||
echo "${CRON_SCHEDULE} poetry run spotiplex sync-manual-lists" >> /etc/supercronic-cron | ||
|
||
# Run the initial commands | ||
poetry run spotiplex sync-lidarr-imports | ||
poetry run spotiplex sync-manual-lists | ||
|
||
# Start supercronic with the generated crontab | ||
exec supercronic /etc/supercronic-cron |
Oops, something went wrong.