本文整理汇总了C#中BaseItem.GetClientTypeName方法的典型用法代码示例。如果您正苦于以下问题:C# BaseItem.GetClientTypeName方法的具体用法?C# BaseItem.GetClientTypeName怎么用?C# BaseItem.GetClientTypeName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseItem
的用法示例。
在下文中一共展示了BaseItem.GetClientTypeName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AttachBasicFields
//.........这里部分代码省略.........
dto.ProductionYear = item.ProductionYear;
if (fields.Contains(ItemFields.ProviderIds))
{
dto.ProviderIds = item.ProviderIds;
}
dto.RunTimeTicks = item.RunTimeTicks;
if (fields.Contains(ItemFields.SortName))
{
dto.SortName = item.SortName;
}
if (fields.Contains(ItemFields.CustomRating))
{
dto.CustomRating = item.CustomRating;
}
if (fields.Contains(ItemFields.Taglines))
{
var hasTagline = item as IHasTaglines;
if (hasTagline != null)
{
dto.Taglines = hasTagline.Taglines;
}
if (dto.Taglines == null)
{
dto.Taglines = new List<string>();
}
}
dto.Type = item.GetClientTypeName();
dto.CommunityRating = item.CommunityRating;
if (fields.Contains(ItemFields.VoteCount))
{
dto.VoteCount = item.VoteCount;
}
if (item.IsFolder)
{
var folder = (Folder)item;
if (fields.Contains(ItemFields.IndexOptions))
{
dto.IndexOptions = folder.IndexByOptionStrings.ToArray();
}
}
var supportsPlaceHolders = item as ISupportsPlaceHolders;
if (supportsPlaceHolders != null)
{
dto.IsPlaceHolder = supportsPlaceHolders.IsPlaceHolder;
}
// Add audio info
var audio = item as Audio;
if (audio != null)
{
dto.Album = audio.Album;
var albumParent = audio.AlbumEntity;
if (albumParent != null)
示例2: GetItemInfo
/// <summary>
/// Converts a BaseItem to a BaseItemInfo
/// </summary>
/// <param name="item">The item.</param>
/// <param name="chapterOwner">The chapter owner.</param>
/// <param name="mediaSourceId">The media source identifier.</param>
/// <returns>BaseItemInfo.</returns>
/// <exception cref="System.ArgumentNullException">item</exception>
private BaseItemInfo GetItemInfo(BaseItem item, BaseItem chapterOwner, string mediaSourceId)
{
if (item == null)
{
throw new ArgumentNullException("item");
}
var info = new BaseItemInfo
{
Id = GetDtoId(item),
Name = item.Name,
MediaType = item.MediaType,
Type = item.GetClientTypeName(),
RunTimeTicks = item.RunTimeTicks,
IndexNumber = item.IndexNumber,
ParentIndexNumber = item.ParentIndexNumber,
PremiereDate = item.PremiereDate,
ProductionYear = item.ProductionYear
};
info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary);
if (info.PrimaryImageTag != null)
{
info.PrimaryImageItemId = GetDtoId(item);
}
var episode = item as Episode;
if (episode != null)
{
info.IndexNumberEnd = episode.IndexNumberEnd;
}
var hasSeries = item as IHasSeries;
if (hasSeries != null)
{
info.SeriesName = hasSeries.SeriesName;
}
var recording = item as ILiveTvRecording;
if (recording != null && recording.RecordingInfo != null)
{
if (recording.RecordingInfo.IsSeries)
{
info.Name = recording.RecordingInfo.EpisodeTitle;
info.SeriesName = recording.RecordingInfo.Name;
if (string.IsNullOrWhiteSpace(info.Name))
{
info.Name = recording.RecordingInfo.Name;
}
}
}
var audio = item as Audio;
if (audio != null)
{
info.Album = audio.Album;
info.Artists = audio.Artists;
if (info.PrimaryImageTag == null)
{
var album = audio.Parents.OfType<MusicAlbum>().FirstOrDefault();
if (album != null && album.HasImage(ImageType.Primary))
{
info.PrimaryImageTag = GetImageCacheTag(album, ImageType.Primary);
if (info.PrimaryImageTag != null)
{
info.PrimaryImageItemId = GetDtoId(album);
}
}
}
}
var musicVideo = item as MusicVideo;
if (musicVideo != null)
{
info.Album = musicVideo.Album;
if (!string.IsNullOrWhiteSpace(musicVideo.Artist))
{
info.Artists.Add(musicVideo.Artist);
}
}
var backropItem = item.HasImage(ImageType.Backdrop) ? item : null;
var thumbItem = item.HasImage(ImageType.Thumb) ? item : null;
var logoItem = item.HasImage(ImageType.Logo) ? item : null;
if (thumbItem == null)
{
if (episode != null)
//.........这里部分代码省略.........
示例3: GetBaseItemInfo
/// <summary>
/// Converts a BaseItem to a BaseItemInfo
/// </summary>
/// <param name="item">The item.</param>
/// <returns>BaseItemInfo.</returns>
/// <exception cref="System.ArgumentNullException">item</exception>
public BaseItemInfo GetBaseItemInfo(BaseItem item)
{
if (item == null)
{
throw new ArgumentNullException("item");
}
var info = new BaseItemInfo
{
Id = GetDtoId(item),
Name = item.Name,
MediaType = item.MediaType,
Type = item.GetClientTypeName(),
RunTimeTicks = item.RunTimeTicks
};
var imagePath = item.PrimaryImagePath;
if (!string.IsNullOrEmpty(imagePath))
{
info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary, imagePath);
}
return info;
}
示例4: AttachBasicFields
//.........这里部分代码省略.........
dto.ProductionYear = item.ProductionYear;
if (fields.Contains(ItemFields.ProviderIds))
{
dto.ProviderIds = item.ProviderIds;
}
dto.RunTimeTicks = item.RunTimeTicks;
if (fields.Contains(ItemFields.SortName))
{
dto.SortName = item.SortName;
}
if (fields.Contains(ItemFields.CustomRating))
{
dto.CustomRating = item.CustomRating;
}
if (fields.Contains(ItemFields.Taglines))
{
var hasTagline = item as IHasTaglines;
if (hasTagline != null)
{
dto.Taglines = hasTagline.Taglines;
}
if (dto.Taglines == null)
{
dto.Taglines = new List<string>();
}
}
dto.Type = item.GetClientTypeName();
dto.CommunityRating = item.CommunityRating;
dto.VoteCount = item.VoteCount;
if (item.IsFolder)
{
var folder = (Folder)item;
if (fields.Contains(ItemFields.IndexOptions))
{
dto.IndexOptions = folder.IndexByOptionStrings.ToArray();
}
}
// Add audio info
var audio = item as Audio;
if (audio != null)
{
dto.Album = audio.Album;
dto.Artists = audio.Artists;
var albumParent = audio.FindParent<MusicAlbum>();
if (albumParent != null)
{
dto.AlbumId = GetDtoId(albumParent);
var imagePath = albumParent.PrimaryImagePath;
if (!string.IsNullOrEmpty(imagePath))
{
dto.AlbumPrimaryImageTag = GetImageCacheTag(albumParent, ImageType.Primary, imagePath);
}
示例5: AttachBasicFields
//.........这里部分代码省略.........
dto.PremiereDate = item.PremiereDate;
dto.ProductionYear = item.ProductionYear;
if (fields.Contains(ItemFields.ProviderIds))
{
dto.ProviderIds = item.ProviderIds;
}
dto.RunTimeTicks = item.RunTimeTicks;
if (fields.Contains(ItemFields.SortName))
{
dto.SortName = item.SortName;
}
if (fields.Contains(ItemFields.CustomRating))
{
dto.CustomRating = item.CustomRating;
}
if (fields.Contains(ItemFields.Taglines))
{
if (!string.IsNullOrWhiteSpace(item.Tagline))
{
dto.Taglines = new List<string> { item.Tagline };
}
if (dto.Taglines == null)
{
dto.Taglines = new List<string>();
}
}
dto.Type = item.GetClientTypeName();
dto.CommunityRating = item.CommunityRating;
if (fields.Contains(ItemFields.VoteCount))
{
dto.VoteCount = item.VoteCount;
}
//if (item.IsFolder)
//{
// var folder = (Folder)item;
// if (fields.Contains(ItemFields.IndexOptions))
// {
// dto.IndexOptions = folder.IndexByOptionStrings.ToArray();
// }
//}
var supportsPlaceHolders = item as ISupportsPlaceHolders;
if (supportsPlaceHolders != null)
{
dto.IsPlaceHolder = supportsPlaceHolders.IsPlaceHolder;
}
// Add audio info
var audio = item as Audio;
if (audio != null)
{
dto.Album = audio.Album;
dto.ExtraType = audio.ExtraType;
var albumParent = audio.AlbumEntity;
示例6: GetItemInfo
/// <summary>
/// Converts a BaseItem to a BaseItemInfo
/// </summary>
/// <param name="item">The item.</param>
/// <param name="runtimeTicks">The now playing runtime ticks.</param>
/// <returns>BaseItemInfo.</returns>
/// <exception cref="System.ArgumentNullException">item</exception>
private BaseItemInfo GetItemInfo(BaseItem item, long? runtimeTicks)
{
if (item == null)
{
throw new ArgumentNullException("item");
}
var info = new BaseItemInfo
{
Id = GetDtoId(item),
Name = item.Name,
MediaType = item.MediaType,
Type = item.GetClientTypeName(),
RunTimeTicks = runtimeTicks,
IndexNumber = item.IndexNumber,
ParentIndexNumber = item.ParentIndexNumber,
PremiereDate = item.PremiereDate,
ProductionYear = item.ProductionYear
};
info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary);
if (info.PrimaryImageTag.HasValue)
{
info.PrimaryImageItemId = GetDtoId(item);
}
var episode = item as Episode;
if (episode != null)
{
info.IndexNumberEnd = episode.IndexNumberEnd;
}
var hasSeries = item as IHasSeries;
if (hasSeries != null)
{
info.SeriesName = hasSeries.SeriesName;
}
var recording = item as ILiveTvRecording;
if (recording != null && recording.RecordingInfo != null)
{
if (recording.RecordingInfo.IsSeries)
{
info.Name = recording.RecordingInfo.EpisodeTitle;
info.SeriesName = recording.RecordingInfo.Name;
if (string.IsNullOrWhiteSpace(info.Name))
{
info.Name = recording.RecordingInfo.Name;
}
}
}
var audio = item as Audio;
if (audio != null)
{
info.Album = audio.Album;
info.Artists = audio.Artists;
if (!info.PrimaryImageTag.HasValue)
{
var album = audio.Parents.OfType<MusicAlbum>().FirstOrDefault();
if (album != null && album.HasImage(ImageType.Primary))
{
info.PrimaryImageTag = GetImageCacheTag(album, ImageType.Primary);
if (info.PrimaryImageTag.HasValue)
{
info.PrimaryImageItemId = GetDtoId(album);
}
}
}
}
var musicVideo = item as MusicVideo;
if (musicVideo != null)
{
info.Album = musicVideo.Album;
if (!string.IsNullOrWhiteSpace(musicVideo.Artist))
{
info.Artists.Add(musicVideo.Artist);
}
}
var backropItem = item.HasImage(ImageType.Backdrop) ? item : null;
var thumbItem = item.HasImage(ImageType.Thumb) ? item : null;
var logoItem = item.HasImage(ImageType.Logo) ? item : null;
if (thumbItem == null)
{
if (episode != null)
{
//.........这里部分代码省略.........
示例7: FilterItem
private bool FilterItem(BaseItem item, out int type)
{
type = -1;
if (!Plugin.Instance.Configuration.IsEnabled)
{
return false;
}
if (item.LocationType == LocationType.Virtual)
{
return false;
}
if (item.SourceType != SourceType.Library)
{
return false;
}
var typeName = item.GetClientTypeName();
if (string.IsNullOrEmpty(typeName))
{
return false;
}
switch (typeName)
{
//MOVIES
case "Movie":
if (!Plugin.Instance.Configuration.tkMovies)
{
return false;
}
type = 0;
break;
case "Boxset":
if (!Plugin.Instance.Configuration.tkBoxSets)
{
return false;
}
type = 4;
break;
case "Series":
case "Season":
case "Episode":
if (!Plugin.Instance.Configuration.tkTVShows)
{
return false;
}
type = 1;
break;
case "Audio":
case "MusicArtist":
case "MusicAlbum":
if (!Plugin.Instance.Configuration.tkMusic)
{
return false;
}
type = 2;
break;
case "MusicVideo":
if (!Plugin.Instance.Configuration.tkMusicVideos)
{
return false;
}
type = 3;
break;
default:
type = -1;
_logger.Debug(String.Format("Emby.Kodi.SyncQueue: Ingoring Type {0}", typeName));
return false;
}
return true;
}
示例8: GetNowPlayingInfo
/// <summary>
/// Converts a BaseItem to a BaseItemInfo
/// </summary>
/// <param name="item">The item.</param>
/// <param name="mediaSourceId">The media version identifier.</param>
/// <param name="nowPlayingRuntimeTicks">The now playing runtime ticks.</param>
/// <returns>BaseItemInfo.</returns>
/// <exception cref="System.ArgumentNullException">item</exception>
private BaseItemInfo GetNowPlayingInfo(BaseItem item, string mediaSourceId, long? nowPlayingRuntimeTicks)
{
if (item == null)
{
throw new ArgumentNullException("item");
}
var info = new BaseItemInfo
{
Id = GetDtoId(item),
Name = item.Name,
MediaType = item.MediaType,
Type = item.GetClientTypeName(),
RunTimeTicks = nowPlayingRuntimeTicks,
MediaSourceId = mediaSourceId
};
info.PrimaryImageTag = GetImageCacheTag(item, ImageType.Primary);
var backropItem = item.HasImage(ImageType.Backdrop) ? item : null;
var thumbItem = item.HasImage(ImageType.Thumb) ? item : null;
if (thumbItem == null)
{
var episode = item as Episode;
if (episode != null)
{
var series = episode.Series;
if (series != null && series.HasImage(ImageType.Thumb))
{
thumbItem = series;
}
}
}
if (backropItem == null)
{
var episode = item as Episode;
if (episode != null)
{
var series = episode.Series;
if (series != null && series.HasImage(ImageType.Backdrop))
{
backropItem = series;
}
}
}
if (thumbItem == null)
{
thumbItem = item.Parents.FirstOrDefault(i => i.HasImage(ImageType.Thumb));
}
if (thumbItem != null)
{
info.ThumbImageTag = GetImageCacheTag(thumbItem, ImageType.Thumb);
info.ThumbItemId = GetDtoId(thumbItem);
}
if (thumbItem != null)
{
info.BackdropImageTag = GetImageCacheTag(backropItem, ImageType.Backdrop);
info.BackdropItemId = GetDtoId(backropItem);
}
return info;
}
示例9: GetRow
/// <summary> Gets a row. </summary>
/// <param name="item"> The item. </param>
/// <returns> The row. </returns>
private ReportRow GetRow(BaseItem item)
{
var hasTrailers = item as IHasTrailers;
var hasSpecialFeatures = item as IHasSpecialFeatures;
var video = item as Video;
ReportRow rRow = new ReportRow
{
Id = item.Id.ToString("N"),
HasLockData = item.IsLocked,
IsUnidentified = item.IsUnidentified,
HasLocalTrailer = hasTrailers != null ? hasTrailers.GetTrailerIds().Count() > 0 : false,
HasImageTagsPrimary = (item.ImageInfos != null && item.ImageInfos.Count(n => n.Type == ImageType.Primary) > 0),
HasImageTagsBackdrop = (item.ImageInfos != null && item.ImageInfos.Count(n => n.Type == ImageType.Backdrop) > 0),
HasImageTagsLogo = (item.ImageInfos != null && item.ImageInfos.Count(n => n.Type == ImageType.Logo) > 0),
HasSpecials = hasSpecialFeatures != null ? hasSpecialFeatures.SpecialFeatureIds.Count > 0 : false,
HasSubtitles = video != null ? video.HasSubtitles : false,
RowType = ReportHelper.GetRowType(item.GetClientTypeName())
};
return rRow;
}