mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 05:23:31 -07:00
New: Added album disambiguation to UI and Naming [ex. Weezer (Blue Album)] (#431)
This commit is contained in:
parent
54d1d90e16
commit
e6a43b2dc0
19 changed files with 73 additions and 39 deletions
|
@ -12,6 +12,7 @@ namespace Lidarr.Api.V1.Albums
|
|||
public class AlbumResource : RestResource
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string Disambiguation { get; set; }
|
||||
public int ArtistId { get; set; }
|
||||
public List<string> AlbumLabel { get; set; }
|
||||
public string ForeignAlbumId { get; set; }
|
||||
|
@ -66,6 +67,7 @@ namespace Lidarr.Api.V1.Albums
|
|||
ReleaseDate = model.ReleaseDate,
|
||||
Genres = model.Genres,
|
||||
Title = model.Title,
|
||||
Disambiguation = model.Disambiguation,
|
||||
Images = model.Images,
|
||||
Ratings = model.Ratings,
|
||||
Duration = model.Duration,
|
||||
|
@ -87,6 +89,7 @@ namespace Lidarr.Api.V1.Albums
|
|||
Id = resource.Id,
|
||||
ForeignAlbumId = resource.ForeignAlbumId,
|
||||
Title = resource.Title,
|
||||
Disambiguation = resource.Disambiguation,
|
||||
Images = resource.Images,
|
||||
Monitored = resource.Monitored,
|
||||
CurrentRelease = resource.CurrentRelease
|
||||
|
|
|
@ -33,6 +33,8 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
|||
_album = Builder<Album>
|
||||
.CreateNew()
|
||||
.With(s => s.Title = "Hybrid Theory")
|
||||
.With(s => s.AlbumType = "Album")
|
||||
.With(s => s.Disambiguation = "The Best Album")
|
||||
.Build();
|
||||
|
||||
|
||||
|
@ -147,6 +149,24 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests
|
|||
.Should().Be("Hybrid Theory");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_replace_Album_Type()
|
||||
{
|
||||
_namingConfig.StandardTrackFormat = "{Album Type}";
|
||||
|
||||
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
||||
.Should().Be("Album");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_replace_Album_Disambiguation()
|
||||
{
|
||||
_namingConfig.StandardTrackFormat = "{Album Disambiguation}";
|
||||
|
||||
Subject.BuildTrackFileName(new List<Track> { _track1 }, _artist, _album, _trackFile)
|
||||
.Should().Be("The Best Album");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_replace_Album_underscore_Title()
|
||||
{
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(18)]
|
||||
public class album_disambiguation : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Alter.Table("Albums").AddColumn("Disambiguation").AsString().Nullable();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -19,6 +19,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
|
|||
public DateTime ReleaseDate { get; set; }
|
||||
public List<ImageResource> Images { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Disambiguation { get; set; }
|
||||
public string Overview { get; set; }
|
||||
public List<string> Genres { get; set; }
|
||||
public List<string> Labels { get; set; }
|
||||
|
|
|
@ -262,6 +262,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
|||
{
|
||||
Album album = new Album();
|
||||
album.Title = resource.Title;
|
||||
album.Disambiguation = resource.Disambiguation;
|
||||
album.ForeignAlbumId = resource.Id;
|
||||
album.ReleaseDate = resource.ReleaseDate;
|
||||
album.CleanTitle = Parser.Parser.CleanArtistName(album.Title);
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace NzbDrone.Core.Music
|
|||
public string ForeignAlbumId { get; set; }
|
||||
public int ArtistId { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string Disambiguation { get; set; }
|
||||
public string CleanTitle { get; set; }
|
||||
public DateTime? ReleaseDate { get; set; }
|
||||
public List<string> Label { get; set; }
|
||||
|
|
|
@ -92,6 +92,7 @@ namespace NzbDrone.Core.Music
|
|||
album.LastInfoSync = DateTime.UtcNow;
|
||||
album.CleanTitle = albumInfo.CleanTitle;
|
||||
album.Title = albumInfo.Title ?? "Unknown";
|
||||
album.Disambiguation = albumInfo.Disambiguation;
|
||||
album.AlbumType = albumInfo.AlbumType;
|
||||
album.SecondaryTypes = albumInfo.SecondaryTypes;
|
||||
album.Genres = albumInfo.Genres;
|
||||
|
|
|
@ -189,6 +189,7 @@
|
|||
<Compile Include="Datastore\Migration\015_remove_fanzub.cs" />
|
||||
<Compile Include="Datastore\Migration\016_update_artist_history_indexes.cs" />
|
||||
<Compile Include="Datastore\Migration\017_remove_nma.cs" />
|
||||
<Compile Include="Datastore\Migration\018_album_disambiguation.cs" />
|
||||
<Compile Include="Datastore\Migration\Framework\MigrationContext.cs" />
|
||||
<Compile Include="Datastore\Migration\Framework\MigrationController.cs" />
|
||||
<Compile Include="Datastore\Migration\Framework\MigrationDbFactory.cs" />
|
||||
|
|
|
@ -269,6 +269,12 @@ namespace NzbDrone.Core.Organizer
|
|||
tokenHandlers["{Album CleanTitle}"] = m => CleanTitle(album.Title);
|
||||
tokenHandlers["{Album TitleThe}"] = m => TitleThe(album.Title);
|
||||
tokenHandlers["{Album Type}"] = m => album.AlbumType;
|
||||
|
||||
if (album.Disambiguation != null)
|
||||
{
|
||||
tokenHandlers["{Album Disambiguation}"] = m => album.Disambiguation;
|
||||
}
|
||||
|
||||
if (album.ReleaseDate.HasValue)
|
||||
{
|
||||
tokenHandlers["{Release Year}"] = m => album.ReleaseDate.Value.Year.ToString();
|
||||
|
|
|
@ -38,6 +38,7 @@ namespace NzbDrone.Core.Organizer
|
|||
Title = "The Album Title",
|
||||
ReleaseDate = System.DateTime.Today,
|
||||
AlbumType = "Album",
|
||||
Disambiguation = "The Best Album",
|
||||
Media = new List<Medium>
|
||||
{
|
||||
new Medium
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue