mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-15 01:32:55 -07:00
Save the language code against the request so we can use it later e.g. Sending to the DVR apps
This commit is contained in:
parent
7755053ba0
commit
9cc9bf7e78
9 changed files with 1248 additions and 6 deletions
|
@ -51,7 +51,7 @@ namespace Ombi.Core.Engine
|
|||
/// <returns></returns>
|
||||
public async Task<RequestEngineResult> RequestMovie(MovieRequestViewModel model)
|
||||
{
|
||||
var movieInfo = await MovieApi.GetMovieInformationWithExtraInfo(model.TheMovieDbId);
|
||||
var movieInfo = await MovieApi.GetMovieInformationWithExtraInfo(model.TheMovieDbId, model.LanguageCode);
|
||||
if (movieInfo == null || movieInfo.Id == 0)
|
||||
{
|
||||
return new RequestEngineResult
|
||||
|
@ -82,7 +82,8 @@ namespace Ombi.Core.Engine
|
|||
RequestedDate = DateTime.UtcNow,
|
||||
Approved = false,
|
||||
RequestedUserId = userDetails.Id,
|
||||
Background = movieInfo.BackdropPath
|
||||
Background = movieInfo.BackdropPath,
|
||||
LangCode = model.LanguageCode
|
||||
};
|
||||
|
||||
var usDates = movieInfo.ReleaseDates?.Results?.FirstOrDefault(x => x.IsoCode == "US");
|
||||
|
|
|
@ -29,5 +29,6 @@ namespace Ombi.Core.Models.Requests
|
|||
public class MovieRequestViewModel
|
||||
{
|
||||
public int TheMovieDbId { get; set; }
|
||||
public string LanguageCode { get; set; } = "en";
|
||||
}
|
||||
}
|
|
@ -10,6 +10,6 @@
|
|||
public bool IgnoreCertificateErrors { get; set; }
|
||||
public bool DoNotSendNotificationsForAutoApprove { get; set; }
|
||||
public bool HideRequestsUsers { get; set; }
|
||||
|
||||
public string DefaultLanguageCode { get; set; } = "en";
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using Ombi.Helpers;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
|
@ -19,5 +19,13 @@ namespace Ombi.Store.Entities.Requests
|
|||
|
||||
public int RootPathOverride { get; set; }
|
||||
public int QualityOverride { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Only Use for setting the Language Code, Use the LanguageCode property for reading
|
||||
/// </summary>
|
||||
public string LangCode { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string LanguageCode => LangCode.IsNullOrEmpty() ? "en" : LangCode;
|
||||
}
|
||||
}
|
||||
|
|
1206
src/Ombi.Store/Migrations/20190104203305_LanguageCode.Designer.cs
generated
Normal file
1206
src/Ombi.Store/Migrations/20190104203305_LanguageCode.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
22
src/Ombi.Store/Migrations/20190104203305_LanguageCode.cs
Normal file
22
src/Ombi.Store/Migrations/20190104203305_LanguageCode.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace Ombi.Store.Migrations
|
||||
{
|
||||
public partial class LanguageCode : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "LangCode",
|
||||
table: "MovieRequests",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "LangCode",
|
||||
table: "MovieRequests");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using Ombi.Store.Context;
|
||||
|
||||
namespace Ombi.Store.Migrations
|
||||
|
@ -730,6 +731,8 @@ namespace Ombi.Store.Migrations
|
|||
|
||||
b.Property<int?>("IssueId");
|
||||
|
||||
b.Property<string>("LangCode");
|
||||
|
||||
b.Property<DateTime>("MarkedAsApproved");
|
||||
|
||||
b.Property<DateTime?>("MarkedAsAvailable");
|
||||
|
|
|
@ -154,6 +154,7 @@ export interface IEpisodesRequests {
|
|||
|
||||
export interface IMovieRequestModel {
|
||||
theMovieDbId: number;
|
||||
languageCode: string;
|
||||
}
|
||||
|
||||
export interface IFilter {
|
||||
|
|
|
@ -84,7 +84,8 @@ export class MovieSearchComponent implements OnInit {
|
|||
}
|
||||
|
||||
try {
|
||||
this.requestService.requestMovie({ theMovieDbId: searchResult.id })
|
||||
const language = this.selectedLanguage && this.selectedLanguage.length > 0 ? this.selectedLanguage : "en";
|
||||
this.requestService.requestMovie({ theMovieDbId: searchResult.id, languageCode: language })
|
||||
.subscribe(x => {
|
||||
this.result = x;
|
||||
if (this.result.result) {
|
||||
|
@ -189,7 +190,6 @@ export class MovieSearchComponent implements OnInit {
|
|||
}
|
||||
|
||||
public applyRefinedSearch() {
|
||||
console.log(this.selectedLanguage);
|
||||
this.runSearch();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue