LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices



Reply
 
Search this Thread
Old 03-26-2013, 08:03 AM   #3826
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,767

Rep: Reputation: 76
SVN revision 386: condensed games for non-subscribers


Quote:
Originally Posted by BostonPeng View Post
I did try that game, but it wouldn't open for some reason.
The default condensed game request is for a game that requires authorization. However, there is a lower quality stream that does not require authentication.

Add "free_condensed=1" to your ~/.mlb/config and restart mlbviewer (or reload the configuration using 'R' key. Now when you select a condensed game, it will choose the lower quality stream that you don't need authorization for.

Let me know if that works out for you.


Also fixed a logic bug where, under certain circumstances, the preferred audio would in fact be a video stream. :/
 
Old 03-26-2013, 10:54 AM   #3827
BostonPeng
Member
 
Registered: Jul 2009
Location: Boston, MA
Distribution: SolydK Testing + KDE 4.9.5
Posts: 88

Rep: Reputation: Disabled
Quote:
Originally Posted by daftcat View Post
The default condensed game request is for a game that requires authorization. However, there is a lower quality stream that does not require authentication.

Add "free_condensed=1" to your ~/.mlb/config and restart mlbviewer (or reload the configuration using 'R' key. Now when you select a condensed game, it will choose the lower quality stream that you don't need authorization for.

Let me know if that works out for you.
You rock! Unfortunately I get the first second of the condensed game playing in mplayer and the it seems to lock up. I can play it in VLC so it's usable. Plus, if push comes to shove, I see that I can show the player command and then simply copy the URL and open it in my web browser for viewing, saving, etc.

I would like to use VLC for viewing top plays and the condensed games since the GUI it provides is a lot more helpful than what I can see to use in mplayer, but it's no biggie. I can tweak my config file as needed and reload it if I want to switch my top_plays_player on the fly.

ETA: It turns out mplayer itself is going funky on me. I can't even play the top plays individually in mplayer without it hanging after the video starts playing. I can play them without much problem other than possible buffering in VLC. I enabled debug in config file but neither that nor enabling debug with the hotkey seems to output any info on why the video hangs in mplayer.

Last edited by BostonPeng; 03-26-2013 at 11:03 AM.
 
Old 03-26-2013, 01:09 PM   #3828
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,767

Rep: Reputation: 76
Quote:
Originally Posted by BostonPeng View Post
You rock! Unfortunately I get the first second of the condensed game playing in mplayer and the it seems to lock up. I can play it in VLC so it's usable. Plus, if push comes to shove, I see that I can show the player command and then simply copy the URL and open it in my web browser for viewing, saving, etc.

I would like to use VLC for viewing top plays and the condensed games since the GUI it provides is a lot more helpful than what I can see to use in mplayer, but it's no biggie. I can tweak my config file as needed and reload it if I want to switch my top_plays_player on the fly.

ETA: It turns out mplayer itself is going funky on me. I can't even play the top plays individually in mplayer without it hanging after the video starts playing. I can play them without much problem other than possible buffering in VLC. I enabled debug in config file but neither that nor enabling debug with the hotkey seems to output any info on why the video hangs in mplayer.
I would recommend installing mplayer2 if you haven't already. Then even with mplayer2, I notice that I usually have to nudge it past the first second or two with the right arrow key.

Debug in mlbviewer unfortunately wouldn't tell you anything about the player. Mlbviewer is basically just a browser: a whole lot of code just to find the media url and maybe two or three lines of code to connect your media player to it.

Let me see what I can do about accommodating the highlight playlist feature with vlc. I may just have to include yet another player option in the config just to separate out playlist vs non-playlist syntax.
 
Old 03-26-2013, 01:21 PM   #3829
BostonPeng
Member
 
Registered: Jul 2009
Location: Boston, MA
Distribution: SolydK Testing + KDE 4.9.5
Posts: 88

Rep: Reputation: Disabled
Quote:
Originally Posted by daftcat View Post
I would recommend installing mplayer2 if you haven't already. Then even with mplayer2, I notice that I usually have to nudge it past the first second or two with the right arrow key.

Debug in mlbviewer unfortunately wouldn't tell you anything about the player. Mlbviewer is basically just a browser: a whole lot of code just to find the media url and maybe two or three lines of code to connect your media player to it.

Let me see what I can do about accommodating the highlight playlist feature with vlc. I may just have to include yet another player option in the config just to separate out playlist vs non-playlist syntax.
I keep forgetting to try mplayer2. But when I tried it on yesterday's condensed game (Tigers at Marlins) I got this in my terminal:
Code:
$ cd mlbviewer-2013 && python mlbviewer.py && cd
Traceback (most recent call last):
  File "mlbviewer.py", line 621, in <module>
    curses.wrapper(mainloop, mycfg)
  File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "mlbviewer.py", line 483, in mainloop
    mediaUrl = mediaStream.locateMedia()
  File "/home/peng/mlbviewer-2013/MLBviewer/mlbMediaStream.py", line 150, in locateMedia
    return self.locateCondensedMedia()
  File "/home/peng/mlbviewer-2013/MLBviewer/mlbMediaStream.py", line 616, in locateCondensedMedia
    return condensed
UnboundLocalError: local variable 'condensed' referenced before assignment
$
It's weird because it worked fine earlier this am when I was using it.

Last edited by BostonPeng; 03-26-2013 at 01:23 PM. Reason: to report that the crash comes regardless of what player I try to use
 
Old 03-26-2013, 06:00 PM   #3830
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,767

Rep: Reputation: 76
Quote:
Originally Posted by BostonPeng View Post
I keep forgetting to try mplayer2. But when I tried it on yesterday's condensed game (Tigers at Marlins) I got this in my terminal:
Code:
$ cd mlbviewer-2013 && python mlbviewer.py && cd
Traceback (most recent call last):
  File "mlbviewer.py", line 621, in <module>
    curses.wrapper(mainloop, mycfg)
  File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "mlbviewer.py", line 483, in mainloop
    mediaUrl = mediaStream.locateMedia()
  File "/home/peng/mlbviewer-2013/MLBviewer/mlbMediaStream.py", line 150, in locateMedia
    return self.locateCondensedMedia()
  File "/home/peng/mlbviewer-2013/MLBviewer/mlbMediaStream.py", line 616, in locateCondensedMedia
    return condensed
UnboundLocalError: local variable 'condensed' referenced before assignment
$
It's weird because it worked fine earlier this am when I was using it.
I have fixed the crash but it seems they have pulled the 600K stream from the XML reply. (You can see the xml reply in ~/.mlb/unsuccessful-1.xml and parse it with test/mediaxml.py.) I have picked the next best stream, a 550K mobile stream. It's not great quality but it looks like the highest res for non-subscribers. It's a temp solution. The better solution is to build a list of acceptable streams and allow a config file override of the default. There is actually a better quality condensed game stream for subscribers so this would benefit everyone.
 
Old 03-27-2013, 02:35 AM   #3831
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,767

Rep: Reputation: 76
Hmm...there's a weird little logic error that if free_condensed is set, audio and video player commands do not get formatted correctly (line 500: prepareMediaPlayerCmd needs to be called for all cases except highlights and free condensed games.) But since the only reason you should set free_condensed is if you are a non-subscriber, normal subscribers shouldn't run into this error and non-subscribers will get a media not found response before they run into this. Interesting but harmless bug.

BTW: I did some cleanup on Sourceforge so if any of you received an answer for a three or four year old request today, I wanted to make sure Sourceforge info was current now.
 
Old 03-27-2013, 09:27 AM   #3832
BostonPeng
Member
 
Registered: Jul 2009
Location: Boston, MA
Distribution: SolydK Testing + KDE 4.9.5
Posts: 88

Rep: Reputation: Disabled
MLB's making .3gp files available for condensed games? That could come in handy since my dumbphone requires .3g2 files for watching vids on it.

It's looking pretty well so far. Thanks for getting the 2013 season off to such a great start for Linux-using baseball fans, especially us poor schmucks who can't afford to pay for a video subscription that we'd surely buy if we could. With Opening Day upon us I'll write an article for my site with the updated info for running your program. Do you have an idea when the latest changes will make it into the official release? I'd like to let my readers know if there's an ETA but if there isn't I'll provide info on getting the code from svn.
 
Old 03-27-2013, 01:48 PM   #3833
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,767

Rep: Reputation: 76
Quote:
Originally Posted by BostonPeng View Post
MLB's making .3gp files available for condensed games? That could come in handy since my dumbphone requires .3g2 files for watching vids on it.

It's looking pretty well so far. Thanks for getting the 2013 season off to such a great start for Linux-using baseball fans, especially us poor schmucks who can't afford to pay for a video subscription that we'd surely buy if we could. With Opening Day upon us I'll write an article for my site with the updated info for running your program. Do you have an idea when the latest changes will make it into the official release? I'd like to let my readers know if there's an ETA but if there isn't I'll provide info on getting the code from svn.
I have no idea if we are looking at the official offering for 2013 or just a rehash of the 2012 offering for Spring Training while they continue to work out new features for 2013. They have frequently rolled out changes as late as Opening Week. I usually don't like to say this is good to go for Sourceforge until after at least the first week of the season.

That said, I am out of town this weekend and may not be able to follow Opening Day. I can upload a pre-release version and wait to see what happens in the next week or two.
 
Old 03-27-2013, 02:14 PM   #3834
BostonPeng
Member
 
Registered: Jul 2009
Location: Boston, MA
Distribution: SolydK Testing + KDE 4.9.5
Posts: 88

Rep: Reputation: Disabled
Quote:
Originally Posted by daftcat View Post
I have no idea if we are looking at the official offering for 2013 or just a rehash of the 2012 offering for Spring Training while they continue to work out new features for 2013. They have frequently rolled out changes as late as Opening Week. I usually don't like to say this is good to go for Sourceforge until after at least the first week of the season.

That said, I am out of town this weekend and may not be able to follow Opening Day. I can upload a pre-release version and wait to see what happens in the next week or two.
Thanks. I'll see about posting a preliminary article based on what's working as of when I write it and make a note to write a followup once the league decides what they're doing this season.
 
Old 03-27-2013, 05:18 PM   #3835
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,767

Rep: Reputation: 76
Quote:
Originally Posted by BostonPeng View Post
Thanks. I'll see about posting a preliminary article based on what's working as of when I write it and make a note to write a followup once the league decides what they're doing this season.
I updated the documentation for 2013 and removed the pyxml requirement. That XML code has been part of standard python since 2.7. I added a couple of sentences for how to get it running on a default python3 system (like Arch Linux) using python2 mlbviewer.py. I've also updated mlbplay and mlblistings to the rewritten libraries. And my personal favorite, test/mediaxml.py has been updated to include node attribute names and values. Combined with the successful and unsuccessful xml's I write for every media request, this should be a huge help for debugging media not available or not authorized errors.

So install should be easiest it has been in a long time.

1. Python2.7 (or newer, but not Python3.x) - no other python libraries to install
2. Mplayer2 or VLC
3. rtmpdump for basic and subscriber condensed games
4. mlbhls for nexdef

3. and 4. not necessary for non-subscribers.
 
Old 03-27-2013, 05:31 PM   #3836
dovf
LQ Newbie
 
Registered: Jul 2010
Posts: 13

Rep: Reputation: 1
Regarding condensed games and "free_condensed" --

I am not a paying subscriber, just use mlbviewer to watch the free condensed games. I just tried watching one of the condensed games using the settings I used last year, and got some error; so I tried the "free_condensed" configuration and it worked. However, the quality is significantly lower than the quality that you get in the browser (also for unauthenticated, free games). So looking a bit more into the error I was getting, it turns out to be what looks like a bug: a full rtmpdump invocation command is being passed as the url to the video player. The following patch fixes the issue I'm seeing (not sure of it breaks more-common use-cases, though, since the free condensed games is the only thing I use):

Code:
diff -r 314900a2654f MLBviewer/mlbMediaStream.py
--- a/MLBviewer/mlbMediaStream.py	Wed Mar 27 02:54:47 2013 +0000
+++ b/MLBviewer/mlbMediaStream.py	Wed Mar 27 23:29:13 2013 +0200
@@ -390,7 +390,7 @@
 
     def prepareMediaPlayer(self,game_url):
         if self.streamtype == 'condensed':
-            return 'rtmpdump -r %s' % game_url
+            return game_url
         elif self.cfg.get('use_nexdef') and self.streamtype != 'audio':
             self.nexdef_media_url = game_url
             return self.prepareHlsCmd(game_url)
As always, thanks for your great work on this project!
Dov
 
Old 03-28-2013, 03:45 AM   #3837
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,767

Rep: Reputation: 76
Quote:
Originally Posted by dovf View Post
Regarding condensed games and "free_condensed" --

I am not a paying subscriber, just use mlbviewer to watch the free condensed games. I just tried watching one of the condensed games using the settings I used last year, and got some error; so I tried the "free_condensed" configuration and it worked. However, the quality is significantly lower than the quality that you get in the browser (also for unauthenticated, free games). So looking a bit more into the error I was getting, it turns out to be what looks like a bug: a full rtmpdump invocation command is being passed as the url to the video player. The following patch fixes the issue I'm seeing (not sure of it breaks more-common use-cases, though, since the free condensed games is the only thing I use):

Code:
diff -r 314900a2654f MLBviewer/mlbMediaStream.py
--- a/MLBviewer/mlbMediaStream.py	Wed Mar 27 02:54:47 2013 +0000
+++ b/MLBviewer/mlbMediaStream.py	Wed Mar 27 23:29:13 2013 +0200
@@ -390,7 +390,7 @@
 
     def prepareMediaPlayer(self,game_url):
         if self.streamtype == 'condensed':
-            return 'rtmpdump -r %s' % game_url
+            return game_url
         elif self.cfg.get('use_nexdef') and self.streamtype != 'audio':
             self.nexdef_media_url = game_url
             return self.prepareHlsCmd(game_url)
As always, thanks for your great work on this project!
Dov
Can you paste the contents of ~/.mlb/successful-1.xml to http://pastebin.com and paste that url here?

From the responses I am seeing from MLB servers, there are several condensed games available but only a couple that look available for non-subscribers:

Quote:
playback_scenario: 3GP_H264_128K_320X240
playback_scenario: 3GP_H264_200K_320X240
playback_scenario: 3GP_H264_550K_320X240
playback_scenario: FLASH_1200K_640X360
playback_scenario: FLASH_1800K_960X540
playback_scenario: HTTP_CLOUD_MOBILE
playback_scenario: HTTP_CLOUD_TABLET
playback_scenario: HTTP_CLOUD_ANDROID_TABLET
Of the two FLASH streams, mlbviewer defaults to the FLASH_1200K stream. I plan to enhance it to allow subscribers to select between 1200 and 1800 stream. Both of the FLASH streams have attributes of login:Y and auth:Y which seems to imply that they are only available for subscribers.

I hesitate to use any of the CLOUD streams (even though they are login:N and auth:N) as it looks like we could be circumventing app revenue since they are clearly intended for the mobile apps.

That leaves the 3GP streams which top out at 550K but have login:N and auth:N.

Are you sure your subscription didn't auto-renew?

In any case, if free_condensed is set to 1, mlbviewer retrieves the 3GP 550K stream which is just an http url that cannot go through the rtmp code.

In mlbviewer.py, line 496:

Code:
if not mycfg.get('free_condensed'):
    mediaUrl = mediaStream.prepareMediaPlayer(mediaUrl)
does exactly what your patch does. If free_condensed is used, don't invoke rtmpdump.

However, for the subscribers, condensed games using the FLASH streams are rtmp urls and your proposed patch would break condensed games for subscribers not using free_condensed.

BTW, I agree that the web stream is higher quality but I don't know which stream it is using. I tried some initial inspection using wireshark and debug console on the browser and couldn't figure it out. It looks like the web stream is an rtmp stream.
 
Old 03-28-2013, 03:55 AM   #3838
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,767

Rep: Reputation: 76
Checked in revision393 which re-enables the old [DEBUG] behavior. If debug is set, the command string is displayed only and does not execute the command string. This should help us both track down any malformed commands.
 
Old 03-28-2013, 06:59 AM   #3839
dovf
LQ Newbie
 
Registered: Jul 2010
Posts: 13

Rep: Reputation: 1
Quote:
Originally Posted by daftcat View Post
Can you paste the contents of ~/.mlb/successful-1.xml to http://pastebin.com and paste that url here?

From the responses I am seeing from MLB servers, there are several condensed games available but only a couple that look available for non-subscribers:



Of the two FLASH streams, mlbviewer defaults to the FLASH_1200K stream. I plan to enhance it to allow subscribers to select between 1200 and 1800 stream. Both of the FLASH streams have attributes of login:Y and auth:Y which seems to imply that they are only available for subscribers.

I hesitate to use any of the CLOUD streams (even though they are login:N and auth:N) as it looks like we could be circumventing app revenue since they are clearly intended for the mobile apps.

That leaves the 3GP streams which top out at 550K but have login:N and auth:N.

Are you sure your subscription didn't auto-renew?

In any case, if free_condensed is set to 1, mlbviewer retrieves the 3GP 550K stream which is just an http url that cannot go through the rtmp code.

In mlbviewer.py, line 496:

Code:
if not mycfg.get('free_condensed'):
    mediaUrl = mediaStream.prepareMediaPlayer(mediaUrl)
does exactly what your patch does. If free_condensed is used, don't invoke rtmpdump.

However, for the subscribers, condensed games using the FLASH streams are rtmp urls and your proposed patch would break condensed games for subscribers not using free_condensed.

BTW, I agree that the web stream is higher quality but I don't know which stream it is using. I tried some initial inspection using wireshark and debug console on the browser and couldn't figure it out. It looks like the web stream is an rtmp stream.
Hmmm... what's confusing me is that I am *not* using free_condensed...

OK, after some experimentation, I see what's going on. There are a couple of different settings which are interacting here:

First of all, the immediate problem I was seeing was due to my old config having use_librtmp=1. With use_librtmp=0, indeed my patch is not needed. However, it *is* still needed for when use_librtmp=1. So, I think the code you pointed to above (in mlbviewer.py, line 496) should actually be changed to reflect that:

Code:
diff -r 27256988463d mlbviewer.py
--- a/mlbviewer.py  Thu Mar 28 07:54:03 2013 +0000
+++ b/mlbviewer.py  Thu Mar 28 12:38:26 2013 +0200
@@ -493,7 +493,7 @@
                     myscr.refresh()
                     time.sleep(2)
                     continue
-                if not mycfg.get('free_condensed'):
+                if not mycfg.get('use_librtmp'):
                     mediaUrl = mediaStream.prepareMediaPlayer(mediaUrl)
                 eventId  = available[listwin.current_cursor][6]
I believe this should fix the problem I was seeing even with my old config, without breaking the regular subscriber's use case. (The reason I am completely getting rid of 'free_condensed' will be explained next.)

Secondly, for watching the condensed games, apparently not even an mlb.com account is needed (which makes sense, given that in the browser they are freely available without logging in): I moved aside my .mlb/config, in which case mlbviewer creates a new, clean, config, and asks you to fill in the user and password. If you just leave them empty and start mlbviewer again, it will complain about an authentication error, but will nonetheless start. At this point, you are still able to watch the condensed games, and you get the 1200K stream, just like you would in the browser. So, I think that free_condensed is not actually needed at all. I will try to create a patch which cleans this up; and if you have no objections, I will put up a patched version on bitbucket.org (as a mercurial repository, from which you will be able to get a raw patch)?

Hope this helps!
Dov
 
Old 03-28-2013, 01:36 PM   #3840
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,767

Rep: Reputation: 76
BostonPeng, see post above. Leaving user= and pass= blank will get you access to the 1200K condensed game stream and the highlights.

Dov, changing free_condensed to use_librtmp will only work for that one case but it will break all the subscriber use cases including nexdef which has nothing to do with librtmp. I will have to look deeper into how to re-work the logic for librtmp. It will probably go into prepareMediaPlayerCmd effectively removing the need for that "if" statement. But I probably can't do that today as it needs a bit of testing.

In the meantime, I can disable it in the code and release note it until I have it re-worked.

I'm heading out of town soon for the weekend so I'm likely not going to take new patches until next week. Non-subscribers have a workaround by leaving user= and pass= blank and librtmp users can revert back to rtmpdump until I have this sorted.
 
  


Reply

Tags
help, install, installation, instructions, seek, vlc, windows


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mlb.com gameday audio stream statmobile Linux - Newbie 6 05-06-2008 11:16 PM
link dies intermittently-seemingly at random- between win<->linux not linux<->linux?? takahaya Linux - Networking 10 03-09-2007 11:37 PM
triple boot linux/linux/linux No Windows involved toastermaker Linux - Newbie 12 03-02-2006 11:40 PM
Redhat (rhel v2.1) bootup problem with linux (linux vs linux-up) namgor Linux - Software 2 06-24-2004 03:49 PM


All times are GMT -5. The time now is 07:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration