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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
// Inferred from https://www.joshkunz.com/iTunesControl/main.html

#![allow(non_camel_case_types)]

#[cfg(feature = "num_enum")]
use num_derive::FromPrimitive;

/// Specifies the artwork format.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITArtworkFormat {
    /// Unknown artwork format.
    ITArtworkFormatUnknown = 0,
    /// JPEG image.
    ITArtworkFormatJPEG = 1,
    /// PNG image.
    ITArtworkFormatPNG = 2,
    /// BMP image.
    ITArtworkFormatBMP = 3,
}

/// iTunes-specific HRESULT error codes.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITErrors {
    /// user canceled the operation
    /// Note that Microsoft defines ERROR_CANCELLED, but this is a positive value. We need to use a negative value to force this to be treated as an exception.
    ITUNES_E_USERCANCEL = 0xA0040201,
    /// the entity referenced by this COM object has been deleted
    ITUNES_E_OBJECTDELETED = 0xA0040202,
    /// attempt to modify a locked property
    ITUNES_E_OBJECTLOCKED = 0xA0040203,
    /// attempt to start a conversion while a previous conversion is still in progress
    ITUNES_E_CONVERSIONINPROGRESS = 0xA0040204,
    /// access to the iTunes Store is disabled in the preferences
    ITUNES_E_MUSICSTOREDISABLED = 0xA0040205,
    /// an object with the same name already exists (added in iTunes type library 1.2)
    ITUNES_E_OBJECTEXISTS = 0xA0040206,
    /// access to podcasts is disabled in the preferences (added in iTunes type library 1.5)
    ITUNES_E_PODCASTSDISABLED = 0xA0040207,
}

/// The major and minor version of the iTunes type library. Use these constants with CheckVersion().
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITVersion {
    /// iTunes type library major version
    kITTypeLibrary_MajorVersion = 1,
    /// iTunes type library minor version (0 for iTunes 4.5, 1 for iTunes 4.6, 2 for iTunes 4.7 and 4.7.1, 3 for iTunes 4.8 and 4.8.1, 4 for iTunes 4.9, 5 for iTunes 5.0, 6 for iTunes 6.0, 7 for iTunes 6.0.2, 8 for iTunes 7.0, 9 for iTunes 7.1, 10 for iTunes 7.4, 11 for iTunes 7.7, 12 for iTunes 8.1)
    kITTypeLibrary_MinorVersion = 4,
}

/// Specifies the reason the COM interface is being disabled.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITCOMDisabledReason {
    /// COM interface is being disabled for some other reason.
    ITCOMDisabledReasonOther = 0,
    /// COM interface is being disabled because a modal dialog is being displayed.
    ITCOMDisabledReasonDialog = 1,
    /// COM interface is being disabled because iTunes is quitting.
    ITCOMDisabledReasonQuitting = 2,
}

/// Events generated by IITConvertOperationStatus.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITConvertOperationStatusEvent {
    /// status about the conversion operation has changed
    ITConvertOperationStatusChanged = 1,
    /// the conversion operation has completed
    ITConvertOperationComplete = 2,
}

/// Events generated by IiTunes.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITEvent {
    /// iTunes database has changed
    ITEventDatabaseChanged = 1,
    /// a track has started playing
    ITEventPlayerPlay = 2,
    /// a track has stopped playing
    ITEventPlayerStop = 3,
    /// information about the currently playing track has changed
    ITEventPlayerPlayingTrackChanged = 4,
    /// calls to the iTunes COM interface will be deferred (typically because a modal dialog is displayed)
    ITEventCOMCallsDisabled = 6,
    /// calls to the iTunes COM interface will no longer be deferred (typically because the last modal dialog has been dismissed)
    ITEventCOMCallsEnabled = 7,
    /// iTunes is about to quit, existing iTunes COM objects will no longer be valid
    ITEventQuitting = 8,
    /// iTunes is about to prompt the user to quit, you should release iTunes COM objects if you want to avoid the dialog
    ITEventAboutToPromptUserToQuit = 9,
    /// the sound output volume has changed
    ITEventSoundVolumeChanged = 10,
}

