LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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-05-2008, 09:08 AM   #106
jkr
Member
 
Registered: Apr 2008
Posts: 115

Rep: Reputation: 15

I've also updated the script -- now you can select days by using the side arrows.

Download from the same place (link on the previous page). I'll just keep replacing it until it seems worthwhile to start giving version numbers. I'll let you know when I make significant changes.

I've looked at pylirc, and that seems like it should work for adding remote control support, so pretty soon, using Theophile's button, there should be clunky but workable mythtv support. (I personally prefer a full screen transparent terminal.)

Last edited by jkr; 04-05-2008 at 09:20 AM.
 
Old 04-05-2008, 01:24 PM   #107
Theophile
Member
 
Registered: Jan 2003
Posts: 283

Rep: Reputation: 35
I got a fullscreen transparent terminal using konsole profiles, class names, and wm rules. I'm not using compiz/beryl on my MythTV machine, but if you are, it's a lot easier t get a transparent terminal. I also significantly increased the font size and I'm using Xine for playback because it handles buffering better and has the ability to change the aspect ratio on the fly.

I love it! Thanks!
 
Old 04-05-2008, 02:08 PM   #108
TrisMcC
LQ Newbie
 
Registered: Apr 2008
Posts: 2

Rep: Reputation: 0
Hacked mlbviewer.py to do radio, away streams only

I just hacked up your brilliant mlbviewer.py script to deal with gameday audio. I did just enough to make it work....away streams only.

One difference is that the text section of the JSON just has the radio station call letters.

Code:
--- mlbviewer.py        2008-04-05 14:49:40.000000000 -0400
+++ mlbviewerradio.py   2008-04-05 14:51:09.000000000 -0400
@@ -61,11 +61,11 @@
 # interacts oddly with terminal curses. You could also try the vlc
 # option if you prefer.

-PLAYER = 'xterm -e mplayer -cache 2048 -quiet'
+PLAYER = 'xterm -e mplayer -cache 64 -quiet -playlist'
 #PLAYER = 'vlc >/dev/null 2>&1'
 #PLAYER = "gnome-mplayer"

-SPEED = 400 
+SPEED = 12 
 # or 800, or 1200. If you put it any other value, it will fail
 # ungracefully.

@@ -137,17 +137,12 @@
             out = []
             for elem in self.data:
                 # All contingent on it having a tv broadcast.
-                if elem['mlbtv']:
+                if elem['away_audio']:
                     dct = {}
                     dct['event_time'] = elem['event_time']
                     dct['status'] = elem['status']
-                    # If things have gotten this far and they still
-                    # have weird text, just say that it's weird...
-                    try:
-                        dct['text'] = elem['mlbtv']['text'].split(':')[1].split('|')[0].strip()
-                    except:
-                        dct['text'] = "[mlbviewer couldn't read this...]"
-                    for url in elem['mlbtv']['urls']:
+                    dct['text'] = elem['away_audio']['text']
+                    for url in elem['away_audio']['urls']:
                         dct[url['speed']] = url['url']['id']
                     out.append((elem['gameid'], dct))
         return out
@@ -162,7 +157,7 @@
         # Make the workflow url
         url = "http://www.mlb.com/enterworkflow.do?" +\
             "flowId=media.media&keepWfParams=true&mediaId=" +\
-            str(self.id) + "&catCode=mlb_lg&av=v"
+            str(self.id) + "&catCode=mlb_ga&av=a"
         # Some preliminary setup...
         cookieJar = ClientCookie.CookieJar()
         opener = ClientCookie.build_opener(ClientCookie.HTTPCookieProcessor(cookieJar))
@@ -191,7 +186,7 @@
     def url(self):

         # url_pattern
-        pattern = re.compile(r'(url:.*\")(mms:\/\/[^ ]*)(".*)')
+        pattern = re.compile(r'(url:.*\")(http:\/\/[^ ]*)(".*)')
         game_url = re.search(pattern, self.__getInfo()).groups()[1]
         return game_url

@@ -299,7 +294,7 @@
             gameid = available[current_cursor][2]
             g = GameStream(gameid, email, password)
             u = g.url()
-            subprocess.call(PLAYER+' '+u,shell=True)
+            subprocess.call(PLAYER + ' "' + u + '"',shell=True)

         if c == ord('r'):
             # refresh
 
Old 04-05-2008, 05:38 PM   #109
jkr
Member
 
Registered: Apr 2008
Posts: 115

Rep: Reputation: 15
That's great. Thanks for the patch. When I get done with my current project (adding lirc support), I'll see if I can fold that in to the larger script. Maybe press "v" for video, "a" for audion, or something...
 
Old 04-06-2008, 02:30 AM   #110
Hoth
LQ Newbie
 
Registered: Jan 2007
Location: Northern California
Distribution: Kubuntu 8.10
Posts: 26

