Beispiel #1
0
        public async Task MusicBrainzArtistSearch()
        {
            if (!Configuration.Integrations.MusicBrainzProviderEnabled)
            {
                return;
            }
            var logger = new EventMessageLogger <MusicBrainzProvider>();

            logger.Messages += MessageLogger_Messages;
            var mb = new MusicBrainzProvider(Configuration, CacheManager, logger);

            var artistName = "Billy Joel";
            var mbId       = "64b94289-9474-4d43-8c93-918ccc1920d1"; //https://musicbrainz.org/artist/64b94289-9474-4d43-8c93-918ccc1920d1

            var sw = Stopwatch.StartNew();

            var result = await mb.PerformArtistSearch(artistName, 1);

            sw.Stop();
            var elapsedTime = sw.ElapsedMilliseconds;

            Assert.NotNull(result);
            Assert.NotNull(result.Data);
            Assert.NotEmpty(result.Data);
            var artist = result.Data.FirstOrDefault();

            Assert.NotNull(artist);
            Assert.Equal(artist.MusicBrainzId, mbId);
        }
Beispiel #2
0
        public async Task MusicBrainzReleaseSearch()
        {
            if (!Configuration.Integrations.MusicBrainzProviderEnabled)
            {
                return;
            }
            var logger = new EventMessageLogger <MusicBrainzProvider>();

            logger.Messages += MessageLogger_Messages;
            var mb = new MusicBrainzProvider(Configuration, CacheManager, logger);

            var artistName = "Billy Joel";
            var mbId       = "584a3887-c74e-4ff2-81e1-1620fbbe4f84"; // https://musicbrainz.org/release/584a3887-c74e-4ff2-81e1-1620fbbe4f84
            var title      = "Piano Man";
            var sw         = Stopwatch.StartNew();

            var result = await mb.PerformReleaseSearch(artistName, title, 1);

            sw.Stop();
            var elapsedTime = sw.ElapsedMilliseconds;

            Assert.NotNull(result);
            Assert.NotNull(result.Data);
            Assert.NotEmpty(result.Data);
            var release = result.Data.FirstOrDefault();

            Assert.NotNull(release);
            Assert.Equal(release.MusicBrainzId, mbId);
        }
Beispiel #3
0
        public SearchEngineTests()
        {
            MessageLogger           = new EventMessageLogger <SearchEngineTests>();
            MessageLogger.Messages += MessageLogger_Messages;

            var settings = new RoadieSettings();
            IConfigurationBuilder configurationBuilder = new ConfigurationBuilder();

            configurationBuilder.AddJsonFile("appsettings.test.json");
            IConfiguration configuration = configurationBuilder.Build();

            configuration.GetSection("RoadieSettings").Bind(settings);
            Configuration = settings;
            CacheManager  = new DictionaryCacheManager(Logger, new CachePolicy(TimeSpan.FromHours(4)));
            HttpEncoder   = new Encoding.DummyHttpEncoder();
        }
Beispiel #4
0
        public Inspector()
        {
            Console.WriteLine("Roadie Media Inspector");

            MessageLogger           = new EventMessageLogger();
            MessageLogger.Messages += MessageLogger_Messages;

            var settings = new RoadieSettings();
            IConfigurationBuilder configurationBuilder = new ConfigurationBuilder();

            configurationBuilder.AddJsonFile("appsettings.json", false);
            IConfiguration configuration = configurationBuilder.Build();

            configuration.GetSection("RoadieSettings").Bind(settings);
            settings.ConnectionString = configuration.GetConnectionString("RoadieDatabaseConnection");
            Configuration             = settings;
            CacheManager = new DictionaryCacheManager(Logger, new CachePolicy(TimeSpan.FromHours(4)));
            TagsHelper   = new ID3TagsHelper(Configuration, CacheManager, Logger);
        }
