Class MediaLocator
java.lang.Object
ca.phon.media.MediaLocator
Helper methods for locating and handling paths for media files.
Also includes methods for setting up the media include paths.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic File
findMediaFile
(Project project, Session session) Find media given a project and session.static File
findMediaFile
(String filename) Search for a file in the media include paths.static File
findMediaFile
(String filename, Project project, String sessionFolder) Search for a file in the media include path.findMediaFileRelative
(String filename, Project project, String corpus) Search for a file in the media include path.getMediaIncludePaths
(Project project) Get media include paths for the user and project.getMediaIncludePaths
(Project project, String sessionFolder) Get media include paths for the user and project including the given session folder.static String
getRelativeMediaFilePath
(Project project, String path) Check to see if the provided absolute path is inside on of the media include paths.static void
setMediaIncludePaths
(List<String> paths) Set global media include paths for the user.
-
Field Details
-
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
-
getMediaIncludePaths
-
getMediaIncludePaths
-
getMediaIncludePaths
-
findMediaFile
-
findMediaFile
-
findMediaFile
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 benull
)sessionFolder
- (may benull
)- Returns:
- the file object for the file or null if not found
-
findMediaFileRelative
-
getRelativeMediaFilePath
Check to see if the provided absolute path is inside on of the media include paths.- Parameters:
project
- the project to checkpath
- 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
-