mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
Added missing Audio drama type
This commit is contained in:
parent
d8407e74e7
commit
6c7a578cb7
10 changed files with 127 additions and 1 deletions
|
@ -114,6 +114,13 @@
|
||||||
"name": "Compilation"
|
"name": "Compilation"
|
||||||
},
|
},
|
||||||
"allowed": false
|
"allowed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"secondaryAlbumType": {
|
||||||
|
"id": 11,
|
||||||
|
"name": "Audio drama"
|
||||||
|
},
|
||||||
|
"allowed": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"releaseStatuses": [
|
"releaseStatuses": [
|
||||||
|
|
|
@ -116,6 +116,13 @@
|
||||||
"name": "Compilation"
|
"name": "Compilation"
|
||||||
},
|
},
|
||||||
"allowed": false
|
"allowed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"secondaryAlbumType": {
|
||||||
|
"id": 11,
|
||||||
|
"name": "Audio drama"
|
||||||
|
},
|
||||||
|
"allowed": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"releaseStatuses": [
|
"releaseStatuses": [
|
||||||
|
|
|
@ -114,6 +114,13 @@
|
||||||
"name": "Compilation"
|
"name": "Compilation"
|
||||||
},
|
},
|
||||||
"allowed": false
|
"allowed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"secondaryAlbumType": {
|
||||||
|
"id": 11,
|
||||||
|
"name": "Audio drama"
|
||||||
|
},
|
||||||
|
"allowed": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"releaseStatuses": [
|
"releaseStatuses": [
|
||||||
|
|
|
@ -114,6 +114,13 @@
|
||||||
"name": "Compilation"
|
"name": "Compilation"
|
||||||
},
|
},
|
||||||
"allowed": false
|
"allowed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"secondaryAlbumType": {
|
||||||
|
"id": 11,
|
||||||
|
"name": "Audio drama"
|
||||||
|
},
|
||||||
|
"allowed": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"releaseStatuses": [
|
"releaseStatuses": [
|
||||||
|
|
|
@ -114,6 +114,13 @@
|
||||||
"name": "Compilation"
|
"name": "Compilation"
|
||||||
},
|
},
|
||||||
"allowed": false
|
"allowed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"secondaryAlbumType": {
|
||||||
|
"id": 11,
|
||||||
|
"name": "Audio drama"
|
||||||
|
},
|
||||||
|
"allowed": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"releaseStatuses": [
|
"releaseStatuses": [
|
||||||
|
|
|
@ -114,6 +114,13 @@
|
||||||
"name": "Studio"
|
"name": "Studio"
|
||||||
},
|
},
|
||||||
"allowed": true
|
"allowed": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"secondaryAlbumType": {
|
||||||
|
"id": 11,
|
||||||
|
"name": "Audio drama"
|
||||||
|
},
|
||||||
|
"allowed": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"releaseStatuses": [
|
"releaseStatuses": [
|
||||||
|
|
|
@ -114,6 +114,13 @@
|
||||||
"name": "Compilation"
|
"name": "Compilation"
|
||||||
},
|
},
|
||||||
"allowed": false
|
"allowed": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"secondaryAlbumType": {
|
||||||
|
"id": 11,
|
||||||
|
"name": "Audio drama"
|
||||||
|
},
|
||||||
|
"allowed": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"releaseStatuses": [
|
"releaseStatuses": [
|
||||||
|
|
|
@ -0,0 +1,73 @@
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
using Dapper;
|
||||||
|
using FluentMigrator;
|
||||||
|
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Core.Datastore.Migration
|
||||||
|
{
|
||||||
|
[Migration(060)]
|
||||||
|
public class update_audio_types : NzbDroneMigrationBase
|
||||||
|
{
|
||||||
|
private readonly JsonSerializerOptions _serializerSettings;
|
||||||
|
|
||||||
|
public update_audio_types()
|
||||||
|
{
|
||||||
|
_serializerSettings = new JsonSerializerOptions
|
||||||
|
{
|
||||||
|
AllowTrailingCommas = true,
|
||||||
|
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||||
|
PropertyNameCaseInsensitive = true,
|
||||||
|
DictionaryKeyPolicy = JsonNamingPolicy.CamelCase,
|
||||||
|
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
||||||
|
WriteIndented = true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void MainDbUpgrade()
|
||||||
|
{
|
||||||
|
Execute.WithConnection(GetEntries);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GetEntries(IDbConnection conn, IDbTransaction tran)
|
||||||
|
{
|
||||||
|
var profiles = conn.Query<MetadataProfile059>($"SELECT \"Id\", \"SecondaryAlbumTypes\" FROM \"MetadataProfiles\"");
|
||||||
|
|
||||||
|
var corrected = new List<MetadataProfile059>();
|
||||||
|
|
||||||
|
foreach (var profile in profiles)
|
||||||
|
{
|
||||||
|
var oldTypes = JsonSerializer.Deserialize<List<SecondaryAlbumType059>>(profile.SecondaryAlbumTypes, _serializerSettings);
|
||||||
|
|
||||||
|
oldTypes.Add(new SecondaryAlbumType059
|
||||||
|
{
|
||||||
|
SecondaryAlbumType = 11,
|
||||||
|
Allowed = false
|
||||||
|
});
|
||||||
|
|
||||||
|
corrected.Add(new MetadataProfile059
|
||||||
|
{
|
||||||
|
Id = profile.Id,
|
||||||
|
SecondaryAlbumTypes = JsonSerializer.Serialize(oldTypes, _serializerSettings)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var updateSql = $"UPDATE \"MetadataProfiles\" SET \"SecondaryAlbumTypes\" = @SecondaryAlbumTypes WHERE \"Id\" = @Id";
|
||||||
|
conn.Execute(updateSql, corrected, transaction: tran);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class MetadataProfile059
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
public string SecondaryAlbumTypes { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SecondaryAlbumType059
|
||||||
|
{
|
||||||
|
public int SecondaryAlbumType { get; set; }
|
||||||
|
public bool Allowed { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -652,6 +652,8 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
|
||||||
return SecondaryAlbumType.Mixtape;
|
return SecondaryAlbumType.Mixtape;
|
||||||
case "demo":
|
case "demo":
|
||||||
return SecondaryAlbumType.Demo;
|
return SecondaryAlbumType.Demo;
|
||||||
|
case "audio drama":
|
||||||
|
return SecondaryAlbumType.Audiodrama;
|
||||||
default:
|
default:
|
||||||
return SecondaryAlbumType.Studio;
|
return SecondaryAlbumType.Studio;
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,6 +76,7 @@ namespace NzbDrone.Core.Music
|
||||||
public static SecondaryAlbumType DJMix => new SecondaryAlbumType(8, "DJ-mix");
|
public static SecondaryAlbumType DJMix => new SecondaryAlbumType(8, "DJ-mix");
|
||||||
public static SecondaryAlbumType Mixtape => new SecondaryAlbumType(9, "Mixtape/Street");
|
public static SecondaryAlbumType Mixtape => new SecondaryAlbumType(9, "Mixtape/Street");
|
||||||
public static SecondaryAlbumType Demo => new SecondaryAlbumType(10, "Demo");
|
public static SecondaryAlbumType Demo => new SecondaryAlbumType(10, "Demo");
|
||||||
|
public static SecondaryAlbumType Audiodrama => new SecondaryAlbumType(11, "Audio drama");
|
||||||
|
|
||||||
public static readonly List<SecondaryAlbumType> All = new List<SecondaryAlbumType>
|
public static readonly List<SecondaryAlbumType> All = new List<SecondaryAlbumType>
|
||||||
{
|
{
|
||||||
|
@ -88,7 +89,8 @@ namespace NzbDrone.Core.Music
|
||||||
Remix,
|
Remix,
|
||||||
DJMix,
|
DJMix,
|
||||||
Mixtape,
|
Mixtape,
|
||||||
Demo
|
Demo,
|
||||||
|
Audiodrama
|
||||||
};
|
};
|
||||||
|
|
||||||
public static SecondaryAlbumType FindById(int id)
|
public static SecondaryAlbumType FindById(int id)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue