Remove chapter search.

This commit is contained in:
Damiano Galassi committed 2021-04-29 16:49:31 +02:00
1 parent d17f1776cb
commit 4b2de03045
4 files changed
+18 -57

No files matched your search

+2 -8
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18121" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18121"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@@ -162,12 +162,6 @@
<action selector="searchMetadata:" target="-1" id="593"/>
</connections>
</menuItem>
<menuItem title="Search chapters online…" id="blb-EP-gbJ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="searchChapters:" target="-1" id="TBD-2j-3Yu"/>
</connections>
</menuItem>
<menuItem title="Metadata…" id="564">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17505"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -10,7 +10,6 @@
<connections>
<outlet property="addTracks" destination="FY3-O2-t3T" id="fcf-d9-3eB"/>
<outlet property="deleteTrack" destination="rhw-S4-nZ8" id="VaB-n8-rPm"/>
<outlet property="searchChapters" destination="sa2-7a-h2I" id="qix-LL-OuP"/>
<outlet property="searchMetadata" destination="uiq-J2-uPs" id="lv3-UJ-53r"/>
<outlet property="sendToQueue" destination="app-IS-8EB" id="jdh-iz-uSq"/>
<outlet property="window" destination="s5f-yH-26m" id="YRM-He-gQ6"/>
@@ -35,7 +34,7 @@
<toolbarItem implicitItemIdentifier="NSToolbarSeparatorItem" id="mX6-y6-VZe"/>
<toolbarItem implicitItemIdentifier="D2E8E21C-DCD4-456F-B15A-9AC0AA5556DF" label="Import" paletteLabel="Import" toolTip="Import tracks from external files" image="NSAddTemplate" sizingBehavior="auto" id="FY3-O2-t3T" customClass="ButtonToolbarItem" customModule="Subler" customModuleProvider="target">
<button key="view" verticalHuggingPriority="750" id="UZy-eh-ZBz">
<rect key="frame" x="3" y="14" width="36" height="28"/>
<rect key="frame" x="8" y="14" width="26" height="23"/>
<autoresizingMask key="autoresizingMask"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSAddTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="r0z-KC-Ehd">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -48,7 +47,7 @@
</toolbarItem>
<toolbarItem implicitItemIdentifier="5B6FDF6D-9486-49B2-8EA4-184D76D0864C" label="Delete Track" paletteLabel="Delete Track" toolTip="Delete the selected track" image="ToolbarRemoveTemplate" sizingBehavior="auto" id="rhw-S4-nZ8" customClass="ButtonToolbarItem" customModule="Subler" customModuleProvider="target">
<button key="view" verticalHuggingPriority="750" id="e81-Qg-Ncc">
<rect key="frame" x="19" y="14" width="36" height="28"/>
<rect key="frame" x="23" y="14" width="28" height="23"/>
<autoresizingMask key="autoresizingMask"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="ToolbarRemoveTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="HWd-4N-V3A">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -61,7 +60,7 @@
</toolbarItem>
<toolbarItem implicitItemIdentifier="66402BE4-4A7B-4048-A584-2BC0F5E69600" label="Search Metadata" paletteLabel="Search Metadata" toolTip="Search metadata on the web" image="NSRevealFreestandingTemplate" sizingBehavior="auto" id="uiq-J2-uPs" customClass="ButtonToolbarItem" customModule="Subler" customModuleProvider="target">
<button key="view" verticalHuggingPriority="750" id="Nes-H1-fbL">
<rect key="frame" x="30" y="14" width="36" height="24"/>
<rect key="frame" x="35" y="14" width="27" height="23"/>
<autoresizingMask key="autoresizingMask"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSRevealFreestandingTemplate" imagePosition="overlaps" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="hLF-cH-6MQ">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -72,22 +71,9 @@
<action selector="searchMetadata:" target="-2" id="3Jl-xK-nb3"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="C90398D0-2F66-43E9-8B04-6CCD8DDA90D2" label="Search Chapters" paletteLabel="Search Chapters" toolTip="Search chapters on the web" image="ToolbarChaptersTemplate" sizingBehavior="auto" id="sa2-7a-h2I" customClass="ButtonToolbarItem" customModule="Subler" customModuleProvider="target">
<button key="view" verticalHuggingPriority="750" id="gh7-Et-PwJ">
<rect key="frame" x="30" y="14" width="36" height="28"/>
<autoresizingMask key="autoresizingMask"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="ToolbarChaptersTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="E5l-0l-Tsr">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<connections>
<action selector="searchChapters:" target="-2" id="0wP-Eq-9mv"/>
</connections>
</toolbarItem>
<toolbarItem implicitItemIdentifier="9F789D5F-C25E-449F-ABCE-DDF99B4FF988" label="Send to Queue" paletteLabel="Send to Queue" toolTip="Send the current document to the queue" image="ToolbarActionTemplate" sizingBehavior="auto" id="app-IS-8EB" customClass="ButtonToolbarItem" customModule="Subler" customModuleProvider="target">
<button key="view" verticalHuggingPriority="750" id="c38-NC-1I2">
<rect key="frame" x="25" y="14" width="36" height="28"/>
<rect key="frame" x="28" y="14" width="30" height="23"/>
<autoresizingMask key="autoresizingMask"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="ToolbarActionTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="ZbH-ut-l4n">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -101,7 +87,7 @@
<toolbarItem implicitItemIdentifier="2E3AB086-491A-436E-A610-14E36AEE8F49" label="Action" paletteLabel="Action" image="NSActionTemplate" sizingBehavior="auto" id="V6w-Ey-bjV">
<nil key="toolTip"/>
<popUpButton key="view" verticalHuggingPriority="750" id="QuP-nB-KsX">
<rect key="frame" x="2" y="14" width="38" height="28"/>
<rect key="frame" x="0.0" y="14" width="50" height="25"/>
<autoresizingMask key="autoresizingMask"/>
<popUpButtonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" pullsDown="YES" selectedItem="LML-iW-skB" id="LNp-Kr-404">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@@ -217,7 +203,6 @@
<image name="NSAddTemplate" width="14" height="13"/>
<image name="NSRevealFreestandingTemplate" width="15" height="15"/>
<image name="ToolbarActionTemplate" width="24" height="24"/>
<image name="ToolbarChaptersTemplate" width="14" height="13"/>
<image name="ToolbarRemoveTemplate" width="16" height="16"/>
</resources>
</document>
+5 -23
View File
@@ -8,7 +8,7 @@
import Cocoa
import MP42Foundation
final class DocumentWindowController: NSWindowController, TracksViewControllerDelegate, ChapterSearchControllerDelegate, MetadataSearchViewControllerDelegate, FileImportControllerDelegate, ProgressViewControllerDelegate, NSDraggingDestination, NSMenuItemValidation, NSToolbarItemValidation {
final class DocumentWindowController: NSWindowController, TracksViewControllerDelegate, MetadataSearchViewControllerDelegate, FileImportControllerDelegate, ProgressViewControllerDelegate, NSDraggingDestination, NSMenuItemValidation, NSToolbarItemValidation {
private var doc: Document {
return document as! Document
@@ -206,7 +206,6 @@ final class DocumentWindowController: NSWindowController, TracksViewControllerDe
case #selector(selectFile(_:)),
#selector(selectMetadataFile(_:)),
#selector(searchMetadata(_:)),
#selector(searchChapters(_:)),
#selector(addChaptersEvery(_:)),
#selector(iTunesFriendlyTrackGroups(_:)),
#selector(clearTrackNames(_:)),
@@ -371,16 +370,6 @@ final class DocumentWindowController: NSWindowController, TracksViewControllerDe
self.contentViewController?.presentAsSheet(controller)
}
@IBAction func searchChapters(_ sender: Any?) {
let name = mp4.metadata.metadataItemsFiltered(byIdentifier: MP42MetadataKeyName).first?.stringValue
let url = mp4.firstSourceURL ?? doc.fileURL
let title = (name?.isEmpty == false ? name : url?.lastPathComponent) ?? ""
let duration = UInt64(mp4.duration)
let controller = ChapterSearchController(delegate: self, title: title, duration: duration)
contentViewController?.presentAsSheet(controller)
}
func didSelect(metadata: MetadataResult) {
let map = metadata.mediaKind == .movie ? MetadataPrefs.movieResultMap : MetadataPrefs.tvShowResultMap
let keepEmptyKeys = MetadataPrefs.keepEmptyAnnotations
@@ -399,17 +388,6 @@ final class DocumentWindowController: NSWindowController, TracksViewControllerDe
metadataViewController?.metadata = mp4.metadata
}
func didSelect(chapters: [MP42TextSample]) {
let chapterTrack = MP42ChapterTrack()
for chapter in chapters {
chapterTrack.addChapter(chapter)
}
mp4.addTrack(chapterTrack)
doc.updateChangeCount(.changeDone)
tracksViewController.reloadData()
}
// MARK: File import
private func addChapters(fileURL: URL) {
@@ -422,6 +400,10 @@ final class DocumentWindowController: NSWindowController, TracksViewControllerDe
private func updateChapters(fileURL: URL) {
do {
try mp4.chapters?.update(fromCSVFile: fileURL)
doc.updateChangeCount(.changeDone)
if let track = mp4.chapters {
chapterViewController?.track = track
}
}
catch {
if let windowForSheet = doc.windowForSheet {
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17506" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17506"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -413,7 +413,7 @@
<font key="font" metaFont="controlContent" size="11"/>
<menu key="menu" title="OtherViews" id="T3N-JJ-mWq">
<items>
<menuItem image="NSSmartBadgeTemplate" hidden="YES" id="B0i-yb-Nf4">
<menuItem image="NSActionTemplate" hidden="YES" id="B0i-yb-Nf4">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem title="Rename every chapter" id="SOg-Lz-v5L">
@@ -436,8 +436,8 @@
</customView>
</objects>
<resources>
<image name="NSActionTemplate" width="15" height="15"/>
<image name="NSAddTemplate" width="14" height="13"/>
<image name="NSRemoveTemplate" width="14" height="4"/>
<image name="NSSmartBadgeTemplate" width="14" height="14"/>
</resources>
</document>