public static ChannelViewModel FromApiChannel(ApiChannel apiChannel)
        {
            ChannelViewModel viewModel = new ChannelViewModel()
            {
                Id               = apiChannel.Items[0].Id,
                ChannelTitle     = apiChannel.Items[0].Snippet.Title,
                ChannelUrl       = "https://www.youtube.com/channel/" + apiChannel.Items[0].Id,
                ChannelThumbnail = apiChannel.Items[0].Snippet.Thumbnails.Default.Url == null ? "" : apiChannel.Items[0].Snippet.Thumbnails.Default.Url,
                ChannelBanner    = apiChannel.Items[0].BrandingSettings.Image == null ? "" : apiChannel.Items[0].BrandingSettings.Image.BannerExternalUrl
            };

            return(viewModel);
        }
 public ViewsPerChannelViewModel(ChannelViewModel channel, int numVideos)
 {
     Channel   = channel;
     NumVideos = numVideos;
 }
Exemplo n.º 3
0
 public TimePerChannelViewModel(ChannelViewModel channel, TimeSpan timeWatched)
 {
     Channel     = channel;
     TimeWatched = timeWatched;
 }
 public static string SerializeObject(ChannelViewModel viewModel)
 {
     return(viewModel.Id + "#del#" + viewModel.ChannelTitle + "#del#" + viewModel.ChannelUrl + "#del#" + viewModel.ChannelThumbnail + "#del#" + viewModel.ChannelBanner);
 }