LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-30-2013, 12:54 PM   #4021
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,883

Rep: Reputation: 86

Quote:
Originally Posted by chrisVV View Post
That's great. As an experiment I have caused all SIGWINCH interrupts in mlbviewer.py to be discarded everywhere except in select(): in other words, the interrupt handler is set as donothing() just before entering select, and then set to SIG_IGN as soon as it comes out (either when entering the exception handler's else block or before calling getch() where select has unblocked on keyboard input). Without the interrupt throttling, the program still misbehaves under a SIGWINCH storm. This seems to me to show pretty definitely that the problem is with the way python wraps select when receiving interrupt storms.

I don't suggest you reconfigure the code in this way in the release version of mlbviewer.py, because an ambidextrous user who both pressed a key and resized the window at the same time could lose the window redraw if the race went against her.

So I think the solution now adopted is probably the best that can be achieved, unless something else occurs to me.
Not concerned. I have bigger fish to fry with catching urllib2.URLError everywhere I have been lazily ignoring it. I also want to change curses.window.addstr to curses.window.addnstr. Finally, now that scoreboard refreshes no longer lose their cursor place, I can see a case for reducing the visible area to two lines (just one game.) There is an out of range bug when the screen is dynamically resized to that height. Though restarting can overcome it. I'd rather fix that crash than worry whether jittery squids want to wiggle my corners while changing through screens.

Btw, a line score fix for the home runs got checked in last night after the Ana-Oak marathon in case anyone is crashing trying to open that line score.
 
Old 05-01-2013, 03:57 AM   #4022
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,883

Rep: Reputation: 86
SVN revision 466: Lots of bug fixes related to resizing

Lots of check-ins related to fixing the cursor handling between listings and scoreboard and scrolling through each window when the screen has been resized.

Some issues fixed:

+ scrolling would skip records when moving between screenfuls of data for odd number of lines + fixed scrolling for small windows where strings to be added to screen were larger than the space on the screen to write them (converting addstr to addnstr)
+ added support for "Replay" status to fix a crash during PIT-MIL game and a home run review.
+ fixed scrolling issues where cursor could scroll off the screen
+ added an exception for screen too small when resized to something smaller than visible region.

