aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-08-20 08:20:51 -0400
committerLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-08-20 08:20:51 -0400
commitab01b49f6430fddb6eae4c29d4591f698a8405b2 (patch)
tree49746597ec355c225dcddb5ef57744a20a57bd5e
parentda23355fccb08cacd5088fdcda2f992b74a958d9 (diff)
Added more Audio fields to DTOBaseItem
-rw-r--r--MediaBrowser.Api/ApiService.cs3
-rw-r--r--MediaBrowser.Controller/Providers/AudioInfoProvider.cs44
-rw-r--r--MediaBrowser.Model/DTO/AudioInfo.cs1
-rw-r--r--MediaBrowser.Model/Entities/Audio.cs1
4 files changed, 42 insertions, 7 deletions
diff --git a/MediaBrowser.Api/ApiService.cs b/MediaBrowser.Api/ApiService.cs
index 99b25f94e..b7a2c4adc 100644
--- a/MediaBrowser.Api/ApiService.cs
+++ b/MediaBrowser.Api/ApiService.cs
@@ -113,8 +113,7 @@ namespace MediaBrowser.Api
AlbumArtist = audio.AlbumArtist,
Artist = audio.Artist,
BitRate = audio.BitRate,
- Channels = audio.Channels,
- Composer = audio.Composer
+ Channels = audio.Channels
};
}
diff --git a/MediaBrowser.Controller/Providers/AudioInfoProvider.cs b/MediaBrowser.Controller/Providers/AudioInfoProvider.cs
index 4b79d2b7b..6d2287b2d 100644
--- a/MediaBrowser.Controller/Providers/AudioInfoProvider.cs
+++ b/MediaBrowser.Controller/Providers/AudioInfoProvider.cs
@@ -78,8 +78,16 @@ namespace MediaBrowser.Controller.Providers
audio.Name = title;
}
+ string composer = GetDictionaryValue(tags, "composer");
+
+ if (!string.IsNullOrEmpty(composer))
+ {
+ var list = (audio.People ?? new PersonInfo[] { }).ToList();
+ list.Add(new PersonInfo() { Name = composer, Type = "Composer" });
+ audio.People = list;
+ }
+
audio.Album = GetDictionaryValue(tags, "album");
- audio.Composer = GetDictionaryValue(tags, "composer");
audio.Artist = GetDictionaryValue(tags, "artist");
audio.AlbumArtist = GetDictionaryValue(tags, "albumartist") ?? GetDictionaryValue(tags, "album artist") ?? GetDictionaryValue(tags, "album_artist");
@@ -91,6 +99,36 @@ namespace MediaBrowser.Controller.Providers
audio.ProductionYear = GetDictionaryNumericValue(tags, "date");
audio.PremiereDate = GetDictionaryDateTime(tags, "retaildate") ?? GetDictionaryDateTime(tags, "retail date") ?? GetDictionaryDateTime(tags, "retail_date");
+
+ FetchGenres(audio, tags);
+
+ FetchStudios(audio, tags, "organization");
+ FetchStudios(audio, tags, "ensemble");
+ FetchStudios(audio, tags, "publisher");
+ }
+
+ private void FetchStudios(Audio audio, Dictionary<string, string> tags, string tagName)
+ {
+ string val = GetDictionaryValue(tags, tagName);
+
+ if (!string.IsNullOrEmpty(val))
+ {
+ var list = (audio.Studios ?? new string[] { }).ToList();
+ list.AddRange(val.Split('/'));
+ audio.Studios = list;
+ }
+ }
+
+ private void FetchGenres(Audio audio, Dictionary<string, string> tags)
+ {
+ string val = GetDictionaryValue(tags, "genre");
+
+ if (!string.IsNullOrEmpty(val))
+ {
+ var list = (audio.Genres ?? new string[] { }).ToList();
+ list.AddRange(val.Split('/'));
+ audio.Genres = list;
+ }
}
private int? GetDictionaryDiscValue(Dictionary<string, string> tags)
@@ -123,7 +161,7 @@ namespace MediaBrowser.Controller.Providers
return null;
}
-
+
private string GetDictionaryValue(Dictionary<string, string> tags, string key)
{
string[] keys = tags.Keys.ToArray();
@@ -174,7 +212,7 @@ namespace MediaBrowser.Controller.Providers
return null;
}
-
+
private string GetOutputCachePath(BaseItem item)
{
string outputDirectory = Path.Combine(Kernel.Instance.ApplicationPaths.FFProbeAudioCacheDirectory, item.Id.ToString().Substring(0, 1));
diff --git a/MediaBrowser.Model/DTO/AudioInfo.cs b/MediaBrowser.Model/DTO/AudioInfo.cs
index 3aa1cc1bf..b9a1c4db3 100644
--- a/MediaBrowser.Model/DTO/AudioInfo.cs
+++ b/MediaBrowser.Model/DTO/AudioInfo.cs
@@ -9,6 +9,5 @@ namespace MediaBrowser.Model.DTO
public string Artist { get; set; }
public string Album { get; set; }
public string AlbumArtist { get; set; }
- public string Composer { get; set; }
}
}
diff --git a/MediaBrowser.Model/Entities/Audio.cs b/MediaBrowser.Model/Entities/Audio.cs
index cc48a58a7..fcf33dbeb 100644
--- a/MediaBrowser.Model/Entities/Audio.cs
+++ b/MediaBrowser.Model/Entities/Audio.cs
@@ -10,6 +10,5 @@ namespace MediaBrowser.Model.Entities
public string Artist { get; set; }
public string Album { get; set; }
public string AlbumArtist { get; set; }
- public string Composer { get; set; }
}
}