Skip to content

Commit

Permalink
Version 1.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
uiryuu committed Mar 30, 2019
2 parents 36d17a4 + 36311f9 commit cd54b82
Show file tree
Hide file tree
Showing 33 changed files with 330 additions and 169 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ osx_image: xcode10.1

before_install:
- gem install cocoapods
- pod update

# Build the main app, which happens to depend on the other two targets.
script: xcodebuild -workspace iina.xcworkspace -scheme iina
Expand Down
2 changes: 1 addition & 1 deletion OpenInIINA/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<key>Image</key>
<string>ToolbarItemIcon.pdf</string>
<key>Label</key>
<string>Open in IINA Button</string>
<string>Open in IINA</string>
</dict>
<key>SFSafariWebsiteAccess</key>
<dict>
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ $ brew install cocoapods
1. Install mpv:

```console
$ brew install mpv --with-uchardet
$ brew install mpv
```
Feel free to include your own copies of the other libraries if you'd like.

2. Copy latest [header files](https://github.com/mpv-player/mpv/tree/master/libmpv) into `libmpv/include/mpv/`.

Expand Down
40 changes: 30 additions & 10 deletions iina-cli/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,6 @@ guard FileManager.default.fileExists(atPath: iinaPath) else {
let task = Process()
task.launchPath = iinaPath

guard let stdin = InputStream(fileAtPath: "/dev/stdin") else {
print("Cannot open stdin.")
exit(1)
}
stdin.open()

let isStdin = stdin.hasBytesAvailable
var keepRunning = false

// Check arguments
Expand All @@ -53,10 +46,11 @@ if userArgs.contains(where: { $0 == "--help" || $0 == "-h" }) {
Example: --mpv-volume=20 --mpv-resume-playback=no
--separate-windows | -w:
Open all files in separate windows.
--stdin:
--stdin, --no-stdin:
You may also pipe to stdin directly. Sometimes iina-cli can detect whether
stdin has file, but sometimes not. Therefore it's recommended to always
supply this argument when piping to iina.
supply --stdin when piping to iina, and --no-stdin when you are not intend
to use stdin.
--keep-running:
Normally iina-cli launches IINA and quits immediately. Supply this option
if you would like to keep it running until the main application exits.
Expand All @@ -72,6 +66,30 @@ if userArgs.contains(where: { $0 == "--help" || $0 == "-h" }) {
exit(0)
}

var isStdin = false
var userSpecifiedStdin = false

for arg in userArgs {
if arg == "--stdin" {
isStdin = true
userSpecifiedStdin = true
} else if arg == "--no-stdin" {
isStdin = false
userSpecifiedStdin = true
} else if arg == "--" {
break
}
}

if (!userSpecifiedStdin) {
guard let stdin = InputStream(fileAtPath: "/dev/stdin") else {
print("Cannot open stdin.")
exit(1)
}
stdin.open()
isStdin = stdin.hasBytesAvailable
}

if let dashIndex = userArgs.index(of: "--") {
userArgs.remove(at: dashIndex)
for i in dashIndex..<userArgs.count {
Expand Down Expand Up @@ -107,7 +125,9 @@ userArgs = userArgs.map { arg in
if isStdin {
task.standardInput = FileHandle.standardInput
task.standardOutput = FileHandle.standardOutput
userArgs.insert("--stdin", at: 0)
if !userSpecifiedStdin {
userArgs.insert("--stdin", at: 0)
}
} else {
task.standardOutput = nil
task.standardError = nil
Expand Down
4 changes: 4 additions & 0 deletions iina.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@
E3B3DD5720FDB8A600325184 /* PreferenceWindowController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E3B3DD5920FDB8A600325184 /* PreferenceWindowController.xib */; };
E3BA79EE2131443A00529D99 /* OpenURLWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3BA79EC2131443A00529D99 /* OpenURLWindowController.swift */; };
E3C12F6B201F281F00297964 /* FirstRunManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3C12F6A201F281F00297964 /* FirstRunManager.swift */; };
E3CB258F222799B800A62C47 /* MPVHook.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3CB258E222799B800A62C47 /* MPVHook.swift */; };
E3CB75BB1FD998F5004DB10A /* Regex.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84A886F21E26CA24008755BB /* Regex.swift */; };
E3CB75BD1FDACB82004DB10A /* SavedFilter.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3CB75BC1FDACB82004DB10A /* SavedFilter.swift */; };
E3DBD239218B057A00B3AFBF /* Translators.json in Resources */ = {isa = PBXBuildFile; fileRef = E3DBD238218B057A00B3AFBF /* Translators.json */; };
Expand Down Expand Up @@ -1168,6 +1169,7 @@
E3B3DD5B20FDB8A900325184 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/PreferenceWindowController.strings"; sourceTree = "<group>"; };
E3BA79EC2131443A00529D99 /* OpenURLWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenURLWindowController.swift; sourceTree = "<group>"; };
E3C12F6A201F281F00297964 /* FirstRunManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FirstRunManager.swift; sourceTree = "<group>"; };
E3CB258E222799B800A62C47 /* MPVHook.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MPVHook.swift; sourceTree = "<group>"; };
E3CB75BC1FDACB82004DB10A /* SavedFilter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SavedFilter.swift; sourceTree = "<group>"; };
E3DBD238218B057A00B3AFBF /* Translators.json */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = text.json; path = Translators.json; sourceTree = "<group>"; tabWidth = 4; };
E3DBD23A218B199700B3AFBF /* Translators.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Translators.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1598,6 +1600,7 @@
847644071D48B413004F6DF5 /* MPVOption.swift */,
844DE1BE1D3E2B9900272589 /* MPVEvent.swift */,
84F7258E1D486185000DEF1B /* MPVProperty.swift */,
E3CB258E222799B800A62C47 /* MPVHook.swift */,
84EB1F041D2F5C5B004FA5A1 /* AppData.swift */,
84A0BA8F1D2F8D4100BC8DA1 /* IINAError.swift */,
84AABE8A1DBF634600D138FD /* CharEncoding.swift */,
Expand Down Expand Up @@ -2319,6 +2322,7 @@
84FBCB381EEACDDD0076C77C /* FFmpegController.m in Sources */,
84879A981E0FFC7E0004F894 /* PrefUIViewController.swift in Sources */,
84C6D3641EB276E9009BF721 /* PlaybackHistory.swift in Sources */,
E3CB258F222799B800A62C47 /* MPVHook.swift in Sources */,
843FFD4D1D5DAA01001F3A44 /* RoundedTextFieldCell.swift in Sources */,
8407D1401E3A684C0043895D /* ViewLayer.swift in Sources */,
84A0BA9B1D2FAB4100BC8DA1 /* Parameter.swift in Sources */,
Expand Down
1 change: 1 addition & 0 deletions iina/AppData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,5 @@ extension Notification.Name {
static let iinaFileLoaded = Notification.Name("IINAFileLoaded")
static let iinaHistoryUpdated = Notification.Name("IINAHistoryUpdated")
static let iinaLegacyFullScreen = Notification.Name("IINALegacyFullScreen")
static let iinaKeyBindingChanged = Notification.Name("iinaKeyBindingChanged")
}
4 changes: 2 additions & 2 deletions iina/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
@IBOutlet weak var dockMenu: NSMenu!

