Преглед изворни кода

Add some new music-related person types and parse from ffprobe

MrTimscampi пре 3 година
родитељ
комит
c9b1cd1d8c

+ 33 - 1
MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs

@@ -1132,7 +1132,7 @@ namespace MediaBrowser.MediaEncoding.Probing
                 }
             }
 
-            // Check for writer some music is tagged that way as alternative to composer/lyricist
+            // In cases where there isn't sufficient information as to which role a writer performed on a recording, tagging software uses the "writer" tag.
             if (tags.TryGetValue("writer", out var writer) && !string.IsNullOrWhiteSpace(writer))
             {
                 foreach (var person in Split(writer, false))
@@ -1141,6 +1141,38 @@ namespace MediaBrowser.MediaEncoding.Probing
                 }
             }
 
+            if (tags.TryGetValue("arranger", out var arranger) && !string.IsNullOrWhiteSpace(arranger))
+            {
+                foreach (var person in Split(arranger, false))
+                {
+                    people.Add(new BaseItemPerson { Name = person, Type = PersonType.Arranger });
+                }
+            }
+
+            if (tags.TryGetValue("engineer", out var engineer) && !string.IsNullOrWhiteSpace(engineer))
+            {
+                foreach (var person in Split(engineer, false))
+                {
+                    people.Add(new BaseItemPerson { Name = person, Type = PersonType.Engineer });
+                }
+            }
+
+            if (tags.TryGetValue("mixer", out var mixer) && !string.IsNullOrWhiteSpace(mixer))
+            {
+                foreach (var person in Split(mixer, false))
+                {
+                    people.Add(new BaseItemPerson { Name = person, Type = PersonType.Mixer });
+                }
+            }
+
+            if (tags.TryGetValue("remixer", out var remixer) && !string.IsNullOrWhiteSpace(remixer))
+            {
+                foreach (var person in Split(remixer, false))
+                {
+                    people.Add(new BaseItemPerson { Name = person, Type = PersonType.Remixer });
+                }
+            }
+
             audio.People = people.ToArray();
 
             // Set album artist

+ 29 - 9
MediaBrowser.Model/Entities/PersonType.cs

@@ -1,42 +1,42 @@
 namespace MediaBrowser.Model.Entities
 {
     /// <summary>
-    /// Struct PersonType.
+    /// Types of persons.
     /// </summary>
-    public class PersonType
+    public static class PersonType
     {
         /// <summary>
-        /// The actor.
+        /// A person whose profession is acting on the stage, in films, or on television.
         /// </summary>
         public const string Actor = "Actor";
 
         /// <summary>
-        /// The director.
+        /// A person who supervises the actors and other staff in a film, play, or similar production.
         /// </summary>
         public const string Director = "Director";
 
         /// <summary>
-        /// The composer.
+        /// A person who writes music, especially as a professional occupation.
         /// </summary>
         public const string Composer = "Composer";
 
         /// <summary>
-        /// The writer.
+        /// A writer of a book, article, or document. Can also be used as a generic term for music writer if there is a lack of specificity.
         /// </summary>
         public const string Writer = "Writer";
 
         /// <summary>
-        /// The guest star.
+        /// A well-known actor or other performer who appears in a work in which they do not have a regular role.
         /// </summary>
         public const string GuestStar = "GuestStar";
 
         /// <summary>
-        /// The producer.
+        /// A person responsible for the financial and managerial aspects of the making of a film or broadcast or for staging a play, opera, etc.
         /// </summary>
         public const string Producer = "Producer";
 
         /// <summary>
-        /// The conductor.
+        /// A person who directs the performance of an orchestra or choir.
         /// </summary>
         public const string Conductor = "Conductor";
 
@@ -44,5 +44,25 @@ namespace MediaBrowser.Model.Entities
         /// The lyricist.
         /// </summary>
         public const string Lyricist = "Lyricist";
+
+        /// <summary>
+        /// A person who writes the words to a song or musical.
+        /// </summary>
+        public const string Arranger = "Arranger";
+
+        /// <summary>
+        /// An audio engineer who performed a general engineering role.
+        /// </summary>
+        public const string Engineer = "Engineer";
+
+        /// <summary>
+        /// An engineer responsible for using a mixing console to mix a recorded track into a single piece of music suitable for release.
+        /// </summary>
+        public const string Mixer = "Mixer";
+
+        /// <summary>
+        /// A person who remixed a recording by taking one or more other tracks, substantially altering them and mixing them together with other material.
+        /// </summary>
+        public const string Remixer = "Remixer";
     }
 }

+ 1 - 1
tests/Jellyfin.MediaEncoding.Tests/Probing/ProbeResultNormalizerTests.cs

@@ -107,7 +107,7 @@ namespace Jellyfin.MediaEncoding.Tests.Probing
             Assert.Equal(2020, res.ProductionYear);
             Assert.True(res.PremiereDate.HasValue);
             Assert.Equal(DateTime.Parse("2020-10-26T00:00Z", DateTimeFormatInfo.CurrentInfo).ToUniversalTime(), res.PremiereDate);
-            Assert.Equal(18, res.People.Length);
+            Assert.Equal(22, res.People.Length);
             Assert.Equal("Krysta Youngs", res.People[0].Name);
             Assert.Equal(PersonType.Composer, res.People[0].Type);
             Assert.Equal("Julia Ross", res.People[1].Name);