mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-23 06:45:19 -07:00
Added MovieFileResource. This allows the UI to interact with movie files better. Downloaded Quality is now shown in the table.
This commit is contained in:
parent
48559cf964
commit
cde8b4dd97
7 changed files with 102 additions and 4 deletions
|
@ -232,6 +232,7 @@
|
||||||
<Compile Include="RootFolders\RootFolderResource.cs" />
|
<Compile Include="RootFolders\RootFolderResource.cs" />
|
||||||
<Compile Include="SeasonPass\SeasonPassResource.cs" />
|
<Compile Include="SeasonPass\SeasonPassResource.cs" />
|
||||||
<Compile Include="Series\AlternateTitleResource.cs" />
|
<Compile Include="Series\AlternateTitleResource.cs" />
|
||||||
|
<Compile Include="Series\MovieFileResource.cs" />
|
||||||
<Compile Include="Series\SeasonResource.cs" />
|
<Compile Include="Series\SeasonResource.cs" />
|
||||||
<Compile Include="SeasonPass\SeasonPassModule.cs" />
|
<Compile Include="SeasonPass\SeasonPassModule.cs" />
|
||||||
<Compile Include="Series\SeriesEditorModule.cs" />
|
<Compile Include="Series\SeriesEditorModule.cs" />
|
||||||
|
|
85
src/NzbDrone.Api/Series/MovieFileResource.cs
Normal file
85
src/NzbDrone.Api/Series/MovieFileResource.cs
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using NzbDrone.Api.REST;
|
||||||
|
using NzbDrone.Core.MediaCover;
|
||||||
|
using NzbDrone.Core.Tv;
|
||||||
|
using NzbDrone.Core.Qualities;
|
||||||
|
using NzbDrone.Api.Series;
|
||||||
|
using NzbDrone.Core.MediaFiles;
|
||||||
|
|
||||||
|
namespace NzbDrone.Api.Movie
|
||||||
|
{
|
||||||
|
public class MovieFileResource : RestResource
|
||||||
|
{
|
||||||
|
public MovieFileResource()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Todo: Sorters should be done completely on the client
|
||||||
|
//Todo: Is there an easy way to keep IgnoreArticlesWhenSorting in sync between, Series, History, Missing?
|
||||||
|
//Todo: We should get the entire Profile instead of ID and Name separately
|
||||||
|
|
||||||
|
public int MovieId { 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 string ReleaseGroup { get; set; }
|
||||||
|
public QualityModel Quality { get; set; }
|
||||||
|
public MovieResource Movie { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//TODO: Add series statistics as a property of the series (instead of individual properties)
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class MovieFileResourceMapper
|
||||||
|
{
|
||||||
|
public static MovieFileResource ToResource(this MovieFile model)
|
||||||
|
{
|
||||||
|
if (model == null) return null;
|
||||||
|
|
||||||
|
MovieResource movie = null;
|
||||||
|
|
||||||
|
if (model.Movie != null)
|
||||||
|
{
|
||||||
|
model.Movie.LazyLoad();
|
||||||
|
if (model.Movie.Value != null)
|
||||||
|
{
|
||||||
|
//movie = model.Movie.Value.ToResource();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new MovieFileResource
|
||||||
|
{
|
||||||
|
Id = model.Id,
|
||||||
|
RelativePath = model.RelativePath,
|
||||||
|
Path = model.Path,
|
||||||
|
Size = model.Size,
|
||||||
|
DateAdded = model.DateAdded,
|
||||||
|
ReleaseGroup = model.ReleaseGroup,
|
||||||
|
Quality = model.Quality,
|
||||||
|
Movie = movie,
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MovieFile ToModel(this MovieFileResource resource)
|
||||||
|
{
|
||||||
|
if (resource == null) return null;
|
||||||
|
|
||||||
|
return new MovieFile
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<MovieFileResource> ToResource(this IEnumerable<MovieFile> movies)
|
||||||
|
{
|
||||||
|
return movies.Select(ToResource).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -55,6 +55,7 @@ namespace NzbDrone.Api.Movie
|
||||||
public AddMovieOptions AddOptions { get; set; }
|
public AddMovieOptions AddOptions { get; set; }
|
||||||
public Ratings Ratings { get; set; }
|
public Ratings Ratings { get; set; }
|
||||||
public List<string> AlternativeTitles { get; set; }
|
public List<string> AlternativeTitles { get; set; }
|
||||||
|
public MovieFileResource MovieFile { get; set; }
|
||||||
|
|
||||||
//TODO: Add series statistics as a property of the series (instead of individual properties)
|
//TODO: Add series statistics as a property of the series (instead of individual properties)
|
||||||
|
|
||||||
|
@ -84,6 +85,7 @@ namespace NzbDrone.Api.Movie
|
||||||
|
|
||||||
long size = 0;
|
long size = 0;
|
||||||
bool downloaded = false;
|
bool downloaded = false;
|
||||||
|
MovieFileResource movieFile = null;
|
||||||
|
|
||||||
|
|
||||||
if(model.MovieFile != null)
|
if(model.MovieFile != null)
|
||||||
|
@ -95,6 +97,7 @@ namespace NzbDrone.Api.Movie
|
||||||
{
|
{
|
||||||
size = model.MovieFile.Value.Size;
|
size = model.MovieFile.Value.Size;
|
||||||
downloaded = true;
|
downloaded = true;
|
||||||
|
movieFile = model.MovieFile.Value.ToResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new MovieResource
|
return new MovieResource
|
||||||
|
@ -140,7 +143,8 @@ namespace NzbDrone.Api.Movie
|
||||||
Added = model.Added,
|
Added = model.Added,
|
||||||
AddOptions = model.AddOptions,
|
AddOptions = model.AddOptions,
|
||||||
AlternativeTitles = model.AlternativeTitles,
|
AlternativeTitles = model.AlternativeTitles,
|
||||||
Ratings = model.Ratings
|
Ratings = model.Ratings,
|
||||||
|
MovieFile = movieFile
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<span class="label label-{{DownloadedStatusColor}}">{{DownloadedStatus}}</span>
|
<span class="label label-{{DownloadedStatusColor}}" title="{{DownloadedQuality}}">{{DownloadedStatus}}</span>
|
||||||
|
|
|
@ -161,6 +161,14 @@ Handlebars.registerHelper('DownloadedStatus', function() {
|
||||||
return "Missing";
|
return "Missing";
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Handlebars.registerHelper("DownloadedQuality", function() {
|
||||||
|
if (this.movieFile) {
|
||||||
|
return this.movieFile.quality.quality.name;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
Handlebars.registerHelper('inCinemas', function() {
|
Handlebars.registerHelper('inCinemas', function() {
|
||||||
var monthNames = ["January", "February", "March", "April", "May", "June",
|
var monthNames = ["January", "February", "March", "April", "May", "June",
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
<span class="label label-default">Announced</span>
|
<span class="label label-default">Announced</span>
|
||||||
{{/if_eq}}
|
{{/if_eq}}
|
||||||
<span class="label label-{{DownloadedStatusColor}}">{{DownloadedStatus}}</span>
|
<span class="label label-{{DownloadedStatusColor}}" title="{{DownloadedQuality}}">{{DownloadedStatus}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<span class="series-info-links">
|
<span class="series-info-links">
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
{{profile profileId}}
|
{{profile profileId}}
|
||||||
|
|
||||||
<span class="label label-{{DownloadedStatusColor}}">{{DownloadedStatus}}</span>
|
<span class="label label-{{DownloadedStatusColor}}" title="{{DownloadedQuality}}">{{DownloadedStatus}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 col-xs-4">
|
<div class="col-md-4 col-xs-4">
|
||||||
<span class="movie-info-links">
|
<span class="movie-info-links">
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue