hoyon / mpv-mpris

MPRIS plugin for mpv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cue sheet support

opened this issue · comments

I found that mpv treats cue sheet entries as chapters. If a cue sheet contains 4 entries (i.e. 4 songs / pieces of music), it means that there will be 4 chapters.

If I change this ... (Lines 378 - 386)

    } else if (g_strcmp0(method_name, "Next") == 0) {
        const char *cmd[] = {"playlist_next", NULL};
        mpv_command_async(ud->mpv, 0, cmd);
        g_dbus_method_invocation_return_value(invocation, NULL);

    } else if (g_strcmp0(method_name, "Previous") == 0) {
        const char *cmd[] = {"playlist_prev", NULL};
        mpv_command_async(ud->mpv, 0, cmd);
        g_dbus_method_invocation_return_value(invocation, NULL);

... into this,

    } else if (g_strcmp0(method_name, "Next") == 0) {
        const char *cmd[] = {"add", "chapter", "1", NULL};
        mpv_command_async(ud->mpv, 0, cmd);
        g_dbus_method_invocation_return_value(invocation, NULL);

    } else if (g_strcmp0(method_name, "Previous") == 0) {
        const char *cmd[] = {"add", "chapter", "-1", NULL};
        mpv_command_async(ud->mpv, 0, cmd);
        g_dbus_method_invocation_return_value(invocation, NULL);

Then "Media Next" and "Media Previous" keyboard keys, which are originally used to jump to the next / previous file in playlist, will be used to jump to the next / previous entry in cue sheet.

For VLC (which does not require additional mpris plugin), when a .cue file is played, the keys jump to the next / previous entry in cue sheet. (However, this behavior of VLC does not apply to video files with chapter markers.)

Will it be possible / suitable for the mpv-mpris plugin to detect whether a cue sheet file is being played, and switches the mode to work on cue sheet entries instead of playlist file entries?

I don't think it would be a good idea to implement different behaviour depending on whether the current file has chapters or not.

In VLC, cue file entries are treated as separate entries in the playlist, alongside normal files. The skip function in mpris is consistent with the interface skip buttons.

However in mpv cue files are a single entry in the playlist and cannot be skipped through without using separate chapter skip keys. Therefore I feel it would be inappropriate to deviate from mpv's way of handling cue files.

Besides, as far as I can tell, there is no way to tell that the currently played file is a cue sheet, besides looking at the file name. This isn't ideal since cue sheets can be embedded in files, and would cause inconsistent behaviour.