public void Save(BaseItem item, CancellationToken cancellationToken) { var builder = new StringBuilder(); builder.Append("<season>"); var task = XmlSaverHelpers.AddCommonNodes(item, builder, _libraryManager); Task.WaitAll(task); builder.Append("</season>"); var xmlFilePath = GetSavePath(item); XmlSaverHelpers.Save(builder, xmlFilePath, new string[] { }); }
public void Save(BaseItem item, CancellationToken cancellationToken) { var builder = new StringBuilder(); var tag = item is MusicVideo ? "musicvideo" : "movie"; builder.Append("<" + tag + ">"); var task = XmlSaverHelpers.AddCommonNodes(item, builder, _libraryManager); Task.WaitAll(task); var imdb = item.GetProviderId(MetadataProviders.Imdb); if (!string.IsNullOrEmpty(imdb)) { builder.Append("<id>" + SecurityElement.Escape(imdb) + "</id>"); } var musicVideo = item as MusicVideo; if (musicVideo != null) { if (!string.IsNullOrEmpty(musicVideo.Artist)) { builder.Append("<artist>" + SecurityElement.Escape(musicVideo.Artist) + "</artist>"); } if (!string.IsNullOrEmpty(musicVideo.Album)) { builder.Append("<album>" + SecurityElement.Escape(musicVideo.Album) + "</album>"); } } XmlSaverHelpers.AddMediaInfo((Video)item, builder); builder.Append("</" + tag + ">"); var xmlFilePath = GetSavePath(item); XmlSaverHelpers.Save(builder, xmlFilePath, new[] { "id", "album", "artist" }); }
public void Save(BaseItem item, CancellationToken cancellationToken) { var builder = new StringBuilder(); builder.Append("<episodedetails>"); var task = XmlSaverHelpers.AddCommonNodes(item, builder, _libraryManager); Task.WaitAll(task); if (item.IndexNumber.HasValue) { builder.Append("<episode>" + item.IndexNumber.Value.ToString(_usCulture) + "</episode>"); } if (item.ParentIndexNumber.HasValue) { builder.Append("<season>" + item.ParentIndexNumber.Value.ToString(_usCulture) + "</season>"); } if (item.PremiereDate.HasValue) { builder.Append("<aired>" + SecurityElement.Escape(item.PremiereDate.Value.ToShortDateString()) + "</aired>"); } XmlSaverHelpers.AddMediaInfo((Episode)item, builder); builder.Append("</episodedetails>"); var xmlFilePath = GetSavePath(item); XmlSaverHelpers.Save(builder, xmlFilePath, new string[] { "aired", "season", "episode" }); }
public void Save(BaseItem item, CancellationToken cancellationToken) { var builder = new StringBuilder(); builder.Append("<artist>"); var task = XmlSaverHelpers.AddCommonNodes(item, builder, _libraryManager); Task.WaitAll(task); var albums = ((MusicArtist)item).Children.OfType <MusicAlbum>().ToList(); AddAlbums(albums, builder); builder.Append("</artist>"); var xmlFilePath = GetSavePath(item); XmlSaverHelpers.Save(builder, xmlFilePath, new[] { "album" }); }
public void Save(BaseItem item, CancellationToken cancellationToken) { var builder = new StringBuilder(); builder.Append("<tvshow>"); var task = XmlSaverHelpers.AddCommonNodes(item, builder, _libraryManager); Task.WaitAll(task); var tvdb = item.GetProviderId(MetadataProviders.Tvdb); if (!string.IsNullOrEmpty(tvdb)) { builder.Append("<id>" + SecurityElement.Escape(tvdb) + "</id>"); builder.AppendFormat("<episodeguide><url cache=\"{0}.xml\">http://www.thetvdb.com/api/1D62F2F90030C444/series/{0}/all/{1}.zip</url></episodeguide>", tvdb, string.IsNullOrEmpty(_config.Configuration.PreferredMetadataLanguage) ? "en" : _config.Configuration.PreferredMetadataLanguage); } var imdb = item.GetProviderId(MetadataProviders.Imdb); if (!string.IsNullOrEmpty(imdb)) { builder.Append("<imdb_id>" + SecurityElement.Escape(imdb) + "</imdb_id>"); } builder.Append("<season>-1</season>"); builder.Append("<episode>-1</episode>"); var series = (Series)item; if (series.Status.HasValue) { builder.Append("<status>" + SecurityElement.Escape(series.Status.Value.ToString()) + "</status>"); } if (series.Studios.Count > 0) { builder.Append("<studio>" + SecurityElement.Escape(item.Studios[0]) + "</studio>"); } if (!string.IsNullOrEmpty(series.AirTime)) { builder.Append("<airs_time>" + SecurityElement.Escape(series.AirTime) + "</airs_time>"); } if (series.AirDays.Count == 7) { builder.Append("<airs_dayofweek>" + SecurityElement.Escape("Daily") + "</airs_dayofweek>"); } else if (series.AirDays.Count > 0) { builder.Append("<airs_dayofweek>" + SecurityElement.Escape(series.AirDays[0].ToString()) + "</airs_dayofweek>"); } builder.Append("</tvshow>"); var xmlFilePath = GetSavePath(item); XmlSaverHelpers.Save(builder, xmlFilePath, new[] { "id", "imdb_id", "season", "episode", "status", "studio", "airs_time", "airs_dayofweek", "episodeguide" }); }