예제 #1
0
        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[] { });
        }
예제 #2
0
        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>");
            }

            XmlSaverHelpers.AddMediaInfo((Video)item, builder);

            builder.Append("</" + tag + ">");

            var xmlFilePath = GetSavePath(item);

            XmlSaverHelpers.Save(builder, xmlFilePath, new[]
            {
                "id"
            });
        }
예제 #3
0
        public void Save(BaseItem item, CancellationToken cancellationToken)
        {
            var builder = new StringBuilder();

            builder.Append("<album>");

            var task = XmlSaverHelpers.AddCommonNodes(item, builder, _libraryManager);

            Task.WaitAll(task);

            var tracks = ((MusicAlbum)item).Children.OfType <Audio>().ToList();

            var artists = tracks
                          .SelectMany(i => new[] { i.Artist, i.AlbumArtist })
                          .Where(i => !string.IsNullOrEmpty(i))
                          .Distinct(StringComparer.OrdinalIgnoreCase);

            foreach (var artist in artists)
            {
                builder.Append("<artist>" + SecurityElement.Escape(artist) + "</artist>");
            }

            AddTracks(tracks, builder);

            builder.Append("</album>");

            var xmlFilePath = GetSavePath(item);

            XmlSaverHelpers.Save(builder, xmlFilePath, new[]
            {
                "track"
            });
        }
예제 #4
0
        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[] { });
        }
예제 #5
0
        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"
            });
        }
예제 #6
0
        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"
            });
        }