Class TunesUtilities

  • public final class TunesUtilities
    extends Object
    Utility class that makes it easier to obtain a Track object. Also allows to serialize calls to the tunes library, i.e. to iTunes.
    Hendrik Schreiber
    • Method Detail

      • getExecutorService

        public static MultiQueueExecutor getExecutorService()
        Special ExecutorService for synchronizing access to external resources. This service is typically single threaded.

        Note that the simpler methods like ExecutorService.submit(Runnable), Executor.execute(Runnable) or ExecutorService.submit(Callable) execute runnables and callables out of order, if you are already in the executor's thread. In other words, typically tasks are queued (i.e. executed in order), but when you are already in the executor thread, your task is executed right away (i.e. executed out of order).

        executor service
      • getTrack

        public static Track getTrack​(Playlist playlist,
                                     AudioSong song)
        Attempts to get a Track object from the given playlist for the given song. Will be deleted in beaTunes 6.
        playlist - playlist to search in
        song - song to search for
        track for the given song
      • invokeLater

        public static Future<?> invokeLater​(Runnable runnable)
        Executes the runnable asynchronously in the TunesUtilities executor thread.
        runnable - runnable
      • isInTunesUtilitiesThread

        public static boolean isInTunesUtilitiesThread()
        Checks whether are already in the TunesUtilityThread
        true or false
      • interruptTunesUtilitiesThread

        public static void interruptTunesUtilitiesThread()
        Calls Thread.interrupt() on the Tunes Utilities thread.
      • getPath

        public static String getPath​(Track track)
        track - track
        location that is guaranteed to start with a slash
      • openPrimaryArtworkStreamFromCache

        public static InputStream openPrimaryArtworkStreamFromCache​(File libraryXML,
                                                                    Long songId,
                                                                    Long libraryId)
      • isPrimaryArtworkInCache

        public static boolean isPrimaryArtworkInCache​(File libraryXML,
                                                      Long songId,
                                                      Long libraryId)
      • getPrimaryArtworkFileFromCache

        public static File getPrimaryArtworkFileFromCache​(File libraryXML,
                                                          Long songId,
                                                          Long libraryId)
      • getPrimaryArtworkFromCache

        public static Image getPrimaryArtworkFromCache​(File libraryXML,
                                                       Long songId,
                                                       Long libraryId)