Interface ITunes


  • public interface ITunes
    Represents iTunes. Use this class to manipulate iTunes, songs (i.e. Tracks) in it etc. Typically, if you are using AudioSongs, there should never be a need to call this interface (or objects accessed through it) directly, as AudioSong takes care of dispatching your calls transparently.
    Author:
    Hendrik Schreiber
    See Also:
    Track
    • Method Detail

      • isAvailable

        boolean isAvailable()
        Indicates whether this instance is available for communication. This is e.g. not the case, when an iTunes dialog is open.
        Returns:
        true or false
      • isLibraryXMLSharingEnabled

        boolean isLibraryXMLSharingEnabled()
        Indicates whether the sharing of the iTunes Library.xml files is enabled in the iTunes advanced preferences.
        Returns:
        true or false
      • getDefaultITunesMusicLibraryFile

        default Path getDefaultITunesMusicLibraryFile()
        Default file name of the iTunes Music Library.xml file.
        Returns:
        file or null, if we can't find one
        See Also:
        Apple docs
      • getITunesMusicLibraryFiles

        Path[] getITunesMusicLibraryFiles()
        Returns array of all iTunes Music Library.xml or iTunes Library.xml files we were able to find. This list may be incomplete.
        Returns:
        iTunes Library.xml files.
      • getMusicLibraryFile

        Path getMusicLibraryFile()
        Actual music library file.
        Returns:
        music library file - iTunes Music Library.xml in the case of iTunes
      • setMusicLibraryFile

        void setMusicLibraryFile​(Path file)
        Sets the actually used music library files. Note that this does not change the file that is used. This method should only be called by the app/framework itself, not by a plugin.
        Parameters:
        file - library file, e.g. iTunes Music Library.xml
      • openPrimaryArtworkStreamFromCache

        InputStream openPrimaryArtworkStreamFromCache​(long songId)
        Opens an InputStream to image data from a cache (i.e. not from the songs file).
        Parameters:
        songId - persistent song id
        Returns:
        inputstream to image data or null, if none exist
      • getPrimaryArtworkFromCache

        Image getPrimaryArtworkFromCache​(long songId)
        Returns the primary image for a song from a cache, should it exist.
        Parameters:
        songId - persistent song id
        Returns:
        Image object or null
        See Also:
        openPrimaryArtworkStreamFromCache(long)
      • isPrimaryArtworkInCache

        boolean isPrimaryArtworkInCache​(long songId)
        Indicates whether there is an image file in the cache.
        Parameters:
        songId - persistent song id
        Returns:
        true or false
        See Also:
        openPrimaryArtworkStreamFromCache(long)
      • removePrimaryArtworkFromCache

        void removePrimaryArtworkFromCache​(long songId)
        Removes an artwork entry from the cache.
        Parameters:
        songId - song id
      • playPause

        void playPause()
        Toggle play pause.
      • pause

        void pause()
        Pause.
      • stop

        void stop()
        Stop.
      • getMute

        boolean getMute()
        Mute.
        Returns:
        mute
      • setMute

        void setMute​(boolean mute)
        Mutes.
        Parameters:
        mute - boolean value
      • eject

        void eject()
        Eject CD.
      • next

        void next()
        Play next track.
      • previous

        void previous()
        Play previous track.
      • setVolume

        void setVolume​(float volume)
        Set sound volume.
        Parameters:
        volume - volume
      • getVolume

        float getVolume()
        Get sound volume.
        Returns:
        volume
      • play

        void play​(Track track)
        Play track.
        Parameters:
        track - track
      • play

        void play​(Playlist playlist)
        Play playlist.
        Parameters:
        playlist - playlist
      • getLibrarySource

        Source getLibrarySource()
        Get main library source.
        Returns:
        library source
      • getLibraryPlaylist

        LibraryPlaylist getLibraryPlaylist()
        Get main library playlist.
        Returns:
        library playlist
      • getVersion

        String getVersion()
        Version of iTunes.
        Returns:
        version of iTunes
      • getTime

        long getTime()
        The player's position within the currently playing track in milliseconds. The underlying iTunes implementation may round to the nearest second.
        Returns:
        position in ms
      • setTime

        void setTime​(long time)
        Sets the player's position within the currently playing track in milliseconds. The underlying iTunes implementation may round to the nearest second.
        Parameters:
        time - milliseconds
      • getPlayerState

        PlayerState getPlayerState()
        Is iTunes stopped, paused, or playing?
        Returns:
        PlayerState
      • getCurrentPlaylist

        Playlist getCurrentPlaylist()
        The playlist containing the currently targeted track.
        Returns:
        current playlist
      • getCurrentStreamTitle

        String getCurrentStreamTitle()
        The name of the current song in the playing stream (provided by streaming server).
        Returns:
        current stream title
      • getCurrentStreamURL

        String getCurrentStreamURL()
        The URL of the playing stream or streaming web site (provided by streaming server).
        Returns:
        current stream url
      • openLocation

        void openLocation​(String url)
        Opens a given streaming URL.
        Parameters:
        url - url
      • getCurrentTrack

        Track getCurrentTrack()
        The current targeted track.
        Returns:
        current track or null, if there is no current track
      • isSupportedPlayList

        boolean isSupportedPlayList​(PlayList.Kind kind)
        Indicates whether a distinguished kind of PlayList is supported.
        Parameters:
        kind - kind
        Returns:
        true or false
      • setRepeatMode

        void setRepeatMode​(RepeatMode repeatMode)
      • addPropertyChangeListener

        void addPropertyChangeListener​(PropertyChangeListener propertyChangeListener)
      • removePropertyChangeListener

        void removePropertyChangeListener​(PropertyChangeListener propertyChangeListener)