Beispiel #5
0
        public ID3TagsHelperTests()
        {
            this.MessageLogger           = new EventMessageLogger <ID3TagsHelperTests>();
            this.MessageLogger.Messages += MessageLoggerMessages;

            var settings = new RoadieSettings();
            IConfigurationBuilder configurationBuilder = new ConfigurationBuilder();

            configurationBuilder.AddJsonFile("appsettings.test.json");
            IConfiguration configuration = configurationBuilder.Build();

            configuration.GetSection("RoadieSettings").Bind(settings);
            settings.ConnectionString = configuration.GetConnectionString("RoadieDatabaseConnection");
            this.Configuration        = settings;
            this.CacheManager         = new DictionaryCacheManager(this.Logger, new CachePolicy(TimeSpan.FromHours(4)));
            var tagHelperLooper = new EventMessageLogger <ID3TagsHelper>();

            tagHelperLooper.Messages += MessageLoggerMessages;
            this.TagsHelper           = new ID3TagsHelper(this.Configuration, this.CacheManager, tagHelperLooper);
        }
Beispiel #6
0
        public async Task DiscogsHelperReleaseSearch()
        {
            if (!Configuration.Integrations.DiscogsProviderEnabled)
            {
                return;
            }
            var discogsLogger = new EventMessageLogger <DiscogsHelper>();

            discogsLogger.Messages += MessageLogger_Messages;

            var engine = new DiscogsHelper(Configuration, CacheManager, discogsLogger);

            var artistName = "With The Dead";
            var title      = "Love From With The Dead";

            var result = await engine.PerformReleaseSearch(artistName, title, 1);

            Assert.NotNull(result);
            Assert.NotEmpty(result.Data);
        }
Beispiel #7
0
        public AdminService(IRoadieSettings configuration,
                            IHttpEncoder httpEncoder,
                            IHttpContext httpContext,
                            data.IRoadieDbContext context,
                            ICacheManager cacheManager,
                            ILogger <ArtistService> logger,
                            IHubContext <ScanActivityHub> scanActivityHub
                            )
            : base(configuration, httpEncoder, context, cacheManager, logger, httpContext)
        {
            ScanActivityHub              = scanActivityHub;
            EventMessageLogger           = new EventMessageLogger();
            EventMessageLogger.Messages += EventMessageLogger_Messages;

            MusicBrainzProvider = new MusicBrainzProvider(configuration, cacheManager, MessageLogger);
            LastFmHelper        = new LastFmHelper(configuration, cacheManager, MessageLogger, context, httpEncoder);
            FileNameHelper      = new FileNameHelper(configuration, cacheManager, MessageLogger);
            ID3TagsHelper       = new ID3TagsHelper(configuration, cacheManager, MessageLogger);

            ArtistLookupEngine =
                new ArtistLookupEngine(configuration, httpEncoder, context, cacheManager, MessageLogger);
            LabelLookupEngine   = new LabelLookupEngine(configuration, httpEncoder, context, cacheManager, MessageLogger);
            ReleaseLookupEngine = new ReleaseLookupEngine(configuration, httpEncoder, context, cacheManager,
                                                          MessageLogger, ArtistLookupEngine, LabelLookupEngine);
            ImageFactory = new ImageFactory(configuration, httpEncoder, context, cacheManager, MessageLogger,
                                            ArtistLookupEngine, ReleaseLookupEngine);
            LabelFactory = new LabelFactory(configuration, httpEncoder, context, cacheManager, MessageLogger,
                                            ArtistLookupEngine, ReleaseLookupEngine);
            AudioMetaDataHelper = new AudioMetaDataHelper(configuration, httpEncoder, context, MusicBrainzProvider,
                                                          LastFmHelper, cacheManager,
                                                          MessageLogger, ArtistLookupEngine, ImageFactory, FileNameHelper, ID3TagsHelper);
            ReleaseFactory = new ReleaseFactory(configuration, httpEncoder, context, cacheManager, MessageLogger,
                                                ArtistLookupEngine, LabelFactory, AudioMetaDataHelper, ReleaseLookupEngine);
            ArtistFactory = new ArtistFactory(configuration, httpEncoder, context, cacheManager, MessageLogger,
                                              ArtistLookupEngine, ReleaseFactory, ImageFactory, ReleaseLookupEngine, AudioMetaDataHelper);
        }