Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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
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.
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.
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.)
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.)
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:
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.
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)?
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!
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. )
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.)
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.