Change editor rule
This commit is contained in:
@@ -1,18 +1,19 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
/// <summary>The picture file names of an album or playlist. Resized names stay null until processing finishes.</summary>
|
||||
public class EntityPictures
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
[Required]
|
||||
public required string OriginalName { get; set; }
|
||||
/// <summary>The picture file names of an album or playlist. Resized names stay null until processing finishes.</summary>
|
||||
public class EntityPictures
|
||||
{
|
||||
[Required]
|
||||
public required string OriginalName { get; set; }
|
||||
|
||||
public string? SmallName { get; set; }
|
||||
public string? SmallName { get; set; }
|
||||
|
||||
public string? MediumName { get; set; }
|
||||
public string? MediumName { get; set; }
|
||||
|
||||
public string? LargeName { get; set; }
|
||||
public string? LargeName { get; set; }
|
||||
|
||||
public static EntityPictures Pending(string objectName) => new() { OriginalName = objectName };
|
||||
public static EntityPictures Pending(string objectName) => new() { OriginalName = objectName };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +1,32 @@
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public enum Genre
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
Pop = 0,
|
||||
Rock = 1,
|
||||
HipHop = 2,
|
||||
RnB = 3,
|
||||
Jazz = 4,
|
||||
Blues = 5,
|
||||
Classical = 6,
|
||||
Electronic = 7,
|
||||
House = 8,
|
||||
Techno = 9,
|
||||
Trance = 10,
|
||||
Dubstep = 11,
|
||||
DrumAndBass = 12,
|
||||
Metal = 13,
|
||||
Punk = 14,
|
||||
Reggae = 15,
|
||||
Reggaeton = 16,
|
||||
Country = 17,
|
||||
Folk = 18,
|
||||
Indie = 19,
|
||||
KPop = 20,
|
||||
Latin = 21,
|
||||
Soul = 22,
|
||||
Funk = 23,
|
||||
Ambient = 24,
|
||||
Lofi = 25
|
||||
public enum Genre
|
||||
{
|
||||
Pop = 0,
|
||||
Rock = 1,
|
||||
HipHop = 2,
|
||||
RnB = 3,
|
||||
Jazz = 4,
|
||||
Blues = 5,
|
||||
Classical = 6,
|
||||
Electronic = 7,
|
||||
House = 8,
|
||||
Techno = 9,
|
||||
Trance = 10,
|
||||
Dubstep = 11,
|
||||
DrumAndBass = 12,
|
||||
Metal = 13,
|
||||
Punk = 14,
|
||||
Reggae = 15,
|
||||
Reggaeton = 16,
|
||||
Country = 17,
|
||||
Folk = 18,
|
||||
Indie = 19,
|
||||
KPop = 20,
|
||||
Latin = 21,
|
||||
Soul = 22,
|
||||
Funk = 23,
|
||||
Ambient = 24,
|
||||
Lofi = 25
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +1,50 @@
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
|
||||
public static class GenreCompatibility
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
private static readonly HashSet<(Genre, Genre)> IncompatiblePairs = BuildIncompatiblePairs();
|
||||
|
||||
private static HashSet<(Genre, Genre)> BuildIncompatiblePairs()
|
||||
public static class GenreCompatibility
|
||||
{
|
||||
var pairs = new HashSet<(Genre, Genre)>();
|
||||
private static readonly HashSet<(Genre, Genre)> IncompatiblePairs = BuildIncompatiblePairs();
|
||||
|
||||
void Add(Genre a, Genre b)
|
||||
private static HashSet<(Genre, Genre)> BuildIncompatiblePairs()
|
||||
{
|
||||
pairs.Add((a, b));
|
||||
pairs.Add((b, a));
|
||||
}
|
||||
var pairs = new HashSet<(Genre, Genre)>();
|
||||
|
||||
var intense = new[] { Genre.Metal, Genre.Punk, Genre.Dubstep, Genre.DrumAndBass };
|
||||
var mellow = new[] { Genre.Classical, Genre.Ambient, Genre.Lofi };
|
||||
|
||||
foreach (var intenseGenre in intense)
|
||||
{
|
||||
foreach (var mellowGenre in mellow)
|
||||
Add(intenseGenre, mellowGenre);
|
||||
}
|
||||
|
||||
return pairs;
|
||||
}
|
||||
|
||||
public static bool AreCompatible(Genre a, Genre b) =>
|
||||
a == b || !IncompatiblePairs.Contains((a, b));
|
||||
|
||||
public static IReadOnlyCollection<(Genre First, Genre Second)> FindConflicts(IEnumerable<Genre> tags)
|
||||
{
|
||||
var distinctTags = tags.Distinct().ToList();
|
||||
var conflicts = new List<(Genre, Genre)>();
|
||||
|
||||
for (var i = 0; i < distinctTags.Count; i++)
|
||||
{
|
||||
for (var j = i + 1; j < distinctTags.Count; j++)
|
||||
void Add(Genre a, Genre b)
|
||||
{
|
||||
if (!AreCompatible(distinctTags[i], distinctTags[j]))
|
||||
conflicts.Add((distinctTags[i], distinctTags[j]));
|
||||
pairs.Add((a, b));
|
||||
pairs.Add((b, a));
|
||||
}
|
||||
|
||||
var intense = new[] { Genre.Metal, Genre.Punk, Genre.Dubstep, Genre.DrumAndBass };
|
||||
var mellow = new[] { Genre.Classical, Genre.Ambient, Genre.Lofi };
|
||||
|
||||
foreach (var intenseGenre in intense)
|
||||
{
|
||||
foreach (var mellowGenre in mellow)
|
||||
Add(intenseGenre, mellowGenre);
|
||||
}
|
||||
|
||||
return pairs;
|
||||
}
|
||||
|
||||
return conflicts;
|
||||
public static bool AreCompatible(Genre a, Genre b) =>
|
||||
a == b || !IncompatiblePairs.Contains((a, b));
|
||||
|
||||
public static IReadOnlyCollection<(Genre First, Genre Second)> FindConflicts(IEnumerable<Genre> tags)
|
||||
{
|
||||
var distinctTags = tags.Distinct().ToList();
|
||||
var conflicts = new List<(Genre, Genre)>();
|
||||
|
||||
for (var i = 0; i < distinctTags.Count; i++)
|
||||
{
|
||||
for (var j = i + 1; j < distinctTags.Count; j++)
|
||||
{
|
||||
if (!AreCompatible(distinctTags[i], distinctTags[j]))
|
||||
conflicts.Add((distinctTags[i], distinctTags[j]));
|
||||
}
|
||||
}
|
||||
|
||||
return conflicts;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public enum LifeCycleStatus
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
Active = 0,
|
||||
Removing = 1,
|
||||
Failed = 2
|
||||
public enum LifeCycleStatus
|
||||
{
|
||||
Active = 0,
|
||||
Removing = 1,
|
||||
Failed = 2
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public enum MixKind
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
Discovery = 0,
|
||||
Daily = 1
|
||||
public enum MixKind
|
||||
{
|
||||
Discovery = 0,
|
||||
Daily = 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public enum PlayListVisibility
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
Private = 0,
|
||||
Public = 1
|
||||
public enum PlayListVisibility
|
||||
{
|
||||
Private = 0,
|
||||
Public = 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public enum ProcessingStatus
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
Pending = 0,
|
||||
Processing = 1,
|
||||
Completed = 2,
|
||||
Failed = 3
|
||||
public enum ProcessingStatus
|
||||
{
|
||||
Pending = 0,
|
||||
Processing = 1,
|
||||
Completed = 2,
|
||||
Failed = 3
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public class TrackAudio
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
public string? OriginalName { get; set; }
|
||||
public class TrackAudio
|
||||
{
|
||||
public string? OriginalName { get; set; }
|
||||
|
||||
public string? FolderName { get; set; }
|
||||
public string? FolderName { get; set; }
|
||||
|
||||
public ProcessingStatus TranscodeStatus { get; set; } = ProcessingStatus.Pending;
|
||||
public ProcessingStatus TranscodeStatus { get; set; } = ProcessingStatus.Pending;
|
||||
|
||||
[MemberNotNullWhen(true, nameof(FolderName))]
|
||||
public bool IsProcessed => TranscodeStatus == ProcessingStatus.Completed;
|
||||
[MemberNotNullWhen(true, nameof(FolderName))]
|
||||
public bool IsProcessed => TranscodeStatus == ProcessingStatus.Completed;
|
||||
|
||||
public bool IsFailed => TranscodeStatus == ProcessingStatus.Failed;
|
||||
public bool IsFailed => TranscodeStatus == ProcessingStatus.Failed;
|
||||
|
||||
public bool IsInProgress => TranscodeStatus is ProcessingStatus.Pending or ProcessingStatus.Processing;
|
||||
public bool IsInProgress => TranscodeStatus is ProcessingStatus.Pending or ProcessingStatus.Processing;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public class TrackPictures
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
public string? OriginalName { get; set; }
|
||||
public class TrackPictures
|
||||
{
|
||||
public string? OriginalName { get; set; }
|
||||
|
||||
public string? SmallName { get; set; }
|
||||
public string? SmallName { get; set; }
|
||||
|
||||
public string? MediumName { get; set; }
|
||||
public string? MediumName { get; set; }
|
||||
|
||||
public string? LargeName { get; set; }
|
||||
public string? LargeName { get; set; }
|
||||
|
||||
public ProcessingStatus ProcessingStatus { get; set; } = ProcessingStatus.Pending;
|
||||
public ProcessingStatus ProcessingStatus { get; set; } = ProcessingStatus.Pending;
|
||||
|
||||
[MemberNotNullWhen(true, nameof(SmallName))]
|
||||
[MemberNotNullWhen(true, nameof(MediumName))]
|
||||
[MemberNotNullWhen(true, nameof(LargeName))]
|
||||
public bool IsProcessed => ProcessingStatus == ProcessingStatus.Completed;
|
||||
[MemberNotNullWhen(true, nameof(SmallName))]
|
||||
[MemberNotNullWhen(true, nameof(MediumName))]
|
||||
[MemberNotNullWhen(true, nameof(LargeName))]
|
||||
public bool IsProcessed => ProcessingStatus == ProcessingStatus.Completed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public enum UploadIntentPurpose
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
PlayListPicture,
|
||||
TrackPicture,
|
||||
TrackAudio,
|
||||
AlbumPicture,
|
||||
public enum UploadIntentPurpose
|
||||
{
|
||||
PlayListPicture,
|
||||
TrackPicture,
|
||||
TrackAudio,
|
||||
AlbumPicture,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
namespace Musify.Domain.ValueObjects;
|
||||
|
||||
public enum UploadIntentStatus
|
||||
namespace Musify.Domain.ValueObjects
|
||||
{
|
||||
Issued,
|
||||
Consumed,
|
||||
Expired,
|
||||
public enum UploadIntentStatus
|
||||
{
|
||||
Issued,
|
||||
Consumed,
|
||||
Expired,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user