mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-23 22:25:09 -04:00
Medium Support (Multi-disc Albums), Quality Grouping (#121)
* Multi Disc Stage 1 - Backend Work * Quality Group Functionality * Fixed: Only show wanted album types on ArtistDetail page * Add Media Count Column to ArtistDetail Page * Parser updates for multidisc cases, other usenet release title formats * Search for Tracks by Medium Number in Addition to Title and TrackNumber * Medium Renaming Token for Track Naming * fixup Codacy and Comment Cleanup * fixup remove comments
This commit is contained in:
@@ -9,19 +9,20 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
|
||||
{
|
||||
public AlbumResource()
|
||||
{
|
||||
Tracks = new List<TrackResource>();
|
||||
Media = new List<MediumResource>();
|
||||
}
|
||||
//public string AlbumType { get; set; } // Might need to make this a separate class
|
||||
|
||||
public List<ArtistResource> Artists { get; set; } // Will always be length of 1 unless a compilation
|
||||
public string Url { get; set; } // Link to the endpoint api to give full info for this object
|
||||
public string Id { get; set; } // This is a unique Album ID. Needed for all future API calls
|
||||
public DateTime ReleaseDate { get; set; }
|
||||
public List<ImageResource> Images { get; set; }
|
||||
public string Title { get; set; } // In case of a takedown, this may be empty
|
||||
public string Title { get; set; }
|
||||
public string Overview { get; set; }
|
||||
public List<string> Genres { get; set; }
|
||||
public List<string> Label { get; set; }
|
||||
public string Type { get; set; }
|
||||
public List<MediumResource> Media { get; set; }
|
||||
public List<TrackResource> Tracks { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
|
||||
{
|
||||
public class MediumResource
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Format { get; set; }
|
||||
public int Position { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -17,8 +17,10 @@ namespace NzbDrone.Core.MetadataSource.SkyHook.Resource
|
||||
public string Href { get; set; }
|
||||
public string Id { get; set; }
|
||||
public string TrackName { get; set; }
|
||||
public int TrackNumber { get; set; }
|
||||
public string TrackNumber { get; set; }
|
||||
public int TrackPosition { get; set; }
|
||||
public bool Explicit { get; set; }
|
||||
public int MediumNumber { get; set; }
|
||||
public List<ArtistResource> Artists { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ using Newtonsoft.Json.Linq;
|
||||
using NzbDrone.Core.Music;
|
||||
using Newtonsoft.Json;
|
||||
using NzbDrone.Core.Configuration;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||
{
|
||||
@@ -157,20 +158,33 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||
album.Images = resource.Images.Select(MapImage).ToList();
|
||||
album.Label = resource.Label;
|
||||
|
||||
var tracks = resource.Tracks.Select(MapTrack);
|
||||
album.Tracks = tracks.ToList();
|
||||
album.Media = resource.Media.Select(MapMedium).ToList();
|
||||
album.Tracks = resource.Tracks.Select(MapTrack).ToList();
|
||||
|
||||
|
||||
return album;
|
||||
}
|
||||
|
||||
private static Medium MapMedium(MediumResource resource)
|
||||
{
|
||||
Medium medium = new Medium();
|
||||
medium.Name = resource.Name;
|
||||
medium.Number = resource.Position;
|
||||
medium.Format = resource.Format;
|
||||
|
||||
return medium;
|
||||
}
|
||||
|
||||
private static Track MapTrack(TrackResource resource)
|
||||
{
|
||||
Track track = new Track();
|
||||
track.Title = resource.TrackName;
|
||||
track.ForeignTrackId = resource.Id;
|
||||
track.TrackNumber = resource.TrackNumber;
|
||||
track.AbsoluteTrackNumber = resource.TrackPosition;
|
||||
track.Duration = resource.DurationMs;
|
||||
track.MediumNumber = resource.MediumNumber;
|
||||
|
||||
return track;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user