Changed some types to List to avoid having to call ToList for insertion purposes
This commit is contained in:
parent
2b8f23dff4
commit
278cf89a88
|
@ -48,7 +48,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioStream audioStream = (LibraryItem.AudioStreams ?? new AudioStream[] { }).FirstOrDefault();
|
AudioStream audioStream = (LibraryItem.AudioStreams ?? new List<AudioStream>()).FirstOrDefault();
|
||||||
|
|
||||||
if (audioStream != null)
|
if (audioStream != null)
|
||||||
{
|
{
|
||||||
|
@ -121,7 +121,7 @@ namespace MediaBrowser.Api.HttpHandlers
|
||||||
|
|
||||||
private string GetAudioArguments(string outputFormat)
|
private string GetAudioArguments(string outputFormat)
|
||||||
{
|
{
|
||||||
AudioStream audioStream = (LibraryItem.AudioStreams ?? new AudioStream[] { }).FirstOrDefault();
|
AudioStream audioStream = (LibraryItem.AudioStreams ?? new List<AudioStream>()).FirstOrDefault();
|
||||||
|
|
||||||
if (audioStream == null)
|
if (audioStream == null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,7 +96,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(composer))
|
if (!string.IsNullOrEmpty(composer))
|
||||||
{
|
{
|
||||||
var list = (audio.People ?? new PersonInfo[] { }).ToList();
|
var list = audio.People ?? new List<PersonInfo>();
|
||||||
list.Add(new PersonInfo() { Name = composer, Type = "Composer" });
|
list.Add(new PersonInfo() { Name = composer, Type = "Composer" });
|
||||||
audio.People = list;
|
audio.People = list;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(val))
|
if (!string.IsNullOrEmpty(val))
|
||||||
{
|
{
|
||||||
var list = (audio.Studios ?? new string[] { }).ToList();
|
var list = audio.Studios ?? new List<string>();
|
||||||
list.AddRange(val.Split('/'));
|
list.AddRange(val.Split('/'));
|
||||||
audio.Studios = list;
|
audio.Studios = list;
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(val))
|
if (!string.IsNullOrEmpty(val))
|
||||||
{
|
{
|
||||||
var list = (audio.Genres ?? new string[] { }).ToList();
|
var list = audio.Genres ?? new List<string>();
|
||||||
list.AddRange(val.Split('/'));
|
list.AddRange(val.Split('/'));
|
||||||
audio.Genres = list;
|
audio.Genres = list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
|
|
||||||
if (baseItem != null)
|
if (baseItem != null)
|
||||||
{
|
{
|
||||||
return Task.Run(() => { PopulateImages(baseItem, args); });
|
return Task.Run(() => { PopulateBaseItemImages(baseItem, args); });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -74,7 +74,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fills in image paths based on files win the folder
|
/// Fills in image paths based on files win the folder
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void PopulateImages(BaseItem item, ItemResolveEventArgs args)
|
private void PopulateBaseItemImages(BaseItem item, ItemResolveEventArgs args)
|
||||||
{
|
{
|
||||||
List<string> backdropFiles = new List<string>();
|
List<string> backdropFiles = new List<string>();
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ namespace MediaBrowser.Controller.Providers
|
||||||
|
|
||||||
audio.Language = AudioInfoProvider.GetDictionaryValue(stream.tags, "language");
|
audio.Language = AudioInfoProvider.GetDictionaryValue(stream.tags, "language");
|
||||||
|
|
||||||
List<AudioStream> streams = (video.AudioStreams ?? new AudioStream[] { }).ToList();
|
List<AudioStream> streams = video.AudioStreams ?? new List<AudioStream>();
|
||||||
streams.Add(audio);
|
streams.Add(audio);
|
||||||
video.AudioStreams = streams;
|
video.AudioStreams = streams;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ namespace MediaBrowser.Controller.Xml
|
||||||
|
|
||||||
case "TagLine":
|
case "TagLine":
|
||||||
{
|
{
|
||||||
var list = (item.Taglines ?? new string[] { }).ToList();
|
var list = item.Taglines ?? new List<string>();
|
||||||
var tagline = reader.ReadElementContentAsString();
|
var tagline = reader.ReadElementContentAsString();
|
||||||
|
|
||||||
if (!list.Contains(tagline))
|
if (!list.Contains(tagline))
|
||||||
|
@ -135,10 +135,10 @@ namespace MediaBrowser.Controller.Xml
|
||||||
|
|
||||||
case "Genre":
|
case "Genre":
|
||||||
{
|
{
|
||||||
var genres = (item.Genres ?? new string[] { }).ToList();
|
var list = item.Genres ?? new List<string>();
|
||||||
genres.AddRange(GetSplitValues(reader.ReadElementContentAsString(), '|'));
|
list.AddRange(GetSplitValues(reader.ReadElementContentAsString(), '|'));
|
||||||
|
|
||||||
item.Genres = genres;
|
item.Genres = list;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,16 +148,16 @@ namespace MediaBrowser.Controller.Xml
|
||||||
|
|
||||||
case "Network":
|
case "Network":
|
||||||
{
|
{
|
||||||
var studios = (item.Studios ?? new string[] { }).ToList();
|
var list = item.Studios ?? new List<string>();
|
||||||
studios.AddRange(GetSplitValues(reader.ReadElementContentAsString(), '|'));
|
list.AddRange(GetSplitValues(reader.ReadElementContentAsString(), '|'));
|
||||||
|
|
||||||
item.Studios = studios;
|
item.Studios = list;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "Director":
|
case "Director":
|
||||||
{
|
{
|
||||||
var list = (item.People ?? new PersonInfo[] { }).ToList();
|
var list = item.People ?? new List<PersonInfo>();
|
||||||
list.AddRange(GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo() { Name = v, Type = "Director" }));
|
list.AddRange(GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo() { Name = v, Type = "Director" }));
|
||||||
|
|
||||||
item.People = list;
|
item.People = list;
|
||||||
|
@ -165,7 +165,7 @@ namespace MediaBrowser.Controller.Xml
|
||||||
}
|
}
|
||||||
case "Writer":
|
case "Writer":
|
||||||
{
|
{
|
||||||
var list = (item.People ?? new PersonInfo[] { }).ToList();
|
var list = item.People ?? new List<PersonInfo>();
|
||||||
list.AddRange(GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo() { Name = v, Type = "Writer" }));
|
list.AddRange(GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo() { Name = v, Type = "Writer" }));
|
||||||
|
|
||||||
item.People = list;
|
item.People = list;
|
||||||
|
@ -175,7 +175,7 @@ namespace MediaBrowser.Controller.Xml
|
||||||
case "Actors":
|
case "Actors":
|
||||||
case "GuestStars":
|
case "GuestStars":
|
||||||
{
|
{
|
||||||
var list = (item.People ?? new PersonInfo[] { }).ToList();
|
var list = item.People ?? new List<PersonInfo>();
|
||||||
list.AddRange(GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo() { Name = v, Type = "Actor" }));
|
list.AddRange(GetSplitValues(reader.ReadElementContentAsString(), '|').Select(v => new PersonInfo() { Name = v, Type = "Actor" }));
|
||||||
|
|
||||||
item.People = list;
|
item.People = list;
|
||||||
|
@ -309,7 +309,7 @@ namespace MediaBrowser.Controller.Xml
|
||||||
{
|
{
|
||||||
AudioStream stream = FetchMediaInfoAudio(reader.ReadSubtree());
|
AudioStream stream = FetchMediaInfoAudio(reader.ReadSubtree());
|
||||||
|
|
||||||
List<AudioStream> streams = (item.AudioStreams ?? new AudioStream[] { }).ToList();
|
List<AudioStream> streams = item.AudioStreams ?? new List<AudioStream>();
|
||||||
streams.Add(stream);
|
streams.Add(stream);
|
||||||
item.AudioStreams = streams;
|
item.AudioStreams = streams;
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ namespace MediaBrowser.Controller.Xml
|
||||||
{
|
{
|
||||||
SubtitleStream stream = FetchMediaInfoSubtitles(reader.ReadSubtree());
|
SubtitleStream stream = FetchMediaInfoSubtitles(reader.ReadSubtree());
|
||||||
|
|
||||||
List<SubtitleStream> streams = (item.Subtitles ?? new SubtitleStream[] { }).ToList();
|
List<SubtitleStream> streams = item.Subtitles ?? new List<SubtitleStream>();
|
||||||
streams.Add(stream);
|
streams.Add(stream);
|
||||||
item.Subtitles = streams;
|
item.Subtitles = streams;
|
||||||
|
|
||||||
|
@ -490,7 +490,7 @@ namespace MediaBrowser.Controller.Xml
|
||||||
|
|
||||||
private void FetchFromTaglinesNode(XmlReader reader, T item)
|
private void FetchFromTaglinesNode(XmlReader reader, T item)
|
||||||
{
|
{
|
||||||
List<string> list = (item.Taglines ?? new string[] { }).ToList();
|
var list = item.Taglines ?? new List<string>();
|
||||||
|
|
||||||
reader.MoveToContent();
|
reader.MoveToContent();
|
||||||
|
|
||||||
|
@ -504,7 +504,7 @@ namespace MediaBrowser.Controller.Xml
|
||||||
{
|
{
|
||||||
string val = reader.ReadElementContentAsString();
|
string val = reader.ReadElementContentAsString();
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(val))
|
if (!string.IsNullOrWhiteSpace(val) && !list.Contains(val))
|
||||||
{
|
{
|
||||||
list.Add(val);
|
list.Add(val);
|
||||||
}
|
}
|
||||||
|
@ -523,7 +523,7 @@ namespace MediaBrowser.Controller.Xml
|
||||||
|
|
||||||
private void FetchFromGenresNode(XmlReader reader, T item)
|
private void FetchFromGenresNode(XmlReader reader, T item)
|
||||||
{
|
{
|
||||||
List<string> list = (item.Genres ?? new string[] { }).ToList();
|
var list = item.Genres ?? new List<string>();
|
||||||
|
|
||||||
reader.MoveToContent();
|
reader.MoveToContent();
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ namespace MediaBrowser.Controller.Xml
|
||||||
|
|
||||||
private void FetchDataFromPersonsNode(XmlReader reader, T item)
|
private void FetchDataFromPersonsNode(XmlReader reader, T item)
|
||||||
{
|
{
|
||||||
List<PersonInfo> list = (item.People ?? new PersonInfo[] { }).ToList();
|
var list = item.People ?? new List<PersonInfo>();
|
||||||
|
|
||||||
reader.MoveToContent();
|
reader.MoveToContent();
|
||||||
|
|
||||||
|
@ -584,7 +584,7 @@ namespace MediaBrowser.Controller.Xml
|
||||||
|
|
||||||
private void FetchFromStudiosNode(XmlReader reader, T item)
|
private void FetchFromStudiosNode(XmlReader reader, T item)
|
||||||
{
|
{
|
||||||
List<string> list = (item.Studios ?? new string[] { }).ToList();
|
var list = item.Studios ?? new List<string>();
|
||||||
|
|
||||||
reader.MoveToContent();
|
reader.MoveToContent();
|
||||||
|
|
||||||
|
|
|
@ -56,13 +56,13 @@ namespace MediaBrowser.Model.Entities
|
||||||
|
|
||||||
public string Language { get; set; }
|
public string Language { get; set; }
|
||||||
public string Overview { get; set; }
|
public string Overview { get; set; }
|
||||||
public IEnumerable<string> Taglines { get; set; }
|
public List<string> Taglines { get; set; }
|
||||||
|
|
||||||
public IEnumerable<PersonInfo> People { get; set; }
|
public List<PersonInfo> People { get; set; }
|
||||||
|
|
||||||
public IEnumerable<string> Studios { get; set; }
|
public List<string> Studios { get; set; }
|
||||||
|
|
||||||
public IEnumerable<string> Genres { get; set; }
|
public List<string> Genres { get; set; }
|
||||||
|
|
||||||
public string DisplayMediaType { get; set; }
|
public string DisplayMediaType { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@ namespace MediaBrowser.Model.Entities
|
||||||
{
|
{
|
||||||
public VideoType VideoType { get; set; }
|
public VideoType VideoType { get; set; }
|
||||||
|
|
||||||
public IEnumerable<SubtitleStream> Subtitles { get; set; }
|
public List<SubtitleStream> Subtitles { get; set; }
|
||||||
public IEnumerable<AudioStream> AudioStreams { get; set; }
|
public List<AudioStream> AudioStreams { get; set; }
|
||||||
|
|
||||||
public int Height { get; set; }
|
public int Height { get; set; }
|
||||||
public int Width { get; set; }
|
public int Width { get; set; }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user