Skip to content

Conversation

svobs
Copy link
Contributor

@svobs svobs commented Jun 1, 2023


Description:

This simple change checks if there is only one path arg given, and if that path arg is a local directory. If true, sends it to mpv to process instead of processing it directly via IINA's code. This allows iina-cli --mpv-shuffle to work properly, at least for the case where there is only one path arg given. This should provide a workable solution for most users. (If one were to try implementing this for multiple path args and allow for fully compatibility with mpv while not breaking IINA's directory loading features, it looks like larger structural changes would be needed).

…stead of expanding its contents in IINA (this allows `iina-cli --mpv-shuffle` to work properly, at least for a single folder arg)
@low-batt
Copy link
Contributor

low-batt commented Jun 1, 2023

Changes look good, but I think there is another defect lurking. The iina-cli does not require use of the --mpv- prefix:

mpv Option:
Raw mpv options without --mpv- prefix. All mpv options are supported here.
Example: --volume=20 --no-resume-playback

But for some reason only --mpv-shuffle is working for me. When I tested --shuffle the playlist was not shuffled. Possibly something is wrong with argument processing in AppDelegate.

@low-batt low-batt linked an issue Jun 1, 2023 that may be closed by this pull request
1 task
@svobs
Copy link
Contributor Author

svobs commented Jun 2, 2023

Well...this is interesting. It seems that CommandLineStatus was putting args which don't start with --mpv- into a separate array called iinaArguments, and then...doing nothing with that array ever after. The end result is that mpv options without the --mpv- prefix are being ignored.

This behavior doesn't make sense. Very odd that this wasn't noticed before. I checked some previous commits, going as far as the v1.3.1 tag, but it seems this behavior is not new. I worked on this code before but somehow missed it.

Maybe it's is a bit scope creepy, but I made another commit which removes the unused array and instead passes the previously unhandled arguments to the mpv core. This will allow --shuffle (and other mpv options) to be used without needing the prefix.

@low-batt
Copy link
Contributor

low-batt commented Jun 2, 2023

Yes, odd that this is so broken. The iina-cli help is very clear that this should work.

Testing with:

low-batt@gag MacOS$ ./iina-cli --shuffle --pip  ~/Movies/

The mpv log shows:

[   0.040][v][cplayer] Set property: shuffle="yes" -> 1
[   0.040][v][cplayer] Set property: pip="yes" -> -3

Shuffle is working now. I'm thinking IINA should be filtering out the known iina-cli options such as pip.

@svobs
Copy link
Contributor Author

svobs commented Jun 2, 2023

OK. I see now I'm getting pulled deeper into this. Rabbit holes everywhere! 🤣

I'm thinking IINA should be filtering out the known iina-cli options such as pip.

Yes, you're right. The IINA args should be processed before the mpv args, and should not be passed to mpv. I see that een with my fix, they are not.

I think I should back out my CommandLineStatus changes and put them into a new issue. It is a completely separate problem than the one this PR was meant to address, and will require more new lines of code than the original problem did.

@low-batt
Copy link
Contributor

low-batt commented Jun 2, 2023

Agree. The problem with mpv options can be a separate issue.

@svobs svobs force-pushed the pr-fix-mpv-shuffle branch from dfeb97f to 28d2c80 Compare June 3, 2023 00:24
Copy link
Contributor

@low-batt low-batt left a comment

Choose a reason for hiding this comment

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

Tested and iina-cli --mpv-shuffle is working now.

@low-batt low-batt requested a review from uiryuu June 3, 2023 16:44
@uiryuu uiryuu merged commit f0df089 into iina:develop Jul 15, 2023
@uiryuu
Copy link
Member

uiryuu commented Jul 15, 2023

Thanks!

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.

iina-cli --mpv-shuffle does not shuffle playlist
3 participants