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

upcoming mpv release is incompatible due to API change #261

Closed
wiiaboo opened this issue Nov 17, 2019 · 10 comments · Fixed by #310
Closed

upcoming mpv release is incompatible due to API change #261

wiiaboo opened this issue Nov 17, 2019 · 10 comments · Fixed by #310
Assignees

Comments

@wiiaboo
Copy link
Contributor

wiiaboo commented Nov 17, 2019

mpv-player/mpv@f57f13c

No date for the removal of input-file, but it's finally being deprecated.

@wiiaboo wiiaboo changed the title mpv: replace input-file by input-ipc-server usage [feature request] mpv: replace input-file by input-ipc-server usage Nov 17, 2019
@Et0h
Copy link
Contributor

Et0h commented Nov 18, 2019

Thanks for letting us know @wiiaboo

I have had an initial look at https://github.com/mpv-player/mpv/blob/master/DOCS/man/ipc.rst and it looks like moving to input-ipc-server would require moving to JSON and might also involve having to work around some UTF-8 quirks and might have some additional issues working on Windows, so not a straightforward switch from one command line option to another.

Ideally we would want any change to be done in a way which maintained backwards compatibility with mpv >= 0.6.2 (which as per https://syncplay.pl/guide/install/ is the earliest version of mpv we say we support).

@wiiaboo
Copy link
Contributor Author

wiiaboo commented Nov 18, 2019

I don't think it's sane to still support that old an mpv. At that point, still supporting mplayer/mplayer2 makes as much sense. Might as well just create a new mpv thing and that should be supported since at least the moment named pipes were supported in Windows (~v0.17.0).

I've been using a python script to send URLs from the browser to a single-instance mpv for years now, so named pipes should be fine. Not sure about two-way communication though. My script is one-way only:

#!python3
#!/usr/bin/env python3
#mpv-append.pyw
import sys, subprocess, shlex, codecs, os
from time import strftime
import argparse

log_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'umpv.log')

parser = argparse.ArgumentParser(prefix_chars='-/')
parser.add_argument('mpvopts',
                    help='opts passed to mpv if already open',
                    nargs='+')
parsed_args = parser.parse_args(sys.argv[1:])

with codecs.open(log_path, 'a', 'utf-8') as log_file:
    if len(sys.argv[1:]) > len(parsed_args.mpvopts):
        log_file.write('[{}] {} ⇒ "{}"\n'.format(strftime("%Y-%m-%d %H:%M:%S"),
            sys.argv[1:], '" "'.join(parsed_args.mpvopts)))
    else:
        log_file.write('[{}] "{}"\n'.format(strftime("%Y-%m-%d %H:%M:%S"),
            sys.argv[1:], '" "'.join(parsed_args.mpvopts)))

try:
    f = open(r'\\.\pipe\mpvsocket', 'r+b', 0)
    for arg in parsed_args.mpvopts:
        if not arg.startswith('-'):
             subprocess.run(["echo", "loadfile", arg.replace('&','^&'),
                "append-play"], stdout=f, shell=True)
except OSError:
    args = ['mpv.exe', '--profile=umpv', '--input-ipc-server=\\\\.\\pipe\\mpvsocket']
    args += parsed_args.mpvopts
    subprocess.Popen(args)

@daniel-123

This comment has been minimized.

@wiiaboo

This comment has been minimized.

@wiiaboo
Copy link
Contributor Author

wiiaboo commented Mar 28, 2020

It's out on git master and on the next release: mpv-player/mpv@b8daef5

@Et0h
Copy link
Contributor

Et0h commented Mar 28, 2020

Thanks for the notification @wiiaboo - hopefully moving over to JSON won't be too tricky.

@Et0h Et0h self-assigned this Mar 28, 2020
@C0rn3j
Copy link

C0rn3j commented Mar 28, 2020

Syncplay 1.6.4a nor git now won't work against git mpv, I guess it's because of this change.

Syncplay is not compatible with this version of mpv. Please use a different version of mpv (e.g. Git HEAD).

@Et0h
Copy link
Contributor

Et0h commented Mar 28, 2020

I've now added a notice to the syncplay.pl homepage advising people to stick with mpv 0.6.2 – 0.32.0 for now.

