本文整理汇总了C#中IMediaItem类的典型用法代码示例。如果您正苦于以下问题:C# IMediaItem类的具体用法?C# IMediaItem怎么用?C# IMediaItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMediaItem类属于命名空间,在下文中一共展示了IMediaItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeStatus
public void ChangeStatus(IMediaItem inItem, MediaStatus inStatus)
{
var item = (TvEpisode)inItem;
item.Status = inStatus;
Cabinet.SetAsync(item).Wait();
}
示例2: PostStatusAsync
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
if (mediaItems == null)
throw new ArgumentNullException(nameof(mediaItems));
if (mediaItems.Length == 0)
throw new ArgumentException("Err:Media not specified.");
foreach (var item in mediaItems)
{
if (item == null)
throw new ArgumentException("Err:Media not specified.");
if (!item.Exists)
throw new ArgumentException("Err:Media not found.");
}
var uploadTasks = from m in mediaItems
select this.UploadMediaItem(m);
var mediaIds = await Task.WhenAll(uploadTasks)
.ConfigureAwait(false);
await this.tw.PostStatus(text, inReplyToStatusId, mediaIds)
.ConfigureAwait(false);
}
示例3: AbstractTranscoder
public AbstractTranscoder(IMediaItem item, uint quality, bool isDirect, uint offsetSeconds, uint lengthSeconds)
{
State = TranscodeState.None;
Item = item;
Quality = quality;
IsDirect = isDirect;
OffsetSeconds = offsetSeconds;
LengthSeconds = lengthSeconds;
}
示例4: VideoTranscoder
public VideoTranscoder(IMediaItem item, uint quality, bool isDirect, uint? width, uint? height, bool maintainAspect, uint offsetSeconds, uint lengthSeconds)
: base(item, quality, isDirect, offsetSeconds, lengthSeconds)
{
Width = width;
Height = height;
MaintainAspect = maintainAspect;
OffsetSeconds = offsetSeconds;
LengthSeconds = lengthSeconds;
}
示例5: BuildMediaItemsTimelineMediaItemViewModel
private MediaItemViewModel BuildMediaItemsTimelineMediaItemViewModel(IMediaItem mediaItem, MediaItemsTimelineViewModel mediaItemsTimelineViewModel, TrackViewModel trackViewModel)
{
return new MediaItemViewModel
{
MediaItem = mediaItem,
MediaItemsTimelineViewModel = mediaItemsTimelineViewModel,
TrackViewModel = trackViewModel
};
}
示例6: Compare
public override int Compare(IMediaItem x, IMediaItem y)
{
if (x == null) {
throw new ArgumentNullException("x");
}
if (y == null) {
throw new ArgumentNullException("y");
}
return comp.Compare(x.Title, y.Title);
}
示例7: Compare
public override int Compare(IMediaItem x, IMediaItem y)
{
var xm = x as IMetaInfo;
var ym = y as IMetaInfo;
if (xm != null && ym != null) {
var rv = xm.InfoDate.CompareTo(ym.InfoDate);
if (rv != 0) {
return rv;
}
}
return base.Compare(x, y);
}
示例8: KFile
public KFile( Kernel kernel, KDevice device, IMediaItem item )
{
Kernel = kernel;
Device = device;
Item = item;
FolderOffset = 0;
IsOpen = true;
CanWrite = !( ( item.Attributes & MediaItemAttributes.ReadOnly ) == MediaItemAttributes.ReadOnly );
CanSeek = false;
IsValid = true;
}
示例9: Compare
public override int Compare(IMediaItem x, IMediaItem y)
{
if (x == null && y == null) {
return 0;
throw new ArgumentNullException("x");
}
if (x == null) {
return 1;
}
if (y == null) {
return -1;
}
return comparer.Compare(x.ToComparableTitle(), y.ToComparableTitle());
}
示例10: Compare
public override int Compare(IMediaItem x, IMediaItem y)
{
if (x == null) {
throw new ArgumentNullException("x");
}
if (y == null) {
throw new ArgumentNullException("y");
}
ITitleComparable tx = x as ITitleComparable, ty = y as ITitleComparable;
return comp.Compare(
tx != null ? tx.ToComparableTitle() : x.Title.StemCompareBase(),
ty != null ? ty.ToComparableTitle() : y.Title.StemCompareBase()
);
}
示例11: RegisterPath
private void RegisterPath(IMediaItem item)
{
var path = item.Path;
string id;
if (!paths.ContainsKey(path)) {
while (ids.ContainsKey(id = idGen.Next(1000, int.MaxValue).ToString("X8"))) {
}
paths[path] = id;
}
else {
id = paths[path];
}
ids[id] = new WeakReference(item);
item.Id = id;
}
示例12: PostStatusAsync
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
if (mediaItems == null)
throw new ArgumentNullException(nameof(mediaItems));
if (mediaItems.Length == 0)
throw new ArgumentException("Err:Media not specified.");
foreach (var item in mediaItems)
{
if (item == null)
throw new ArgumentException("Err:Media not specified.");
if (!item.Exists)
throw new ArgumentException("Err:Media not found.");
}
await Task.Run(() => this.tw.PostStatusWithMultipleMedia(text, inReplyToStatusId, mediaItems))
.ConfigureAwait(false);
}
示例13: TryParseItem
public bool TryParseItem(XElement element, out IMediaItem item)
{
item = null;
if (element.Name != "video")
{
return false;
}
VideoItem videoItem = new VideoItem();
item = videoItem;
XItemParserMediaItem.ReadItem(videoItem, element);
var audioTracks = (from ats in element.Elements("audioTracks")
from at in ats.Elements("audioTrack")
select new AudioTrack { Title = (string)at.Attribute("title") }).ToArray();
for (int i = 0; i < audioTracks.Length; i++)
{
audioTracks[i].Index = i;
}
videoItem.AudioTracks = audioTracks;
videoItem.ItemType = "Video";
return true;
}
示例14: UploadMedia
public string UploadMedia(IMediaItem item, ref long? mediaId)
{
if (MyCommon._endingFlag) return "";
if (Twitter.AccountState != MyCommon.ACCOUNT_STATE.Valid) return "";
HttpStatusCode res;
var content = "";
try
{
res = twCon.UploadMedia(item, ref content);
}
catch (Exception ex)
{
return "Err:" + ex.Message;
}
var err = this.CheckStatusCode(res, content);
if (err != null) return err;
TwitterUploadMediaResult status;
try
{
status = TwitterUploadMediaResult.ParseJson(content);
}
catch (SerializationException ex)
{
MyCommon.TraceOut(ex.Message + Environment.NewLine + content);
return "Err:Json Parse Error(DataContractJsonSerializer)";
}
catch (Exception ex)
{
MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content);
return "Err:Invalid Json!";
}
mediaId = status.MediaId;
return "";
}
示例15: PostStatusWithMedia
public string PostStatusWithMedia(string postStr, long? reply_to, IMediaItem item)
{
if (MyCommon._endingFlag) return "";
if (Twitter.AccountState != MyCommon.ACCOUNT_STATE.Valid) return "";
HttpStatusCode res;
var content = "";
try
{
res = twCon.UpdateStatusWithMedia(postStr, reply_to, item, ref content);
}
catch(Exception ex)
{
return "Err:" + ex.Message;
}
// 投稿に成功していても404が返ることがあるらしい: https://dev.twitter.com/discussions/1213
if (res == HttpStatusCode.NotFound) return "";
var err = this.CheckStatusCode(res, content);
if (err != null) return err;
TwitterStatus status;
try
{
status = TwitterStatus.ParseJson(content);
}
catch(SerializationException ex)
{
MyCommon.TraceOut(ex.Message + Environment.NewLine + content);
return "Err:Json Parse Error(DataContractJsonSerializer)";
}
catch(Exception ex)
{
MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content);
return "Err:Invalid Json!";
}
_followersCount = status.User.FollowersCount;
_friendsCount = status.User.FriendsCount;
_statusesCount = status.User.StatusesCount;
_location = status.User.Location;
_bio = status.User.Description;
if (IsPostRestricted(status))
{
return "OK:Delaying?";
}
return "";
}