Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@tbertels
Copy link
Member

@tbertels tbertels commented Aug 24, 2024

By default, PgDown and PgUp will play the next/previous video in folder if there's no more chapter and there's only one file in the playlist.

With the renamed "Play next file in folder when there is only one item in the playlist" option enabled, the next file in folder will play without pressing anything when the end of the file is reached and the playlist has only the current file.

Fixes #137

By default, PgDown and PgUp will play the next/previous video in folder
if there's no more chapter and there's only one file in the playlist.

With the renamed "Play next file in folder when there is only one item
in the playlist" option enabled, the next file in folder will play
without pressing anything when the end of the file is reached and the
playlist has only the current file.
@tbertels
Copy link
Member Author

tbertels commented Aug 24, 2024

PlaybackManager::checkAfterPlayback(bool playlistMode) is always called with playlistMode set to true.
It used to be also called with false. Now it seems like we're always in playlist mode, it just contains one file or more.
Could it be removed?

@tbertels
Copy link
Member Author

tbertels commented Aug 24, 2024

I'm thinking about adding key shortcuts to open the next/previous file in folder even if there are more chapters after, I think MPC-HC has this.

Maybe "Play next file in folder when there is only one item in the playlist" could be renamed to something like "Play automatically next file in folder when there is only one item in the playlist" to make it clearer that the next file will play... automatically.

@cmdrkotori
Copy link
Member

PlaybackManager::checkAfterPlayback(bool playlistMode) is always called with playlistMode set to true. It used to be also called with false. Now it seems like we're always in playlist mode, it just contains one file or more. Could it be removed?

Yes it could be removed. There used to be some obscure mode where a file could be played without it landing in the playlist, but it's gone now.

I'm thinking about adding key shortcuts to open the next/previous file in folder even if there are more chapters after, I think MPC-HC has this.

If there's something MPC-HC is doing that we aren't, I consider it a bug unless there's a good reason why we can't/don't.

Maybe "Play next file in folder when there is only one item in the playlist" could be renamed to something like "Play automatically next file in folder when there is only one item in the playlist" to make it clearer that the next file will play... automatically.

I'm not against this. It is also possible to add a separate option (default on) for controlling whether automatic file progression is active or not.

Don't close the file at the end, just pause the player, like MPC-HC.
This allows manually opening the next file when the playing stopped at
the end, seeking back, and being able to see we've reached the end.

Wait for playlength to change before updating recents.
This avoids using the length of the previous file for the current one or
using -1 as the length.
Since the length is set to -1 when opening a file before being set to
its actual size, the recents are updated even if the next file has the
same length (first to -1 then to real length).
@tbertels tbertels force-pushed the play_next_previous_in_folder branch from f9f6e6d to f4cd624 Compare August 26, 2024 09:41
@tbertels
Copy link
Member Author

tbertels commented Aug 26, 2024

I'm thinking about adding key shortcuts to open the next/previous file in folder even if there are more chapters after, I think MPC-HC has this.

If there's something MPC-HC is doing that we aren't, I consider it a bug unless there's a good reason why we can't/don't.

I've just checked it out: it opens the next/previous file in playlist or, if there's only one, the next file in folder with Ctrl+PgDown and Ctrl+PgUp by default.

Maybe "Play next file in folder when there is only one item in the playlist" could be renamed to something like "Play automatically next file in folder when there is only one item in the playlist" to make it clearer that the next file will play... automatically.

I'm not against this. It is also possible to add a separate option (default on) for controlling whether automatic file progression is active or not.

By "automatic file progression", do you mean playing the next file in folder without user interaction?
Because MPC-HC doesn't do that, you have to press PgDown.

So I was thinking about an option to open the next file in folder manually (enabled by default) and an option to open it automatically (disabled by default).
Maybe "Use next file in folder when there is only one item in the playlist" and "Play automatically next file in folder when there is only one item in the playlist". I'm not sure that's clear enough though.

Opens the previous/next file in playlist or, if there's only one in it,
the previous/next file in folder.
@cmdrkotori
Copy link
Member

By "automatic file progression", do you mean playing the next file in folder without user interaction?
Because MPC-HC doesn't do that, you have to press PgDown.

I was speaking in general (both playlist and folder) in relation to the existing code. But you're right MPC-HC doesn't do that, it should be changed to match. Playlists without automatic playlist progression doesn't make sense anyway.

