当前位置: 首页>>代码示例>>Java>>正文


Java IMediaFile类代码示例

本文整理汇总了Java中sagex.phoenix.vfs.IMediaFile的典型用法代码示例。如果您正苦于以下问题:Java IMediaFile类的具体用法?Java IMediaFile怎么用?Java IMediaFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IMediaFile类属于sagex.phoenix.vfs包,在下文中一共展示了IMediaFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processRenameFailedCommand

import sagex.phoenix.vfs.IMediaFile; //导入依赖的package包/类
private void processRenameFailedCommand(IMediaFile res, Exception e) {
	String path = res.getPath();
	log.info("Executing Command '"+renameFailedCommand +" \""+ path +"\" \""+e.getMessage()+"\"'");
	
	List<String> cmd = new ArrayList<String>();
	cmd.add(renameFailedCommand);
	cmd.add(path);
	cmd.add(e.getMessage());
	if (postExecuteCommandArgs!=null) {
		cmd.add(postExecuteCommandArgs);
	}
	ProcessBuilder pb = new ProcessBuilder(cmd);

	pb.redirectErrorStream();
	
	try {
		Process p = pb.start();
		StreamGobbler gobble = new StreamGobbler(p.getInputStream());
		gobble.start();
		gobble.join();
	} catch (Throwable t) {
		log.error("Failed to start process: " + renameFailedCommand + "; " + t.getMessage());
	}
}
 
开发者ID:stuckless,项目名称:phoenix-renamer,代码行数:25,代码来源:PhoenixRenamer.java

示例2: GetLastWatchedTimeStamp

import sagex.phoenix.vfs.IMediaFile; //导入依赖的package包/类
public static long GetLastWatchedTimeStamp(IMediaResource o) {
    if (o instanceof IMediaFile) {
        Object theairing = o.getMediaObject();
        Object thisAiring = phoenix.media.GetMediaObject(theairing);
        //LOG.debug("IMediaFile found - realwatched from thisAiring '" + AiringAPI.GetRealWatchedStartTime(thisAiring) + "' for S" + phoenix.metadata.GetSeasonNumber(thisAiring) + "E" + phoenix.metadata.GetEpisodeNumber(thisAiring));
        return AiringAPI.GetRealWatchedStartTime(thisAiring);
    }

    if (o instanceof IMediaFolder) {
        //LOG.debug("IMediaFolder found - searching");
        return searchFolderForLastWatchedTimeStamp((IMediaFolder) o);
    }

    // If it's not a File or Folder just return a 0
    //LOG.debug("Neither found - class is '" + o.getClass() + "'");
    return 0;
}
 
开发者ID:jusjoken,项目名称:gemstone2,代码行数:18,代码来源:MetadataCalls.java

示例3: canAccept