/// Specifies the state of the play/pause/stop button.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITPlayButtonState {
    /// Disabled play button.
    ITPlayButtonStatePlayDisabled = 0,
    /// Enabled play button.
    ITPlayButtonStatePlayEnabled = 1,
    /// Enabled pause button.
    ITPlayButtonStatePauseEnabled = 2,
    /// Disabled pause button.
    ITPlayButtonStatePauseDisabled = 3,
    /// Enabled stop button.
    ITPlayButtonStateStopEnabled = 4,
    /// Disabled stop button.
    ITPlayButtonStateStopDisabled = 5,
}

/// Specifies a player button.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITPlayerButton {
    /// Previous/rewind button.
    ITPlayerButtonPrevious = 0,
    /// Play button.
    ITPlayerButtonPlay = 1,
    /// Next/fast forward button.
    ITPlayerButtonNext = 2,
}

/// Player button modifier key flags.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITPlayerButtonModifierKey {
    /// No modifiers.
    ITPlayerButtonModifierKeyNone = 0,
    /// Shift key down.
    ITPlayerButtonModifierKeyShift = 1,
    /// Control key down.
    ITPlayerButtonModifierKeyControl = 2,
    /// Alt key down.
    ITPlayerButtonModifierKeyAlt = 4,
    /// Caps Lock key toggled.
    ITPlayerButtonModifierKeyCapsLock = 8,
}

/// Specifies the state of the player.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITPlayerState {
    /// Player is stopped.
    ITPlayerStateStopped = 0,
    /// Player is playing.
    ITPlayerStatePlaying = 1,
    /// Player is fast forwarding.
    ITPlayerStateFastForward = 2,
    /// Player is rewinding.
    ITPlayerStateRewind = 3,
}

/// Specifies the size of the visuals.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITVisualSize {
    /// Small size visuals.
    ITVisualSizeSmall = 0,
    /// Medium size visuals.
    ITVisualSizeMedium = 1,
    /// Large size visuals.
    ITVisualSizeLarge = 2,
}

/// Specifies the window kind.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITWindowKind {
    /// Unknown window kind.
    ITWindowKindUnknown = 0,
    /// Main browser window (IITBrowserWindow).
    ITWindowKindBrowser = 1,
    /// Playlist window (IITPlaylistWindow).
    ITWindowKindPlaylist = 2,
    /// EQ window.
    ITWindowKindEQ = 3,
    /// Artwork window.
    ITWindowKindArtwork = 4,
    /// Now Playing window.
    ITWindowKindNowPlaying = 5,
}

/// Specifies the source kind.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITSourceKind {
    /// Unknown source kind.
    ITSourceKindUnknown = 0,
    /// Library source.
    ITSourceKindLibrary = 1,
    /// iPod source (IITIPodSource).
    ITSourceKindIPod = 2,
    /// Audio CD source.
    ITSourceKindAudioCD = 3,
    /// MP3 CD source.
    ITSourceKindMP3CD = 4,
    /// Device source.
    ITSourceKindDevice = 5,
    /// Radio tuner source.
    ITSourceKindRadioTuner = 6,
    /// Shared library source.
    ITSourceKindSharedLibrary = 7,
}

/// Specifies the playlist kind.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITPlaylistKind {
    /// Unknown playlist kind.
    ITPlaylistKindUnknown = 0,
    /// Library playlist (IITLibraryPlaylist).
    ITPlaylistKindLibrary = 1,
    /// User playlist (IITUserPlaylist).
    ITPlaylistKindUser = 2,
    /// CD playlist (IITAudioCDPlaylist).
    ITPlaylistKindCD = 3,
    /// Device playlist.
    ITPlaylistKindDevice = 4,
    /// Radio tuner playlist.
    ITPlaylistKindRadioTuner = 5,
}

/// Specifies the kind of playlist printout.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITPlaylistPrintKind {
    /// Print a list of tracks in the playlist.
    ITPlaylistPrintKindPlaylist = 0,
    /// Print a list of albums in the playlist.
    ITPlaylistPrintKindAlbumlist = 1,
    /// Print a CD jewel case insert.
    ITPlaylistPrintKindInsert = 2,
}

