mirror of
https://github.com/Radarr/Radarr
synced 2026-01-14 19:43:09 +01:00
* New: Manually Edit/Override Album Release * !fixup for comments, loading all albums instead of only artist albums * fixup! UI Cleanup lint issues * fixup! Remove AddAlbum service for now, fix refresh override selected release * fixup! Last one... to fix updating albums with custom release set Closes #109 Closes #129 Closes #128
78 lines
2.6 KiB
C#
78 lines
2.6 KiB
C#
using System;
|
|
using System.IO;
|
|
using NzbDrone.Core.DecisionEngine;
|
|
using NzbDrone.Core.Languages;
|
|
using NzbDrone.Core.MediaFiles;
|
|
using NzbDrone.Core.Qualities;
|
|
using Lidarr.Http.REST;
|
|
|
|
namespace Lidarr.Api.V1.TrackFiles
|
|
{
|
|
public class TrackFileResource : RestResource
|
|
{
|
|
public int ArtistId { get; set; }
|
|
public int AlbumId { get; set; }
|
|
public string RelativePath { get; set; }
|
|
public string Path { get; set; }
|
|
public long Size { get; set; }
|
|
public DateTime DateAdded { get; set; }
|
|
//public string SceneName { get; set; }
|
|
public Language Language { get; set; }
|
|
public QualityModel Quality { get; set; }
|
|
public MediaInfoResource MediaInfo { get; set; }
|
|
|
|
public bool QualityCutoffNotMet { get; set; }
|
|
public bool LanguageCutoffNotMet { get; set; }
|
|
|
|
}
|
|
|
|
public static class TrackFileResourceMapper
|
|
{
|
|
private static TrackFileResource ToResource(this TrackFile model)
|
|
{
|
|
if (model == null) return null;
|
|
|
|
return new TrackFileResource
|
|
{
|
|
Id = model.Id,
|
|
|
|
ArtistId = model.ArtistId,
|
|
AlbumId = model.AlbumId,
|
|
RelativePath = model.RelativePath,
|
|
//Path
|
|
Size = model.Size,
|
|
DateAdded = model.DateAdded,
|
|
// SceneName = model.SceneName,
|
|
Language = model.Language,
|
|
Quality = model.Quality,
|
|
MediaInfo = model.MediaInfo.ToResource()
|
|
//QualityCutoffNotMet
|
|
};
|
|
|
|
}
|
|
|
|
public static TrackFileResource ToResource(this TrackFile model, NzbDrone.Core.Music.Artist artist, IUpgradableSpecification upgradableSpecification)
|
|
{
|
|
if (model == null) return null;
|
|
|
|
return new TrackFileResource
|
|
{
|
|
Id = model.Id,
|
|
|
|
ArtistId = model.ArtistId,
|
|
AlbumId = model.AlbumId,
|
|
RelativePath = model.RelativePath,
|
|
Path = Path.Combine(artist.Path, model.RelativePath),
|
|
Size = model.Size,
|
|
DateAdded = model.DateAdded,
|
|
//SceneName = model.SceneName,
|
|
Language = model.Language,
|
|
Quality = model.Quality,
|
|
MediaInfo = model.MediaInfo.ToResource(),
|
|
|
|
QualityCutoffNotMet = upgradableSpecification.QualityCutoffNotMet(artist.Profile.Value, model.Quality),
|
|
LanguageCutoffNotMet = upgradableSpecification.LanguageCutoffNotMet(artist.LanguageProfile.Value, model.Language)
|
|
};
|
|
}
|
|
}
|
|
}
|