private void OnActivityReceive(ChannelActivityEvent activityEvent)
        {
            StoredChannel   channel = Channels.First(c => c.ChannelId == activityEvent.ChannelId);
            YoutubeActivity latest  = activityEvent.Result.items.OrderByDescending(act => act.Snippet.PublishedAt).First();

            channel.NewVideo           = channel.LastVideoId == null || !channel.LastVideoId.Equals(latest.VideoId);
            channel.LastVideoId        = latest.VideoId;
            channel.LastVideoImageLink = latest.ImageLink;
            channel.LastVideoTitle     = latest.Snippet.Title;
            channel.LastVideoTime      = latest.Snippet.PublishedAt.ToShortDateString() + " " + latest.Snippet.PublishedAt.ToShortTimeString();
            channel.Activity           = latest;
            channel.Searching          = false;
            App.ChannelsDatastore.AddUpdate(channel);
        }
Beispiel #2
0
 public static YoutubeActivity RequestAllParts(this YoutubeActivity activity)
 {
     return(activity.RequestSnippet().RequestContentDetails());
 }
Beispiel #3
0
 public static YoutubeActivity RequestSnippet(this YoutubeActivity activity)
 {
     return(activity.RequestPart(PartType.Snippet));
 }
Beispiel #4
0
 public static YoutubeActivity RequestContentDetails(this YoutubeActivity activity)
 {
     return(activity.RequestPart(PartType.ContentDetails));
 }
Beispiel #5
0
 public static YoutubeActivity RequestPart(this YoutubeActivity activity, PartType partType)
 {
     return(Activity(activity.Settings.Clone(), activity.PartTypes.Append(partType).ToArray()));
 }