itunes-com 0.2.0

Bindings over iTunes COM API
Documentation
// 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,
}