public void TestGettingTheDiscTagsForACdStub() { var tagSource = new MusicBrainzTagSource(new MockMusicBrainzApi(), new MockCoverArtApi()); var discTags = tagSource.GetTags(DummyData.AppelsEten.TableOfContents).ToList(); Assert.That(discTags, Is.Not.Null); Assert.That(discTags.Count(), Is.EqualTo(1)); var expectedAlbum = new AlbumIdentification { Id = "S0liNSPBm5gjOHw9JtmPPDhXynI-", //Stub has a special Id AlbumArtist = "Ketnet Band", AlbumTitle = "Appels Eten", Year = null, NumberOfTracks = 3 }; expectedAlbum.AddTrack(new TrackIdentification { Title = "Appels Eten q2", TrackNumber = 1 }); expectedAlbum.AddTrack(new TrackIdentification { Title = "Appels Eten Instrumental q2", TrackNumber = 2 }); expectedAlbum.AddTrack(new TrackIdentification { Title = "Appels Eten PB q2", TrackNumber = 3 }); AssertAlbum(discTags.First(), expectedAlbum); }
public RippingStatusViewModel AlbumSelected(string albumId) { _album = _albums.First(a => a.Id == albumId); _progress = (from t in _album.Tracks select new TrackProgress(t.TrackNumber)).ToList(); OnAlbumSelected(_drive, _album); return(StatusUpdated()); }
public RippingStatusViewModel AlbumsIdentified(IEnumerable <AlbumIdentification> albums) { _progress = null; _album = null; _albums = albums.ToList(); OnAlbumIdentified(_drive, _albums); return(StatusUpdated()); }
public RippingStatusViewModel Clear() { _drive = null; _album = null; _albums = null; _progress = null; return(StatusUpdated()); }
public void TestGettingAnUnknownDiscId() { var tagSource = new MusicBrainzTagSource(new MockMusicBrainzApi(), new MockCoverArtApi()); var discTags = tagSource.GetTags(DummyData.UnknownCd.TableOfContents).ToList(); Assert.That(discTags.Count, Is.EqualTo(1)); AssertAlbum(discTags.First(), AlbumIdentification.GetEmpty(2)); }
public RippingStatusViewModel DiscInserted(DriveInfo drive) { _albums = null; _album = null; _progress = null; _drive = drive; OnDiscInserted(drive); return(StatusUpdated()); }
public RippingStatusViewModel(AlbumIdentification album, IEnumerable <TrackProgress> progress) { var tracks = from t in album != null ? album.Tracks : Enumerable.Empty <TrackIdentification>() let pc = progress.First(p => p.TrackNumber == t.TrackNumber).PercentageComplete select new TrackStatusViewModel(t.Title, t.Artist, t.TrackNumber, pc); Albums = album == null ? null : new[] { new AlbumStatusViewModel(album.Id, album.AlbumTitle, album.AlbumArtist, tracks.ToList()) }; }
public void TestReplaceNullTokens() { var output = new OutputLocationBuilder(@"c:\test", "track-{title}-{albumtitle}.mp3"); var album = new AlbumIdentification(); album.AddTrack(new TrackIdentification()); var filename = output.PrepareOutput(album.Tracks.First()); Assert.That(filename.FileName, Is.EqualTo(@"c:\test\track--.mp3")); }
private void AssertAlbum(AlbumIdentification actual, AlbumIdentification expected) { Assert.That(actual.Id, Is.EqualTo(expected.Id), "AlbumId"); Assert.That(actual.AlbumArtist, Is.EqualTo(expected.AlbumArtist), "AlbumArtist"); Assert.That(actual.AlbumTitle, Is.EqualTo(expected.AlbumTitle), "AlbumTitle"); Assert.That(actual.Year, Is.EqualTo(expected.Year), "Year"); Assert.That(actual.AlbumArt, Is.EqualTo(expected.AlbumArt)); Assert.That(actual.NumberOfTracks, Is.EqualTo(expected.NumberOfTracks), "NumberOfTracks"); Assert.That(actual.Tracks.Count(), Is.EqualTo(expected.Tracks.Count()), "Count of tracks on the album"); for (int i = 0; i < expected.Tracks.Count(); i++) { var expectedTrack = expected.Tracks.ElementAt(i); var actualTrack = actual.Tracks.ElementAt(i); AssertTrack(actualTrack, expectedTrack); } }
private async Task RipAlbum(DriveInfo drive, AlbumIdentification album, CancellationToken token) { using (var cdDrive = CdDrive.Create(drive)) { var toc = await cdDrive.ReadTableOfContents(); foreach (var track in toc.Tracks) { if (token.IsCancellationRequested) { break; } var trackid = album.Tracks.Single(t => t.TrackNumber == track.TrackNumber); await RipTrack(cdDrive, track, trackid, token); } await cdDrive.Eject(); } }
public void TestReplaceTokens() { var output = new OutputLocationBuilder(@"c:\test", @"track\{title}\{artist}-{tracknumber}\{genre}-{albumtitle}.{albumartist}-{numberoftracks}-{year}.mp3"); var album = new AlbumIdentification { AlbumTitle = "album title", AlbumArtist = "album artist", NumberOfTracks = 25, Year = "1854" }; album.AddTrack(new TrackIdentification() { Title = "title", Artist = "artist", TrackNumber = 4, Genre = "genre", }); var filename = output.PrepareOutput(album.Tracks.First()); Assert.That(filename.FileName, Is.EqualTo(@"c:\test\track\title\artist-04\genre-album title.album artist-25-1854.mp3")); }
public LameArgumentBuilder(EncoderSettings settings) { _track = settings.Track ?? AlbumIdentification.GetEmpty(1).Tracks.First(); _mp3Settings = settings.Mp3Settings ?? Mp3Settings.Default; _trackLocation = settings.Output.PrepareOutput(_track) ?? OutputLocationBuilder.Default.PrepareOutput(_track); }