Пример #1
0
        public void GetMetadata(CancellationToken cancellationToken, Job job)
        {
            var raw = job.Disc.Metadata.Raw;
            var derived = job.Disc.Metadata.Derived;

            var token = new ProgressToken(Host, this, cancellationToken);
            var provider = new IsanMetadataProvider(token);

            provider.Populate(raw.V_ISAN);

            var isan = raw.ISAN;
            if (isan != null && !string.IsNullOrWhiteSpace(isan.Title))
            {
                // TODO: Scrape language from isan.org
                // Don't insert twice
                if (!derived.SearchQueries.Any(query => query.Title == isan.Title && query.Year == isan.Year))
                    derived.SearchQueries.Insert(0, new SearchQuery { Title = isan.Title, Year = isan.Year });
            }
        }
Пример #2
0
        public void GetMetadata(CancellationToken cancellationToken, Job job)
        {
            var raw = job.Disc.Metadata.Raw;
            var derived = job.Disc.Metadata.Derived;

            var token = new ProgressToken(Host, this, cancellationToken);
            var prefs = PluginUtils.GetPreferences(AssemblyInfo, () => new IsanPreferences());

            if (raw.V_ISAN != null && prefs.TryPopulate(raw.V_ISAN))
            {
                return;
            }

            Lookup(token, raw, derived);

            if (raw.V_ISAN != null)
            {
                prefs.Store(raw.V_ISAN);
                PluginUtils.SavePreferences(AssemblyInfo, prefs);
            }
        }
Пример #3
0
 /// <summary>
 /// Constructs a new IsanMetadataProvider that reports its progress and allows the user to cancel requests
 /// via the given <paramref name="token"/>.
 /// </summary>
 /// <param name="token"></param>
 public IsanMetadataProvider(ProgressToken token)
 {
     _token = token;
 }
Пример #4
0
        private static void Lookup(ProgressToken token, DiscMetadata.RawMetadata raw, DiscMetadata.DerivedMetadata derived)
        {
            var provider = new IsanMetadataProvider(token);

            provider.Populate(raw.V_ISAN);

            var isan = raw.ISAN;
            if (isan != null && !string.IsNullOrWhiteSpace(isan.Title))
            {
                // TODO: Get language from isan.org
                // Don't insert twice
                if (!derived.SearchQueries.Any(query => query.Title == isan.Title && query.Year == isan.Year))
                    derived.SearchQueries.Insert(0, new SearchQuery { Title = isan.Title, Year = isan.Year });
            }
        }