musica 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/README.md +27 -34
- data/lib/musica/cli.rb +44 -8
- data/lib/musica/interpreter.rb +1 -1
- data/lib/musica/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 68997c53cdcb8c578599e7ede93568d15db73adf953c7c6d674e382aed778ee5
|
|
4
|
+
data.tar.gz: f5591c92f6bae98c446a2a8bce0be35f6c18749475fe9f553a8fdd79d36c779a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7945760f5d031faf50a9dd0b0161a2b26e5c127214a78c0b15cefeb58d165980640bd7c52d91a02f98d7f71906748d65143e39fb094a2678d4c5c582bbd0b736
|
|
7
|
+
data.tar.gz: 4ba20cab7bb5ac547b172936eabf69b6d154b6a450faaa3da4f0f57fe7f6eed95f9e11d9bf849dea6eb95b8bd62913dd5b25e8533f0bb44355b0d7360b6c149c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [0.3.0] - 2026-10-19
|
|
2
|
+
|
|
3
|
+
- Turn plain requests into commands by default, without `-n`
|
|
4
|
+
- Send AppleScript commands as is with `-s`/`--script`, which was the default before
|
|
5
|
+
- Add `-h`/`--help` and `-v`/`--version`
|
|
6
|
+
|
|
1
7
|
## [0.2.0] - 2026-10-19
|
|
2
8
|
|
|
3
9
|
- Add natural language commands with `-n`, using Apple's on-device model through `fm`
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -15,24 +15,25 @@ If bundler is not being used to manage dependencies, install the gem by executin
|
|
|
15
15
|
|
|
16
16
|
## Usage
|
|
17
17
|
|
|
18
|
-
Musica
|
|
19
|
-
command, so `musica <command>` runs:
|
|
18
|
+
Tell Musica what you want in plain words:
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
$ musica skip this song
|
|
21
|
+
$ musica turn it down a bit
|
|
22
|
+
$ musica play Digital Love by Daft Punk
|
|
23
|
+
$ musica play something by Queen
|
|
24
|
+
$ musica play the album Adore
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
Musica uses Apple's on-device model, through the `fm` command, to turn the
|
|
27
|
+
request into a command for your music player. This needs macOS 26 with Apple
|
|
28
|
+
Intelligence.
|
|
27
29
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
$ musica set sound volume to 50
|
|
30
|
+
It understands play, pause, next and previous track, volume changes, and
|
|
31
|
+
playing a track or album from your library by name, artist or album. To play
|
|
32
|
+
an album in order, Musica fills a playlist named "Musica" with its tracks and
|
|
33
|
+
plays that playlist, replacing what was in it before. Playing from your library
|
|
34
|
+
only works with Music.
|
|
34
35
|
|
|
35
|
-
After each
|
|
36
|
+
After each request, Musica prints the current status: the artist and track
|
|
36
37
|
while playing, otherwise the player state:
|
|
37
38
|
|
|
38
39
|
$ musica play
|
|
@@ -40,31 +41,23 @@ while playing, otherwise the player state:
|
|
|
40
41
|
$ musica pause
|
|
41
42
|
🎧 paused
|
|
42
43
|
|
|
43
|
-
Run `musica` without arguments to print the status alone
|
|
44
|
-
|
|
45
|
-
Commands can differ between players. For example, Music uses
|
|
46
|
-
`set shuffle enabled to true` and Spotify uses `set shuffling to true`. Wrap
|
|
47
|
-
commands that contain quotes in single quotes so the shell keeps them:
|
|
44
|
+
Run `musica` without arguments to print the status alone, `musica --help` for
|
|
45
|
+
a summary of the options, and `musica --version` for the version.
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
### AppleScript
|
|
50
48
|
|
|
51
|
-
|
|
49
|
+
With `-s` (or `--script`), Musica sends its arguments to the player as an
|
|
50
|
+
AppleScript command, without `fm`. Any command in the player's AppleScript
|
|
51
|
+
dictionary works (open it in Script Editor with File > Open Dictionary):
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
Intelligence.
|
|
53
|
+
$ musica -s playpause
|
|
54
|
+
$ musica -s set sound volume to 50
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
$ musica -n play something by Queen
|
|
61
|
-
$ musica -n play the album Adore
|
|
56
|
+
Commands can differ between players. For example, Music uses
|
|
57
|
+
`set shuffle enabled to true` and Spotify uses `set shuffling to true`. Wrap
|
|
58
|
+
commands that contain quotes in single quotes so the shell keeps them:
|
|
62
59
|
|
|
63
|
-
|
|
64
|
-
playing a track or album from your library by name, artist or album. To play
|
|
65
|
-
an album in order, Musica fills a playlist named "Musica" with its tracks and
|
|
66
|
-
plays that playlist, replacing what was in it before. Playing from your library
|
|
67
|
-
only works with Music.
|
|
60
|
+
$ musica -s 'play playlist "Favorite Songs"'
|
|
68
61
|
|
|
69
62
|
## Configuration
|
|
70
63
|
|
data/lib/musica/cli.rb
CHANGED
|
@@ -2,25 +2,61 @@
|
|
|
2
2
|
|
|
3
3
|
module Musica
|
|
4
4
|
class Cli
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
HELP = <<~TEXT
|
|
6
|
+
Usage: musica [request]
|
|
7
|
+
musica -s <applescript>
|
|
8
|
+
|
|
9
|
+
Without arguments, print what's playing. With a request, turn it into a
|
|
10
|
+
command using fm, send it to the music player, then print what's playing.
|
|
11
|
+
|
|
12
|
+
Options:
|
|
13
|
+
-s, --script Send an AppleScript command to the player as is
|
|
14
|
+
-h, --help Show this help
|
|
15
|
+
-v, --version Show the version
|
|
16
|
+
|
|
17
|
+
Examples:
|
|
18
|
+
musica skip this song
|
|
19
|
+
musica play the album Adore
|
|
20
|
+
musica -s set sound volume to 50
|
|
21
|
+
|
|
22
|
+
The player is set in musica/config.yml, under $XDG_CONFIG_HOME or ~/.config.
|
|
23
|
+
TEXT
|
|
24
|
+
|
|
25
|
+
def initialize(argv, player: nil, interpreter: nil, out: $stdout)
|
|
26
|
+
@argv = argv
|
|
8
27
|
@player = player
|
|
9
28
|
@interpreter = interpreter
|
|
10
29
|
@out = out
|
|
11
30
|
end
|
|
12
31
|
|
|
13
32
|
def run
|
|
14
|
-
|
|
15
|
-
|
|
33
|
+
case argv.first
|
|
34
|
+
when "-h", "--help"
|
|
35
|
+
out << HELP
|
|
36
|
+
when "-v", "--version"
|
|
37
|
+
out << "musica #{VERSION}\n"
|
|
38
|
+
when "-s", "--script"
|
|
39
|
+
play argv.drop(1).join(" ")
|
|
40
|
+
else
|
|
41
|
+
play(argv.empty? ? "" : interpreter.call(argv.join(" ")))
|
|
42
|
+
end
|
|
16
43
|
end
|
|
17
44
|
|
|
18
45
|
private
|
|
19
46
|
|
|
20
|
-
attr_reader :
|
|
47
|
+
attr_reader :argv, :out
|
|
48
|
+
|
|
49
|
+
def play(command)
|
|
50
|
+
player.tell command unless command.empty?
|
|
51
|
+
out << "\u{1F3A7} #{player.status}\n"
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def player
|
|
55
|
+
@player ||= Player.new(application: Config.player)
|
|
56
|
+
end
|
|
21
57
|
|
|
22
|
-
def
|
|
23
|
-
|
|
58
|
+
def interpreter
|
|
59
|
+
@interpreter ||= Interpreter.new
|
|
24
60
|
end
|
|
25
61
|
end
|
|
26
62
|
end
|
data/lib/musica/interpreter.rb
CHANGED
|
@@ -28,7 +28,7 @@ module Musica
|
|
|
28
28
|
|
|
29
29
|
output
|
|
30
30
|
rescue Errno::ENOENT
|
|
31
|
-
raise Error, "
|
|
31
|
+
raise Error, "Requests need fm (macOS 26 with Apple Intelligence); use -s to send AppleScript instead"
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
COMMANDS = {
|
data/lib/musica/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: musica
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ariel Rzezak
|
|
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
55
55
|
- !ruby/object:Gem::Version
|
|
56
56
|
version: '0'
|
|
57
57
|
requirements: []
|
|
58
|
-
rubygems_version: 4.0.
|
|
58
|
+
rubygems_version: 4.0.23
|
|
59
59
|
specification_version: 4
|
|
60
60
|
summary: Control macOS music players from the command-line
|
|
61
61
|
test_files: []
|