Using sopcast

From gr0x0rd
Revision as of 20:39, 11 December 2010 by Gr0x0rd (talk | contribs) (→‎How Do I... - Using sopcast)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

How Do I... - Using sopcast

Sopcast is a great way to watch streaming live sports without advertising, flash streams or other clutter. At one point, sopcast was in portage along with some GUI frontends, but these have since been removed. In order to use sopcast, you'll have to install the binary manually from the sopcast download page. Once you have downloaded it, extract the archive contents to the folder of your choice. Open a terminal and navigate to that folder. Next, copy the archive to /usr/bin.

$ sudo cp sp-sc-auth /usr/bin/

In order to make things easier for other applications that may reference the sopcast binary, we'll create a few symlinks.

$ sudo ln -s /usr/bin/sp-sc-auth /usr/bin/sp-sc
$ sudo ln -s /usr/bin/sp-sc-auth /usr/bin/sopcast

The syntax to connect to an active sopcast stream is as follows. The url can be a specific ip or one of the sopcast broker urls. The channel is the numeric identifier for the sopcast channel you're connecting to. The remoteport and localport usually default to 8908 and 3908 respectively. If you're opening multiple streams at once, it is wise to increment both by one.

$ sopcast sop://url:channel remoteport localport >/dev/null &

The sopcast binary has a dependency, libstdc++.so.5. This is part of the libstdc++ package. If you get a dependency error running sopcast,

$ sudo emerge -av libstdc++

I have developed a bash script to connect to a sopcast stream and open it in the video player of your choice, and on the display of your choice. Feel free to edit it to your needs.

$ sudo nano /usr/bin/sop

Copy and paste the following for a list of 20 live sports channels using the script.

#! /bin/bash
#
####################################
#
# sop: gr0x0rd's sopcast launcher
#
####################################

# read the port number 
echo -n "Which port? (ex. 08) "
read -e PORT

# read which channel
echo 'Which channel?'
PS3='Choice: '
select channel in \
    'NDSports1' \
    'NDSports2' \
    'DAZ Sports1' \
    'AVJ Sports' \
    'NASN' \
    'TBN' \
    'Brewcrew' \
    'Potatocast' \
    'ChasTV' \
    'TB4U22' \
    'SG-TV' \
    'LiveSport1' \
    'KiloNet1' \
    'KiloNet2' \
    'KiloNetHD' \
    'mbcr' \
    'TeamTeal' \
    'HorrorHouse' \
    'SportZone' \
    'MMA-TV'
do
    case $REPLY in
        1 ) SOP=sop://broker1.sopcast.com:3912/90434 ;;
        2 ) SOP=sop://broker1.sopcast.com:3912/90707 ;;
        3 ) SOP=sop://broker.sopcast.com:3912/65179 ;;
        4 ) SOP=sop://broker.sopcast.com:3912/79543 ;;
	5 ) SOP=sop://broker.sopcast.com:3912/36451 ;;
	6 ) SOP=sop://broker.sopcast.com:3912/70500 ;;
	7 ) SOP=sop://broker.sopcast.com:3912/72812 ;;
	8 ) SOP=sop://broker.sopcast.com:3912/76181 ;;
	9 ) SOP=sop://broker.sopcast.com:3912/42001 ;;
	10) SOP=sop://broker.sopcast.com:3912/82507 ;;
	11) SOP=sop://broker.sopcast.com:3912/46180 ;;
	12) SOP=sop://broker.sopcast.com:3912/84506 ;;
	13) SOP=sop://broker.sopcast.com:3912/95242 ;;
	14) SOP=sop://broker.sopcast.com:3912/95243 ;;
	15) SOP=sop://60.191.221.56:3912/85844 ;;
	16) SOP=sop://broker.sopcast.com:3912/84588 ;;
	17) SOP=sop://broker.sopcast.com:3912/76181 ;;
	18) SOP=sop://broker.sopcast.com:3912/74440 ;;
	19) SOP=sop://60.12.164.67:3912/90191 ;;
	20) SOP=sop://broker.sopcast.com:3912/24267 ;;
        * ) echo 'wtf?' ;;
    esac
    if [[ -n $channel ]]; then
        exec sp-sc $SOP 39$PORT 89$PORT > /dev/null &
	echo "executing exec sp-sc $SOP 39$PORT 89$PORT > /dev/null & ..."
	break
    fi
done

# read which display
echo "Which Display?"
PS3='Choice: '
select display in \
    'LCD' \
    'TV'
do
    case $REPLY in 
	1 ) DISPLAY=0 ;;
	2 ) DISPLAY=1 ;;
	* ) echo 'wtf?' ;;
    esac
    if [[ -n $display ]]; then
	break
    fi
done

# read which player
echo "Which Player?"
PS3='Choice: '
select player in \
    'vlc' \
    'smplayer' 
do
    case $REPLY in
        1 ) PLAY="vlc -f --aspect-ratio 16:9" ;;
        2 ) PLAY="smplayer -actions \"fullscreen aspect_16:9 true\"" ;;
        * ) echo 'wtf?' ;;
    esac
    if [[ -n $player ]]; then
	sleep 5;
	export DISPLAY=:0.$DISPLAY && exec $PLAY http://$HOSTNAME:89$PORT &>/dev/null &
#	exec $PLAY http://$HOSTNAME:89$PORT &>/dev/null &
	echo "...and a good day to you, Sir!"
        break
    fi	
done

After saving the file, be sure to make it executable.

$ sudo chmod 755 /usr/bin/sop