feat(requests): add language profile support (#860)

This commit is contained in:
Jakob Ankarhem
2021-02-07 16:33:18 +01:00
committed by GitHub
parent 8956cb3915
commit 53f6f59798
13 changed files with 358 additions and 32 deletions

View File

@@ -78,6 +78,9 @@ export class MediaRequest {
@Column({ nullable: true })
public rootFolder: string;
@Column({ nullable: true })
public languageProfileId: number;
constructor(init?: Partial<MediaRequest>) {
Object.assign(this, init);
}
@@ -559,6 +562,11 @@ export class MediaRequest {
? sonarrSettings.activeAnimeProfileId
: sonarrSettings.activeProfileId;
let languageProfile =
seriesType === 'anime' && sonarrSettings.activeAnimeLanguageProfileId
? sonarrSettings.activeAnimeLanguageProfileId
: sonarrSettings.activeLanguageProfileId;
if (
this.rootFolder &&
this.rootFolder !== '' &&
@@ -577,10 +585,24 @@ export class MediaRequest {
});
}
if (
this.languageProfileId &&
this.languageProfileId !== languageProfile
) {
languageProfile = this.languageProfileId;
logger.info(
`Request has an override Language Profile: ${languageProfile}`,
{
label: 'Media Request',
}
);
}
// Run this asynchronously so we don't wait for it on the UI side
sonarr
.addSeries({
profileId: qualityProfile,
languageProfileId: languageProfile,
rootFolderPath: rootFolder,
title: series.name,
tvdbid: tvdbId,