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

Dockerize #11

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/downloads
/vendor
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@
/vendors-install.bat
/vendors-update.bat
/vendors-whatsnew.bat
/vendor
/downloads
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM alpine:3.6

COPY . /southpark

WORKDIR /southpark

RUN apk add --no-cache mkvtoolnix ffmpeg php7 php7-json php7-phar php7-iconv php7-openssl php7-dom

RUN php -r "eval('?>'.file_get_contents('http://getcomposer.org/installer'));" -- && \
php composer.phar --no-interaction --no-plugins install --prefer-dist && \
cp config-sample-linux.php config.php

ENTRYPOINT ["php","download.php"]
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,17 @@ To download all episodes of season 15 in English:
To download episode 8 of season 13 in German and English, while taking video from the German source and setting the default audio language to German:

php download.php s=13 e=8 l=de+en

# Alternative usage with docker

## Unix

To download all episodes of season 15 in English:

bash download.sh -s 15 -l en

To download episode 8 of season 13 in German and English, while taking video from the German source and setting the default audio language to German:

bash download.sh -s 13 -e 8 -l de+en

## Windows
39 changes: 39 additions & 0 deletions download.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash

IMAGE_NAME="southparkdownloader"

# set all arguments
while getopts e:s:l: OPTION
do
case ${OPTION} in
e) EPISODE=${OPTARG};;
s) SEASON=${OPTARG};;
l) LANGUAGE=${OPTARG};;
esac
done

# validate season
if ! [[ ${SEASON} =~ ^[0-9]{1,2}$ ]]; then
echo "Season (-s) must be an integer value."; exit 1
fi

# validate language
if ! [[ ${LANGUAGE} =~ ^(en|de|de\+en|en\+de)$ ]]; then
echo "Language (-l) must be \"en\" for english, \"de\" for german, \"de+en\" for both with german as default "\
"or \"en+de\" for both with english as default."; exit 1
fi

# validate episode if is set
if ! [ -z ${EPISODE} ]; then
if ! [[ ${EPISODE} =~ ^[0-9]{1,2}$ ]]; then
echo "Episode (-e) must be an integer value."; exit 1
fi
fi

# build docker image if it does not exist
if [ -z $(docker images -q ${IMAGE_NAME}) ]; then
docker build -t ${IMAGE_NAME} $(pwd)/.
fi

# run downloader
docker run -it -v $(pwd)/downloads:/tmp ${IMAGE_NAME} s=${SEASON} l=${LANGUAGE} $(! [ -z ${EPISODE} ] || e=${EPISODE})
2 changes: 0 additions & 2 deletions vendor/.gitignore

This file was deleted.