Merge pull request #16 from l3uddz/develop

Develop
pull/27/head
James 7 years ago committed by GitHub
commit 966e34ab60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,23 +1,42 @@
# Git # User-specific stuff:
.git .idea
# Systemd files ## File-based project format:
systemd *.iws
# Logs # IntelliJ
*.log* /out/
# Configs
*.json
# Byte-compiled / optimized / DLL files # Byte-compiled / optimized / DLL files
**/__pycache__ __pycache__/
*.py[cod] *.py[cod]
*$py.class *$py.class
*.pyc *.pyc
# logs
*.log*
# databases
*.db
# configs
*.cfg
*.json
# generators
*.bat
# Pyenv # Pyenv
**/.python-version **/.python-version
# User-specific stuff: # PyInstaller
.idea build/
dist/
*.manifest
*.spec
# Git
.git
# Systemd
systemd

@ -1,22 +1,22 @@
FROM python:3.6-alpine3.7 FROM python:3.6-alpine3.7
# Arguments for build tracking
ARG BRANCH=
ARG COMMIT=
ENV \ ENV \
# App directory
APP_DIR=traktarr \ APP_DIR=traktarr \
# Branch to clone BRANCH=${BRANCH} \
BRANCH=master \ COMMIT=${COMMIT} \
# Config file
TRAKTARR_CONFIG=/config/config.json \ TRAKTARR_CONFIG=/config/config.json \
# Log file
TRAKTARR_LOGFILE=/config/traktarr.log TRAKTARR_LOGFILE=/config/traktarr.log
COPY . /${APP_DIR}
RUN \ RUN \
echo "** BRANCH: ${BRANCH} COMMIT: ${COMMIT} **" && \
echo "** Upgrade all packages **" && \ echo "** Upgrade all packages **" && \
apk --no-cache -U upgrade && \ apk --no-cache -U upgrade && \
echo "** Install OS dependencies **" && \
apk --no-cache -U add git && \
echo "** Get Traktarr **" && \
git clone --depth 1 --branch ${BRANCH} https://github.com/l3uddz/traktarr.git /${APP_DIR} && \
echo "** Install PIP dependencies **" && \ echo "** Install PIP dependencies **" && \
pip install --no-cache-dir --upgrade pip setuptools && \ pip install --no-cache-dir --upgrade pip setuptools && \
pip install --no-cache-dir --upgrade -r /${APP_DIR}/requirements.txt pip install --no-cache-dir --upgrade -r /${APP_DIR}/requirements.txt

@ -0,0 +1,6 @@
#!/bin/bash
# Docker cloud bug ?, working directory is not set acording to the config
cd ..
docker build --build-arg BRANCH=${SOURCE_BRANCH} --build-arg COMMIT=${SOURCE_COMMIT} -f ${DOCKERFILE_PATH} -t ${IMAGE_NAME} .

@ -493,21 +493,32 @@ def automatic_movies(add_delay=2.5, no_search=False, notifications=False):
def run(add_delay=2.5, no_search=False, no_notifications=False): def run(add_delay=2.5, no_search=False, no_notifications=False):
# add tasks to repeat # add tasks to repeat
if cfg.automatic.movies.interval: if cfg.automatic.movies.interval:
schedule.every(cfg.automatic.movies.interval).hours.do(automatic_movies, add_delay, no_search, schedule.every(cfg.automatic.movies.interval).hours.do(
not no_notifications) automatic_movies,
add_delay,
no_search,
not no_notifications
)
if cfg.automatic.shows.interval: if cfg.automatic.shows.interval:
schedule.every(cfg.automatic.shows.interval).hours.do(automatic_shows, add_delay, no_search, schedule.every(cfg.automatic.shows.interval).hours.do(
not no_notifications) automatic_shows,
add_delay,
no_search,
not no_notifications
)
# run schedule # run schedule
log.info("Automatic mode is now running...") log.info("Automatic mode is now running...")
while True: while True:
try: try:
# Sleep until next run
time.sleep(schedule.idle_seconds())
# Check jobs to run
schedule.run_pending() schedule.run_pending()
except Exception:
log.exception("Unhandled exception occurred while processing scheduled tasks: ") except Exception as e:
else: log.exception("Unhandled exception occurred while processing scheduled tasks: %s", e)
time.sleep(1)
############################################################ ############################################################

Loading…
Cancel
Save