/// Specifies the playlist playback repeat mode.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITPlaylistRepeatMode {
    /// Play playlist once.
    ITPlaylistRepeatModeOff = 0,
    /// Repeat song.
    ITPlaylistRepeatModeOne = 1,
    /// Repeat playlist.
    ITPlaylistRepeatModeAll = 2,
}

/// Specifies the fields in each track that will be searched by IITPlaylist::Search().
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITPlaylistSearchField {
    /// Search all fields of each track.
    ITPlaylistSearchFieldAll = 0,
    /// Search only the fields with columns that are currently visible in the display for the playlist.
    /// Note that song name, artist, album, and composer will always be searched, even if these columns are not visible.
    ITPlaylistSearchFieldVisible = 1,
    /// Search only the artist field of each track (IITTrack::Artist).
    ITPlaylistSearchFieldArtists = 2,
    /// Search only the album field of each track (IITTrack::Album).
    ITPlaylistSearchFieldAlbums = 3,
    /// Search only the composer field of each track (IITTrack::Composer).
    ITPlaylistSearchFieldComposers = 4,
    /// Search only the song name field of each track (IITTrack::Name).
    ITPlaylistSearchFieldSongNames = 5,
}

/// Specifies the user playlist special kind.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITUserPlaylistSpecialKind {
    /// No special kind.
    ITUserPlaylistSpecialKindNone = 0,
    /// Purchased Music playlist.
    ITUserPlaylistSpecialKindPurchasedMusic = 1,
    /// Party Shuffle playlist. Was one called iTunes DJ.
    ITUserPlaylistSpecialKindPartyShuffle = 2,
    /// Podcasts playlist.
    ITUserPlaylistSpecialKindPodcasts = 3,
    /// Folder playlist.
    ITUserPlaylistSpecialKindFolder = 4,
    /// Videos playlist (added in iTunes type library 1.6).
    ITUserPlaylistSpecialKindVideos = 5,
    /// Music playlist (added in iTunes type library 1.8).
    ITUserPlaylistSpecialKindMusic = 6,
    /// Movies playlist (added in iTunes type library 1.8).
    ITUserPlaylistSpecialKindMovies = 7,
    /// TV Shows playlist (added in iTunes type library 1.8).
    ITUserPlaylistSpecialKindTVShows = 8,
    /// Audiobooks playlist (added in iTunes type library 1.8).
    ITUserPlaylistSpecialKindAudiobooks = 9,
    ITUserPlaylistSpecialKindITunesU = 10,
    ITUserPlaylistSpecialKindGenius = 11,
}

/// Specifies the rating kind (added in iTunes type library 1.10).
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITRatingKind {
    /// User-specified rating.
    ITRatingKindUser = 0,
    /// iTunes-computed rating.
    ITRatingKindComputed = 1,
}

/// Specifies the track kind.
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITTrackKind {
    /// Unknown track kind.
    ITTrackKindUnknown = 0,
    /// File track (IITFileOrCDTrack).
    ITTrackKindFile = 1,
    /// CD track (IITFileOrCDTrack).
    ITTrackKindCD = 2,
    /// URL track (IITURLTrack).
    ITTrackKindURL = 3,
    /// Device track.
    ITTrackKindDevice = 4,
    /// Shared library track.
    ITTrackKindSharedLibrary = 5,
}

/// Specifies the video track kind (added in iTunes type library 1.8).
#[repr(C)]
#[derive(Debug, Eq, PartialEq)]
#[cfg_attr(feature = "num_enum", derive(FromPrimitive))]
pub enum ITVideoKind {
    /// Not a video track, or unknown video track kind.
    ITVideoKindNone = 0,
    /// Movie video track.
    ITVideoKindMovie = 1,
    /// Music video track.
    ITVideoKindMusicVideo = 2,
    /// TV show video track.
    ITVideoKindTVShow = 3,
}