-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·53 lines (48 loc) · 1.87 KB
/
run.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
#
# Script to download a bunch of stuff from svtplay. Relies heavily on
# svtplay-dl. In this script we use docker to run it, smart ey!
#
# Author: [email protected], https://github.com/deegan
#
#
# Full path to where you want to store are you svtplay goodness.
# STORAGE=$(pwd)
STORAGE="/mnt/drives/mnt1/media/barntv"
# enter the root path.
cd $STORAGE
# start with printing a neat line.
echo "--------------------------------------------------------------"
# print the date for logging purpose.
date
pwd
# make sure we have the latest version.
docker pull spaam/svtplay-dl
# handle some input in case we just want to add a single show.
if [ $1 ]; then
show=$1
if [ ! -d $STORAGE/$show ]; then
mkdir $STORAGE/$show
fi
pwd
cd $STORAGE/$show
docker run -d --rm --name svtplay_$show -u $(id -u):$(id -g) -v "$(pwd):/data" spaam/svtplay-dl -A https://svtplay.se/$show &
else
# This can be a file either local or remote, you decide. Formating is simple
# you add one show per line which matches with what svtplay uses.
# example: masterflygarna = https://www.svtplay.se/masterflygarna
showlist=$(curl https://raw.githubusercontent.com/deegan/barntv/master/shows)
# Loop through the list, checking if the show path already exists. If not then
# create the directory and cd into it. If it does exist then just cd into it
# and start running the docker image.
for show in $showlist; do
if [ ! -d $STORAGE/$show ]; then
mkdir $STORAGE/$show
fi
pwd
cd $STORAGE/$show
docker run -d --rm --name svtplay_$show -u $(id -u):$(id -g) -v "$(pwd):/data" spaam/svtplay-dl -A https://svtplay.se/$show &
sleep 1 # this is very silly. But spawning containers too fast may cause them to not come up with a network connection and subsequently dies.
done
fi
echo "--------------------------------------------------------------"