So I was thinking about an option to open the next file in folder manually (enabled by default) and an option to open it automatically (disabled by default).

Maybe "Use next file in folder when there is only one item in the playlist" and "Play automatically next file in folder when there is only one item in the playlist". I'm not sure that's clear enough though.

It's clear enough. You could also go with "Use next file in folder when there is only one item in the playlist" (enabled by default, as you said) and "Wait for navigation when there is only one item in the playlist" (enabled by default). I'll leave this up to you.

@tbertels
Copy link
Member Author

So I was thinking about an option to open the next file in folder manually (enabled by default) and an option to open it automatically (disabled by default).
Maybe "Use next file in folder when there is only one item in the playlist" and "Play automatically next file in folder when there is only one item in the playlist". I'm not sure that's clear enough though.

It's clear enough. You could also go with "Use next file in folder when there is only one item in the playlist" (enabled by default, as you said) and "Wait for navigation when there is only one item in the playlist" (enabled by default). I'll leave this up to you.

MPC-HC actually uses the equivalent of this Playback option we talked about in the issue to enable or not the auto play next file in folder:

image

And it does it this way: first the files of the playlist, then the files in the folder.

MPC-QT does the same with the equivalent setting.
So I wonder if it wouldn't be better to just use that option instead of adding a second one which will do the exact same thing, now that the previous/next command feature will have its own option.

@cmdrkotori
Copy link
Member

So I wonder if it wouldn't be better to just use that option instead of adding a second one which will do the exact same thing, now that the previous/next command feature will have its own option.

Yes it would indeed. In fact I noticed when writing the code for "default after playback" (added much later) that I was stomping on my own foot having a semi-related option in the tweaks page, so I had to write it such a way that certain actions were invoked by multiple options, certain options took priority, and so on.

Play automatically next item of playlist.

Rename folder fallback option to "Use next/previous file in folder when
there is only one item in the playlist" and make it work like so.
@tbertels
Copy link
Member Author

tbertels commented Aug 26, 2024

Now what remains to be done is the ability to play the next file in folder after the playlist is finished (and empty the playlist). Both with autoplay and with manual input.
I don't know if the users really want this though, as it can make them lose the playlist.
Alternatively, the option "Play next in the folder" could be renamed "Play next in the folder if the playlist is empty" (= only one file in it).

MPC-HC does empty the playlist and plays the file - that follows the last one played - found the directory.
But MPC-HC doesn't allow to set the "default after playback" in a persistent manner.
This means that the user probably knows that it will overwrite the playlist (at least after the first try).

If that's a real use case, I think it would be better to add a command to empty the playlist, which would allow continuing playing the files in the folder.

@cmdrkotori
Copy link
Member

I don't know if the users really want this though, as it can make them lose the playlist.

This is a concern, yes. I know of at least one mpv dev who uses mpc-qt to play their 10000-file-strong music collection that I presume is spread over multiple folders, so this is probably not desirable. Adding so many files back would be a pain for them.

If that's a real use case, I think it would be better to add a command to empty the playlist, which would allow continuing playing the files in the folder.

To support the existing use-case, there would have to be an option to turn it off I think.

@tbertels
Copy link
Member Author

tbertels commented Aug 27, 2024

An option to turn off the command?
Given the fact that the user can just open a different file to empty the playlist, maybe it's just better to let it like it is right now and just rename the option "Play next in the folder" to let the user know that it works just like the next file and next chapter (once at the end) commands (playlist if not empty, otherwise folder).

@cmdrkotori
Copy link
Member

Yeah I'm fine with that.

Rename "Play next in the folder" to "Play next file"
Rename "After Playback: Play next file in the folder" to "After
Playback: Play next file" (HTTP)
@tbertels
Copy link
Member Author

There's still one thing missing: the ability to play again the same file by pressing Play when at the end.

Restore MpvObject::eofReached() and use it to check if we're at the end.
If so, seek back to the start before unpausing.
Copy link
Member

@cmdrkotori cmdrkotori left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'll do some testing and merge it in the morning if that's okay with you.

@cmdrkotori cmdrkotori merged commit fe38be2 into mpc-qt:master Aug 29, 2024
@tbertels tbertels deleted the play_next_previous_in_folder branch August 29, 2024 08:01
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

Successfully merging this pull request may close these issues.

Next Video In Folder

2 participants