Kodi Community Forum
[Discontinued] NHL Gamecenter Addon - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Video Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=154)
+---- Thread: [Discontinued] NHL Gamecenter Addon (/showthread.php?tid=118853)



- 91dxcrx - 2012-02-29

apok Wrote:You would need to recompile your xbmc binary from source to replace it. The lines prefixed with > show where code was modified for my patched build.

Code:
apokalypse@destruction:~/tmp/xbmc$ diff ~/tmp/xbmc/playlists/PlayListFactory.cpp ~/xbmc-patched/xbmc/playlists/PlayListFactory.cpp
66c66
<     if (strMimeType == "audio/x-mpegurl")
---
>     if ((strMimeType == "audio/x-mpegurl") && !item.IsType(".m3u8"))
123c123
<   || strMimeType == "audio/x-mpegurl")
---
>   || ((strMimeType == "audio/x-mpegurl") && !item.IsType(".m3u8")))

Reading the wiki about recompiling builds, but I'm having a hard time grasping it. :o


- apok - 2012-03-02

Carb0, I think I have a way of getting NHL live games working in the interim until HLS support is built into xbmc without having to roll your own xbmc binary.

A couple tweaks to the gamecenter.py with code from divingmule's MLBMC plugin (nexdef mod more specifically), and a mlbhls stream downloader that doesn't decrypt the stream (MLB streams are AES-128 encrypted). If you guys like, I can throw this up somewhere after I test it tonight.


- Carb0 - 2012-03-02

apok Wrote:Carb0, I think I have a way of getting NHL live games working in the interim until HLS support is built into xbmc without having to roll your own xbmc binary.

A couple tweaks to the gamecenter.py with code from divingmule's MLBMC plugin (nexdef mod more specifically), and a mlbhls stream downloader that doesn't decrypt the stream (MLB streams are AES-128 encrypted). If you guys like, I can throw this up somewhere after I test it tonight.

Cool. I hope it works.


- apok - 2012-03-03

K, I think I'm satisfied with this.

http://www.2shared.com/file/1Tdn1jkD/mlbhls-nhltar.html
http://www.2shared.com/file/e9Rw4J89/pluginvideonhl-gamecenter-mlbt.html

extract plugin.video.nhl-gamecenter-mlb.tar.gz to your addons directory as you would a normal script.

extract mlbhls-nhl.tar.gz somewhere and compile it (you need the libraries that are included below, i.e. config, curl, crypto and math).

apokalypse@destruction:~/temp$ cd mlbhls-nhl
apokalypse@destruction:~/temp/mlbhls-nhl$ make
gcc -O2 mlb.c utils.c output.c -lm -lcurl -lcrypto -lconfig -o mlbhls
mlb.c: In function 'mlb_refresh_playlists_thread':
mlb.c:345: warning: format '%lld' expects type 'long long int', but argument 2 has type 'size_t'
apokalypse@destruction:~/temp/mlbhls-nhl$ ./mlbhls
Usage: ./mlbhls [options] -B <base64> -o <output_file>

Required:
-B, --base64 base64 url
-o, --ouput File to output to
Options:

-V, --verbose Verbose output (big V, use multiple times to increase verbosity)


then, as root, copy 'mlbhls' to /usr/bin or somewhere in your $PATH.

Changes
Two different links show up for Home and Away feeds. You can stream the game in it's entirety '(start)', or by selecting the '(stream)'. The start will skip the first 50 minutes worth of video, as most streams start 50-60 minutes before the broadcast feed kicks in. I'd only recommend streaming from the start if you are going to tune in right as the game is about to start.

If you select stream, it'll buffer the last 20 seconds (2 URLs) worth of video. This is hardcoded in the addLinkExt() calls with the '2' at the end.

It'll sleep for about 5 seconds before launching the player, so don't freak out. It's just giving the mlbhls program enough time to download from the streams and write to disk. The download file is written to /tmp/output, and cleaned up afterwards. There's also a log for mlbhls written to /tmp/hls.log.


- Carb0 - 2012-03-03

Thank you.

Does it only work on linux?

What did you change in gamecenter.py? I've seen you added "def LAUNCHEXTERNAL(url,startFrom)" and "def addLinkExt(name,url,title,iconimage,startFrom)" and changed a few lines in "def LIVELINKS(url,name)". Anything else?

Do you want to keep it as a seperate version of the addon? Or should I add the changes to my next version?


