Class MediaLocator

java.lang.Object
ca.phon.media.MediaLocator

public class MediaLocator extends Object
Helper methods for locating and handling paths for media files. Also includes methods for setting up the media include paths.
  • Field Details

    • MEDIA_INCLUDE_PATH_PROP

      public static final String MEDIA_INCLUDE_PATH_PROP
      Media include path property. This value of this property should be a semicolon separated list of paths in order of search priority.
      See Also:
  • Constructor Details

    • MediaLocator

      public MediaLocator()
  • Method Details

    • setMediaIncludePaths

      public static void setMediaIncludePaths(List<String> paths)
      Set global media include paths for the user.
      Parameters:
      paths -
    • getMediaIncludePaths

      public static List<String> getMediaIncludePaths()
    • getMediaIncludePaths

      public static List<String> getMediaIncludePaths(Project project)
      Get media include paths for the user and project.
      Parameters:
      project -
      Returns:
    • getMediaIncludePaths

      public static List<String> getMediaIncludePaths(Project project, String sessionFolder)
      Get media include paths for the user and project including the given session folder.
      Parameters:
      project - a phon project
      sessionFolder - a session folder
      Returns:
    • findMediaFile

      public static File findMediaFile(Project project, Session session)
      Find media given a project and session.
    • findMediaFile

      public static File findMediaFile(String filename)
      Search for a file in the media include paths.
      Parameters:
      filename -
      Returns:
      the file object for the file or null if not found
    • findMediaFile

      public static File findMediaFile(String filename, Project project, String sessionFolder)
      Search for a file in the media include path. Will look in the project resource directory first if project is not null.
      Parameters:
      filename -
      project - (may be null)
      sessionFolder - (may be null)
      Returns:
      the file object for the file or null if not found
    • findMediaFileRelative

      public static Tuple<File,File> findMediaFileRelative(String filename, Project project, String corpus)
      Search for a file in the media include path.
      Parameters:
      filename -
      project -
      corpus -
      Returns:
    • getRelativeMediaFilePath

      public static String getRelativeMediaFilePath(Project project, String path)
      Check to see if the provided absolute path is inside on of the media include paths.
      Parameters:
      project - the project to check
      path - the absolute path to check
      Returns:
      the relative path to one of the media include paths or the absolute path if it is not in a media include path