Kodi Community Forum
[Release] MLBMC - a Major League Baseball (video) add-on - 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: [Release] MLBMC - a Major League Baseball (video) add-on (/showthread.php?tid=104391)



RE: [Release] MLBMC - a Major League Baseball (video) add-on - bunglebungle - 2015-04-22

(2015-04-22, 07:39)Yuioup Wrote: Ok good to know about MLBViewer. I think I'll start integrating code when I have time. On my personal TODO list I have HLS Integration and the Logout button. I'll start looking around for code to integrate.

I made the fork and have most of the Logout code ready, I just have to finish testing and get you the pull request. MLBViewer is also Python so the code is easy to port. If somehow we could share the base libraries and just have different UI code I think that would help with maintainability, but I'm not sure how far they've diverged yet.


RE: [Release] MLBMC - a Major League Baseball (video) add-on - Yuioup - 2015-04-22

(2015-04-22, 18:23)bunglebungle Wrote:
(2015-04-22, 07:39)Yuioup Wrote: Ok good to know about MLBViewer. I think I'll start integrating code when I have time. On my personal TODO list I have HLS Integration and the Logout button. I'll start looking around for code to integrate.

I made the fork and have most of the Logout code ready, I just have to finish testing and get you the pull request. MLBViewer is also Python so the code is easy to port. If somehow we could share the base libraries and just have different UI code I think that would help with maintainability, but I'm not sure how far they've diverged yet.

Well I took the code from https://code.google.com/p/mlbmc-xbmc/downloads/list, version 2.0.72. I did some code cleanup using pylint (mainly spaces and styling), and fixed a couple of warning of undefined variables (simple to fix). I added the pydev library so that I can debug the module in Eclipse. If you took my version then the merge should not be a problem. If you took divingmule's version well it will be simple to merge - I only changed spaces and tabs.

[Edit] Good to hear that you have the logout code written! Looking forward to the pull request.


RE: [Release] MLBMC - a Major League Baseball (video) add-on - Yuioup - 2015-04-22

(2015-04-22, 18:19)bunglebungle Wrote:
(2015-04-22, 16:23)sdsnyr94 Wrote: As a user of this add-on from day one, I may be able to shed some light on a couple of things. There were 2 different versions of the add-on because the HLS version required the binary add-on to acquire the HD feeds, and an add-on like that could not be added to the official XBMC repository (Because of the binary add-on, and it's not platform agnostic). The version most of us are currently using 2.0.7x was the last non-HLS version that was in the official repository.

The HLS version of the plugin has an option to turn it off. If the default is off one that cannot or does not want the HLS binary can just never set it up and it will work without it. I don't know if that would satisify the repository requirements or not. The defaults would be platform-agnostic.

I am aware of the mlb-hls version. The version that I have has the option to turn HLS on, but I don't think it does anything. I downloaded the HLS version from divingmule's Google code version and compiled the mlbhls executable in Fedora. It compiled but when I ran it I got "encryption error". I then gave up but want to take a look at it again. I know that both versions are very similar. The hls version calls the executable. The non-hls version does not seem to do anything but add something to the address but I doubt it does anything.

(2015-04-22, 18:19)bunglebungle Wrote:
(2015-04-22, 16:23)sdsnyr94 Wrote: The mlb-hls file that was/is used has not been updated for a couple of years and originally only worked on Linux, however there have been some modifications

Hopefully someone from mlbviewer will pick it up, or, as mentioned later in that thread, get VLC/mplayer/ffmpeg to support this flavor of hls.

A better option would be to completely re-implement it in Python. Unfortunately decryption goes way over my head so I would not know where to start.

(2015-04-22, 18:19)bunglebungle Wrote:
(2015-04-22, 16:23)sdsnyr94 Wrote: to make it compatible on Windows and the Raspberry Pi. The mlb-hls file would retrieve the feed and store the file in a temp directory (location of temp directory was changeable in the settings), and MLBMC would play from that file. There were a couple of issues with this approach... the first being if you are on a device with limited storage space. I had an ION PC running Openelec installed on a 4GB USB drive and while watching a game it would crash about half-way

If somehow we could get it to use a ring buffer that would help, but I have no idea if that's possible or how to get mlbhls and Kodi to interact on that.

Yeah I noticed that there were several executables in the .zip file. To get it to work on the Pi you need ARM versions of the executable. I don't know what ring buffers are.

(2015-04-22, 18:19)bunglebungle Wrote:
(2015-04-22, 16:23)sdsnyr94 Wrote: the latter since it would make it platform agnostic, and should avoid the issues I mentioned. Also, is there a better way to handle the log in? It appears that each time I switch games it performs a log in, making it easy to lock the account. I know you mentioned a log out button but I do not see how it will avoid this issue because it seems to be the number of login attempts in a short time.... not the number of concurrent logins.

I intended to do some testing on that because I noticed I was getting some "too many login" errors when restarting the video multiple times. It appears the intention of the code is to keep the login credentials, but it may not be working that way. My testing wasn't rigorous but when I was flipping between Chrome and Kodi and logging out each time it did seem to help with the lockout. But reducing unnecessary logins is the goal.

Hmm interesting. Yeah I looked at the code and it looks dubious at best. I added debugging to the code and I can debug in Eclipse. Maybe I can track down the issue - without locking myself out of course which is a huge PITA.

(2015-04-22, 18:19)bunglebungle Wrote:
(2015-04-22, 16:23)sdsnyr94 Wrote: You also mentioned about the Live DVR function... in which the only feature we had was just the ability to select the innings. Rewinding or fast forwarding really did not work as you were only limited to the data that you had stored in the temp directory. If you set to buffer to 30 seconds before beginning playback, it gave you a little wiggle room, but really nothing to write home about. I have mentioned it here before, Timewasted's NHL add-on did a fantastic job of creating the Live DVR... I could watch a game from the start at any time, and easily skip the commercials and intermissions.

I thought about investigating that, too. When a game is archived the rtmp version works well - 960x540 is fine, and skipping around works great. I'd love to save the whole stream when watching a game live - just buffer it all and be able to skip back and forth. One could pause and let some time build up then come back to it. But I don't know enough about Kodi or video streams at the moment. I will look into that addon and see if there are any similarities that will be helpful. Or erhaps capturing some network traffic with MLB.tv's Live DVR on a Windows box to see what sort of requests it is sending will help.

Ah. Yeah this is something that needs investigation.


RE: [Release] MLBMC - a Major League Baseball (video) add-on - sdsnyr94 - 2015-04-22

Without knowing the ins and outs of how most of this works, here is a link to Timewasted's github for his HLS Proxy : https://github.com/timewasted/service.nhl-hls-proxy . I think he used this to perform a similar task as mlbhls, without the need for the binary add-on. I am not too sure if it could be adapted, or how easy it would be... but maybe it can be used for ideas.

Of course, if it's useful all credit goes to Timewasted.


RE: [Release] MLBMC - a Major League Baseball (video) add-on - rbrohman - 2015-04-23

Really happy to see development continue on this. Please let us know where we can donate as I'm sure lots would be happy to buy you beer to get this restored.


RE: [Release] MLBMC - a Major League Baseball (video) add-on - bunglebungle - 2015-04-23

Okay, I submitted the pull request. I did a little testing and when bringing up a game the logging does seem to indicate that is using the stored cookies each time, at least until I logout, then it gets new ones the next time. But I have noticed getting locked out, so there must be somewhere that isn't working. If the logout is successful it doesn't do anything - I don't know if we should pop a notification or not. It does do that if there's an error.

As far as the HLS version - yeah, I think someone just copied the whole thing and added the optional call to the HLS binary. I know this version has an HLS setting that appears to do nothing. I'm using (K|Myth)buntu and compiling mlbhls worked okay. I'm sure Python could handle the functionality but I'm very rusty on C and new to Python. (A ring buffer is circular, so it's one size and when it's full it just loops around, thus you wouldn't run out of disk space. But, again, I'm not sure if or how that's possible in this environment.)

