[WINDOWS] HOW-TO use StreamTorrent as external player
#1
I've had a deeper look into streamtorrent and I have to say that this software is a piece of cr...cruel annoyment.

1. Streamtorrent is only available for windows. If you want to use it with other platforms you can only do that by means of a windows emulator(e.g. WINE for linux)

2. Streamtorrent doesn't allow any command line options to start a stream fullscreen. The only command line option is the stream url. So the window opens in standard size.

3. Streamtorrent is unstable. Sometimes buffering hangs the application and you have to kill the process.

4. Streamtorrent is not controllable with hotkeys, so you can't use your remote control for it (ok, you could assign something like: move mouse to x,y => click, but this is very unprecise and the window has to be at the same position)

The following instructions are for advanced users only.

General approach:

1. Install StreamTorrent (e.g. from http://www.softpedia.com/dyn-postdownloa...31&t=4&i=1)

2. Write a script with autoit/autohotkey that takes the stream url ("st://...") as argument. The script starts streamtorrent with this url, searches for its window and puts it fullscreen. Setup a hotkey to close streamtorrent and your script. You should always kill the process of streamtorrent, because it hangs sometimes.

3. Use the script as external player in your playercorefactory, define a rule for the "st"-protocol to use this new player.

4. Write some macros for your remote control that emulate mousemovements and clicks for volume, fullscreen, stop etc. Don't forget to define a macro for closing your script (remember the hotkey in 2.).


My solution:
I've made an AutoIt script that does exactly what I posted above:

Code:
Opt("WinTitleMatchMode", 3)
$streamurl = ""
If $CmdLine[0] > 0 Then
    $streamurl = $CmdLine[1]
Else
    MsgBox(0, '', "No stream parameter",3)
    Exit
EndIf    


$decodedUrl =  Base64Decode($streamurl)
$array = StringRegExp($decodedUrl, Chr(23) & '.(.*?)Š[a|A]', 2)
$channel = $array[1]

$WindowName = "StreamTorrent"
$Process = "streamtorrent.exe"
$Application = "[color=red]C:\Programme\StreamTorrent 1.0\StreamTorrent.exe[/color]"
HotKeySet("{F11}","Quit")

ShellExecute ( $Application ,$streamurl)

WinWait($WindowName)
WinSetState($WindowName,"",@SW_MINIMIZE)

WinWait($channel)
WinSetState($channel,"",@SW_MAXIMIZE)
ProcessWaitClose($Process)


Func Quit()
    WinClose($channel)
    WinClose($WindowName)
    $runString = StringFormat("taskkill -im %s -f", $Process)
    $run = Run($runString, "", @SW_HIDE)
    Exit
EndFunc

Func Base64Decode($s)
    Local $key = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=', _
    $t = '', $p = -8, $a = 0, $c, $d, $len = StringLen($s)
    For $i = 1 to $len
        $c = StringInStr($key, StringMid($s,$i,1), 1) - 1
        If $c < 0 Then ContinueLoop
            $a = BitOR(BitShift($a, -6), BitAND($c, 63))
            $p = $p + 6
        If $p >= 0 Then
            $d = BitAND(BitShift($a, $p), 255)
        If $c <> 64 Then $t = $t & Chr($d)
            $a = BitAND($a, 63)
            $p = $p - 8
        EndIf
    Next
    Return $t
EndFunc

That's my player for playercorefactory:
Code:
<player name="StreamTorrent" type="ExternalPlayer" audio="false" video="true">
      <filename>[color=red]C:\Skripte\StreamTorrent.exe[/color]</filename>
      <args>"{1}"</args>
      <hidexbmc>true</hidexbmc>
      <hideconsole>true</hideconsole>
      <warpcursor>none</warpcursor>
    </player>
...and the corresponding rule:
Code:
<rule protocols="st" player="StreamTorrent"/>

Pressing F11 quits the whole application. Please keep in mind that the filepaths (red) have to be adjusted . The StreamTorrent.exe is the compiled AutoIt script.

Use the script together with a macro for your remote control. Set audio adjustment to general mixer control and assign a button with F11 for closing and going back to xbmc. If you want to have true fullscreen, also assign a key for mouse double click at screen's middle. I cannot switch to fullscreen automatically because I don't know when the stream is fully loaded (and it only works when it is loaded). Have fun!
Reply


Messages In This Thread
[WINDOWS] HOW-TO use StreamTorrent as external player - by MaxMustermann - 2011-08-24, 12:11
[No subject] - by MaxMustermann - 2011-08-24, 12:14
Logout Mark Read Team Forum Stats Members Help
[WINDOWS] HOW-TO use StreamTorrent as external player0