mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 20:12:41 +02:00
* added YouTubeTrailerId to movie model * db migration for new column * added videos to append_to_response for tmdb * increased height of .series-posters-item * new handlebar helper to build the trailer url
This commit is contained in:
parent
af478d3799
commit
56a5b6ec89
@ -34,6 +34,7 @@ public MovieResource()
|
|||||||
public string RemotePoster { get; set; }
|
public string RemotePoster { get; set; }
|
||||||
public int Year { get; set; }
|
public int Year { get; set; }
|
||||||
public bool HasFile { get; set; }
|
public bool HasFile { get; set; }
|
||||||
|
public string YouTubeTrailerId { get; set; }
|
||||||
|
|
||||||
//View & Edit
|
//View & Edit
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
@ -144,7 +145,8 @@ public static MovieResource ToResource(this Core.Tv.Movie model)
|
|||||||
AddOptions = model.AddOptions,
|
AddOptions = model.AddOptions,
|
||||||
AlternativeTitles = model.AlternativeTitles,
|
AlternativeTitles = model.AlternativeTitles,
|
||||||
Ratings = model.Ratings,
|
Ratings = model.Ratings,
|
||||||
MovieFile = movieFile
|
MovieFile = movieFile,
|
||||||
|
YouTubeTrailerId = model.YouTubeTrailerId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,7 +193,8 @@ public static Core.Tv.Movie ToModel(this MovieResource resource)
|
|||||||
Added = resource.Added,
|
Added = resource.Added,
|
||||||
AddOptions = resource.AddOptions,
|
AddOptions = resource.AddOptions,
|
||||||
AlternativeTitles = resource.AlternativeTitles,
|
AlternativeTitles = resource.AlternativeTitles,
|
||||||
Ratings = resource.Ratings
|
Ratings = resource.Ratings,
|
||||||
|
YouTubeTrailerId = resource.YouTubeTrailerId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
using System.Data;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
{
|
||||||
|
[Migration(119)]
|
||||||
|
public class add_youtube_trailer_id : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
Alter.Table("Movies").AddColumn("YouTubeTrailerId").AsString().Nullable();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -66,6 +66,7 @@ public class MovieResourceRoot
|
|||||||
public int vote_count { get; set; }
|
public int vote_count { get; set; }
|
||||||
public AlternativeTitles alternative_titles { get; set; }
|
public AlternativeTitles alternative_titles { get; set; }
|
||||||
public ReleaseDatesResource release_dates { get; set; }
|
public ReleaseDatesResource release_dates { get; set; }
|
||||||
|
public VideosResource videos { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ReleaseDatesResource
|
public class ReleaseDatesResource
|
||||||
@ -130,4 +131,21 @@ public class Title
|
|||||||
public string iso_3166_1 { get; set; }
|
public string iso_3166_1 { get; set; }
|
||||||
public string title { get; set; }
|
public string title { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class VideosResource
|
||||||
|
{
|
||||||
|
public List<Video> results { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Video
|
||||||
|
{
|
||||||
|
public string id { get; set; }
|
||||||
|
public string iso_639_1 { get; set; }
|
||||||
|
public string iso_3166_1 { get; set; }
|
||||||
|
public string key { get; set; }
|
||||||
|
public string name { get; set; }
|
||||||
|
public string site { get; set; }
|
||||||
|
public string size { get; set; }
|
||||||
|
public string type { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ public Movie GetMovieInfo(int TmdbId)
|
|||||||
.SetSegment("route", "movie")
|
.SetSegment("route", "movie")
|
||||||
.SetSegment("id", TmdbId.ToString())
|
.SetSegment("id", TmdbId.ToString())
|
||||||
.SetSegment("secondaryRoute", "")
|
.SetSegment("secondaryRoute", "")
|
||||||
.AddQueryParam("append_to_response", "alternative_titles,release_dates")
|
.AddQueryParam("append_to_response", "alternative_titles,release_dates,videos")
|
||||||
.AddQueryParam("country", "US")
|
.AddQueryParam("country", "US")
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
@ -149,6 +149,18 @@ public Movie GetMovieInfo(int TmdbId)
|
|||||||
{
|
{
|
||||||
movie.Status = MovieStatusType.Announced;
|
movie.Status = MovieStatusType.Announced;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (resource.videos != null)
|
||||||
|
{
|
||||||
|
foreach(Video video in resource.videos.results)
|
||||||
|
{
|
||||||
|
if(video.type == "Trailer" && video.site == "YouTube")
|
||||||
|
{
|
||||||
|
movie.YouTubeTrailerId = video.key;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return movie;
|
return movie;
|
||||||
}
|
}
|
||||||
|
@ -183,6 +183,7 @@
|
|||||||
<Compile Include="Datastore\Migration\002_remove_tvrage_imdb_unique_constraint.cs" />
|
<Compile Include="Datastore\Migration\002_remove_tvrage_imdb_unique_constraint.cs" />
|
||||||
<Compile Include="Datastore\Migration\003_remove_clean_title_from_scene_mapping.cs" />
|
<Compile Include="Datastore\Migration\003_remove_clean_title_from_scene_mapping.cs" />
|
||||||
<Compile Include="Datastore\Migration\004_updated_history.cs" />
|
<Compile Include="Datastore\Migration\004_updated_history.cs" />
|
||||||
|
<Compile Include="Datastore\Migration\119_add_youtube_trailer_id_table .cs" />
|
||||||
<Compile Include="Datastore\Migration\118_update_movie_slug.cs" />
|
<Compile Include="Datastore\Migration\118_update_movie_slug.cs" />
|
||||||
<Compile Include="Datastore\Migration\117_update_movie_file.cs" />
|
<Compile Include="Datastore\Migration\117_update_movie_file.cs" />
|
||||||
<Compile Include="Datastore\Migration\116_update_movie_sorttitle_again.cs" />
|
<Compile Include="Datastore\Migration\116_update_movie_sorttitle_again.cs" />
|
||||||
|
@ -48,6 +48,7 @@ public Movie()
|
|||||||
public LazyLoaded<MovieFile> MovieFile { get; set; }
|
public LazyLoaded<MovieFile> MovieFile { get; set; }
|
||||||
public int MovieFileId { get; set; }
|
public int MovieFileId { get; set; }
|
||||||
public List<string> AlternativeTitles { get; set; }
|
public List<string> AlternativeTitles { get; set; }
|
||||||
|
public string YouTubeTrailerId{ get; set; }
|
||||||
|
|
||||||
public bool HasFile => MovieFileId > 0;
|
public bool HasFile => MovieFileId > 0;
|
||||||
|
|
||||||
|
@ -84,6 +84,7 @@ private void RefreshMovieInfo(Movie movie)
|
|||||||
movie.AlternativeTitles = movieInfo.AlternativeTitles;
|
movie.AlternativeTitles = movieInfo.AlternativeTitles;
|
||||||
movie.Year = movieInfo.Year;
|
movie.Year = movieInfo.Year;
|
||||||
movie.PhysicalRelease = movieInfo.PhysicalRelease;
|
movie.PhysicalRelease = movieInfo.PhysicalRelease;
|
||||||
|
movie.YouTubeTrailerId = movieInfo.YouTubeTrailerId;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -8,4 +8,9 @@
|
|||||||
{{#if imdbId}}
|
{{#if imdbId}}
|
||||||
<a href="{{imdbUrl}}" class="label label-info">IMDB</a>
|
<a href="{{imdbUrl}}" class="label label-info">IMDB</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if youTubeTrailerId}}
|
||||||
|
<a href="{{youTubeTrailerUrl}}" class="label label-info">Trailer</a>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
</span>
|
</span>
|
||||||
|
@ -51,6 +51,10 @@ Handlebars.registerHelper('tmdbUrl', function() {
|
|||||||
return 'https://www.themoviedb.org/movie/' + this.tmdbId;
|
return 'https://www.themoviedb.org/movie/' + this.tmdbId;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Handlebars.registerHelper('youTubeTrailerUrl', function() {
|
||||||
|
return 'https://www.youtube.com/watch?v=' + this.youTubeTrailerId;
|
||||||
|
});
|
||||||
|
|
||||||
Handlebars.registerHelper('homepage', function() {
|
Handlebars.registerHelper('homepage', function() {
|
||||||
return this.website;
|
return this.website;
|
||||||
});
|
});
|
||||||
|
@ -33,6 +33,10 @@
|
|||||||
{{#if imdbId}}
|
{{#if imdbId}}
|
||||||
<a href="{{imdbUrl}}" class="label label-info">IMDB</a>
|
<a href="{{imdbUrl}}" class="label label-info">IMDB</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if youTubeTrailerId}}
|
||||||
|
<a href="{{youTubeTrailerUrl}}" class="label label-info">Trailer</a>
|
||||||
|
{{/if}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -54,6 +54,10 @@
|
|||||||
{{#if imdbId}}
|
{{#if imdbId}}
|
||||||
<a href="{{imdbUrl}}" class="label label-info">IMDB</a>
|
<a href="{{imdbUrl}}" class="label label-info">IMDB</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
|
{{#if youTubeTrailerId}}
|
||||||
|
<a href="{{youTubeTrailerUrl}}" class="label label-info">Trailer</a>
|
||||||
|
{{/if}}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -26,7 +26,9 @@
|
|||||||
{{#if imdbId}}
|
{{#if imdbId}}
|
||||||
<a href="{{imdbUrl}}" class="label label-info">IMDB</a>
|
<a href="{{imdbUrl}}" class="label label-info">IMDB</a>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{#if youTubeTrailerId}}
|
||||||
|
<a href="{{youTubeTrailerUrl}}" class="label label-info">Trailer</a>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -126,7 +126,7 @@
|
|||||||
.card;
|
.card;
|
||||||
.clickable;
|
.clickable;
|
||||||
margin-bottom : 20px;
|
margin-bottom : 20px;
|
||||||
height : 324px;
|
height : 344px;
|
||||||
|
|
||||||
.center {
|
.center {
|
||||||
display : block;
|
display : block;
|
||||||
@ -166,7 +166,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: @screen-xs-max) {
|
@media (max-width: @screen-xs-max) {
|
||||||
height : 235px;
|
height : 268px;
|
||||||
margin : 5px;
|
margin : 5px;
|
||||||
padding : 6px 5px;
|
padding : 6px 5px;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user