private func getReady() {
registerUserDefaultValues()
menuController.bindMenuItems()
PlayerCore.loadKeyBindings()
isReady = true
Expand All @@ -87,6 +86,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// MARK: - App Delegate

func applicationWillFinishLaunching(_ notification: Notification) {
registerUserDefaultValues()
Logger.log("App will launch")

// register for url event
Expand Down Expand Up @@ -510,7 +510,7 @@ struct CommandLineStatus {
mpvArguments.removeAll()
iinaArguments.removeAll()
for arg in args {
let splitted = arg.dropFirst(2).split(separator: "=", maxSplits: 2)
let splitted = arg.dropFirst(2).split(separator: "=", maxSplits: 1)
let name = String(splitted[0])
if (name.hasPrefix("mpv-")) {
// mpv args
Expand Down
1 change: 1 addition & 0 deletions iina/Base.lproj/FilterWindowController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ Gw
</window>
<viewController id="bda-X5-kCJ" customClass="NewFilterSheetViewController" customModule="IINA" customModuleProvider="target">
<connections>
<outlet property="addButton" destination="THV-Yh-VnK" id="GeO-qk-FbF"/>
<outlet property="filterWindow" destination="-2" id="Pjr-CT-nJA"/>
<outlet property="scrollContentView" destination="ZHP-RK-Ly4" id="NhJ-gL-sPY"/>
<outlet property="tableView" destination="n0t-vk-dME" id="IBk-xT-LkA"/>
Expand Down
13 changes: 7 additions & 6 deletions iina/Base.lproj/MiniPlayerWindowController.xib
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14313.13.2" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.13.2"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand Down Expand Up @@ -44,7 +45,7 @@
<windowCollectionBehavior key="collectionBehavior" fullScreenNone="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="300" height="72"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1057"/>
<value key="minSize" type="size" width="300" height="72"/>
<view key="contentView" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="300" height="72"/>
Expand Down Expand Up @@ -109,15 +110,15 @@
<rect key="frame" x="0.0" y="24" width="300" height="48"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="h25-bp-EvL" customClass="ScrollingTextField" customModule="IINA" customModuleProvider="target">
<rect key="frame" x="133" y="24" width="35" height="18"/>
<rect key="frame" x="133" y="25" width="35" height="17"/>
<textFieldCell key="cell" lineBreakMode="truncatingMiddle" sendsActionOnEndEditing="YES" alignment="center" title="Title" id="Rs9-6l-6vp">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kcj-EY-i9R" customClass="ScrollingTextField" customModule="IINA" customModuleProvider="target">
<rect key="frame" x="109" y="5" width="82" height="15"/>
<rect key="frame" x="109" y="7" width="82" height="14"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Artist - Album" id="Nle-gv-CWY">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
Expand Down Expand Up @@ -416,7 +417,7 @@
</connections>
</slider>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="MP6-sS-T7f">
<rect key="frame" x="143" y="7" width="34" height="15"/>
<rect key="frame" x="143" y="8" width="34" height="14"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="UDC-wZ-xua"/>
</constraints>
Expand Down
Loading

0 comments on commit cd54b82

Please sign in to comment.