本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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());
}
示例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;
}
示例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());
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
}
示例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;
}