Skip to content
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

Command Line Interface #1181

Merged
merged 5 commits into from
Dec 7, 2017
Merged

Command Line Interface #1181

merged 5 commits into from
Dec 7, 2017

Conversation

lhc70000
Copy link
Member

Description:

Basic CLI support.

  • Supports all mpv options (except --no-* ones) with --mpv- prrefix.
  • Supports playing from stdin if invoked with --stdin.
  • Supports passing other Cocoa arguments together, like -Name VALUE.

@saagarjha
Copy link
Member

FWIW I would recommend splitting the command line interface off into a separate target, instead of having it reside in the main binary.

@lhc70000
Copy link
Member Author

@saagarjha

  • Separate binary may require additional installation
  • Still need to pass the options to main binary via some way, and need to handle piping/stdin too

@saagarjha
Copy link
Member

The binary would be bundled as part of IINA, and would handle parsing arguments and handling input/output. Then it would call the main binary and set it up for playback.

@lhc70000
Copy link
Member Author

In which way it calls the main binary? Is it possible to call methods in the main binary directly?

@saagarjha
Copy link
Member

Is it possible to call methods in the main binary directly?

Fair point; this is not easy to do and so probably not worth doing. A few things we should still look into: making IINA behave like a standard command line tool, and offering to symlink it to a directory in the user's PATH such as /usr/local/bin/.

@MuntashirAkon
Copy link
Contributor

MuntashirAkon commented Nov 6, 2017

Splitting CLI is not a good idea. Many applications (although not written in Swift) support CLI and GUI at the same time, including VLC, wine, etc. Also, since this feature is intended for advanced user, whether they want to put iina binary to their ~/.bash_profile should be up to them, or there may be provided an option in the preferences to add iina to their path or as @saagarjha said, make a symlink to a path that is already included by default.

@@ -100,8 +146,20 @@ class AppDelegate: NSObject, NSApplicationDelegate {
parsePendingURL(url)
}

// check whether showing the welcome window after 0.1s
Timer.scheduledTimer(timeInterval: TimeInterval(0.1), target: self, selector: #selector(self.checkForShowingInitialWindow), userInfo: nil, repeats: false)
let _ = PlayerCore.first
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest wrapping this line into a class function of PlayerCore. Kind of wired.

@Et0h
Copy link

Et0h commented Nov 12, 2017

I'm really pleased to see work being done on CLI support for IINA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants