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


Java IMediaFile.getMetadata方法代码示例

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


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

示例1: 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

示例2: resolve

import sagex.phoenix.vfs.IMediaFile; //导入方法依赖的package包/类
@Override
public String resolve(IMediaFile file, String varName) {
    if (file == null || file.getMediaObject() == null || varName == null) {
        return null;
    }
    IMetadata md = file.getMetadata();
    SageProperty key = props.get(varName);
    if (key == null) {
        Loggers.LOG.warn("MetadataResolver: Not a valid property name " + varName);
        return null;
    }

    String s = md.get(key);
    // sometimes the Title is blank for, so we'll use the EpisodeName
    if (StringUtils.isEmpty(s) && "EpisodeName".equals(varName)) {
        s = md.get(props.get("Title"));
    }

    return s;
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:21,代码来源:MediaAPI.java

示例3: resolveFanartMetadata

import sagex.phoenix.vfs.IMediaFile; //导入方法依赖的package包/类
/**
 * this is meant to return a subset of metadata properties that is useful
 * for determining fanart locations
 *
 * @param mediaType
 * @param mediaObject
 * @return
 */
private Map<String, String> resolveFanartMetadata(Map<String, String> metaadata, MediaType mediaType, IMediaFile mf) {
    if (mf == null)
        return null;

    // if we are given a metadata map, then use use it, even if it's empty.
    // this allows us to bypass the season specific fanart by passing in an
    // empty metadata map
    if (metaadata != null)
        return metaadata;

    if (mediaType == MediaType.TV) {
        IMetadata md = mf.getMetadata();
        if (md.getEpisodeNumber() > 0) {
            Map<String, String> props = new HashMap<String, String>();
            props.put(FanartUtil.SEASON_NUMBER, String.valueOf(md.getSeasonNumber()));
            props.put(FanartUtil.EPISODE_NUMBER, String.valueOf(md.getEpisodeNumber()));
            return props;
        }
    }
    return null;
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:30,代码来源:FanartAPI.java

示例4: 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

示例5: visitFile

import sagex.phoenix.vfs.IMediaFile; //导入方法依赖的package包/类
@Override
public boolean visitFile(IMediaFile res, IProgressMonitor monitor) {
    IMetadata md = res.getMetadata();
    if (md == null)
        return false;

    List<ICastMember> actors = md.getActors();
    if (actors != null) {
        for (ICastMember cm : actors) {
            if (isMatch(cm)) {
                addTo.add(res);
                return true;
            }
        }
    }
    return false;
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:18,代码来源:ActorSearchVisitor.java

示例6: updateCustomMetadataFieldsOnly

import sagex.phoenix.vfs.IMediaFile; //导入方法依赖的package包/类
private void updateCustomMetadataFieldsOnly(IMediaFile file, IMetadata md, Hints options) {
    log.warn("Only custom metadata fields are being updated for file " + file + "; Hints: " + options);
    // only update the custom metadata fields
    ISageCustomMetadataRW sage = file.getMetadata();
    sage.setDiscNumber(md.getDiscNumber());
    sage.setEpisodeNumber(md.getEpisodeNumber());
    sage.setIMDBID(md.getIMDBID());
    sage.setMediaProviderDataID(md.getMediaProviderDataID());
    sage.setMediaProviderID(md.getMediaProviderID());
    sage.setMediaTitle(md.getMediaTitle());
    sage.setMediaType(md.getMediaType());
    sage.setSeasonNumber(md.getSeasonNumber());
    sage.setUserRating(md.getUserRating());
    sage.getFanart().clear();
    sage.getFanart().addAll(md.getFanart());
    sage.setTagLine(md.getTagLine());
    if (config.getFetchQuotesAndTrivia()) {
        sage.setQuotes(md.getQuotes());
        sage.setTrivia(md.getTrivia());
    }
    sage.setTrailerUrl(md.getTrailerUrl());
    sage.setCollectionID(md.getCollectionID());
    sage.setCollectionName(md.getCollectionName());
    sage.setCollectionOverview(md.getCollectionOverview());
    sage.setEpisodeCount(md.getEpisodeCount());
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:27,代码来源:Sage7Persistence.java

示例7: logMetadataUpdated

import sagex.phoenix.vfs.IMediaFile; //导入方法依赖的package包/类
public static void logMetadataUpdated(IMediaFile file) {
    try {
        IMetadata md = file.getMetadata();
        StringBuilder sb = new StringBuilder("UPDATE");
        sb.append("; ").append(PathUtils.getLocation(file));
        sb.append("; ").append(md.getMediaTitle());
        sb.append("; ").append(md.getMediaType());
        if (file.isType(MediaResourceType.TV.value())) {
            sb.append("; S").append(md.getSeasonNumber());
            if (md.getEpisodeNumber() > 0) {
                sb.append("; E").append(md.getEpisodeNumber());
            }
            if (md.getDiscNumber() > 0) {
                sb.append("; D").append(md.getDiscNumber());
            }
        }
        sb.append("; ").append(md.getExternalID());
        sb.append("; ").append(file.getId());

        Loggers.METADATA.info(sb.toString());
    } catch (Exception e) {
        Loggers.LOG.warn("Failed to write metadata log message", e);
    }
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:25,代码来源:LogUtil.java

示例8: testFormattedTVTitles

import sagex.phoenix.vfs.IMediaFile; //导入方法依赖的package包/类
@Test
public void testFormattedTVTitles() {
    IMediaFile mf = (IMediaFile) FileResourceFactory.createResource(InitPhoenix.ProjectHome("target/junit/testing/House S01E01.avi"));
    IMetadata md = mf.getMetadata();
    md.setMediaType("TV");
    md.setEpisodeName("Test Episode");
    md.setMediaTitle("House");
    md.setRelativePathWithTitle("House");

    md = mf.getMetadata();

    String title = phoenix.media.GetFormattedTitle(mf);
    assertEquals("House - Test Episode", title);

    md.setSeasonNumber(1);
    md.setEpisodeNumber(5);
    title = phoenix.media.GetFormattedTitle(mf);
    assertEquals("House - S01E05 - Test Episode", title);
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:20,代码来源:TestFormattedTitles.java

示例9: testFormattedMoviesTitles

import sagex.phoenix.vfs.IMediaFile; //导入方法依赖的package包/类
@Test
public void testFormattedMoviesTitles() {
    IMediaFile mf = (IMediaFile) FileResourceFactory.createResource(InitPhoenix.ProjectHome("target/junit/testing/Movie.avi"));
    IMetadata md = mf.getMetadata();
    md.setMediaType("Movie");
    md.setEpisodeName("Test Movie");
    md.setMediaTitle("Test Movie");
    md.setRelativePathWithTitle("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,代码行数:23,代码来源:TestFormattedTitles.java

示例10: GetSeriesInfo

import sagex.phoenix.vfs.IMediaFile; //导入方法依赖的package包/类
/**
 * Given a MediaFile return the SeriesInfo, if it's been assigned.
 *
 * @param mediaFile
 * @return
 */
public ISeriesInfo GetSeriesInfo(IMediaFile mediaFile) {
    if (mediaFile == null)
        return null;

    boolean update = false;
    IMetadata md = mediaFile.getMetadata();

    Object seriesInfo = null;

    int id = md.getSeriesInfoID();
    if (id > 0) {
        seriesInfo = SeriesInfoAPI.GetSeriesInfoForID(String.valueOf(id));
        if (seriesInfo != null)
            return new SageSeriesInfo(seriesInfo);
    }

    // we don't have a series info yet, so udpate it when we do
    update = true;

    // Ask sagetv for it
    seriesInfo = ShowAPI.GetShowSeriesInfo(phoenix.media.GetSageMediaFile(mediaFile));
    if (seriesInfo == null) {
        // still no series info, check the provider id
        id = TVSeriesUtil.createNewSeriesInfoId(md.getMediaProviderID(), md.getMediaProviderDataID());
        seriesInfo = SeriesInfoAPI.GetSeriesInfoForID(String.valueOf(id));
    }

    if (seriesInfo != null) {
        if (update) {
            md.setSeriesInfoID(NumberUtils.toInt(SeriesInfoAPI.GetSeriesID(seriesInfo)));
        }
        return new SageSeriesInfo(seriesInfo);
    }

    // nothing found
    return null;
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:44,代码来源:MediaAPI.java

示例11: resolveMediaType

import sagex.phoenix.vfs.IMediaFile; //导入方法依赖的package包/类
private MediaType resolveMediaType(MediaType mediaType, IMediaFile mf) {
    if (mf == null)
        return mediaType;
    if (mediaType != null)
        return mediaType;

    MediaType mt = null;
    IMetadata md = mf.getMetadata();
    if (md != null) {
        mt = MediaType.toMediaType(md.getMediaType());
    }
    if (mt == null) {
        if (mf.isType(MediaResourceType.TV.value())) {
            mt = MediaType.TV;
        } else if (mf.isType(MediaResourceType.MUSIC.value())) {
            mt = MediaType.MUSIC;
        } else {
            mt = MediaType.MOVIE;
        }
    }

    // do last check for movie files
    // TODO: Move this to the IMetadata implementations
    // AiringMetadataProxy has it already
    String altCat = ShowAPI.GetShowCategory(mf.getMediaObject());
    if (altCat != null) {
        if (altCat.equals("Movie") || altCat.equals(Configuration.GetProperty("alternate_movie_category", "Movie"))) {
            mt = MediaType.MOVIE;
        }
    }

    return mt;
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:34,代码来源:FanartAPI.java

示例12: clearMetadata

import sagex.phoenix.vfs.IMediaFile; //导入方法依赖的package包/类
/**
 * Given a {@link IMediaFile} it will clear the custom metadata (ie fanart
 * metadata) associated with it.
 *
 * @param mf
 */
public static void clearMetadata(IMediaFile mf) {
    if (mf == null)
        return;
    ISageCustomMetadataRW md = mf.getMetadata();
    md.setDiscNumber(0);
    md.setEpisodeNumber(0);
    md.setIMDBID("");
    md.setMediaProviderDataID("");
    md.setMediaProviderID("");
    md.setMediaTitle("");
    md.setMediaType("");
    md.setSeasonNumber(0);
    md.setUserRating(0);
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:21,代码来源:ClearCustomMetadataFieldsVisitor.java

示例13: visitFile

import sagex.phoenix.vfs.IMediaFile; //导入方法依赖的package包/类
@Override
public boolean visitFile(IMediaFile res, IProgressMonitor monitor) {
    String name = res.getTitle();
    if (name != null) {
        name = name.toLowerCase();
        if (name.contains(titleContains)) {
            addTo.add(res);
            return true;
        }
    }

    if (res.isType(MediaResourceType.TV.value())) {
        // check episode name
        IMetadata md = res.getMetadata();
        if (md == null)
            return false;
        name = md.getEpisodeName();
        if (name != null) {
            name = name.toLowerCase();
            if (name.contains(titleContains)) {
                addTo.add(res);
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:29,代码来源:TitleSearchVisitor.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;

    if (o1 instanceof IMediaFile && o2 instanceof IMediaFile) {
        IMediaFile m1 = ((IMediaFile) o1);
        IMediaFile m2 = ((IMediaFile) o2);
        if (m1.getMetadata() == null || m1.getMetadata().getOriginalAirDate() == null)
            return 1;
        if (m2.getMetadata() == null || m2.getMetadata().getOriginalAirDate() == null)
            return -1;
        long t1 = m1.getMetadata().getOriginalAirDate().getTime();
        long t2 = m2.getMetadata().getOriginalAirDate().getTime();
        if (t1 > t2)
            return 1;
        if (t1 < t2)
            return -1;
    }

    // we are probably comparing folders or items to folders, etc..
    if (o1.getTitle() != null) {
        return o1.getTitle().compareTo(o2.getTitle());
    } else {
        return 1;
    }
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:29,代码来源:OriginalAirDateSorter.java

示例15: visitFile

import sagex.phoenix.vfs.IMediaFile; //导入方法依赖的package包/类
@Override
public boolean visitFile(IMediaFile res, IProgressMonitor monitor) {
    if (res.isType(MediaResourceType.ANY_VIDEO.value())) {
        IMetadata md = res.getMetadata();
        log.debug("Updating Ratings for " + res.getTitle() + " " + md.getEpisodeName());
        monitor.setTaskName("Updating Ratings for " + res.getTitle() + " " + md.getEpisodeName());

        if (fixParentalRating(res, md)) {
            incrementAffected();
        }
    }

    return true;
}
 
开发者ID:stuckless,项目名称:sagetv-phoenix-core,代码行数:15,代码来源:FixParentalRatingsVisitor.java


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