import sagex.phoenix.vfs.IMediaFile; //导入依赖的package包/类
@Override
public boolean canAccept(IMediaResource res) {
    boolean watched = getOption(OPT_VALUE).getBoolean(true);
    if (res instanceof IMediaFolder)
        return true;
    if (res instanceof IMediaFile) {
        IMediaFile file = (IMediaFile) res;

        // A file is partially watched if some of it is watched, but it
        // hasn't
        // been marked "Watched"
        return (!file.isWatched() && file.getWatchedDuration() > 0L) == watched;
    } else {
        return false;
    }
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:17,代码来源:PartiallyWatchedFilter.java

示例4: updateQueryDateAndFileFromResource

import sagex.phoenix.vfs.IMediaFile; //导入依赖的package包/类
private void updateQueryDateAndFileFromResource(IMediaFile resource, SearchQuery q) {
    if (q != null) {
        File f = PathUtils.getFirstFile(resource);
        if (f != null) {
            q.set(Field.FILE, f.getAbsolutePath());
            // if there isn't a date set, then try setting the date using
            // the file's date/time
            if (StringUtils.isEmpty(q.get(Field.EPISODE_DATE))) {
                q.set(Field.EPISODE_DATE, getFormattedAiringDate(f.lastModified()));
            }

            int cd = ScraperUtils.parseCD(f.getAbsolutePath());
            if (cd > 0) {
                q.set(Field.DISC, String.valueOf(cd));
            }
        }
    }
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:19,代码来源:SearchQueryFactory.java

示例5: GetMediaFile

import sagex.phoenix.vfs.IMediaFile; //导入依赖的package包/类
/**
 * Given the object return it as a {@link IMediaFile} object. If the object
 * cannot be converted to a {@link IMediaFile}, then null is returned.
 *
 * @param mediaFile
 * @return
 */
public IMediaFile GetMediaFile(Object mediaFile) {
    if (mediaFile instanceof IMediaFile) {
        return (IMediaFile) mediaFile;
    } else if (sagex.api.MediaFileAPI.IsMediaFileObject(mediaFile)) {
        return (new SageMediaFile(null, mediaFile));
    } else if (AiringAPI.IsAiringObject(mediaFile)) {
        return (new SageMediaFile(null, mediaFile));
    } else if (mediaFile instanceof Integer) {
        Object mf = MediaFileAPI.GetMediaFileForID((Integer) mediaFile);
        if (mf != null) {
            return new SageMediaFile(null, mf);
        }
    }

    if (mediaFile != null) {
        log.debug("Failed to Create IMediaFile object from " + mediaFile);
    }
    return null;
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:27,代码来源:MediaAPI.java

示例6: IsPlayable

import sagex.phoenix.vfs.IMediaFile; //导入依赖的package包/类
/**
 * Return true if the file can be handled by PlayMediaFile(). This call is
 * handy to use when you are rendering the media resources, since some media
 * resources, such as grouped resources can be played as a single item.
 *
 * @param media resource (file, folder, sage object)
 * @return
 */
public boolean IsPlayable(Object file) {
    if (file instanceof IMediaFile) {
        IMediaFile IMF = (IMediaFile) file;
        if (IMF.isType(MediaResourceType.DUMMY.value())) {
            log.debug("IsPlayable: " + file + "; not playable for type : MISSINGTV");
            return false;
        } else if (IMF.isType(MediaResourceType.MISSINGTV.value())) {
            log.debug("IsPlayable: " + file + "; not playable for type : DUMMY");
            return false;
        }
    }
    boolean playable = (file instanceof IMediaFile) || (file instanceof HasPlayableUrl) || MediaFileAPI.IsMediaFileObject(file);
    log.debug("IsPlayable: " + file + "; " + playable);
    return playable;
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:24,代码来源:MediaBrowserAPI.java

示例7: testMusicRSSFeed2

import sagex.phoenix.vfs.IMediaFile; //导入依赖的package包/类
@Test
public void testMusicRSSFeed2() {
    String url = InitPhoenix.ProjectHome("src/test/java/test/junit/hot-100.xml").toURI().toString();
    XmlOptions options = new XmlOptions();
    options.setFeedUrl(url);
    options.setMediaType("Music");
    options.addMetadataOption(FieldName.Title, "title", null);
    options.setRegex(FieldName.Title, "[0-9]+:\\s([^,]+),\\s*(.*)");
    options.addMetadataOption(FieldName.Artist, "title", null);
    options.setRegex(FieldName.Artist, "[0-9]+:\\s[^,]+,\\s*(.*)");

    XmlFolder f = new XmlFolder(null, "Music RSS", options);
    assertTrue("no children", f.getChildren().size() > 0);
    assertEquals(100, f.getChildren().size());

    assertEquals("We Found Love", f.getChildren().get(0).getTitle());
    assertEquals("Rihanna Featuring Calvin Harris", ((IMediaFile) f.getChildren().get(0)).getAlbumInfo().getArtist());
    assertEquals("http://www.billboard.com/charts/hot-100", ((IMediaFile) f.getChildren().get(0)).getMetadata().getMediaUrl());
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:20,代码来源:TestXmlFolders.java

示例8: testFormattedMoviesTitlesWithPath

import sagex.phoenix.vfs.IMediaFile; //导入依赖的package包/类
@Test
public void testFormattedMoviesTitlesWithPath() {
    IMediaFile mf = (IMediaFile) FileResourceFactory.createResource(InitPhoenix.ProjectHome("target/junit/testing/Movie.avi"));
    IMetadata md = mf.getMetadata();
    md.setMediaType("Movie");
    md.setMediaTitle("Test Movie");
    md.setEpisodeName("Movies/Test Movie");

    md = mf.getMetadata();

    String title = phoenix.media.GetFormattedTitle(mf);
    assertEquals("Test Movie", title);

    md.setYear(2010);
    title = phoenix.media.GetFormattedTitle(mf);
    assertEquals("Test Movie (2010)", title);

    md.setDiscNumber(2);
    title = phoenix.media.GetFormattedTitle(mf);
    assertEquals("Test Movie (2010) - Disc 02", title);
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:22,代码来源:TestFormattedTitles.java

示例9: resolveMediaTitle

import sagex.phoenix.vfs.IMediaFile; //导入依赖的package包/类
private String resolveMediaTitle(String mediaTitle, IMediaFile mf) {
    if (mf == null)
        return mediaTitle;
    if (!StringUtils.isEmpty(mediaTitle))
        return mediaTitle;

    // check for music
    if (mf.isType(MediaResourceType.MUSIC.value())) {
        IAlbumInfo info = mf.getAlbumInfo();
        if (info != null) {
            mediaTitle = info.getArtist();
        }
        if (!StringUtils.isEmpty(mediaTitle))
            return mediaTitle;
    }

    IMetadata md = mf.getMetadata();
    if (md != null) {
        mediaTitle = md.getMediaTitle();
        if (StringUtils.isEmpty(mediaTitle))
            mediaTitle = null;
    }

    return Utils.returnNonNull(mediaTitle, mf.getTitle());
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:26,代码来源:FanartAPI.java

示例10: testMediaFile

import sagex.phoenix.vfs.IMediaFile; //导入依赖的package包/类
@Test
public void testMediaFile() {
    File mfile = FilesTestCase.makeFile("test/movie cd1.avi");
    IMediaFile mf = (IMediaFile) FileResourceFactory.createResource(mfile);
    assertEquals("getBasename()", "movie cd1", PathUtils.getBasename(mf));
    assertEquals("getExtension()", "avi", PathUtils.getExtension(mf));
    assertEquals("getName()", "movie cd1.avi", PathUtils.getName(mf));
    assertEquals("getTitle()", "movie cd1.avi", mf.getTitle());
    assertTrue("getType()", mf.isType(MediaResourceType.FILE.value()));

    long time = mf.lastModified();
    assertTrue("mf.lastModified() returned 0", time != 0);

    System.out.println(time);
    mf.touch(time + 1000);

    assertEquals("Not Same", mf.lastModified(), time + 1000);

    mf.delete(null);
    assertEquals("delete()", false, mf.exists());
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:22,代码来源:TestMediaResources.java

示例11: testMusicRSSFeedViaFactory

import sagex.phoenix.vfs.IMediaFile; //导入依赖的package包/类
@Test
public void testMusicRSSFeedViaFactory() {
    String url = InitPhoenix.ProjectHome("src/test/java/test/junit/hot-100.xml").toURI().toString();

    XmlSourceFactory factory = new XmlSourceFactory();
    factory.setOptionValue("feedurl", url);
    factory.setOptionValue("MediaType", "Music");
    factory.setOptionValue("EpisodeName-element", "title");
    factory.setOptionValue("EpisodeName-regex", "[0-9]+:\\s([^,]+),\\s*(.*)");

    XmlFolder f = (XmlFolder) factory.create(null);

    assertTrue("no children", f.getChildren().size() > 0);
    assertEquals(100, f.getChildren().size());

    assertEquals("We Found Love", f.getChildren().get(0).getTitle());
    assertEquals("http://www.billboard.com/charts/hot-100", ((IMediaFile) f.getChildren().get(0)).getMetadata().getMediaUrl());
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:19,代码来源:TestXmlFolders.java

示例12: getGroupName

import sagex.phoenix.vfs.IMediaFile; //导入依赖的package包/类
public String getGroupName(IMediaResource res) {
    if (dateField != null && res instanceof IMediaFile) {

        Calendar mediaCal = Calendar.getInstance();
        mediaCal.setTimeInMillis(((IMediaFile) res).getStartTime());

        if (dateField.equalsIgnoreCase("YEAR")) {
            return ("" + mediaCal.get(Calendar.YEAR));
        } else if (dateField.equalsIgnoreCase("MONTH")) {
            return (strMonths[mediaCal.get(Calendar.MONTH)] + " " + mediaCal.get(Calendar.YEAR));
        } else if (dateField.equalsIgnoreCase("DAY")) {

            return ("" + strDays[mediaCal.get(Calendar.DAY_OF_WEEK)] + ", " + Utility.DateFormat("M/d/y", mediaCal.getTime()));
        }
        return ("Unknown");
    }
    return null;
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:19,代码来源:DateGrouper.java

示例13: testAtomFeed

import sagex.phoenix.vfs.IMediaFile; //导入依赖的package包/类
@Test
public void testAtomFeed() {
    String url = InitPhoenix.ProjectHome("src/test/java/test/junit/apple-atomfeed.xml").toURI().toString();
    XmlOptions options = new XmlOptions();
    options.setFeedUrl(url);
    options.setItemElement("entry");
    options.addMetadataOption(FieldName.MediaTitle, "title", "Title");
    options.addMetadataOption(FieldName.Description, "summary", "Title");
    options.addMetadataOption(FieldName.MediaUrl, "[email protected]", null);
    options.setRegex(FieldName.MediaTitle, "([^-]+)");
    options.addMetadataOption(FieldName.Misc, "title", null);
    options.setRegex(FieldName.Misc, ".*-\\s*(.*)");

    XmlFolder f = new XmlFolder(null, "Simple RSS", options);
    assertTrue("no children", f.getChildren().size() > 0);
    assertEquals(10, f.getChildren().size());

    assertEquals("The Help", f.getChildren().get(0).getTitle());
    assertEquals("http://a1151.v.phobos.apple.com/us/r1000/080/Video/eb/27/f3/mzm.xcbhexre..640x458.h264lc.d2.p.m4v",
            ((IMediaFile) f.getChildren().get(0)).getMetadata().getMediaUrl());
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:22,代码来源:TestXmlFolders.java

示例14: compare

import sagex.phoenix.vfs.IMediaFile; //导入依赖的package包/类
public int compare(IMediaResource o1, IMediaResource o2) {
    if (o1 == null)
        return 1;
    if (o2 == null)
        return -1;

    // Get the relevant info
    if (o1 instanceof IMediaFile && o2 instanceof IMediaFile) {

        int id1 = NumberUtils.toInt(((IMediaFile) o1).getId());
        int id2 = NumberUtils.toInt(((IMediaFile) o2).getId());

        return (id1 - id2);
    }

    // If they are not both IMediaFile return 0
    return 0;
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:19,代码来源:MediaFileIDSorter.java

示例15: canAccept

import sagex.phoenix.vfs.IMediaFile; //导入依赖的package包/类
public boolean canAccept(IMediaResource res) {
    String dirspec = cfg.getFolders();
    if (StringUtils.isEmpty(dirspec))
        return false;
    if (res instanceof IMediaFile) {
        File f = PathUtils.getFirstFile((IMediaFile) res);
        if (f == null)
            return false;
        String path = f.getAbsolutePath();
        path = path.toLowerCase();
        dirspec = dirspec.toLowerCase();
        String dirs[] = dirspec.split("\\s*;\\s*");
        for (String d : dirs) {
            if (path.startsWith(d)) {
                return true;
            }
        }
        return false;
    } else {
        // folder
        return true;
    }
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:24,代码来源:HomeVideosFilter.java


注:本文中的sagex.phoenix.vfs.IMediaFile类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。