I can't find any information on whether MLB Advanced Media handles the NHL service or not. They do HBO and WWE and others, so it's possible what Timewasted wrote would work if so. Even if not HTTP Live streaming is supposed to be somewhat standard, so maybe it would work anyway.


RE: [Release] MLBMC - a Major League Baseball (video) add-on - sdsnyr94 - 2015-04-23

I sent Timewasted a PM yesterday, and here is his response -

Quote: Assuming MLB.tv does in fact do HLS streaming, I don't see any reason it couldn't be adapted. The code for the proxy (excluding the required external libraries, but those aren't important for the sake of this discussion) is only 155 lines, so it's super small. It's also pretty generic, with very few assumptions made about what it's actually going to proxy, so there shouldn't be much to rip out and replace.

The code is here: https://github.com/timewasted/service.nhl-hls-proxy
The important file is here: https://github.com/timewasted/service.nh...service.py



RE: [Release] MLBMC - a Major League Baseball (video) add-on - 340rag - 2015-04-24

not authorized playing preview? I have a paid subscription that works on laptop but not with MLBMCHuh? Help Help what I am I doing wrongHuh?? Thx


RE: [Release] MLBMC - a Major League Baseball (video) add-on - Yuioup - 2015-04-24

(2015-04-23, 17:09)sdsnyr94 Wrote: I sent Timewasted a PM yesterday, and here is his response -

Quote: Assuming MLB.tv does in fact do HLS streaming, I don't see any reason it couldn't be adapted. The code for the proxy (excluding the required external libraries, but those aren't important for the sake of this discussion) is only 155 lines, so it's super small. It's also pretty generic, with very few assumptions made about what it's actually going to proxy, so there shouldn't be much to rip out and replace.

The code is here: https://github.com/timewasted/service.nhl-hls-proxy
The important file is here: https://github.com/timewasted/service.nh...service.py

Aha cool. As soon as I have time I'll take a look at this.


RE: [Release] MLBMC - a Major League Baseball (video) add-on - Yuioup - 2015-04-24

(2015-04-23, 04:02)bunglebungle Wrote: Okay, I submitted the pull request. I did a little testing and when bringing up a game the logging does seem to indicate that is using the stored cookies each time, at least until I logout, then it gets new ones the next time. But I have noticed getting locked out, so there must be somewhere that isn't working. If the logout is successful it doesn't do anything - I don't know if we should pop a notification or not. It does do that if there's an error.

As far as the HLS version - yeah, I think someone just copied the whole thing and added the optional call to the HLS binary. I know this version has an HLS setting that appears to do nothing. I'm using (K|Myth)buntu and compiling mlbhls worked okay. I'm sure Python could handle the functionality but I'm very rusty on C and new to Python. (A ring buffer is circular, so it's one size and when it's full it just loops around, thus you wouldn't run out of disk space. But, again, I'm not sure if or how that's possible in this environment.)

I can't find any information on whether MLB Advanced Media handles the NHL service or not. They do HBO and WWE and others, so it's possible what Timewasted wrote would work if so. Even if not HTTP Live streaming is supposed to be somewhat standard, so maybe it would work anyway.

Thx btw for the pull request. I'll try to merge it as soon as I can.


RE: [Release] MLBMC - a Major League Baseball (video) add-on - rbrohman - 2015-04-25

(2015-04-23, 17:09)sdsnyr94 Wrote: I sent Timewasted a PM yesterday, and here is his response -

Quote: Assuming MLB.tv does in fact do HLS streaming, I don't see any reason it couldn't be adapted. The code for the proxy (excluding the required external libraries, but those aren't important for the sake of this discussion) is only 155 lines, so it's super small. It's also pretty generic, with very few assumptions made about what it's actually going to proxy, so there shouldn't be much to rip out and replace.

The code is here: https://github.com/timewasted/service.nhl-hls-proxy
The important file is here: https://github.com/timewasted/service.nh...service.py

This sounds very promising. Thanks for looking into it.


RE: [Release] MLBMC - a Major League Baseball (video) add-on - timewasted - 2015-04-25

Since I have a free moment, I figured I'd jump in here and briefly explain how my HLS proxy works, and how I use it. The NHL servers eventually present me with a URL to fetch the HLS file that actually contains the game footage. Instead of passing that URL straight to Kodi and having it play it, I first prepend my proxy info to the URL, and pass THAT to Kodi to play.

Code:
# About the variables used below:
#
# m3u8_url: The URL that the NHL servers gave me.
# self.hls_server: The host/port for the proxy in the form "http://127.0.0.1:54321".
# game['start_time']: The time that the game started.
# protocol_headers: The headers to ensure get passed to the host we're proxying to.

m3u8_url = self.hls_server + \
    '/playlist?url=' + urllib.quote_plus(m3u8_url) + \
    '&start_at=' + game['start_time'].strftime('%Y%m%d%H%M%S')
if len(protocol_headers) > 0:
    m3u8_url += '&headers=' + urllib.quote(urllib.urlencode(protocol_headers))

So, this hits "/playlist" on the HLS proxy, with the parameters "url" (the URL to proxy to), "start_at" (the start of the game), and optionally "headers" (the headers that need to be passed to the proxied host).

When Kodi attempts to play that URL, the proxy makes a request to "url" to fetch the actual playlist. It then parses the playlist and rewrites relative URLs (/path/to/something) to absolute URLs referencing the proxy (http://127.0.0.1:54321/path/to/something). It also rewinds the playlist to the desired time (based on the "start_at" parameter), but that's a bit more in-depth than I have time for at the moment.

So really, in order to adapt the proxy for MLB, you'd probably have to make some minor adjustments to the rewind_playlist() function of the proxy, and add something relatively similar to the code that I posted above to make sure that Kodi hits the proxy.

Anyways, my free moment has pretty much passed. If anyone has any questions, I'll do my best to answer them.


RE: [Release] MLBMC - a Major League Baseball (video) add-on - 340rag - 2015-04-25

Not authorized - playing preview? I have a paid subscription that works on laptop but not with MLBMC Confused? Help Help what I am I doing wrong Confused?? Thx Still hoping someone can tell me what is wrongHuhHuhHuh Tried to re install the plugin no dice.Maybe someone can post a different one that they know worksHuh Should I try to uninstall Kodi which would suckHuhHuhHuhHuhHuh HELPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP Maybe there is a setting in the plugin that can be changedHuhHuhHuh??


RE: [Release] MLBMC - a Major League Baseball (video) add-on - Yuioup - 2015-04-25

I have looked at timewasted's proxy server. I understand how to get it up and running and what parameters to pass to it, but I don't know how to generate a m3u8 link from mlb.tv. Does anybody know how to do this?


RE: [Release] MLBMC - a Major League Baseball (video) add-on - rocketr - 2015-04-25

(2015-04-25, 11:33)Yuioup Wrote: I have looked at timewasted's proxy server. I understand how to get it up and running and what parameters to pass to it, but I don't know how to generate a m3u8 link from mlb.tv. Does anybody know how to do this?

I saw this old post. I wonder if its still correct?

http://forum.kodi.tv/showthread.php?tid=97251&page=18