Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have to issue 'set player mpv' every time on Windows #397

Closed
GijsTimmers opened this issue Dec 23, 2015 · 6 comments
Closed

I have to issue 'set player mpv' every time on Windows #397

GijsTimmers opened this issue Dec 23, 2015 · 6 comments

Comments

@GijsTimmers
Copy link

Using Windows 7 x86.

Some debug information:

mpsyt:

C:\Users\user>C:\Python34\Scripts\mpsyt.exe --version
mpsyt version  : 0.2.5
   notes       : released 1 June 2015
pafy version   : 0.4.2
Python version : 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600
32 bit (Intel)]
Processor      : x86 Family 6 Model 23 Stepping 10, GenuineIntel
Machine type   : x86
Architecture   : 32bit, WindowsPE
Platform       : Windows-7-6.1.7601-SP1
sys.stdout.enc : cp850
default enc    : utf-8
Config dir     : C:\Users\user\AppData\Roaming\mps-youtube

mpv.com:

C:\Users\user>C:\Python34\Scripts\mpv.com --version
mpv 0.14.0-git-e1993d5 (C) 2000-2015 mpv/MPlayer/mplayer2 projects
 built on Fri Dec 11 20:32:28 CET 2015
ffmpeg library versions:
   libavutil       55.10.100
   libavcodec      57.17.100
   libavformat     57.19.100
   libswscale      4.0.100
   libavfilter     6.20.100
   libswresample   2.0.101
ffmpeg version: N-77205-gcc4718a

set output:

  Key                 Value
  api_key           : sOmeApIkEy
  checkupdate       : True
  colours           : True
  columns           :
  ddir              : C:\Users\user\Downloads\mps
  download_command  :
  encoder           : 0 [None]
  fullscreen        : False
  max_res           : 2160p
  notifier          :
  order             : relevance
  overwrite         : True
  player            : mpv.exe
  playerargs        :
  search_music      : True
  show_mplayer_keys : True
  show_status       : True
  show_video        : True
  user_order        :
  window_pos        :
  window_size       :

Enter set <key> <value> to change
Enter set all default to reset all

The problem I'm facing:

I start mpsyt. I look up a video. mpsyt gives the expected search results. When trying to play a video, I'm getting error: retrying in the bottom left corner of the terminal.

The strange thing: after issuing set player mpv and choosing the desired video again, the video plays.

I exit mpsyt, and start it again. The same problem arises: I have to issue set player mpv again before I can play videos.

For the record, I posted the mpv.com version output as I can't get the mpv.exe output, but player gets set to mpv.exe, as it should.

@lwilletts
Copy link
Contributor

Yes I've had this issue as well when on windows. I have no idea what's causing it either.

@ids1024
Copy link
Contributor

ids1024 commented Dec 23, 2015

Hm, that's odd. Does it change anything to use set player mpv.com? Does set output the same player command when it is not working as it does when it is?

@GijsTimmers
Copy link
Author

> set

  Key                 Value
  api_key           : sOmeKeY
  checkupdate       : True
  colours           : True
  columns           :
  ddir              : C:\Users\user\Downloads\mps
  download_command  :
  encoder           : 0 [None]
  fullscreen        : False
  max_res           : 2160p
  notifier          :
  order             : relevance
  overwrite         : True
  player            : mpv.exe
  playerargs        :
  search_music      : True
  show_mplayer_keys : True
  show_status       : True
  show_video        : True
  user_order        :
  window_pos        :
  window_size       :

> set player mpv

  Key                 Value
  api_key           : sOmeKeY
  checkupdate       : True
  colours           : True
  columns           :
  ddir              : C:\Users\user\Downloads\mps
  download_command  :
  encoder           : 0 [None]
  fullscreen        : False
  max_res           : 2160p
  notifier          :
  order             : relevance
  overwrite         : True
  player            : mpv.exe
  playerargs        :
  search_music      : True
  show_mplayer_keys : True
  show_status       : True
  show_video        : True
  user_order        :
  window_pos        :
  window_size       :

