Skip to content

Commit

Permalink
Use mpv property "chapter" to determine the current chapter
Browse files Browse the repository at this point in the history
Ref: #2404
  • Loading branch information
uiryuu committed Apr 5, 2019
1 parent 4830603 commit 091d4e7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions iina/MPVController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -771,6 +771,7 @@ class MPVController: NSObject {
player.syncUI(.playButton)

case MPVProperty.chapter:
player.info.chapter = Int(getInt(MPVProperty.chapter))
player.syncUI(.time)
player.syncUI(.chapterList)
player.postNotification(.iinaMediaTitleChanged)
Expand Down
1 change: 1 addition & 0 deletions iina/PlaybackInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class PlaybackInfo {

var playlist: [MPVPlaylistItem] = []
var chapters: [MPVChapter] = []
var chapter = 0

var matchedSubs: [String: [URL]] = [:]
var currentSubsInfo: [FileInfo] = []
Expand Down
7 changes: 1 addition & 6 deletions iina/PlaylistViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -525,12 +525,7 @@ class PlaylistViewController: NSViewController, NSTableViewDataSource, NSTableVi

if identifier == .isChosen {
// left column
let currentPos = info.videoPosition!
if currentPos.between(chapter.time, nextChapterTime) {
v.textField?.stringValue = Constants.String.play
} else {
v.textField?.stringValue = ""
}
v.textField?.stringValue = (info.chapter == row) ? Constants.String.play : ""
return v
} else if identifier == .trackName {
// right column
Expand Down

0 comments on commit 091d4e7

Please sign in to comment.