예제 #1
0
        public static void ProcessAlbumData(BaseItem item, LastfmAlbum data)
        {
            if (!string.IsNullOrWhiteSpace(data.mbid))
            {
                item.SetProviderId(MetadataProviders.Musicbrainz, data.mbid);
            }

            var overview = data.wiki != null ? data.wiki.content : null;

            if (!item.LockedFields.Contains(MetadataFields.Overview))
            {
                item.Overview = overview;
            }

            DateTime release;

            if (DateTime.TryParse(data.releasedate, out release) && release.Year != 1901)
            {
                item.PremiereDate   = release;
                item.ProductionYear = release.Year;
            }

            if (data.toptags != null && !item.LockedFields.Contains(MetadataFields.Tags))
            {
                AddTags(item, data.toptags);
            }

            var album = (MusicAlbum)item;

            string imageSize;

            album.LastFmImageUrl  = GetImageUrl(data, out imageSize);
            album.LastFmImageSize = imageSize;
        }
예제 #2
0
        public static void ProcessAlbumData(BaseItem item, LastfmAlbum data)
        {
            if (!string.IsNullOrWhiteSpace(data.mbid)) item.SetProviderId(MetadataProviders.Musicbrainz, data.mbid);

            var overview = data.wiki != null ? data.wiki.content : null;

            if (!item.LockedFields.Contains(MetadataFields.Overview))
            {
                item.Overview = overview;
            }

            DateTime release;

            if (DateTime.TryParse(data.releasedate, out release) && release.Year != 1901)
            {
                item.PremiereDate = release;
                item.ProductionYear = release.Year;
            }

            if (data.toptags != null && !item.LockedFields.Contains(MetadataFields.Tags))
            {
                AddTags(item, data.toptags);
            }

            var album = (MusicAlbum)item;
            album.LastFmImageUrl = GetImageUrl(data);
        }
예제 #3
0
        public static void ProcessAlbumData(BaseItem item, LastfmAlbum data)
        {
            if (!string.IsNullOrWhiteSpace(data.mbid)) item.SetProviderId(MetadataProviders.Musicbrainz, data.mbid);

            var overview = data.wiki != null ? data.wiki.content : null;

            item.Overview = overview;

            DateTime release;
            DateTime.TryParse(data.releasedate, out release);
            item.PremiereDate = release;
            item.ProductionYear = release.Year;
            if (data.toptags != null)
            {
                AddTags(item, data.toptags);
            }
        }
예제 #4
0
        public static void ProcessAlbumData(BaseItem item, LastfmAlbum data)
        {
            var overview = data.wiki != null ? data.wiki.content : null;

            if (!item.LockedFields.Contains(MetadataFields.Overview))
            {
                item.Overview = overview;
            }

            // Only grab the date here if the album doesn't already have one, since id3 tags are preferred
            DateTime release;

            if (DateTime.TryParse(data.releasedate, out release))
            {
                // Lastfm sends back null as sometimes 1901, other times 0
                if (release.Year > 1901)
                {
                    if (!item.PremiereDate.HasValue)
                    {
                        item.PremiereDate = release;
                    }

                    if (!item.ProductionYear.HasValue)
                    {
                        item.ProductionYear = release.Year;
                    }
                }
            }

            if (data.toptags != null && !item.LockedFields.Contains(MetadataFields.Tags))
            {
                AddTags(item, data.toptags);
            }

            var album = (MusicAlbum)item;

            string imageSize;

            album.LastFmImageUrl = GetImageUrl(data, out imageSize);
            album.LastFmImageSize = imageSize;
        }
예제 #5
0
        private void ProcessAlbumData(MusicAlbum item, LastfmAlbum data)
        {
            var overview = data.wiki != null ? data.wiki.content : null;

            if (!item.LockedFields.Contains(MetadataFields.Overview))
            {
                item.Overview = overview;
            }

            // Only grab the date here if the album doesn't already have one, since id3 tags are preferred
            DateTime release;

            if (DateTime.TryParse(data.releasedate, out release))
            {
                // Lastfm sends back null as sometimes 1901, other times 0
                if (release.Year > 1901)
                {
                    if (!item.PremiereDate.HasValue)
                    {
                        item.PremiereDate = release;
                    }

                    if (!item.ProductionYear.HasValue)
                    {
                        item.ProductionYear = release.Year;
                    }
                }
            }

            string imageSize;
            var    url = LastfmHelper.GetImageUrl(data, out imageSize);

            var musicBrainzId = item.GetProviderId(MetadataProviders.MusicBrainzAlbum) ??
                                item.GetProviderId(MetadataProviders.MusicBrainzReleaseGroup);

            if (!string.IsNullOrEmpty(musicBrainzId) && !string.IsNullOrEmpty(url))
            {
                LastfmHelper.SaveImageInfo(_config.ApplicationPaths, _logger, musicBrainzId, url, imageSize);
            }
        }
예제 #6
0
        public static void ProcessAlbumData(BaseItem item, LastfmAlbum data)
        {
            if (!string.IsNullOrWhiteSpace(data.mbid))
            {
                item.SetProviderId(MetadataProviders.Musicbrainz, data.mbid);
            }

            var overview = data.wiki != null ? data.wiki.content : null;

            if (!item.LockedFields.Contains(MetadataFields.Overview))
            {
                item.Overview = overview;
            }
            DateTime release;

            DateTime.TryParse(data.releasedate, out release);
            item.PremiereDate   = release;
            item.ProductionYear = release.Year;
            if (data.toptags != null && !item.LockedFields.Contains(MetadataFields.Tags))
            {
                AddTags(item, data.toptags);
            }
        }