public bool RefreshPlaylist(int playlistId) { var youtubePlaylist = _contentService.GetById(playlistId); var youtubePlaylistId = youtubePlaylist.GetValue <string>(YoutubePlaylistConstants.YoutubePlaylistIdNodeName); try { _youtubePlaylistContentImporter.Import(youtubePlaylist.Id, youtubePlaylistId); } catch (Exception e) { Logger.Error(typeof(PlaylistApiController), $"Unable to refresh Youtube playlist id {youtubePlaylistId}"); return(false); } return(true); }
private void ContentServiceOnSaved(IContentService sender, ContentSavedEventArgs e) { var playlistEntities = e.SavedEntities.Where(ent => ent.ContentType.Alias.InvariantEquals(YoutubePlaylistConstants.ContentTypeAlias)); foreach (var youtubePlaylist in playlistEntities) { var youtubePlaylistId = youtubePlaylist.GetValue <string>(YoutubePlaylistConstants.YoutubePlaylistIdNodeName); if (string.IsNullOrEmpty(youtubePlaylistId)) { return; } _youtubePlaylistContentImporter.Import(youtubePlaylist.Id, youtubePlaylistId); } }