move people page into main editor
This commit is contained in:
parent
20bcc40e23
commit
26aa47eefd
|
@ -3,7 +3,7 @@ using MediaBrowser.Controller.Providers;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Entities
|
namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
public class AdultVideo : Video, IHasPreferredMetadataLanguage, IHasTaglines
|
public class AdultVideo : Video, IHasProductionLocations, IHasPreferredMetadataLanguage, IHasTaglines
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the preferred metadata language.
|
/// Gets or sets the preferred metadata language.
|
||||||
|
@ -16,12 +16,14 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The preferred metadata country code.</value>
|
/// <value>The preferred metadata country code.</value>
|
||||||
public string PreferredMetadataCountryCode { get; set; }
|
public string PreferredMetadataCountryCode { get; set; }
|
||||||
|
public List<string> ProductionLocations { get; set; }
|
||||||
|
|
||||||
public List<string> Taglines { get; set; }
|
public List<string> Taglines { get; set; }
|
||||||
|
|
||||||
public AdultVideo()
|
public AdultVideo()
|
||||||
{
|
{
|
||||||
Taglines = new List<string>();
|
Taglines = new List<string>();
|
||||||
|
ProductionLocations = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool BeforeMetadataRefresh()
|
public override bool BeforeMetadataRefresh()
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class Movie
|
/// Class Movie
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Movie : Video, IHasCriticRating, IHasSoundtracks, IHasBudget, IHasKeywords, IHasTrailers, IHasThemeMedia, IHasTaglines, IHasPreferredMetadataLanguage, IHasAwards, IHasMetascore, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping
|
public class Movie : Video, IHasCriticRating, IHasSoundtracks, IHasProductionLocations, IHasBudget, IHasKeywords, IHasTrailers, IHasThemeMedia, IHasTaglines, IHasPreferredMetadataLanguage, IHasAwards, IHasMetascore, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping
|
||||||
{
|
{
|
||||||
public List<Guid> SpecialFeatureIds { get; set; }
|
public List<Guid> SpecialFeatureIds { get; set; }
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||||
|
|
||||||
public List<Guid> ThemeSongIds { get; set; }
|
public List<Guid> ThemeSongIds { get; set; }
|
||||||
public List<Guid> ThemeVideoIds { get; set; }
|
public List<Guid> ThemeVideoIds { get; set; }
|
||||||
|
public List<string> ProductionLocations { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This is just a cache to enable quick access by Id
|
/// This is just a cache to enable quick access by Id
|
||||||
|
@ -48,6 +49,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||||
BoxSetIdList = new List<Guid>();
|
BoxSetIdList = new List<Guid>();
|
||||||
Taglines = new List<string>();
|
Taglines = new List<string>();
|
||||||
Keywords = new List<string>();
|
Keywords = new List<string>();
|
||||||
|
ProductionLocations = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string AwardSummary { get; set; }
|
public string AwardSummary { get; set; }
|
||||||
|
|
|
@ -9,7 +9,7 @@ using System.Runtime.Serialization;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Entities
|
namespace MediaBrowser.Controller.Entities
|
||||||
{
|
{
|
||||||
public class MusicVideo : Video, IHasArtist, IHasMusicGenres, IHasBudget, IHasLookupInfo<MusicVideoInfo>
|
public class MusicVideo : Video, IHasArtist, IHasMusicGenres, IHasProductionLocations, IHasBudget, IHasLookupInfo<MusicVideoInfo>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the artist.
|
/// Gets or sets the artist.
|
||||||
|
@ -34,6 +34,12 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The revenue.</value>
|
/// <value>The revenue.</value>
|
||||||
public double? Revenue { get; set; }
|
public double? Revenue { get; set; }
|
||||||
|
public List<string> ProductionLocations { get; set; }
|
||||||
|
|
||||||
|
public MusicVideo()
|
||||||
|
{
|
||||||
|
ProductionLocations = new List<string>();
|
||||||
|
}
|
||||||
|
|
||||||
[IgnoreDataMember]
|
[IgnoreDataMember]
|
||||||
public List<string> AllArtists
|
public List<string> AllArtists
|
||||||
|
|
|
@ -12,11 +12,12 @@ namespace MediaBrowser.Controller.Entities
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Class Trailer
|
/// Class Trailer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Trailer : Video, IHasCriticRating, IHasSoundtracks, IHasBudget, IHasTrailers, IHasKeywords, IHasTaglines, IHasPreferredMetadataLanguage, IHasMetascore, IHasLookupInfo<TrailerInfo>
|
public class Trailer : Video, IHasCriticRating, IHasSoundtracks, IHasProductionLocations, IHasBudget, IHasTrailers, IHasKeywords, IHasTaglines, IHasPreferredMetadataLanguage, IHasMetascore, IHasLookupInfo<TrailerInfo>
|
||||||
{
|
{
|
||||||
public List<Guid> SoundtrackIds { get; set; }
|
public List<Guid> SoundtrackIds { get; set; }
|
||||||
|
|
||||||
public string PreferredMetadataLanguage { get; set; }
|
public string PreferredMetadataLanguage { get; set; }
|
||||||
|
public List<string> ProductionLocations { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the preferred metadata country code.
|
/// Gets or sets the preferred metadata country code.
|
||||||
|
@ -31,6 +32,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
SoundtrackIds = new List<Guid>();
|
SoundtrackIds = new List<Guid>();
|
||||||
LocalTrailerIds = new List<Guid>();
|
LocalTrailerIds = new List<Guid>();
|
||||||
Keywords = new List<string>();
|
Keywords = new List<string>();
|
||||||
|
ProductionLocations = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public float? Metascore { get; set; }
|
public float? Metascore { get; set; }
|
||||||
|
|
|
@ -62,34 +62,6 @@ namespace MediaBrowser.Controller.Providers
|
||||||
ValidationType = ValidationType.None
|
ValidationType = ValidationType.None
|
||||||
};
|
};
|
||||||
|
|
||||||
var hasTaglines = item as IHasTaglines;
|
|
||||||
if (hasTaglines != null)
|
|
||||||
{
|
|
||||||
hasTaglines.Taglines.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
item.Studios.Clear();
|
|
||||||
item.Genres.Clear();
|
|
||||||
item.People.Clear();
|
|
||||||
|
|
||||||
var hasTags = item as IHasTags;
|
|
||||||
if (hasTags != null)
|
|
||||||
{
|
|
||||||
hasTags.Tags.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
var hasKeywords = item as IHasKeywords;
|
|
||||||
if (hasKeywords != null)
|
|
||||||
{
|
|
||||||
hasKeywords.Keywords.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
var hasTrailers = item as IHasTrailers;
|
|
||||||
if (hasTrailers != null)
|
|
||||||
{
|
|
||||||
hasTrailers.RemoteTrailers.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Fetch(item, metadataFile, settings, Encoding.GetEncoding("ISO-8859-1"), cancellationToken);
|
//Fetch(item, metadataFile, settings, Encoding.GetEncoding("ISO-8859-1"), cancellationToken);
|
||||||
Fetch(item, metadataFile, settings, Encoding.UTF8, cancellationToken);
|
Fetch(item, metadataFile, settings, Encoding.UTF8, cancellationToken);
|
||||||
}
|
}
|
||||||
|
@ -373,6 +345,15 @@ namespace MediaBrowser.Controller.Providers
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case "Countries":
|
||||||
|
{
|
||||||
|
using (var subtree = reader.ReadSubtree())
|
||||||
|
{
|
||||||
|
FetchFromCountriesNode(subtree, item);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case "ContentRating":
|
case "ContentRating":
|
||||||
case "MPAARating":
|
case "MPAARating":
|
||||||
{
|
{
|
||||||
|
@ -857,6 +838,42 @@ namespace MediaBrowser.Controller.Providers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FetchFromCountriesNode(XmlReader reader, T item)
|
||||||
|
{
|
||||||
|
reader.MoveToContent();
|
||||||
|
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
if (reader.NodeType == XmlNodeType.Element)
|
||||||
|
{
|
||||||
|
switch (reader.Name)
|
||||||
|
{
|
||||||
|
case "Country":
|
||||||
|
{
|
||||||
|
var val = reader.ReadElementContentAsString();
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(val))
|
||||||
|
{
|
||||||
|
var hasProductionLocations = item as IHasProductionLocations;
|
||||||
|
if (hasProductionLocations != null)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrWhiteSpace(val))
|
||||||
|
{
|
||||||
|
hasProductionLocations.AddProductionLocation(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
reader.Skip();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches from taglines node.
|
/// Fetches from taglines node.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -109,6 +109,7 @@
|
||||||
<Compile Include="MediaInfo\FFProbeProvider.cs" />
|
<Compile Include="MediaInfo\FFProbeProvider.cs" />
|
||||||
<Compile Include="MediaInfo\FFProbeVideoInfo.cs" />
|
<Compile Include="MediaInfo\FFProbeVideoInfo.cs" />
|
||||||
<Compile Include="MediaInfo\SubtitleDownloader.cs" />
|
<Compile Include="MediaInfo\SubtitleDownloader.cs" />
|
||||||
|
<Compile Include="MediaInfo\SubtitleResolver.cs" />
|
||||||
<Compile Include="Movies\MovieDbTrailerProvider.cs" />
|
<Compile Include="Movies\MovieDbTrailerProvider.cs" />
|
||||||
<Compile Include="Movies\MovieExternalIds.cs" />
|
<Compile Include="Movies\MovieExternalIds.cs" />
|
||||||
<Compile Include="Movies\TrailerMetadataService.cs" />
|
<Compile Include="Movies\TrailerMetadataService.cs" />
|
||||||
|
|
|
@ -173,7 +173,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
{
|
{
|
||||||
var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager, _fileSystem, _config, _subtitleManager);
|
var prober = new FFProbeVideoInfo(_logger, _isoManager, _mediaEncoder, _itemRepo, _blurayExaminer, _localization, _appPaths, _json, _encodingManager, _fileSystem, _config, _subtitleManager);
|
||||||
|
|
||||||
return !video.SubtitleFiles.SequenceEqual(prober.GetSubtitleFiles(video, directoryService, false).Select(i => i.FullName).OrderBy(i => i), StringComparer.OrdinalIgnoreCase);
|
return !video.SubtitleFiles.SequenceEqual(SubtitleResolver.GetSubtitleFiles(video, directoryService, false).Select(i => i.FullName).OrderBy(i => i), StringComparer.OrdinalIgnoreCase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -411,50 +411,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<string> SubtitleExtensions
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return new[] { ".srt", ".ssa", ".ass", ".sub" };
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<FileSystemInfo> GetSubtitleFiles(Video video, IDirectoryService directoryService, bool clearCache)
|
|
||||||
{
|
|
||||||
var containingPath = video.ContainingFolderPath;
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(containingPath))
|
|
||||||
{
|
|
||||||
throw new ArgumentException(string.Format("Cannot search for items that don't have a path: {0} {1}", video.Name, video.Id));
|
|
||||||
}
|
|
||||||
|
|
||||||
var files = directoryService.GetFiles(containingPath, clearCache);
|
|
||||||
|
|
||||||
var videoFileNameWithoutExtension = Path.GetFileNameWithoutExtension(video.Path);
|
|
||||||
|
|
||||||
return files.Where(i =>
|
|
||||||
{
|
|
||||||
if (!i.Attributes.HasFlag(FileAttributes.Directory) &&
|
|
||||||
SubtitleExtensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
var fullName = i.FullName;
|
|
||||||
|
|
||||||
var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fullName);
|
|
||||||
|
|
||||||
if (string.Equals(videoFileNameWithoutExtension, fileNameWithoutExtension, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (fileNameWithoutExtension.StartsWith(videoFileNameWithoutExtension + ".", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds the external subtitles.
|
/// Adds the external subtitles.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -462,7 +418,9 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
/// <param name="currentStreams">The current streams.</param>
|
/// <param name="currentStreams">The current streams.</param>
|
||||||
private async Task AddExternalSubtitles(Video video, List<MediaStream> currentStreams, IDirectoryService directoryService, CancellationToken cancellationToken)
|
private async Task AddExternalSubtitles(Video video, List<MediaStream> currentStreams, IDirectoryService directoryService, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var externalSubtitleStreams = GetExternalSubtitleStreams(video, currentStreams.Count, directoryService, false).ToList();
|
var subtitleResolver = new SubtitleResolver(_localization);
|
||||||
|
|
||||||
|
var externalSubtitleStreams = subtitleResolver.GetExternalSubtitleStreams(video, currentStreams.Count, directoryService, false).ToList();
|
||||||
|
|
||||||
if ((_config.Configuration.SubtitleOptions.DownloadEpisodeSubtitles &&
|
if ((_config.Configuration.SubtitleOptions.DownloadEpisodeSubtitles &&
|
||||||
video is Episode) ||
|
video is Episode) ||
|
||||||
|
@ -482,7 +440,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
// Rescan
|
// Rescan
|
||||||
if (downloadedLanguages.Count > 0)
|
if (downloadedLanguages.Count > 0)
|
||||||
{
|
{
|
||||||
externalSubtitleStreams = GetExternalSubtitleStreams(video, currentStreams.Count, directoryService, true).ToList();
|
externalSubtitleStreams = subtitleResolver.GetExternalSubtitleStreams(video, currentStreams.Count, directoryService, true).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,65 +449,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
currentStreams.AddRange(externalSubtitleStreams);
|
currentStreams.AddRange(externalSubtitleStreams);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<MediaStream> GetExternalSubtitleStreams(Video video,
|
|
||||||
int startIndex,
|
|
||||||
IDirectoryService directoryService,
|
|
||||||
bool clearCache)
|
|
||||||
{
|
|
||||||
var files = GetSubtitleFiles(video, directoryService, clearCache);
|
|
||||||
|
|
||||||
var streams = new List<MediaStream>();
|
|
||||||
|
|
||||||
var videoFileNameWithoutExtension = Path.GetFileNameWithoutExtension(video.Path);
|
|
||||||
|
|
||||||
foreach (var file in files)
|
|
||||||
{
|
|
||||||
var fullName = file.FullName;
|
|
||||||
|
|
||||||
var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fullName);
|
|
||||||
|
|
||||||
// If the subtitle file matches the video file name
|
|
||||||
if (string.Equals(videoFileNameWithoutExtension, fileNameWithoutExtension, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
streams.Add(new MediaStream
|
|
||||||
{
|
|
||||||
Index = startIndex++,
|
|
||||||
Type = MediaStreamType.Subtitle,
|
|
||||||
IsExternal = true,
|
|
||||||
Path = fullName,
|
|
||||||
Codec = Path.GetExtension(fullName).ToLower().TrimStart('.')
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if (fileNameWithoutExtension.StartsWith(videoFileNameWithoutExtension + ".", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
// Support xbmc naming conventions - 300.spanish.srt
|
|
||||||
var language = fileNameWithoutExtension.Split('.').LastOrDefault();
|
|
||||||
|
|
||||||
// Try to translate to three character code
|
|
||||||
// Be flexible and check against both the full and three character versions
|
|
||||||
var culture = _localization.GetCultures()
|
|
||||||
.FirstOrDefault(i => string.Equals(i.DisplayName, language, StringComparison.OrdinalIgnoreCase) || string.Equals(i.Name, language, StringComparison.OrdinalIgnoreCase) || string.Equals(i.ThreeLetterISOLanguageName, language, StringComparison.OrdinalIgnoreCase) || string.Equals(i.TwoLetterISOLanguageName, language, StringComparison.OrdinalIgnoreCase));
|
|
||||||
|
|
||||||
if (culture != null)
|
|
||||||
{
|
|
||||||
language = culture.ThreeLetterISOLanguageName;
|
|
||||||
}
|
|
||||||
|
|
||||||
streams.Add(new MediaStream
|
|
||||||
{
|
|
||||||
Index = startIndex++,
|
|
||||||
Type = MediaStreamType.Subtitle,
|
|
||||||
IsExternal = true,
|
|
||||||
Path = fullName,
|
|
||||||
Codec = Path.GetExtension(fullName).ToLower().TrimStart('.'),
|
|
||||||
Language = language
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return streams;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The dummy chapter duration
|
/// The dummy chapter duration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
135
MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs
Normal file
135
MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs
Normal file
|
@ -0,0 +1,135 @@
|
||||||
|
using MediaBrowser.Common.Extensions;
|
||||||
|
using MediaBrowser.Controller.Entities;
|
||||||
|
using MediaBrowser.Controller.Localization;
|
||||||
|
using MediaBrowser.Controller.Providers;
|
||||||
|
using MediaBrowser.Model.Entities;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Providers.MediaInfo
|
||||||
|
{
|
||||||
|
public class SubtitleResolver
|
||||||
|
{
|
||||||
|
private readonly ILocalizationManager _localization;
|
||||||
|
|
||||||
|
public SubtitleResolver(ILocalizationManager localization)
|
||||||
|
{
|
||||||
|
_localization = localization;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<MediaStream> GetExternalSubtitleStreams(Video video,
|
||||||
|
int startIndex,
|
||||||
|
IDirectoryService directoryService,
|
||||||
|
bool clearCache)
|
||||||
|
{
|
||||||
|
var files = GetSubtitleFiles(video, directoryService, clearCache);
|
||||||
|
|
||||||
|
var streams = new List<MediaStream>();
|
||||||
|
|
||||||
|
var videoFileNameWithoutExtension = Path.GetFileNameWithoutExtension(video.Path);
|
||||||
|
|
||||||
|
foreach (var file in files)
|
||||||
|
{
|
||||||
|
var fullName = file.FullName;
|
||||||
|
|
||||||
|
var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fullName);
|
||||||
|
|
||||||
|
var codec = Path.GetExtension(fullName).ToLower().TrimStart('.');
|
||||||
|
|
||||||
|
// If the subtitle file matches the video file name
|
||||||
|
if (string.Equals(videoFileNameWithoutExtension, fileNameWithoutExtension, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
streams.Add(new MediaStream
|
||||||
|
{
|
||||||
|
Index = startIndex++,
|
||||||
|
Type = MediaStreamType.Subtitle,
|
||||||
|
IsExternal = true,
|
||||||
|
Path = fullName,
|
||||||
|
Codec = codec
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (fileNameWithoutExtension.StartsWith(videoFileNameWithoutExtension + ".", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var isForced = fullName.IndexOf(".forced.", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||||
|
fullName.IndexOf(".foreign.", StringComparison.OrdinalIgnoreCase) != -1;
|
||||||
|
|
||||||
|
// Support xbmc naming conventions - 300.spanish.srt
|
||||||
|
var language = fileNameWithoutExtension
|
||||||
|
.Replace(".forced", string.Empty, StringComparison.OrdinalIgnoreCase)
|
||||||
|
.Replace(".foreign", string.Empty, StringComparison.OrdinalIgnoreCase)
|
||||||
|
.Split('.')
|
||||||
|
.LastOrDefault();
|
||||||
|
|
||||||
|
// Try to translate to three character code
|
||||||
|
// Be flexible and check against both the full and three character versions
|
||||||
|
var culture = _localization.GetCultures()
|
||||||
|
.FirstOrDefault(i => string.Equals(i.DisplayName, language, StringComparison.OrdinalIgnoreCase) || string.Equals(i.Name, language, StringComparison.OrdinalIgnoreCase) || string.Equals(i.ThreeLetterISOLanguageName, language, StringComparison.OrdinalIgnoreCase) || string.Equals(i.TwoLetterISOLanguageName, language, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
|
if (culture != null)
|
||||||
|
{
|
||||||
|
language = culture.ThreeLetterISOLanguageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
streams.Add(new MediaStream
|
||||||
|
{
|
||||||
|
Index = startIndex++,
|
||||||
|
Type = MediaStreamType.Subtitle,
|
||||||
|
IsExternal = true,
|
||||||
|
Path = fullName,
|
||||||
|
Codec = codec,
|
||||||
|
Language = language,
|
||||||
|
IsForced = isForced
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return streams;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IEnumerable<string> SubtitleExtensions
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new[] { ".srt", ".ssa", ".ass", ".sub" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<FileSystemInfo> GetSubtitleFiles(Video video, IDirectoryService directoryService, bool clearCache)
|
||||||
|
{
|
||||||
|
var containingPath = video.ContainingFolderPath;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(containingPath))
|
||||||
|
{
|
||||||
|
throw new ArgumentException(string.Format("Cannot search for items that don't have a path: {0} {1}", video.Name, video.Id));
|
||||||
|
}
|
||||||
|
|
||||||
|
var files = directoryService.GetFiles(containingPath, clearCache);
|
||||||
|
|
||||||
|
var videoFileNameWithoutExtension = Path.GetFileNameWithoutExtension(video.Path);
|
||||||
|
|
||||||
|
return files.Where(i =>
|
||||||
|
{
|
||||||
|
if (!i.Attributes.HasFlag(FileAttributes.Directory) &&
|
||||||
|
SubtitleExtensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var fullName = i.FullName;
|
||||||
|
|
||||||
|
var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fullName);
|
||||||
|
|
||||||
|
if (string.Equals(videoFileNameWithoutExtension, fileNameWithoutExtension, StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (fileNameWithoutExtension.StartsWith(videoFileNameWithoutExtension + ".", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -133,6 +133,18 @@ namespace MediaBrowser.Providers.Movies
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (movieData.production_countries != null)
|
||||||
|
{
|
||||||
|
var hasProductionLocations = movie as IHasProductionLocations;
|
||||||
|
if (hasProductionLocations != null)
|
||||||
|
{
|
||||||
|
hasProductionLocations.ProductionLocations = movieData
|
||||||
|
.production_countries
|
||||||
|
.Select(i => i.name)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
movie.SetProviderId(MetadataProviders.Tmdb, movieData.id.ToString(_usCulture));
|
movie.SetProviderId(MetadataProviders.Tmdb, movieData.id.ToString(_usCulture));
|
||||||
movie.SetProviderId(MetadataProviders.Imdb, movieData.imdb_id);
|
movie.SetProviderId(MetadataProviders.Imdb, movieData.imdb_id);
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ namespace MediaBrowser.Providers.Savers
|
||||||
|
|
||||||
"Chapters",
|
"Chapters",
|
||||||
"ContentRating",
|
"ContentRating",
|
||||||
|
"Countries",
|
||||||
"CustomRating",
|
"CustomRating",
|
||||||
"CriticRating",
|
"CriticRating",
|
||||||
"CriticRatingSummary",
|
"CriticRatingSummary",
|
||||||
|
@ -318,6 +319,22 @@ namespace MediaBrowser.Providers.Savers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var hasProductionLocations = item as IHasProductionLocations;
|
||||||
|
if (hasProductionLocations != null)
|
||||||
|
{
|
||||||
|
if (hasProductionLocations.ProductionLocations.Count > 0)
|
||||||
|
{
|
||||||
|
builder.Append("<Countries>");
|
||||||
|
|
||||||
|
foreach (var name in hasProductionLocations.ProductionLocations)
|
||||||
|
{
|
||||||
|
builder.Append("<Country>" + SecurityElement.Escape(name) + "</Country>");
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.Append("</Countries>");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var hasDisplayOrder = item as IHasDisplayOrder;
|
var hasDisplayOrder = item as IHasDisplayOrder;
|
||||||
if (hasDisplayOrder != null && !string.IsNullOrEmpty(hasDisplayOrder.DisplayOrder))
|
if (hasDisplayOrder != null && !string.IsNullOrEmpty(hasDisplayOrder.DisplayOrder))
|
||||||
{
|
{
|
||||||
|
|
|
@ -549,7 +549,6 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
"dlnaserversettings.js",
|
"dlnaserversettings.js",
|
||||||
"editcollectionitems.js",
|
"editcollectionitems.js",
|
||||||
"edititemmetadata.js",
|
"edititemmetadata.js",
|
||||||
"edititempeople.js",
|
|
||||||
"edititemimages.js",
|
"edititemimages.js",
|
||||||
"encodingsettings.js",
|
"encodingsettings.js",
|
||||||
"gamesrecommendedpage.js",
|
"gamesrecommendedpage.js",
|
||||||
|
|
|
@ -391,9 +391,6 @@
|
||||||
<Content Include="dashboard-ui\css\notifications.css">
|
<Content Include="dashboard-ui\css\notifications.css">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="dashboard-ui\edititempeople.html">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="dashboard-ui\css\detailtable.css">
|
<Content Include="dashboard-ui\css\detailtable.css">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
@ -1450,9 +1447,6 @@
|
||||||
<Content Include="dashboard-ui\scripts\directorybrowser.js">
|
<Content Include="dashboard-ui\scripts\directorybrowser.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="dashboard-ui\scripts\edititempeople.js">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="dashboard-ui\scripts\edititemimages.js">
|
<Content Include="dashboard-ui\scripts\edititemimages.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user