mirror of https://github.com/lidarr/Lidarr
Added missing Audio drama type
This commit is contained in:
parent
d8407e74e7
commit
6c7a578cb7
|
@ -114,6 +114,13 @@
|
|||
"name": "Compilation"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"secondaryAlbumType": {
|
||||
"id": 11,
|
||||
"name": "Audio drama"
|
||||
},
|
||||
"allowed": false
|
||||
}
|
||||
],
|
||||
"releaseStatuses": [
|
||||
|
|
|
@ -116,6 +116,13 @@
|
|||
"name": "Compilation"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"secondaryAlbumType": {
|
||||
"id": 11,
|
||||
"name": "Audio drama"
|
||||
},
|
||||
"allowed": false
|
||||
}
|
||||
],
|
||||
"releaseStatuses": [
|
||||
|
|
|
@ -114,6 +114,13 @@
|
|||
"name": "Compilation"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"secondaryAlbumType": {
|
||||
"id": 11,
|
||||
"name": "Audio drama"
|
||||
},
|
||||
"allowed": false
|
||||
}
|
||||
],
|
||||
"releaseStatuses": [
|
||||
|
|
|
@ -114,6 +114,13 @@
|
|||
"name": "Compilation"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"secondaryAlbumType": {
|
||||
"id": 11,
|
||||
"name": "Audio drama"
|
||||
},
|
||||
"allowed": false
|
||||
}
|
||||
],
|
||||
"releaseStatuses": [
|
||||
|
|
|
@ -114,6 +114,13 @@
|
|||
"name": "Compilation"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"secondaryAlbumType": {
|
||||
"id": 11,
|
||||
"name": "Audio drama"
|
||||
},
|
||||
"allowed": false
|
||||
}
|
||||
],
|
||||
"releaseStatuses": [
|
||||
|
|
|
@ -114,6 +114,13 @@
|
|||
"name": "Studio"
|
||||
},
|
||||
"allowed": true
|
||||
},
|
||||
{
|
||||
"secondaryAlbumType": {
|
||||
"id": 11,
|
||||
"name": "Audio drama"
|
||||
},
|
||||
"allowed": false
|
||||
}
|
||||
],
|
||||
"releaseStatuses": [
|
||||
|
|
|
@ -114,6 +114,13 @@
|
|||
"name": "Compilation"
|
||||
},
|
||||
"allowed": false
|
||||
},
|
||||
{
|
||||
"secondaryAlbumType": {
|
||||
"id": 11,
|
||||
"name": "Audio drama"
|
||||
},
|
||||
"allowed": false
|
||||
}
|
||||
],
|
||||
"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;
|
||||
case "demo":
|
||||
return SecondaryAlbumType.Demo;
|
||||
case "audio drama":
|
||||
return SecondaryAlbumType.Audiodrama;
|
||||
default:
|
||||
return SecondaryAlbumType.Studio;
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ namespace NzbDrone.Core.Music
|
|||
public static SecondaryAlbumType DJMix => new SecondaryAlbumType(8, "DJ-mix");
|
||||
public static SecondaryAlbumType Mixtape => new SecondaryAlbumType(9, "Mixtape/Street");
|
||||
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>
|
||||
{
|
||||
|
@ -88,7 +89,8 @@ namespace NzbDrone.Core.Music
|
|||
Remix,
|
||||
DJMix,
|
||||
Mixtape,
|
||||
Demo
|
||||
Demo,
|
||||
Audiodrama
|
||||
};
|
||||
|
||||
public static SecondaryAlbumType FindById(int id)
|
||||
|
|
Loading…
Reference in New Issue