Localize TV and movies titles in requests

This commit is contained in:
Florian Dupret 2021-10-21 16:22:16 +02:00
commit ee423db4e6
8 changed files with 11 additions and 9 deletions

View file

@ -183,7 +183,7 @@ namespace Ombi.Core.Engine
var tvBuilder = new TvShowRequestBuilderV2(MovieDbApi);
(await tvBuilder
.GetShowInfo(tv.TheMovieDbId))
.GetShowInfo(tv.TheMovieDbId, tv.languageCode))
.CreateTvList(tv)
.CreateChild(tv, canRequestOnBehalf ? tv.RequestOnBehalf : user.Id);

View file

@ -30,9 +30,9 @@ namespace Ombi.Core.Helpers
public TvRequests NewRequest { get; protected set; }
protected TvInfo TheMovieDbRecord { get; set; }
public async Task<TvShowRequestBuilderV2> GetShowInfo(int id)
public async Task<TvShowRequestBuilderV2> GetShowInfo(int id, string langCode = "en")
{
TheMovieDbRecord = await MovieDbApi.GetTVInfo(id.ToString());
TheMovieDbRecord = await MovieDbApi.GetTVInfo(id.ToString(), langCode);
// Remove 'Specials Season'
var firstSeason = TheMovieDbRecord.seasons.OrderBy(x => x.season_number).FirstOrDefault();

View file

@ -6,5 +6,6 @@ namespace Ombi.Core.Models.Requests
public class TvRequestViewModelV2 : TvRequestViewModelBase
{
public int TheMovieDbId { get; set; }
public string languageCode { get; set; } = "en";
}
}

View file

@ -124,7 +124,7 @@ export class DiscoverCardComponent implements OnInit {
dialog.afterClosed().subscribe((result) => {
if (result) {
this.requestService.requestMovie({ theMovieDbId: +this.result.id,
languageCode: null,
languageCode: navigator.language,
qualityPathOverride: result.radarrPathId,
requestOnBehalf: result.username?.id,
rootFolderOverride: result.radarrFolderId, }).subscribe(x => {
@ -138,7 +138,7 @@ export class DiscoverCardComponent implements OnInit {
}
});
} else {
this.requestService.requestMovie({ theMovieDbId: +this.result.id, languageCode: null, requestOnBehalf: null, qualityPathOverride: null, rootFolderOverride: null }).subscribe(x => {
this.requestService.requestMovie({ theMovieDbId: +this.result.id, languageCode: navigator.language, requestOnBehalf: null, qualityPathOverride: null, rootFolderOverride: null }).subscribe(x => {
if (x.result) {
this.result.requested = true;
this.messageService.send(this.translate.instant("Requests.RequestAddedSuccessfully", { title: this.result.title }), "Ok");

View file

@ -44,6 +44,7 @@ export interface ISearchTvResult {
export interface ITvRequestViewModelV2 extends ITvRequestViewModelBase {
theMovieDbId: number;
languageCode: string;
}

View file

@ -92,7 +92,7 @@ export class MovieDetailsComponent {
dialog.afterClosed().subscribe(async (result) => {
if (result) {
const requestResult = await this.requestService.requestMovie({ theMovieDbId: this.theMovidDbId,
languageCode: null,
languageCode: navigator.language,
qualityPathOverride: result.radarrPathId,
requestOnBehalf: result.username?.id,
rootFolderOverride: result.radarrFolderId, }).toPromise();
@ -107,7 +107,7 @@ export class MovieDetailsComponent {
}
});
} else {
const result = await this.requestService.requestMovie({ theMovieDbId: this.theMovidDbId, languageCode: null, requestOnBehalf: userId, qualityPathOverride: undefined, rootFolderOverride: undefined }).toPromise();
const result = await this.requestService.requestMovie({ theMovieDbId: this.theMovidDbId, languageCode: navigator.language, requestOnBehalf: userId, qualityPathOverride: undefined, rootFolderOverride: undefined }).toPromise();
if (result.result) {
this.movie.requested = true;
this.movie.requestId = result.requestId;

View file

@ -43,7 +43,7 @@ export class TvRequestGridComponent {
const viewModel = <ITvRequestViewModelV2>{
firstSeason: this.tv.firstSeason, latestSeason: this.tv.latestSeason, requestAll: this.tv.requestAll, theMovieDbId: this.tv.id,
requestOnBehalf: null
requestOnBehalf: null, languageCode: navigator.language
};
viewModel.seasons = [];
this.tv.seasonRequests.forEach((season) => {

View file

@ -45,7 +45,7 @@ export class EpisodeRequestComponent {
const viewModel = <ITvRequestViewModelV2>{
firstSeason: this.data.series.firstSeason, latestSeason: this.data.series.latestSeason, requestAll: this.data.series.requestAll, theMovieDbId: this.data.series.id,
requestOnBehalf: this.data.requestOnBehalf
requestOnBehalf: this.data.requestOnBehalf, languageCode: navigator.language
};
viewModel.seasons = [];
this.data.series.seasonRequests.forEach((season) => {