Closed pihug12 closed 4 years ago
It's true that you can't drag and drop subtitles from a file archiver into mpv - only from a file browser. But why would you want to do this, is the real question?
Ark provides a dbus API that
wontfix
Kind of interested what absurd contraptions they've created that dbus is involved in this.
Also can you provide a sample of such a file and a log?
But why would you want to do this, is the real question?
I used to do this on my Windows computer with 7-Zip and MPC-HC. I can't remember if it worked with 7-Zip and mpv (I don't have access to a Windows computer right now).
Also can you provide a sample of such a file and a log?
All the files from https://subscene.com/ for example.
Here is a part of the log with the DnD type
lines:
[cplayer] first video frame after restart shown
[cplayer] Run command: enable-section, flags=64, args=["input_forced_osc", "allow-hide-cursor+allow-vo-dragging"]
[cplayer] audio sync: sync_to_video=1, offset=0.000000
[cplayer] starting audio playback
[cplayer] playback restart complete @ 0.000000
[statusline] AV: 00:00:00 / 00:00:16 (0%) A-V: 0.000
[osc] osc_init
[cplayer] Run command: change-list, flags=64, args=["shared-script-properties", "append", "osc-margins=0.000000,0.000000,0.000000,0.000000"]
[cplayer] Set property: shared-script-properties -> 1
[statusline] AV: 00:00:00 / 00:00:16 (0%) A-V: 0.000
[vo/gpu/x11] Disabling screensaver.
[statusline] AV: 00:00:07 / 00:00:16 (49%) A-V: 0.000
[vo/gpu/x11] DnD type: 'application/x-kde-ark-dndextract-service'
[vo/gpu/x11] DnD type: 'application/x-kde-ark-dndextract-path'
[vo/gpu/x11] DnD type: ''
[vo/gpu/x11] Selected DnD type: (none)
[statusline] AV: 00:00:10 / 00:00:16 (66%) A-V: 0.000
[cplayer] Run command: cycle, flags=73, args=["pause", "1.000000"]
[cplayer] Set property: pause -> 1
[statusline] (Paused) AV: 00:00:10 / 00:00:16 (67%) A-V: 0.000
I don't know if it's useful, but here is the code they are using in Dolphin (KDE file manager): https://invent.kde.org/system/dolphin/-/blob/master/src/views/draganddrophelper.cpp
That's not only KDE specific, but even Ark specific. Unusable.
It's not mpv's responsibility to call a whole bunch of super specific external APIs just to make this work with every external program. Windows provides a standard drag-and-drop universal API, but Ark provides one that only works with Ark.
And again, why would you want to do this?
Ark tells the application to tell Ark (through a different IPC method) to extract the file, which then presumably makes Ark call the same event handler again after it's done but with the extracted file path, or maybe it doesn't actually tell the application at all about when it's done because that'd just be the cherry on top. This is not a well thought out API. Stuff like 7zip on Windows need no application specific support because they just extract the file to a temporary directory and then pass the temporary file to the application, instead of doing a weird back-and-forth dance.
So Dolphin, KDE's file browser, can also open .zip archive files (though curiously not .rar?), and drag-and-dropping from Dolphin onto mpv has a different result: it just triggers a drag and drop for zip://path-to.zip/path-inside-zip
. The mime-type that's being dropped is reported as [vo/gpu/x11] Dropping type: text/uri-list (text/uri-list)
.
mpv could reasonably support this if it's compiled with libarchive, since it doesn't depend on any "asking KDE over dbus to extract a file" nonsense.
EDIT: I guess another question is why Ark doesn't just offer up the mimetype of the single file being dragged and dropped when it really is just one file.
zip://path-to.zip/path-inside-zip
A bit problematic, because it's ambiguous. mpv has a similar schema for archives, but it's unambiguous.
EDIT: I guess another question is why Ark doesn't just offer up the mimetype of the single file being dragged and dropped when it really is just one file.
Yes, I think Ark could use a mime type to negotiate whether extraction should happen. Only when the other application actually requests the "extracted" mime type, extraction would have to happen. How exactly that should happen sounds like something XDG or EWMH itself should define.
Expected behavior of the wanted feature
Ark is the file archiver and compressor developed by KDE. I can't drag & drop SRT files from a ZIP or RAR archive opened in Ark to a running video in mpv. I'm running Fedora KDE 31. Here is the issue in the Ark bugtracker: https://bugs.kde.org/show_bug.cgi?id=425938
Alternative behavior of the wanted feature
Log file