r/o
1
# nowplaying-cli
2
nowplaying-cli is a macOS command-line utility for retrieving currently playing media, and simulating media actions.
3
4
Use nowplaying-cli to get song information and play/pause your media through an easy to use CLI!
5
6
**Disclaimer:** nowplaying-cli uses private frameworks, which may cause it to break with future macOS software updates.
7
8
**Tested and working on:**
9
- Ventura 13.1, 13.2, 13.3, 13.6
10
- Sonoma 14.4
11
12
## Installation
13
14
### Homebrew
15
16
You can install nowplaying-cli using [Homebrew](https://brew.sh/).
17
```bash
18
brew install nowplaying-cli
19
```
20
21
### Build from source
22
23
Clone the repository and run `make` to build the binary. You can then move the binary to your desired location.
24
```bash
25
make
26
mv nowplaying-cli ~/.local/bin
27
```
28
29
## Usage
30
`nowplaying-cli <cmd>`
31
| command | description |
32
| --- | --- |
33
| get [propName1 propName2 ... ] | get now playing media properties |
34
| get-raw | get all non-nil now playing media properties in dictionary format |
35
| play | play the currently playing media regardless of current state |
36
| pause | pause the currently playing media regardless of current state |
37
| togglePlayPause | toggle play/pause based on current state |
38
| seek <seconds> | seek to a specific time in the currently playing media |
39
| next | skip to next track |
40
| previous | go to previous track |
41
42
## Examples
43
![screenshot of examples in terminal](screenshots/examples.png)
44
45
## Available properties
46
| native | nowplaying-cli |
47
|---|---|
48
| kMRMediaRemoteNowPlayingInfoTotalDiscCount | totalDiscCount |
49
| kMRMediaRemoteNowPlayingInfoShuffleMode | shuffleMode
50
| kMRMediaRemoteNowPlayingInfoTrackNumber | trackNumber
51
| kMRMediaRemoteNowPlayingInfoDuration | duration
52
| kMRMediaRemoteNowPlayingInfoRepeatMode | repeatMode
53
| kMRMediaRemoteNowPlayingInfoTitle | title
54
| kMRMediaRemoteNowPlayingInfoPlaybackRate | playbackRate |
55
| kMRMediaRemoteNowPlayingInfoArtworkData | artworkData |
56
| kMRMediaRemoteNowPlayingInfoArtworkDataWidth | artworkDataWidth |
57
| kMRMediaRemoteNowPlayingInfoArtworkDataHeight | artworkDataHeight |
58
| kMRMediaRemoteNowPlayingInfoAlbum | album |
59
| kMRMediaRemoteNowPlayingInfoTotalQueueCount | totalQueueCount |
60
| kMRMediaRemoteNowPlayingInfoArtworkMIMEType | artworkMIMEType
61
| kMRMediaRemoteNowPlayingInfoMediaType | mediaType |
62
| kMRMediaRemoteNowPlayingInfoDiscNumber | discNumber |
63
| kMRMediaRemoteNowPlayingInfoTimestamp | timestamp |
64
| kMRMediaRemoteNowPlayingInfoGenre | genre |
65
| kMRMediaRemoteNowPlayingInfoQueueIndex | queueIndex |
66
| kMRMediaRemoteNowPlayingInfoArtist | artist |
67
| kMRMediaRemoteNowPlayingInfoDefaultPlaybackRate | defaultPlaybackRate |
68
| kMRMediaRemoteNowPlayingInfoElapsedTime | elapsedTime |
69
| kMRMediaRemoteNowPlayingInfoTotalTrackCount | totalTrackCount |
70
| kMRMediaRemoteNowPlayingInfoIsMusicApp | isMusicApp |
71
| kMRMediaRemoteNowPlayingInfoUniqueIdentifier | uniqueIdentifier |
72