Added more Audio fields to DTOBaseItem

This commit is contained in:
LukePulverenti Luke Pulverenti luke pulverenti 2012-08-20 08:20:51 -04:00
parent da23355fcc
commit ab01b49f64
4 changed files with 42 additions and 7 deletions

View File

@ -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
};
}

View File

@ -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)

View File

@ -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; }
}
}

View File

@ -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; }
}
}