Rep: Reputation: 15
Quote:
Originally Posted by jkr View Post
How strange. The url looks valid -- it has the authentication part in it. I just tried out that same game (Boston-at Toronto) and it worked fine. And you could clearly log in, or else you wouldn't have gotten the authorization code. Hmm... Do the urls you get through the firebug or workflow methods work for you?
Oddly, mlbplayer.py is working for me today (no changes, haven't applied your new version yet). Maybe I'd used too many connections in too short a period for mlb.tv to like or something. Anyhow I'm happy now.
 
Old 04-06-2008, 06:24 AM   #111
jkr
Member
 
Registered: Apr 2008
Posts: 115

Rep: Reputation: 15
Update: I made a few more minor changes in day switching (makes sure you can't select non-games, etc), and fixed a problem with refreshing I introduced in the second version. If you're using it, you should probably download the version online now. Sorry about that -- release early, release often, and all that.
 
Old 04-06-2008, 09:14 AM   #112
Theophile
Member
 
Registered: Jan 2003
Posts: 283

Rep: Reputation: 35
If I may make a suggestion:

In the next revision, I think it would be helpful to move the player configuration (PLAYER =) and the stream selection (400k or 800k) to the .mlbtv config file containing the username and password. That way, we don't have to reconfigure those items every time the script is revised.

That said, this really is an amazing piece of work. Even better than Mosaic IMHO. It's simple and it actually works!
 
Old 04-06-2008, 01:01 PM   #113
Hoth
LQ Newbie
 
Registered: Jan 2007
Location: Northern California
Distribution: Kubuntu 8.10
Posts: 26

Rep: Reputation: 15
Trying a live game for the first time. Got "connection reset" messages, both in firefox and in the script. Finally those went away and I got this (using latest version):
Code:
pgk@pgk-desktop:~$ python mlbviewer.py
Traceback (most recent call last):
  File "mlbviewer.py", line 342, in <module>
    curses.wrapper(mainloop,datadct['user'],datadct['pass'])
  File "curses/wrapper.py", line 44, in wrapper
  File "mlbviewer.py", line 322, in mainloop
    u = g.url()
  File "mlbviewer.py", line 213, in url
    game_url = re.search(pattern, self.__getInfo()).groups()[1]
AttributeError: 'NoneType' object has no attribute 'groups'
Edit: These must be due to mlb.tv's server glitches, as it started working now. I'll leave the post content just to illustrate what happens when mlb.tv's end fails.

Last edited by Hoth; 04-06-2008 at 01:04 PM.
 
Old 04-06-2008, 02:20 PM   #114
Fugazi
Member
 
Registered: Oct 2003
Location: Denver
Distribution: Fedora 10
Posts: 53

Original Poster
Rep: Reputation: 15
Maybe you all could help me out with getting this to work. I made the mlbviewer.py file & the password file. I installed ClientForm, ClientCookie, and simplejson, but when I try to run it, I get:

[don@localhost ~]$ python mlbviewer.py
Traceback (most recent call last):
File "mlbviewer.py", line 48, in <module>
import ClientCookie
ImportError: No module named ClientCookie

It looks like it isn't finding ClientCookie (but what do I know?) ClientCookie is in /usr/lib/python2.2 directory. Assume I know very little about Linux and nothing about python.

Thanks
 
Old 04-06-2008, 03:14 PM   #115
Hoth
LQ Newbie
 
Registered: Jan 2007
Location: Northern California
Distribution: Kubuntu 8.10
Posts: 26

Rep: Reputation: 15
Python 2.2? Maybe you need 2.4, that's what I'm running. At any rate go to your package manager (I guess Fedora uses Synaptic?) and search for clientcookie. It should be the only package containing that in the name. Make sure it's marked as installed.
 
Old 04-06-2008, 03:31 PM   #116
ilikerobots
LQ Newbie
 
Registered: Apr 2008
Posts: 17

Rep: Reputation: 0
Quote:
Originally Posted by Hoth View Post
Trying a live game for the first time. Got "connection reset" messages, both in firefox and in the script. Finally those went away and I got this (using latest version):.
I get those same messages on today's (4/6) games as well. Prior day's games work fine. Did you do something to correct this error?
 
Old 04-06-2008, 03:39 PM   #117
Hoth
LQ Newbie
 
Registered: Jan 2007
Location: Northern California
Distribution: Kubuntu 8.10
Posts: 26

Rep: Reputation: 15
No, I just tried again after a few minutes. The game was stuttering a little at times too (and my connection is plenty fast), and there was the firefox message right before it, so I think their servers aren't coping well. Works for me at this moment though.
 
Old 04-06-2008, 07:59 PM   #118
jkr
Member
 
Registered: Apr 2008
Posts: 115

Rep: Reputation: 15
Thanks for reporting the errors.

I just tried the chisox/tigers game and it didn't work. Looked closely and it turned out that it was part of their weekend nationalblackout rules. I don't think that was the issue with the links earlier in the day, but they might still be working out the kinks.

Anyway, as it is now, the script isn't capable of telling you it's blacked out ahead of time (or just not listing it) but the information is available in the listing, so I'll get it in in the next version. Local team blackouts will require a more elegant error message, which I'll also add in.

Last edited by jkr; 04-06-2008 at 08:02 PM.
 
Old 04-06-2008, 08:05 PM   #119
jkr
Member
 
Registered: Apr 2008
Posts: 115

Rep: Reputation: 15
Quote:
Originally Posted by Fugazi View Post
It looks like it isn't finding ClientCookie (but what do I know?) ClientCookie is in /usr/lib/python2.2 directory. Assume I know very little about Linux and nothing about python.
Did you just place it in the directory or did you install it? I.e. did you follow the instructions in the INSTALL file? (This is one of the parts that I will be rewriting sooner or later, so you won't need to install this file in the future. But that rewrite might not be till a bit later.)
 
Old 04-07-2008, 02:50 AM   #120
daftcat
mlbviewer Maintainer
 
Registered: Apr 2008
Posts: 1,883

Rep: Reputation: 86
Hi jkr,

I get the following when trying to run mlbviewer.py:

matthew@tango:~$ ./mlbviewer.py
File "./mlbviewer.py", line 78
class MLBSchedule():
^
SyntaxError: invalid syntax


Vague and frustrating, isn't it? And I thought oracle error tracebacks were bad. :-(

I'm using Debian Etch with python2.4 installed plus python-clientcookie, python-clientform, and python-simplejson.

If I can get this working, I can add this to my howto page if you'd like.

Thanks,
Matthew
 
  


Reply

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



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 09:08 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