@wiiaboo
Copy link
Contributor Author

wiiaboo commented Mar 28, 2020

Preferably 0.32.0.

@daniel-123 daniel-123 changed the title [feature request] mpv: replace input-file by input-ipc-server usage upcoming mpv release is incompatible due to API change Apr 14, 2020
@daniel-123 daniel-123 added the help wanted Anyone willing to help can fix/implement this label Apr 14, 2020
@daniel-123 daniel-123 pinned this issue Apr 14, 2020
@daniel-123
Copy link
Contributor

I've adjusted the issue a bit to reflect its importance and urgency.
Additionally I revisited the mpv versions in latest LTS distros - the oldest one I found is 0.27. Based on this I see absolutely no point in trying to keep compatibility with anything remotely as old as 0.6.
New API under current option naming is available from 0.17 onwards and that IMHO should be the new minimum supported version.

@Et0h Et0h closed this as completed in #310 May 15, 2020
Et0h added a commit that referenced this issue May 15, 2020
* Separate mpv from mplayer, increase min mpv ver to >= 0.17, refactor

* Further separation of mpv from mplayer

* Fix reference to isASCII

* Add iwalton3's Python MPV JSONIPC library (Apache 2.0)

* Move to JSON IPC API for mpv using iwaltons3's library (#261)

* Add empty init in Python MPV JSONIPC to make py2exe happy

* Use managed version of Python MPV JSONIPC to improve initialisation reliability

* Set mpv min version to >=0.29.0 to ensure compatibility

* Allow mpv >=0.23.0 based on daniel-123's tests

* Update mpv compatibility message

* Revert to old OSC compat message

* Removed mpv option that's no longer used afer switching to IPC.

* Update python-mpv-jsonipc to v1.1.11

* Use python-mpv-jsonipc's mpv quit handler

* Shorten mpv paused/position update message

Co-authored-by: daniel-123 <wrobel.dan@gmail.com>
@daniel-123 daniel-123 unpinned this issue May 19, 2020
albertosottile pushed a commit to albertosottile/syncplay that referenced this issue Sep 30, 2020
…Syncplay#310)

* Separate mpv from mplayer, increase min mpv ver to >= 0.17, refactor

* Further separation of mpv from mplayer

* Fix reference to isASCII

* Add iwalton3's Python MPV JSONIPC library (Apache 2.0)

* Move to JSON IPC API for mpv using iwaltons3's library (Syncplay#261)

* Add empty init in Python MPV JSONIPC to make py2exe happy

* Use managed version of Python MPV JSONIPC to improve initialisation reliability

* Set mpv min version to >=0.29.0 to ensure compatibility

* Allow mpv >=0.23.0 based on daniel-123's tests

* Update mpv compatibility message

* Revert to old OSC compat message

* Removed mpv option that's no longer used afer switching to IPC.

* Update python-mpv-jsonipc to v1.1.11

* Use python-mpv-jsonipc's mpv quit handler

* Shorten mpv paused/position update message

Co-authored-by: daniel-123 <wrobel.dan@gmail.com>
albertosottile pushed a commit to albertosottile/syncplay that referenced this issue Sep 30, 2020
…Syncplay#310)

* Separate mpv from mplayer, increase min mpv ver to >= 0.17, refactor

* Further separation of mpv from mplayer

* Fix reference to isASCII

* Add iwalton3's Python MPV JSONIPC library (Apache 2.0)

* Move to JSON IPC API for mpv using iwaltons3's library (Syncplay#261)

* Add empty init in Python MPV JSONIPC to make py2exe happy

* Use managed version of Python MPV JSONIPC to improve initialisation reliability

* Set mpv min version to >=0.29.0 to ensure compatibility

* Allow mpv >=0.23.0 based on daniel-123's tests

* Update mpv compatibility message

* Revert to old OSC compat message

* Removed mpv option that's no longer used afer switching to IPC.

* Update python-mpv-jsonipc to v1.1.11

* Use python-mpv-jsonipc's mpv quit handler

* Shorten mpv paused/position update message

Co-authored-by: daniel-123 <wrobel.dan@gmail.com>
@daniel-123 daniel-123 removed the help wanted Anyone willing to help can fix/implement this label Mar 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants