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

Updated to work with new music apple #13

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ functions:

- `cdf` - `cd` to the current Finder directory
- `flushdns` - Flushes the DNS cache for Yosemite and El Capitan
- `itunes` - Control iTunes: Play, pause, stop, resume, etc.
- `music` - Control Music: Play, pause, stop, resume, etc.
- `manp` - Open a specified man page in Preview
- `pfd` - Return the path of the frontmost Finder window
- `pfs` - Return the current Finder selection
Expand All @@ -41,7 +41,7 @@ $ omf install osx
## Usage

```fish
$ itunes -h # show usage and available options
$ music -h # show usage and available options
$ manp fish # open Fish's manpage in Preview
$ ql *jpg # quick look all such pictures
```
Expand Down
15 changes: 11 additions & 4 deletions functions/itunes.fish → functions/music.fish
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
function itunes -d "Control iTunes. Use -h or --help for a more detailed description."
function music -d "Control Music. Use -h or --help for a more detailed description."
if [ (count $argv) -gt 0 ]
set -l opt $argv[1]
switch $opt
case launch play pause stop rewind resume quit
case launch pause stop rewind resume quit
case "play"
if test (count $argv) -gt 2; and test $argv[2] = playlist
set opt "play the playlist named \"$argv[3]\""
end
case shuffle
if
case mute
set opt "set mute to true"
case unmute
Expand All @@ -12,9 +18,10 @@ function itunes -d "Control iTunes. Use -h or --help for a more detailed descrip
case vol volume
set opt "set sound volume to $argv[2]"
case "" -h --help
echo "Usage: itunes <option>"
echo "Usage: music <option>"
echo "option:"
echo \t"launch, play, pause, stop, rewind, resume, quit"
echo \t"play playlist Takes the name as an argument"
echo \t"mute, unmute Control volume set"
echo \t"next, previous Play next or previous track"
echo \t"vol Set the volume, takes an argument from 0 to 100"
Expand All @@ -24,7 +31,7 @@ function itunes -d "Control iTunes. Use -h or --help for a more detailed descrip
echo "Unknown option $opt. Use -h or --help for a more detailed description."
return 1
end
osascript -e "tell application \"iTunes\" to $opt"
osascript -e "tell application \"Music\" to $opt"
else
echo "No arguments given. Use -h or --help for a more detailed description."
end
Expand Down