adam-ducker / mlbv

Command-line interface MLB game information. Game schedule, scores, and standings
GNU General Public License v3.0
19 stars 5 forks source link

Fetch Does not work #7

Open doganjr opened 3 months ago

doganjr commented 3 months ago

`import subprocess

mlbv_command = [ 'mlbv', '--team', 'hou', '-fetch' ]

subprocess.run(mlbv_command)`

After I run this code, it raises an error as follows:

Feed is not available: etch No stream URL found

I am sure that I correctly entered the credentials. Also, recap/condensed highlight recording is not working properly, too:

`import mlbv import subprocess

mlbv_command = [ 'mlbv', '--team', 'hou', '-f', 'condensed' ]

subprocess.run(mlbv_command) ` Output:

No playback_url found for hou vs min, info: {} FATAL: No playback url for feed 'condensed'

mkomko commented 3 months ago

Aren't you missing a dash in your first example? --fetch...

mkomko commented 3 months ago

Also, there probably isn't a condensed game for today?

doganjr commented 3 months ago

Actually, I tried it with double dashes before, but I forgot to put it there, sorry.

Input:

`import mlbv import subprocess

mlbv_command = [ 'mlbv', '--team', 'hou', '--fetch' ]

subprocess.run(mlbv_command)`

Output:

Default (home/away) feed not found: choosing first available feed Feed is not available: None No stream URL found

mkomko commented 3 months ago

No surprise, there is no game yet today, is there? Condensed game syntax is -f cnd I believe?

doganjr commented 3 months ago

There is a condensed video for the latest matchup of HOU at https://www.mlb.com/video/condensed-game-hou-min-7-6-24

'-f cnd' works, too. If the system does not perceive '-f condensed' as a proper command it would not output like this I believe: No playback_url found for hou vs min, info: {} FATAL: No playback url for feed 'condensed'

mkomko commented 3 months ago

There is a condensed video for the latest matchup of HOU at https://www.mlb.com/video/condensed-game-hou-min-7-6-24

Which was --yesterday

doganjr commented 3 months ago

I am living in Turkey. Technically, it is today but it figured out.

Adding "--yesterday" argument to the command solve the problem for recap and condensed video. However it remains for "--fetch" setting. Here is the new input:

import mlbv import subprocess

mlbv_command = [ 'mlbv', '--yesterday', '--team', 'hou', '--fetch' ]

subprocess.run(mlbv_command)

And the output:

Traceback (most recent call last): File "/opt/anaconda3/envs/req/bin/mlbv", line 8, in <module> sys.exit(main()) File "/opt/anaconda3/envs/req/lib/python3.10/site-packages/mlbv/mlbam/mlbv.py", line 318, in main return mlbstream.play_stream(game_rec, team_to_play, feedtype, args.date, args.fetch, args.from_start, args.inning) File "/opt/anaconda3/envs/req/lib/python3.10/site-packages/mlbv/mlbam/mlbstream.py", line 98, in play_stream stream_url = mlb_session.lookup_stream_url(game_rec['game_pk'], media_playback_id) File "/opt/anaconda3/envs/req/lib/python3.10/site-packages/mlbv/mlbam/mlbsession.py", line 273, in lookup_stream_url "Authorization": self.access_token, File "/opt/anaconda3/envs/req/lib/python3.10/site-packages/mlbv/mlbam/common/session.py", line 125, in access_token self._refresh_access_token() File "/opt/anaconda3/envs/req/lib/python3.10/site-packages/mlbv/mlbam/mlbsession.py", line 111, in _refresh_access_token = self.API_KEY_RE.search(script.text).groups()[0] AttributeError: 'MLBSession' object has no attribute 'API_KEY_RE'

mkomko commented 3 months ago

It's not July 6 in Turkey 😉. Can't help with the new error though.

enjoymoreradio commented 3 months ago

This bug was resolved in this commit: https://github.com/adam-ducker/mlbv/commit/698246bcc84f289946d0725befc6077e2bbd40b6

Please update the most recent version of the package.