-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Repeat single file #4242
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
Repeat single file #4242
Conversation
according to `CONTRIBUTING.md`
I think this feature is very useful, so I cherry-picked it here. |
From a very quick look I spotted one issue that will need to be addressed. I noticed this because I've had to fix this in some of my PRs. From CONTRIBUTING - Localizations:
Changes to localization files in directories other than That means the changes to the file |
Thanks. I have noticed that and reverted the change of |
My bad! Missed that the commit was undoing the changes. I forgot to use GitHub's |
This comment was marked as off-topic.
This comment was marked as off-topic.
It's not duplicate. The loop file part was removed in my old PR. |
I see. Reopened ; ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In testing I found the file loop button was not displayed in the enabled (blue) state in the playlist when IINA was started with file loop enabled. I traced this to the method PlaylistViewController.viewDidAppear
which is only initializing one of the buttons. See the proposed code fix to that class.
The code level design of the changes deviates from the existing method for handling IINA preferences that are tied to mpv options. This is normally done in MPVController.mpvInit
by calling setUserOption
. That method configures mpv initially and establishes a listener for the IINA preference changing that will sync mpv if the IINA preference is changed. We'd want to add something like this at line 218 in MPVController
right after the call to setUserOption
for playlistAutoPlayNext
, BUT DO NOT MAKE THIS CHANGE NOW:
let trueIsInfiniteHandler: OptionObserverInfo.Transformer = { key in
return Preference.bool(for: key) ? "inf" : nil
}
setUserOption(PK.enablePlaylistLoop, type: .other, forName: MPVOption.PlaybackControl.loopPlaylist,
transformer: trueIsInfiniteHandler)
setUserOption(PK.enableFileLoop, type: .other, forName: MPVOption.PlaybackControl.loopFile,
transformer: trueIsInfiniteHandler)
Using this system will allow some of the other code the PR is adding to be simplified. BUT WE DO NOT WANT TO ADDRESS THIS NOW.
I checked with @uiryuu and we want to get this change into the current release. So for now we only need to fix PlaylistViewController.viewDidAppear
. We can refactor and simplify the code after this next release is cut.
@@ -149,7 +151,7 @@ class PlaylistViewController: NSViewController, NSTableViewDataSource, NSTableVi | |||
reloadData(playlist: true, chapters: true) | |||
|
|||
let loopStatus = player.mpv.getString(MPVOption.PlaybackControl.loopPlaylist) | |||
loopBtn.state = (loopStatus == "inf" || loopStatus == "force") ? .on : .off | |||
loopPlaylistBtn.state = (loopStatus == "inf" || loopStatus == "force") ? .on : .off | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | |
let loopFileStatus = player.mpv.getString(MPVOption.PlaybackControl.loopFile) | |
loopFileBtn.state = loopFileStatus == "inf" ? .on : .off | |
} |
* PlaylistView: Store preference for playlist loop status and add a `loop file` button * Update lproj according to `CONTRIBUTING.md` --------- Co-authored-by: 李通洲 <carter.li@eoitek.com>
* Repeat single file (#4242) * PlaylistView: Store preference for playlist loop status and add a `loop file` button * Update lproj according to `CONTRIBUTING.md` --------- Co-authored-by: 李通洲 <carter.li@eoitek.com> * Use image from SF; merge two buttons into 1 * Use LoopMode; implement remote methods * Fixed a bug where the icon is not correctly shown Change the cycle to: no loop -> file loop -> playlist loop * Fix issues about OSD message * Fix some autolayout issues This commit: - Changed the resizing mode of (Scroll View - Clip View - Table View) of both Playlist and Chapters tabs in PlaylistViewController from Autoresizing Mask to Inferred - Added constrains to the table view in both Playlist and Chapters tabs, which makes all of the resizing mode of the aforementioned views from Inferred (Autoresizing Mask) to Inferred (Constrains) - Added "Horizontally in the container = 0" and "Vertically in the container = 0" for both of the table views, otherwise Xcode sometimes complains about missing X or Y contrains for the table view. This commit fixes the xib editor always has the "Misplaced Views" warning and it's actually not fixable. When you try to fix it, the view will shrink a bit and the warning still exist. Even you just ignore it, every time the constrains on the canvas is re-calucated, the view will shrink as well. * Use the proposed fix to reflect the loop status ... when the property is a number --------- Co-authored-by: Mike Wang <mikewang000000@gmail.com> Co-authored-by: 李通洲 <carter.li@eoitek.com>
Description:
New feature: Repeat single file
Cherry-picks CarterLi@490b335
Authored by @CarterLi