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

add put.io integration and merge master commits to mk802II #92

Open
wants to merge 6 commits into
base: mk802II
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ Contributors
* Amir Hassan: <[email protected]>
* Jascha Ehrenreich <[email protected]>
* Bernd Forstner <[email protected]>
* Florian Bittner
33 changes: 33 additions & 0 deletions src/lounge/triggers/helpers/putio
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
# helper script by @burnoutberni
# Get stream URL and title from put.io and resolve to video file

# input format: https://put.io/v2/files/123456789/mp4/stream?token=abcd1234&title=urlencoded_title
# &title= can be omitted

urldecode(){
echo -e "$(sed 's/+/ /g; s/%/\\x/g')"
}

url="$1"

# Split title from URL at '&'
IFS="&" read -a urlparts <<< "${url}"

# Resolve URL
stream=`curl -IsL -w "%{url_effective}" "${urlparts[0]}" -o /dev/null`
stream=${stream:5}
stream="http"$stream

# Format title
title=${urlparts[1]}
title=${title#title=}

# Echo video URL and title if existing
echo $stream
if [ $title ]
then
echo $title | urldecode
else
echo "put.io Stream"
fi
10 changes: 5 additions & 5 deletions src/lounge/triggers/helpers/youtube
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ IFS=","
set -- $STREAMS

SELECTED=
for s in $@; do
for s in $@; do
f=$(l_urldecode "`parse_query $s "type"`"|cut -d ';' -f1)

if [ "$f" != "video/x-flv" ]; then
Expand All @@ -57,7 +57,7 @@ for s in $@; do
elif [ -z "$small" -a "$q" == "small" ]; then
small="$s"
fi
done
done

SELECTED="$large"

Expand All @@ -69,9 +69,9 @@ if [ -z "$SELECTED" ]; then
SELECTED="$small"
fi

SURL=$(l_urldecode "`parse_query $SELECTED "url"`")
SIG="`parse_query $SELECTED "sig"`"
URL="$SURL&signature=$SIG"
URL=$(l_urldecode "`parse_query $SELECTED "url"`")
# SIG="`parse_query $SELECTED "sig"`"
# URL="$SURL&signature=$SIG"

echo $URL
echo $TITLE