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.
Sorry misunderstanding, I use streamlink with other sports, NFL,NHL an NBA , Kinda want to use the same , Altho your plugin looks good . rather just use streamlink on its own to pass the stream to VLC just not understanding how to get the cookies and header stuff to access the stream, Last year it used to be included in the curl which was easy, any way for you to help with that ? thanks
OK, well the whole point of mlbplay (the command-line portion of mlbstreamer) is to get the necessary token to pass to streamlink. If you don't want to use mlbplay, you'd have to basically do what that code is doing anyway, or manually extract the tokens from your browser. And you'd have to do this regularly, as the tokens expire. This isn't really a workflow I'm interested in supporting when I wrote a tool to do exactly that already.
Registered an account just to say thank you for this, tonycpsu. I have linux mint and have been able to stream Spring Training games in whatever player MLB.tv embeds via Chrome. However, they inevitably freeze up on me at some point.
Once I got through some python library issues, I've been able to use your program flawlessly with MPV, and it seems much, much smoother for me.
First, although I have only tested it briefly, mlbplay seems to work fine - well done. However mlbstreamer crashes at start up with:
Code:
Traceback (most recent call last):
File "/usr/bin/mlbstreamer", line 11, in <module>
load_entry_point('mlbstreamer==0.0.1', 'console_scripts', 'mlbstreamer')()
File "/usr/lib64/python2.7/site-packages/mlbstreamer/__main__.py", line 382, in main
view = ScheduleView()
File "/usr/lib64/python2.7/site-packages/mlbstreamer/__main__.py", line 297, in __init__
self.toolbar = Toolbar()
File "/usr/lib64/python2.7/site-packages/mlbstreamer/__main__.py", line 242, in __init__
]) , label="League: ")
File "/usr/lib64/python2.7/site-packages/panwid/dropdown.py", line 458, in __init__
right_chars = right_chars_top if right_chars_top else right_chars
File "/usr/lib64/python2.7/site-packages/panwid/dropdown.py", line 66, in __init__
left_chars=left_chars, right_chars=right_chars
File "/usr/lib64/python2.7/site-packages/panwid/dropdown.py", line 40, in __init__
], dividechars=0)
File "/usr/lib64/python2.7/site-packages/urwid/container.py", line 1095, in __init__
raise ColumnsError, "widget list item invalid: %r" % (w,)
urwid.container.ColumnsError: widget list item invalid: (0, <Text flow widget ''>)
Secondly, I liked mlbviewer's ability to start at the beginning of a particular inning. It would be great if mlbstreamer could do the same. I couldn't seek on the stream either but that may be a limitation of my video player (mplayer).
Thirdly, I suggest the set-up instructions set out in earlier postings here are put in the README, and likewise a note on the options (I struggled to work out how the -r option worked until I read one of the postings here).
One other oddity I have found about mlbplay is that it cannot look up LA Angels or LA Dodgers games using the 'laa' and 'lad' team codes. mlbplay reports a KeyError if you do so: to watch LAA/LAD games you have to use the game number.
One other oddity I have found about mlbplay is that it cannot look up LA Angels or LA Dodgers games using the 'laa' and 'lad' team codes. mlbplay reports a KeyError if you do so: to watch LAA/LAD games you have to use the game number.
I believe the code for the Angels is "ANA". Dodgers might be "LOS"?
I believe the code for the Angels is "ANA". Dodgers might be "LOS"?
Ah yes thanks, that works for the Angels. 'los' for LAD doesn't work though.
On another matter I have found that the -b option doesn't work. I get this when starting the stream with that option:
Code:
Traceback (most recent call last):
File "/usr/bin/mlbplay", line 11, in <module>
load_entry_point('mlbstreamer==0.0.1', 'console_scripts', 'mlbplay')()
File "/usr/lib64/python2.7/site-packages/mlbstreamer/play.py", line 160, in main
live_from_beginning = options.beginning)
File "/usr/lib64/python2.7/site-packages/mlbstreamer/play.py", line 49, in play_stream
game = state.session.schedule(game_id)["dates"][0]["games"][0]
KeyError: 'dates'
The stream works fine if reading from the current state of the game without the -b option.
By trial and error, I have found that the team code for the Dodgers is 'la'.
You could have read post #5031, just above your previous post.
Quote:
Originally Posted by chrisVV
Perhaps a glossary should be included in the mlbstreamer package.
It's just an alpha version, I'm sure a lot of improvements can and hopefully will be made. It would also be possible to support the other team codes as well.
You could have read post #5031, just above your previous post.
I could. All depends on when you refresh your browser. If you feel personally affronted, please don't - no offense was intended: as you can see, I hadn't read it.
Ah yes thanks, that works for the Angels. 'los' for LAD doesn't work though.
On another matter I have found that the -b option doesn't work. I get this when starting the stream with that option:
Code:
Traceback (most recent call last):
File "/usr/bin/mlbplay", line 11, in <module>
load_entry_point('mlbstreamer==0.0.1', 'console_scripts', 'mlbplay')()
File "/usr/lib64/python2.7/site-packages/mlbstreamer/play.py", line 160, in main
live_from_beginning = options.beginning)
File "/usr/lib64/python2.7/site-packages/mlbstreamer/play.py", line 49, in play_stream
game = state.session.schedule(game_id)["dates"][0]["games"][0]
KeyError: 'dates'
The stream works fine if reading from the current state of the game without the -b option.
The following patch applied to play.py should allow you to use the -b option. It is a crude fix as it will make the stream start from the start of the transmission, which is often 30-60 minutes before the game begins.
Code:
diff --git a/mlbstreamer/play.py b/mlbstreamer/play.py
index c73be84..59cbc94 100755
--- a/mlbstreamer/play.py
+++ b/mlbstreamer/play.py
@@ -46,17 +46,19 @@ def play_stream(game_id, resolution, live_from_beginning=False):
if live_from_beginning and media_state == "MEDIA_ON": # live stream
- game = state.session.schedule(game_id)["dates"][0]["games"][0]
- start_time = dateutil.parser.parse(game["gameDate"])
+ #game = state.session.schedule(game_id)["dates"][0]["games"][0]
+ #start_time = dateutil.parser.parse(game["gameDate"])
# print(start_time)
# print(datetime.now(pytz.utc))
# calculate HLS offset, which is negative from end of stream
# for live streams
- offset = datetime.now(pytz.utc) - (start_time.astimezone(pytz.utc))
- hours, remainder = divmod(offset.seconds, 3600)
- minutes, seconds = divmod(remainder, 60)
- offset = "%d:%02d:%02d" %(hours, minutes, seconds)
- logger.info("starting at time offset %s" %(offset))
+ #offset = datetime.now(pytz.utc) - (start_time.astimezone(pytz.utc))
+ #hours, remainder = divmod(offset.seconds, 3600)
+ #minutes, seconds = divmod(remainder, 60)
+ #offset = "%d:%02d:%02d" %(hours, minutes, seconds)
+ #logger.info("starting at time offset %s" %(offset))
+ logger.info("starting at beginning of transmission")
+ offset = True
cmd = [
"streamlink",
@@ -68,7 +70,8 @@ def play_stream(game_id, resolution, live_from_beginning=False):
resolution,
]
if offset:
- cmd += ["--hls-start-offset", offset]
+ #cmd += ["--hls-start-offset", offset]
+ cmd += ["--hls-live-restart"]
logger.debug(" ".join(cmd))
# if options.output_file:
# cmd += ["-o", options.output_file]
Is there a way to try this out (that I have forgotten about)? MLB's giving two days of free plays and I'd love to give it a spin while I watch my boys in blue.
Is there a way to try this out (that I have forgotten about)? MLB's giving two days of free plays and I'd love to give it a spin while I watch my boys in blue.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.