Edit:
There is a new version available in my repo (WITHOUT apok's modifications).
You can download the repo here.

0.3.1
- Fixed logo download

0.3.0
- Added team logos
- Added thumbnails for classic games
- Added option to display team names abbreviated
- Added addon fanart
- Changed addon icon
- Changed video titles
- Faster scraping of classic games

Please note that live games are still not working. If you want to watch live games please use apok's version.


- apok - 2012-03-03

Correct, that will only work in Linux for now. You'd need to get a mlbhls.exe built and then incorporate some platform detection so that the temp file can be written to the right place i.e. %TEMP% on Windows.

There's also a "class MyPlayer( xbmc.Player )" for launching the player, and cleaning up the temp file/killing the mlbhls process when you stop watching video.

If you want to absorb the changes into your script I'm ok with that.


- anthomacp - 2012-03-03

Yay! Progress! haha


- apok - 2012-03-03

Carb0 I got mlbhls to build under Cygwin, and when shipped with the DLLs it'll run on Windows. I'll throw together platform detection, test it here and throw up another copy of gamecenter-mlb.


- apok - 2012-03-04

Alright, update!

Here's a mlbhls.exe (with dependancy DLLs) that I compiled in cygwin. Extract it to somewhere convenient i.e. c:\mlbhls-nhl\

MLBHLS-NHL (Windows EXE and source) http://www.2shared.com/file/f8GjtoPK/mlbhls-nhl.html
NHLGC 0.3.2.1 http://www.2shared.com/file/0MbP0hX8/pluginvideonhl-gamecenter-mlb-.html

I added an enhancement to the mlbhls-nhl for pulling the TARGETDURATION from the m3u8 streams, since the original is coded for a 12 second delay. This should prevent some edge cases from occurring.

You will need to configure the "Path to MLBHLS Binary" and "HLS Output DIR" settings, as these will be OS-dependent.

For the Binary, if you are on linux so long as it's under /usr/bin you can just enter "mlbhls". Use a full path for Windows.
For the Output Dir, supply a trailing slash i.e. '/' on Linux or '\' on Windows.

Sleep on start specifies how long to wait for the stream to start building locally.

Files to buffer is only used when you select a live stream instead of viewing a game from the start. Keep in mind that each file segment is ~10 seconds long.

With the default of 3 and a sleep time of 15 seconds, you'll allow 30-40 seconds of video to be written to the output file prior to xbmc launching it.

I noticed changing the add-on settings seems to crash XBMC, so beware.

On Windows, the mlbhls does open in an external window - just alt-tab and it'll run in the background. Unfortunately I couldn't figure out how to kill the program when you stop viewing the screen if it is hidden (on Windows), because it's a child process that's executed. On Linux, pkill takes care of it Smile


- Carb0 - 2012-03-04

I tried it on Windows 7 64bit but it didn't work. The mlbhls-nhl window pops up, immediately closes and XBMC shows an error. Sometimes the mlbhls-nhl window shows the line "Start fetching video from line: 600" over and over again. The output.ts and the log file are both 0 bytes large.

Here is my xbmc.log:
http://pastebin.com/fEVyTtZW


- apok - 2012-03-04

Carb0 Wrote:I tried it on Windows 7 64bit but it didn't work. The mlbhls-nhl window pops up, immediately closes and XBMC shows an error. Sometimes the mlbhls-nhl window shows the line "Start fetching video from line: 600" over and over again. The output.ts and the log file are both 0 bytes large.

Here is my xbmc.log:
http://pastebin.com/fEVyTtZW

Try setting video quality to auto. The MLBHLS relies on a master URL to fetch stream URLs from, so I don't think providing a quality-based stream will work.

You can specify max bandwidth with -b <value in bits> so that it selects an appropriate choice. This can probably be added to the line w/execution instead of tampering with the URL.

I'm seeing some strange behavior that I'm trying to track down right now where the hls program is exiting. Will update further as I track down the problem.


- apok - 2012-03-04

March 4, 2012 2:55PM EST

Updated MLBHLS-NHL binary, see post http://forum.xbmc.org/showpost.php?p=1036261&postcount=84

Added a timestamp check for when the file was last updated. Had a stream running for 40 minutes, so that's promising.


- Carb0 - 2012-03-04

It works now. Thank you very much.


RE: [RELEASE] NHL Gamecenter Addon - Dougedey - 2012-03-15

Big massive thanks to you guys, this works brilliantly!


Good news for Windows users - Carb0 - 2012-03-25

Live games are working in Margo's XBMC Eden build with PVR support (Windows only). It includes the necessary changes to PlaylistFactory.cpp. You can download it here: http://www.scintilla.utwente.nl/~marcelg/xbmc/prebuild.html