Skip to content
Permalink
Browse files

Use mpv property "chapter" to determine the current chapter

Ref: #2404
  • Loading branch information...
alejx committed Apr 5, 2019
1 parent 4830603 commit 091d4e70eaf8bd62dc164e59bdc53e63c390f24a
Showing with 3 additions and 6 deletions.
  1. +1 −0 iina/MPVController.swift
  2. +1 −0 iina/PlaybackInfo.swift
  3. +1 −6 iina/PlaylistViewController.swift
@@ -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)
@@ -169,6 +169,7 @@ class PlaybackInfo {

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

var matchedSubs: [String: [URL]] = [:]
var currentSubsInfo: [FileInfo] = []
@@ -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

0 comments on commit 091d4e7

Please sign in to comment.
You can’t perform that action at this time.