Kodi Community Forum
[WINDOWS] HOW-TO use StreamTorrent as external player - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Supplementary Tools for Kodi (https://forum.kodi.tv/forumdisplay.php?fid=116)
+--- Thread: [WINDOWS] HOW-TO use StreamTorrent as external player (/showthread.php?tid=108539)



[WINDOWS] HOW-TO use StreamTorrent as external player - MaxMustermann - 2011-08-24

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-postdownload.php?p=129131&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!


- MaxMustermann - 2011-08-24

reserved


Use Wine to run Stream Torrent in Linux - Hudson_Hawk04 - 2011-09-07

Originally posted in the wrong thread, sorry about that, both of my xbmc boxes are running variants of Linux, Ubuntu to be precise. I was wondering if it would be possible to run stream torrent through wine?


RE: [WINDOWS] HOW-TO use StreamTorrent as external player - rbrohman - 2012-05-05

I have run streamtorrent through wine on Ubuntu. It was not a pleasant experience (took MUCH longer for a stream to actually start than in windows), though it did work. I would love to see something like this script for linux, would be great to use with the SportsDevil addon.


RE: [WINDOWS] HOW-TO use StreamTorrent as external player - dkplayaclub - 2012-09-01

I am not able to get streamtorrent links running at all, using the SportsDevil addon. I don't really need to use the remote control functions. Could someone make a little more detailed guide for how to do this?

I am using Windows 7 64 bit for what it's worth.


RE: [WINDOWS] HOW-TO use StreamTorrent as external player - Icarus3000 - 2013-01-20

Any updated guides on how to set this up to work with SportsDevil?


RE: [WINDOWS] HOW-TO use StreamTorrent as external player - aminemed - 2013-02-04

Same here..


RE: [WINDOWS] HOW-TO use StreamTorrent as external player - natenjo - 2013-04-23

Hello, there is also a linux version of StreamTorrent/AceStream now. Maybe someone can help out with a script for my xbmcbuntu Smile

http://forum.torrentstream.org/index.php?topic=1465.0


RE: [WINDOWS] HOW-TO use StreamTorrent as external player - jharrer1980 - 2013-07-23

is there a version for openelec? this boots right into xbmc


RE: [WINDOWS] HOW-TO use StreamTorrent as external player - osirisjem - 2014-08-01

Is this still the preferred way to do things ?