fix handling of bare nfo's
This commit is contained in:
parent
2632093ebb
commit
0bcc43098e
|
@ -341,7 +341,11 @@ namespace MediaBrowser.Model.Dlna
|
|||
MediaStream subtitleStream = playlistItem.SubtitleStreamIndex.HasValue ? item.GetMediaStream(MediaStreamType.Subtitle, playlistItem.SubtitleStreamIndex.Value) : null;
|
||||
|
||||
MediaStream audioStream = item.GetDefaultAudioStream(options.AudioStreamIndex ?? item.DefaultAudioStreamIndex);
|
||||
int? audioStreamIndex = audioStream == null ? (int?)null : audioStream.Index;
|
||||
int? audioStreamIndex = null;
|
||||
if (audioStream != null)
|
||||
{
|
||||
audioStreamIndex = audioStream.Index;
|
||||
}
|
||||
|
||||
MediaStream videoStream = item.VideoStream;
|
||||
|
||||
|
|
|
@ -150,7 +150,12 @@ namespace MediaBrowser.Model.Dto
|
|||
}
|
||||
}
|
||||
|
||||
return numStreams == 0 ? (int?)null : numMatches;
|
||||
if (numStreams == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return numMatches;
|
||||
}
|
||||
|
||||
public bool? IsSecondaryAudio(MediaStream stream)
|
||||
|
|
|
@ -138,6 +138,20 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
|||
|
||||
xml = xml.Substring(0, index + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the file is just an Imdb url, handle that
|
||||
|
||||
var imdbId = xml.Split('/')
|
||||
.FirstOrDefault(i => i.StartsWith("tt", StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(imdbId))
|
||||
{
|
||||
item.SetProviderId(MetadataProviders.Imdb, imdbId);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
using (var ms = new MemoryStream())
|
||||
{
|
||||
|
|
|
@ -153,7 +153,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||
{
|
||||
return GetLocalSavePath(item);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the save path.
|
||||
/// </summary>
|
||||
|
@ -184,7 +184,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||
public void Save(IHasMetadata item, CancellationToken cancellationToken)
|
||||
{
|
||||
var path = GetSavePath(item);
|
||||
|
||||
|
||||
using (var memoryStream = new MemoryStream())
|
||||
{
|
||||
Save(item, memoryStream, path);
|
||||
|
@ -275,6 +275,10 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||
{
|
||||
|
||||
}
|
||||
catch (XmlException ex)
|
||||
{
|
||||
Logger.ErrorException("Error reading existng nfo", ex);
|
||||
}
|
||||
|
||||
writer.WriteEndElement();
|
||||
|
||||
|
@ -466,8 +470,8 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||
{
|
||||
writer.WriteElementString("originaltitle", hasOriginalTitle.OriginalTitle ?? string.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var directors = item.People
|
||||
.Where(i => IsPersonType(i, PersonType.Director))
|
||||
.Select(i => i.Name)
|
||||
|
@ -978,7 +982,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||
{
|
||||
writer.WriteElementString("type", person.Type);
|
||||
}
|
||||
|
||||
|
||||
if (person.SortOrder.HasValue)
|
||||
{
|
||||
writer.WriteElementString("sortorder", person.SortOrder.Value.ToString(UsCulture));
|
||||
|
|
Loading…
Reference in New Issue
Block a user