本文整理汇总了Java中sagex.phoenix.vfs.IMediaResource.isType方法的典型用法代码示例。如果您正苦于以下问题:Java IMediaResource.isType方法的具体用法?Java IMediaResource.isType怎么用?Java IMediaResource.isType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sagex.phoenix.vfs.IMediaResource
的用法示例。
在下文中一共展示了IMediaResource.isType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import sagex.phoenix.vfs.IMediaResource; //导入方法依赖的package包/类
public boolean visit(IMediaResource resource, IProgressMonitor mon) {
if (collectedSize >= max)
return false;
if (mediaResourceType != null) {
if (resource.isType(mediaResourceType.value())) {
collected.add(resource);
collectedSize++;
}
} else {
collected.add(resource);
collectedSize++;
}
if (collectedSize >= max) {
if (mon != null) {
mon.setCancelled(true);
}
return false;
}
return true;
}
示例2: GetAllRealChildren
import sagex.phoenix.vfs.IMediaResource; //导入方法依赖的package包/类
public static List<IMediaResource> GetAllRealChildren(IMediaResource imediaresource){
if (imediaresource==null){
LOG.debug("GetAllRealChildren: null passed in so returning empty list");
return Collections.emptyList();
}
if (phoenix.media.IsMediaType( imediaresource , "FOLDER" )){
ViewFolder Folder = (ViewFolder) imediaresource;
List<IMediaResource> outList = new ArrayList<IMediaResource>();
for (Object imr : phoenix.media.GetAllChildren(Folder)){
//LOG.debug("GetAllRealChildren: checking '" + imr + "'");
if (imr instanceof IMediaResource){
IMediaResource tIMR = (IMediaResource) imr;
if (!tIMR.isType(MediaResourceType.MISSINGTV.value())){
//LOG.debug("GetAllRealChildren: adding '" + tIMR + "'");
outList.add(tIMR);
}else{
//LOG.debug("GetAllRealChildren: skipping as MISSINGTV '" + tIMR + "'");
}
}else{
//LOG.debug("GetAllRealChildren: skipping as not IMR '" + imr + "'");
}
}
return outList;
}else{
return Collections.emptyList();
}
}
示例3: IsMediaType
import sagex.phoenix.vfs.IMediaResource; //导入方法依赖的package包/类
/**
* return true if the media type is one of the ones listed in the
* {@link MediaResourceType} constants
*
* @param type {@link MediaResourceType} contant as a String
* @return true if the media has the given type
*/
public boolean IsMediaType(Object file, String type) {
if (file == null)
return false;
MediaResourceType rt = MediaResourceType.toMediaResourceType(type);
if (rt == null)
return false;
IMediaResource r = GetMediaResource(file);
if (r != null) {
return r.isType(rt.value());
}
return false;
}
示例4: canAccept
import sagex.phoenix.vfs.IMediaResource; //导入方法依赖的package包/类
@Override
public boolean canAccept(IMediaResource res) {
IMetadata md;
if (res.isType(MediaResourceType.TV.value())) {
md = ((IMediaFile) res).getMetadata();
if (ignoreAll || ignoreThe) {
return removeLeadingArticles(md.getEpisodeName(), (ignoreAll)).toLowerCase().startsWith(value.toLowerCase());
} else {
return md.getEpisodeName().toLowerCase().startsWith(value.toLowerCase());
}
} else {
return false;
}
}
示例5: canAccept
import sagex.phoenix.vfs.IMediaResource; //导入方法依赖的package包/类
public boolean canAccept(IMediaResource res) {
if (res instanceof IMediaFolder)
return true;
return res.isType(type);
}
示例6: testMediaScan
import sagex.phoenix.vfs.IMediaResource; //导入方法依赖的package包/类
@Test
public void testMediaScan() {
makeFile("test/movies/dira/Nemo.avi");
makeFile("test/movies/dira/Nemo.avi.properties");
makeFile("test/movies/dira/Nemo.jpg");
makeFile("test/movies/dira/Terminator.avi");
makeFile("test/movies/dirb/x.avi");
makeFile("test/movies/dirc/y/VIDEO_TS/test.vob");
makeFile("test/movies/dirc/y/VIDEO_TS/test.buf");
makeFile("test/movies/dird/dire/z.avi");
makeFile("test/movies/dire/BDMV/test.m2ts");
makeFile("test/movies/merlin/video.vob");
final List<IMediaResource> files = new ArrayList<IMediaResource>();
IMediaResourceVisitor vis = new IMediaResourceVisitor() {
@Override
public boolean visit(IMediaResource res, IProgressMonitor monitor) {
if (res.isType(MediaResourceType.ANY_VIDEO.value())) {
files.add(res);
}
return true;
}
};
IMediaFolder mf = FileResourceFactory.createFolder(makeDir("test/movies"));
mf.accept(vis, null, IMediaResource.DEEP_UNLIMITED);
assertEquals("visitor failed", 7, files.size());
assertEquals("children", 6, mf.getChildren().size());
int fileCtr = 0, dirs = 0;
for (IMediaResource r : mf.getChildren()) {
if (r instanceof IMediaFile) {
fileCtr++;
} else {
dirs++;
}
}
assertEquals("files", 2, fileCtr);
assertEquals("folders", 4, dirs);
// media folder delete will delete everything...
mf.delete(null);
assertEquals("delete()", false, mf.exists());
final List filesLeft = new LinkedList();
sagex.phoenix.util.DirectoryScanner scanner = new DirectoryScanner(FileFileFilter.FILE);
scanner.scan(makeDir("test/movies"), filesLeft);
assertEquals("files left", 0, filesLeft.size());
}