1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
use serde::Deserialize;
#[derive(Deserialize, Debug)]
pub struct ApplicationData {
pub airplay_enabled: Option<bool>,
// is AirPlay currently enabled?
pub converting: Option<bool>,
// is a track currently being converted?
pub current_airplay_devices: Vec<AirplayDevice>,
// the currently selected AirPlay device(s)
pub current_encoder: Encoder,
// the currently selected encoder (MP3, AIFF, WAV, etc.)
pub current_eq_presets: Vec<EqPreset>,
// the currently selected equalizer preset
// pub current_playlist: Option<Playlist>, // the playlist containing the currently targeted track
pub current_stream_title: Option<String>,
// the name of the current track in the playing stream (provided by streaming server)
pub current_stream_url: Option<String>,
// the URL of the playing stream or streaming web site (provided by streaming server)
pub current_visual: Visual,
// the currently selected visual plug-in
pub eq_enabled: bool,
// is the equalizer enabled?
pub fixed_indexing: bool,
// true if all AppleScript track indices should be independent of the play order of the owning playlist.
pub frontmost: bool,
// is this the active application?
pub full_screen: bool,
// is the application using the entire screen?
pub name: Option<String>,
// the name of the application
pub mute: bool,
// has the sound output been muted?
pub player_position: Option<f64>,
// : the player’s position within the currently playing track in seconds.
pub player_state: Option<PlayerState>,
// is the player stopped, paused, or playing?
pub selection: Option<String>,
// TODO: Implement - the selection visible to the user
pub shuffle_enabled: bool,
// are songs played in random order?
pub shuffle_mode: ShuffleMode,
// the playback shuffle mode
pub song_repeat: SongRepeat, // (off/one/all) : the playback repeat mode
pub sound_volume: i8,
// the sound output volume (0 = minimum, 100 = maximum)
pub version: Option<String>,
// the version of the application
pub visuals: Vec<Visual>,
// list of visuals
pub visuals_enabled: bool, // are visuals currently being displayed?
}
#[derive(Deserialize, Debug)]
pub struct AirplayDevice {
pub class: String,
// the class of the item
pub id: i32,
// the id of the item
pub index: i32,
// the index of the item in internal application order
pub name: String,
// the name of the item
pub persistent_id: String,
// the id of the item as a hexadecimal string. This id does not change over time.
pub raw_properties: String, // Every property of the item
pub active: Option<bool>,
// is the device currently being played to?
pub available: Option<bool>,
// is the device currently available?
// pub kind (computer/AirPort Express/Apple TV/AirPlay device/Bluetooth device/HomePod/unknown, r/o) : the kind of the device
pub network_address: Option<String>,
// the network (MAC) address of the device
pub protected: Option<bool>,
// is the device password- or passcode-protected?
pub selected: bool,
//is the device currently selected?
pub supports_audio: Option<bool>,
//does the device support audio playback?
pub supports_video: Option<bool>,
//does the device support video playback?
pub sound_volume: i8, //the output volume for the device (0 = minimum, 100 = maximum)
}
#[derive(Deserialize, Debug)]
pub struct Encoder {
pub class: String,
// the class of the item
pub id: i32,
// the id of the item
pub index: i32,
// the index of the item in internal application order
pub name: String,
// the name of the item
pub raw_properties: String, // Every property of the item
pub format: String, // the data format created by the encoder
}
#[derive(Deserialize, Debug)]
pub struct EqPreset {
pub class: String,
// the class of the item
pub id: i32,
// the id of the item
pub index: i32,
// the index of the item in internal application order
pub name: String,
// the name of the item
pub raw_properties: String, // Every property of the item
pub band1: f32,
// the equalizer 32 Hz band level (-12.0 dB to +12.0 dB)
pub band2: f32,
// the equalizer 32 Hz band level (-12.0 dB to +12.0 dB)
pub band3: f32,
// the equalizer 32 Hz band level (-12.0 dB to +12.0 dB)
pub band4: f32,
// the equalizer 32 Hz band level (-12.0 dB to +12.0 dB)
pub band5: f32,
// the equalizer 32 Hz band level (-12.0 dB to +12.0 dB)
pub band6: f32,
// the equalizer 32 Hz band level (-12.0 dB to +12.0 dB)
pub band7: f32,
// the equalizer 32 Hz band level (-12.0 dB to +12.0 dB)
pub band8: f32,
// the equalizer 32 Hz band level (-12.0 dB to +12.0 dB)
pub band9: f32,
// the equalizer 32 Hz band level (-12.0 dB to +12.0 dB)
pub band10: f32,
// the equalizer 32 Hz band level (-12.0 dB to +12.0 dB)
pub modifiable: Option<bool>,
// can this preset be modified?
pub preamp: f32,
// the equalizer 32 Hz band level (-12.0 dB to +12.0 dB)
pub update_tracks: bool, // should tracks which refer to this preset be updated when the preset is renamed or deleted?
}
#[derive(Deserialize, Debug)]
pub struct Visual {
pub class: String,
// the class of the item
pub id: i32,
// the id of the item
pub index: i32,
// the index of the item in internal application order
pub name: String,
// the name of the item
pub raw_properties: String, // Every property of the item
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "lowercase")]
pub enum PlayerState {
Stopped,
Playing,
Paused,
FastForwarding,
Rewinding,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "lowercase")]
pub enum ShuffleMode {
Songs,
Albums,
Groupings,
}
#[derive(Deserialize, Debug)]
#[serde(rename_all = "lowercase")]
pub enum SongRepeat {
Off,
On,
All,
}