(+ added hidden config file option, curses_debug, for verifying that scrolling/resizing is calculated correctly especially for odd-number lines or very small screens (6 or 7 lines big.

Last edited by daftcat; 05-01-2013 at 04:00 AM.
 
Old 05-03-2013, 03:40 AM   #4023
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,883

Rep: Reputation: 86
SVN revision 467: Added exception handling for URLError

Added exception handling for urllib2.URLError.

In most cases where an XML cannot be retrieved, instead of crashing, I'll print an error string to the status and return back to whatever the current view is.

There may still be cases where crashes occur. I don't want to be overly aggressive with exception handling until I understand what happened and how to handle it properly. So if you encounter a crash, tell me the date, the game, and post the stack trace in its entirety.

Thanks again for your testing and reporting of issues.
 
Old 05-04-2013, 05:02 PM   #4024
splittter
LQ Newbie
 
Registered: Apr 2013
Posts: 8

Rep: Reputation: Disabled
Currently trying to watch the Nationals/Pirates game, which is ongoing, but the NextDef stream seems to play from the start, even though I definitely have "live_from_start=0" in my config file.

Dunno if it's because it seems to be in national blackout, but that shouldn't be affecting me as I'm not in the US. Indeed the non NextDef stream works fine, and is live.

I switched on debug and tried all the streams for the games currently live (Orioles/Angles & Cardinals/Brewers too) and the commands all came through with a -F value of just after 8pm GMT.

Am using rev 467.

EDIT - Think it must be the blackout status as now the later games have started they seem to work fine, but the Orioles/Angels & Cardinals/Brewers are still starting from the start.

Last edited by splittter; 05-04-2013 at 06:28 PM. Reason: more info
 
Old 05-05-2013, 06:10 AM   #4025
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,883

Rep: Reputation: 86
Quote:
Originally Posted by splittter View Post
Currently trying to watch the Nationals/Pirates game, which is ongoing, but the NextDef stream seems to play from the start, even though I definitely have "live_from_start=0" in my config file.

Dunno if it's because it seems to be in national blackout, but that shouldn't be affecting me as I'm not in the US. Indeed the non NextDef stream works fine, and is live.

I switched on debug and tried all the streams for the games currently live (Orioles/Angles & Cardinals/Brewers too) and the commands all came through with a -F value of just after 8pm GMT.

Am using rev 467.

EDIT - Think it must be the blackout status as now the later games have started they seem to work fine, but the Orioles/Angels & Cardinals/Brewers are still starting from the start.
Being in the US, I have no way to test the fix, but I have checked in what I believe should fix this.

For nexdef, there is a routine called getStartOfGame() which performs the live_from_start check. I believe for games in progress that are blacked out nationally, rather than preserving the actual status code of "I" or "D" (In Progress or Delayed), I overwrite the status with "NB". There are two checks in the code logic in this routine:

1. If game status is in I or D and specific start time hasn't been requested (e.g. not jump to innings), if live_from_start set, return the start of the game. Otherwise, don't set start_time.

2. Else, assume an archived game and return the start of the game.

The problem was in the first check. "NB" can be an be an in progress status but without adding it to the first check, I'm always going to return the start of the game.

If you can test this fix later today for me with rev 468, let me know. If this doesn't work, I'll have to add some debug code for you to help me. And in the meantime, you can use jump to inning to jump to the most recent available inning to get as close to live as my code will allow until I get the fix correct.
 
Old 05-05-2013, 07:13 PM   #4026
splittter
LQ Newbie
 
Registered: Apr 2013
Posts: 8

Rep: Reputation: Disabled
Quote:
Originally Posted by daftcat View Post
Being in the US, I have no way to test the fix, but I have checked in what I believe should fix this.
Just tried it on the Giants/Dodgers game currently going on, which also seems to be National Blackout, and everything worked as it should ... thanks a lot.
 
1 members found this post helpful.
Old 05-05-2013, 11:19 PM   #4027
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,883

Rep: Reputation: 86
Quote:
Originally Posted by splittter View Post
Just tried it on the Giants/Dodgers game currently going on, which also seems to be National Blackout, and everything worked as it should ... thanks a lot.
Cool. Only weekend games, ASG, and playoffs are NB. So if it didn't work tonight, we might have had to wait all week to try again. Glad to hear that it's working.

Btw, I'm more than a little jealous that you get to watch this game. I grew up in LA and live in the SF Bay Area. So this is one series I most want to watch every year and I'm always blacked out of it (either national or local.)
 
Old 05-07-2013, 01:05 AM   #4028
mkomko
Member
 
Registered: Mar 2010
Posts: 97

Rep: Reputation: 3
Quote:
Originally Posted by daftcat View Post
Btw, I'm more than a little jealous that you get to watch this game. I grew up in LA and live in the SF Bay Area. So this is one series I most want to watch every year and I'm always blacked out of it (either national or local.)
Can't you watch it on TV though?
 
Old 05-07-2013, 01:23 AM   #4029
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,883

Rep: Reputation: 86
Quote:
Originally Posted by mkomko View Post
Can't you watch it on TV though?
I don't own a TV. Maybe that's why you guys get such good support.

If I really want to watch a local game, I'll either go (if I can afford it), or I'll go to a bar to watch it.

Last edited by daftcat; 05-07-2013 at 01:24 AM.
 
Old 05-08-2013, 11:50 PM   #4030
icelancer
LQ Newbie
 
Registered: May 2013
Posts: 26

Rep: Reputation: Disabled
Love this software, thanks so much!

When running mlblistings.py, you get a unique (?) numerical string after the gameID. What is this string used for, and can it be used to launch games using mlbplay.py? Obviously the current code of mlbplay.py doesn't support such a flag, but for script purposes that I'm writing, I'd like to be able to use that tag rather than v=kc or a=fla, for example.

Thanks!


EDIT: For example, running ./mlblistings.py startdate=04/28/13 gives you:

Quote:
MLB.TV Listings for 4/28/2013
CG: 10:05 AM: 2013/04/28/tormlb-nyamlb-1 E: 14-347117-2013-04-28
CG: 10:10 AM: 2013/04/28/chnmlb-miamlb-1 E: 14-347118-2013-04-28
CG: 10:10 AM: 2013/04/28/phimlb-nynmlb-1 E: 14-347113-2013-04-28
CG: 10:35 AM: 2013/04/28/cinmlb-wasmlb-1 E: 14-347108-2013-04-28
CG: 10:35 AM: 2013/04/28/houmlb-bosmlb-1 E: 14-347111-2013-04-28
CG: 11:10 AM: 2013/04/28/clemlb-kcamlb-1 E: 14-347109-2013-04-28
CG: 5:10 PM: 2013/04/28/clemlb-kcamlb-2 E: 14-347079-2013-04-28
CG: 11:10 AM: 2013/04/28/tbamlb-chamlb-1 E: 14-347115-2013-04-28
CG: 11:10 AM: 2013/04/28/texmlb-minmlb-1 E: 14-347116-2013-04-28
CG: 11:15 AM: 2013/04/28/pitmlb-slnmlb-1 E: 14-347119-2013-04-28
CG: 1:05 PM: 2013/04/28/balmlb-oakmlb-1 E: 14-347107-2013-04-28
CG: 1:10 PM: 2013/04/28/anamlb-seamlb-1 E: 14-347120-2013-04-28
CG: 1:10 PM: 2013/04/28/colmlb-arimlb-1 E: 14-347110-2013-04-28
CG: 1:10 PM: 2013/04/28/milmlb-lanmlb-1 E: 14-347112-2013-04-28
CG: 1:10 PM: 2013/04/28/sfnmlb-sdnmlb-1 E: 14-347114-2013-04-28
CG: 5:08 PM: 2013/04/28/atlmlb-detmlb-1 E: 14-347106-2013-04-28
How do you play the specific KC/CLE games?

Last edited by icelancer; 05-09-2013 at 12:10 AM.
 
Old 05-09-2013, 12:40 PM   #4031
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,883

Rep: Reputation: 86
Quote:
Originally Posted by icelancer View Post
Love this software, thanks so much!

When running mlblistings.py, you get a unique (?) numerical string after the gameID. What is this string used for, and can it be used to launch games using mlbplay.py? Obviously the current code of mlbplay.py doesn't support such a flag, but for script purposes that I'm writing, I'd like to be able to use that tag rather than v=kc or a=fla, for example.

Thanks!


EDIT: For example, running ./mlblistings.py startdate=04/28/13 gives you:



How do you play the specific KC/CLE games?
Are you asking how to play games in the past? To play that specific game, you could use:

Code:
./mlbplay.py v=kc j=4/28/13
The 'j' argument is the same as startdate or 'j'ump in mlbviewer.

Oh...that's a double header. Let me think of a fix for that. Maybe I'll add 'e' for event-id since those can be looked up using mlblistings.
 
Old 05-09-2013, 01:58 PM   #4032
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,883

Rep: Reputation: 86
SVN revision 472: RSS feeds

Been looking at the MLB servers trying to figure out what else I could add to mlbviewer...

From MLB's RSS website:

Quote:
What is RSS?
RSS (or Really Simple Syndication) feeds are free content feeds from Web sites, including mlb.com, that contain article headlines, summaries and links back to full-text articles on the web.
The default feed is "mlb" (all of MLB) and individual team feeds can be selected within the RSS screen by pressing the RSS key again (currently 'w' but customizable with the RSS action if you're customizing keybindings.)

So 'w' to open the mlb feed and 'w' again to open a team feed. The prompt will ask for the teamcode. The teamcode can be found from mlbplay.py without arguments (pretty much the same codes you have been using for audio_follow, video_follow, favorite, etc.)

Code:
$ ./mlbplay.py 
./mlbplay.py <key>=<value>
examples:
./mlbplay.py v=ana   // plays the video stream for LA Angels
./mlbplay.py a=nyy   // plays the audio stream for NY Yankees

See MLBPLAY-HELP for more options.

Valid teamcodes are:

     'ana', 'ari', 'atl', 'bal', 'bos', 'chc', 'cin', 'cle', 'col',
     'cws', 'det', 'fla', 'hou', 'kc', 'la', 'mil', 'min', 'nym',
     'nyy', 'oak', 'phi', 'pit', 'sd', 'sea', 'sf', 'stl', 'tb',
     'tex', 'tor', 'was'
Pressing Enter without a code will return you to the default "mlb" feed.

Highlighting a feed item and pressing Enter will open a browser to the specific link the feed item describes.

The browser command is customizable through the rss_browser config file option (default value is "firefox -new-tab %s" where %s will get substituted with the URL of the feed item.) If you like lynx/links/w3m, you could try this in your ~/.mlb/config:

Code:
rss_browser=xterm -e w3m %s &
I don't attempt to display the web page content within mlbviewer because there's a lot of "junk" HTML to strip out. Also, I'm not sure if this would be allowed according to MLBAM's RSS Terms Of Service (http://mlb.mlb.com/news/rss/terms.jsp)

I currently limit feed items to two lines (re-using a lot of master scoreboard code): one for the title and one for a truncated description. I may expand this in the future to three or four lines to accommodate more description. The description does expand if you re-size the window. Theoretically, a wide enough screen would fit it.

Please give it a try. Let me know what you think. Will you actually use this feature or will it be another "bookmarks" (a good idea that nobody used)?
 
Old 05-09-2013, 03:46 PM   #4033
icelancer
LQ Newbie
 
Registered: May 2013
Posts: 26

Rep: Reputation: Disabled
Being able to play games by event ID (rather than team ID) would be absolutely huge for me. The -e switch sounds perfect.

Not sure where you're going with the RSS idea, however, so I can't comment! I rarely use mlbviewer.py, I use the mlblistings/mlbplay scripts for watching games (I have a script that opens them up when the appropriate time comes). That's why I'd love an easily grep-able eventID that could be invoked, rather than relying on v=ana or the like.

A great flow would be:

-Get a listing of all games with eventID (mlblistings.py)
-Invoke mlbplay.py -e [eventid] to watch the game

That would be perfect. And it would solve the doubleheader problem I ran into!
 
Old 05-09-2013, 03:50 PM   #4034
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,883

Rep: Reputation: 86
Quote:
Originally Posted by icelancer View Post
Being able to play games by event ID (rather than team ID) would be absolutely huge for me. The -e switch sounds perfect.

Not sure where you're going with the RSS idea, however, so I can't comment! I rarely use mlbviewer.py, I use the mlblistings/mlbplay scripts for watching games (I have a script that opens them up when the appropriate time comes). That's why I'd love an easily grep-able eventID that could be invoked, rather than relying on v=ana or the like.

A great flow would be:

-Get a listing of all games with eventID (mlblistings.py)
-Invoke mlbplay.py -e [eventid] to watch the game

That would be perfect. And it would solve the doubleheader problem I ran into!
I logged on here this morning to announce the RSS feature and just by coincidence of timing, I saw your question. I could have the e= switch ready in a day or two. (Which usually means tonight when I can't get to sleep but don't hold me to it. )
 
Old 05-10-2013, 04:05 PM   #4035
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,883

Rep: Reputation: 86
SVN revision 473: expanded mlbplay to support e=<event-id> switch

Event-id only identifies a game. The v= and a= switches are still necessary to identify a broadcast within that game and the stream type (audio or video.)

(z=1 switch is similar to the 'z' key in mlbviewer. It prints the media debug and exits. Media debug consists of a list of available broadcasts matching the streamtype requested for the event requested. Prefer is the broadcast that would be selected for media playback.)

Taking the CLE-KC doubleheader as an example...

Without e= :

Code:
matthew@wheezy:~/mlb2013$ ./mlbplay.py j=4/28/13 v=kc z=1
media = [[('FSKC-HD', u'118', '26546429', '14-347109-2013-04-28'), ('STO-HD', u'114', '26546431', '14-347109-2013-04-28')], [('MLB.com', u'118', '26630865', '14-347079-2013-04-28')]]
prefer = ('MLB.com', u'118', '26630865', '14-347079-2013-04-28')
To support doubleheaders, I changed the media tuple to a list of media tuples. We see above there are two games (14-347109-2013-04-28 and 14-347079-2013-04-28) and three broadcasts (KC and CLE for 347109 and MLB.com for 347079. Without specifying event_id= (or e=), the last one seen becomes the preferred.

With e=14-347109-2013-04-28 :

Code:
matthew@wheezy:~/mlb2013$ ./mlbplay.py j=4/28/13 v=kc e=14-347109-2013-04-28 z=1 
media = [[('FSKC-HD', u'118', '26546429', '14-347109-2013-04-28'), ('STO-HD', u'114', '26546431', '14-347109-2013-04-28')], [('MLB.com', u'118', '26630865', '14-347079-2013-04-28')]]
prefer = ('FSKC-HD', u'118', '26546429', '14-347109-2013-04-28')
matthew@wheezy:~/mlb2013$
We still see all three broadcasts (two for the first game and one for the second) in the available media listing but now the preferred stream is the the KC broadcast from the first game.
 
  


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 10:16 PM
link dies intermittently-seemingly at random- between win<->linux not linux<->linux?? takahaya Linux - Networking 10 03-09-2007 10:37 PM
triple boot linux/linux/linux No Windows involved toastermaker Linux - Newbie 12 03-02-2006 10:40 PM
Redhat (rhel v2.1) bootup problem with linux (linux vs linux-up) namgor Linux - Software 2 06-24-2004 02:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:45 AM.

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
Open Source Consulting | Domain Registration