summaryrefslogtreecommitdiff
path: root/peerflix-deadbeef
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2019-12-22 03:03:14 +0300
committerEvgeny Zinoviev <me@ch1p.io>2019-12-22 03:03:14 +0300
commit9a43ed33b78ad1efc63e23708ce5975d507bc4e9 (patch)
tree118978acb9cb0f6827f52d69ce082865c433cb16 /peerflix-deadbeef
initial commit
Diffstat (limited to 'peerflix-deadbeef')
-rwxr-xr-xpeerflix-deadbeef27
1 files changed, 27 insertions, 0 deletions
diff --git a/peerflix-deadbeef b/peerflix-deadbeef
new file mode 100755
index 0000000..b044d75
--- /dev/null
+++ b/peerflix-deadbeef
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+[ -z "$1" ] && {
+ echo "usage: peerflix-deadbeef <magnet or torrent>"
+ exit 1
+}
+
+if [[ "$1" == "--ready" ]]; then
+ host="$2"
+ port="$3"
+
+ file=$(mktemp --suffix=".m3u")
+
+ url="http://$host:$port/.m3u"
+ usleep 100000
+
+ curl "$url" > "$file"
+ deadbeef "$file" &
+
+ sleep 3
+ rm "$file"
+else
+ host="127.0.0.1"
+ port=$(shuf -i 10000-20000 -n1)
+
+ peerflix "$1" -ardqh $host -p $port --on-listening "$0 --ready $host $port"
+fi