player set to mpv (version -1.0.0)

Enter set <key> <value> to change
Enter set all default to reset all

FWIW, both mpsyt.exe and mpv.exe reside in C:\Python34\Scripts\.

> set player mpv.com
  Key                 Value
  api_key           : sOmEkEy
  checkupdate       : True
  colours           : True
  columns           :
  ddir              : C:\Users\user\Downloads\mps
  download_command  :
  encoder           : 0 [None]
  fullscreen        : False
  max_res           : 2160p
  notifier          :
  order             : relevance
  overwrite         : True
  player            : mpv.com
  playerargs        :
  search_music      : True
  show_mplayer_keys : True
  show_status       : True
  show_video        : True
  user_order        :
  window_pos        :
  window_size       :

player set to mpv (version -1.0.0)

After setting the player to mpv.com, I can look up videos and they play just fine. But when I exit mpsyt, and start it again, a new error appears:

Num  Title                                                               Time
 1   Lynyrd Skynyrd - Sweet Home Alabama                                05:01
 2   Lynyrd Skynyrd - Sweet Home Alabama - Lyrics IN Video + Descripti  04:46
 3   Lynyrd Skynrd - Sweet Home Alabama (From "Sweet Home Alabama" DVD  06:52
 4   Lynyrd Skynyrd - Sweet Home Alabama - 7/2/1977 - Oakland Coliseum  06:59
 5   Sweet Home Alabama Lynyrd Skynyrd                                  04:42
 6   Lynyrd Skynyrd - Sweet Home Alabama                                03:50
 7   Lynyrd    Skynyrd     --    Sweet     Home    Alabama  [[  Offici  07:36
 8   Sweet Home Alabama - Lynyrd Skynyrd - High Quality - Lyrics        06:46
 9   Bonfire - Sweet Home Alabama                                       04:08
10   Kid Rock All Summer Long-Remake                                    03:51
11   How to Play Sweet Home Alabama on Guitar                           09:58
12   Sweet Home Alabama cover - Laura Cox                               04:15
13   Emmerson Nogueira - SWEET HOME ALABAMA                             05:57
14   LYNYRD SKYNYRD - Sweet Home Alabama                                05:43
15   Sweet Home Alabama - Lynyrd Skynyrd (aula de guitarra)             55:05
16   Lynyrd Skynyrd - Sweet home Alabama (lyrics on screen)             04:00
17   The "Original" Sweet Home Alabama                                  06:15
18   Guns N Roses Sweet Home Alabama                                    05:12
19   Sweet Home Alabama - Lynyrd Skynyrd (aula de baixo)                16:17
20   ??? ?????? ?? ?????? Sweet Home Alabama - Lynyrd Skynyrd - ?????   26:13
21   sweet home alabama - original unplugged rare version               04:19

    [<-] seek [->]       [9] volume [0]
    [DN] SEEK [UP]       [space] pause       [q] return

    Lynyrd Skynyrd - Sweet Home Alabama [05:01]
                                                                 [1/24>
Option --msglevel was removed: use --msg-level (changed semantics)
Error parsing option msglevel (option not found)
Setting command line option '--msglevel=all=no:statusline=status' failed.

Exiting... (Fatal error)
Option --msglevel was removed: use --msg-level (changed semantics)
Error parsing option msglevel (option not found)
Setting command line option '--msglevel=all=no:statusline=status' failed.

Exiting... (Fatal error)
Option --msglevel was removed: use --msg-level (changed semantics)
Error parsing option msglevel (option not found)
Setting command line option '--msglevel=all=no:statusline=status' failed.

Exiting... (Fatal error)
Option --msglevel was removed: use --msg-level (changed semantics)
Error parsing option msglevel (option not found)
Setting command line option '--msglevel=all=no:statusline=status' failed.

Exiting... (Fatal error)

mpsyt then returns to the search results.

@ids1024
Copy link
Contributor

ids1024 commented Dec 23, 2015

Hm, mpsyt is supposed to check the version of mpv, so it knows which argument to give, so I guess it must not be running the version checking function for some reason...

@GijsTimmers
Copy link
Author

What I did now was this:

  1. run mpsyt.exe --debug
  2. set player mpv.com
  3. exit mpsyt.exe by typing exit
  4. start mpsyt.exe --debug again
  5. look up a song
  6. try to play it (same error appears)
  7. exit mpsyt.exe by typing exit

This is the content of C:\Users\user\AppData\Local\Temp\mpsyt.log:

DEBUG:root:<generator object <genexpr> at 0x02950508>
DEBUG:root:<generator object <genexpr> at 0x02950508>
DEBUG:root:<generator object <genexpr> at 0x014226E8>
DEBUG:root:<generator object <genexpr> at 0x029580F8>
DEBUG:root:<generator object <genexpr> at 0x029580F8>
DEBUG:root:<generator object <genexpr> at 0x02961B48>
DEBUG:root:<generator object <genexpr> at 0x02961B48>
DEBUG:root:<generator object <genexpr> at 0x02961B48>
DEBUG:root:<generator object <genexpr> at 0x02961B98>
DEBUG:root:<generator object <genexpr> at 0x02961B98>
DEBUG:root:<generator object <genexpr> at 0x0294FE68>
DEBUG:root:<generator object <genexpr> at 0x02950508>
DEBUG:root:<generator object <genexpr> at 0x02964AA8>
DEBUG:root:<generator object <genexpr> at 0x02964AA8>
DEBUG:root:<generator object <genexpr> at 0x02964AA8>
DEBUG:root:<generator object <genexpr> at 0x02964B48>

Not sure if it helps though...

@GijsTimmers
Copy link
Author

I read the code in https://github.com/mps-youtube/mps-youtube/blob/develop/mps_youtube/util.py#L41 and executed it on Windows. There seems to be a problem with get_mpv_version().

I'll illustrate:

$ python3
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> import subprocess
>>> exename="mpv.exe"
>>> o = subprocess.check_output([exename, "--version"]).decode()
>>> o
'mpv 0.14.0-git-e1993d5 (C) 2000-2015 mpv/MPlayer/mplayer2 projects\r\n built on
 Fri Dec 11 20:32:28 CET 2015\r\nffmpeg library versions:\r\n   libavutil
55.10.100\r\n   libavcodec      57.17.100\r\n   libavformat     57.19.100\r\n
libswscale      4.0.100\r\n   libavfilter     6.20.100\r\n   libswresample   2.0
.101\r\nffmpeg version: N-77205-gcc4718a\r\n\r\n'
>>> re_ver = re.compile(r"%s (\d+)\.(\d+)\.(\d+)" % exename)
>>> re_ver
re.compile('mpv.exe (\\d+)\\.(\\d+)\\.(\\d+)')
>>> for line in o.split("\n"):
...     m = re_ver.match(line)
...     print(m)
...
None
None
None
None
None
None
None
None
None
None
None
None
>>>

The problem has something to do with the regex, which also explains why it works on Linux but not on Windows.

On Windows, exename is set to mpv.exe or mpv.com. This will work for getting the subprocess output. The problem is that mpsyt tries to match for exename in the --version output as well. As the version output does not contain this extension, there are no matches:

C:\Python34\Scripts>mpv.com --version
mpv 0.14.0-git-e1993d5 (C) 2000-2015 mpv/MPlayer/mplayer2 projects
 built on Fri Dec 11 20:32:28 CET 2015
ffmpeg library versions:
   libavutil       55.10.100
   libavcodec      57.17.100
   libavformat     57.19.100
   libswscale      4.0.100
   libavfilter     6.20.100
   libswresample   2.0.101
ffmpeg version: N-77205-gcc4718a

As you can see, it only contains 'mpv'. On Linux, this is no problem: the exename is mpv, too.

Proposed solution: declare a different variable, without the extension.

I can't test it myself due to #400.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants