diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs
index e15e6ef6eb..6c5b279d00 100644
--- a/MediaBrowser.Api/ItemUpdateService.cs
+++ b/MediaBrowser.Api/ItemUpdateService.cs
@@ -311,10 +311,12 @@ namespace MediaBrowser.Api
SetProductionLocations(item, request);
- var hasLanguage = item as IHasLanguage;
- if (hasLanguage != null)
+ var hasLang = item as IHasPreferredMetadataLanguage;
+
+ if (hasLang != null)
{
- hasLanguage.Language = request.Language;
+ hasLang.PreferredMetadataCountryCode = request.PreferredMetadataCountryCode;
+ hasLang.PreferredMetadataLanguage = request.PreferredMetadataLanguage;
}
var hasAspectRatio = item as IHasAspectRatio;
diff --git a/MediaBrowser.Controller/Entities/AdultVideo.cs b/MediaBrowser.Controller/Entities/AdultVideo.cs
index 9d19b5d928..f81cfa1f62 100644
--- a/MediaBrowser.Controller/Entities/AdultVideo.cs
+++ b/MediaBrowser.Controller/Entities/AdultVideo.cs
@@ -4,5 +4,11 @@ namespace MediaBrowser.Controller.Entities
public class AdultVideo : Video, IHasPreferredMetadataLanguage
{
public string PreferredMetadataLanguage { get; set; }
+
+ ///
+ /// Gets or sets the preferred metadata country code.
+ ///
+ /// The preferred metadata country code.
+ public string PreferredMetadataCountryCode { get; set; }
}
}
diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs
index 9651a4f045..028fc964d3 100644
--- a/MediaBrowser.Controller/Entities/Audio/Audio.cs
+++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs
@@ -9,19 +9,13 @@ namespace MediaBrowser.Controller.Entities.Audio
///
/// Class Audio
///
- public class Audio : BaseItem, IHasMediaStreams, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLanguage
+ public class Audio : BaseItem, IHasMediaStreams, IHasAlbumArtist, IHasArtist, IHasMusicGenres
{
public Audio()
{
Artists = new List();
}
- ///
- /// Gets or sets the language.
- ///
- /// The language.
- public string Language { get; set; }
-
///
/// Gets or sets a value indicating whether this instance has embedded image.
///
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index 6e5024a458..a02369b2cb 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -960,7 +960,7 @@ namespace MediaBrowser.Controller.Entities
/// Gets the preferred metadata language.
///
/// System.String.
- public virtual string GetPreferredMetadataLanguage()
+ public string GetPreferredMetadataLanguage()
{
string lang = null;
@@ -971,6 +971,13 @@ namespace MediaBrowser.Controller.Entities
lang = hasLang.PreferredMetadataLanguage;
}
+ if (string.IsNullOrEmpty(lang))
+ {
+ lang = Parents.OfType()
+ .Select(i => i.PreferredMetadataLanguage)
+ .FirstOrDefault(i => !string.IsNullOrEmpty(i));
+ }
+
if (string.IsNullOrEmpty(lang))
{
lang = ConfigurationManager.Configuration.PreferredMetadataLanguage;
@@ -979,6 +986,36 @@ namespace MediaBrowser.Controller.Entities
return lang;
}
+ ///
+ /// Gets the preferred metadata language.
+ ///
+ /// System.String.
+ public string GetPreferredMetadataCountryCode()
+ {
+ string lang = null;
+
+ var hasLang = this as IHasPreferredMetadataLanguage;
+
+ if (hasLang != null)
+ {
+ lang = hasLang.PreferredMetadataCountryCode;
+ }
+
+ if (string.IsNullOrEmpty(lang))
+ {
+ lang = Parents.OfType()
+ .Select(i => i.PreferredMetadataCountryCode)
+ .FirstOrDefault(i => !string.IsNullOrEmpty(i));
+ }
+
+ if (string.IsNullOrEmpty(lang))
+ {
+ lang = ConfigurationManager.Configuration.MetadataCountryCode;
+ }
+
+ return lang;
+ }
+
///
/// Determines if a given user has access to this item
///
diff --git a/MediaBrowser.Controller/Entities/Book.cs b/MediaBrowser.Controller/Entities/Book.cs
index e4e1ab39c0..298941378e 100644
--- a/MediaBrowser.Controller/Entities/Book.cs
+++ b/MediaBrowser.Controller/Entities/Book.cs
@@ -23,6 +23,12 @@ namespace MediaBrowser.Controller.Entities
public string PreferredMetadataLanguage { get; set; }
+ ///
+ /// Gets or sets the preferred metadata country code.
+ ///
+ /// The preferred metadata country code.
+ public string PreferredMetadataCountryCode { get; set; }
+
///
///
///
diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs
index ce5f720ef3..da95b7c44e 100644
--- a/MediaBrowser.Controller/Entities/Game.cs
+++ b/MediaBrowser.Controller/Entities/Game.cs
@@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace MediaBrowser.Controller.Entities
{
- public class Game : BaseItem, IHasSoundtracks, IHasTrailers, IHasThemeMedia, IHasTags, IHasLanguage, IHasScreenshots, IHasPreferredMetadataLanguage
+ public class Game : BaseItem, IHasSoundtracks, IHasTrailers, IHasThemeMedia, IHasTags, IHasScreenshots, IHasPreferredMetadataLanguage
{
public List SoundtrackIds { get; set; }
@@ -14,6 +14,12 @@ namespace MediaBrowser.Controller.Entities
public string PreferredMetadataLanguage { get; set; }
+ ///
+ /// Gets or sets the preferred metadata country code.
+ ///
+ /// The preferred metadata country code.
+ public string PreferredMetadataCountryCode { get; set; }
+
public Game()
{
MultiPartGameFiles = new List();
@@ -26,12 +32,6 @@ namespace MediaBrowser.Controller.Entities
ScreenshotImagePaths = new List();
}
- ///
- /// Gets or sets the language.
- ///
- /// The language.
- public string Language { get; set; }
-
public List LocalTrailerIds { get; set; }
///
diff --git a/MediaBrowser.Controller/Entities/IHasLanguage.cs b/MediaBrowser.Controller/Entities/IHasLanguage.cs
deleted file mode 100644
index a1bb800980..0000000000
--- a/MediaBrowser.Controller/Entities/IHasLanguage.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-
-namespace MediaBrowser.Controller.Entities
-{
- ///
- /// Interface IHasLanguage
- ///
- public interface IHasLanguage
- {
- ///
- /// Gets or sets the language.
- ///
- /// The language.
- string Language { get; set; }
- }
-}
diff --git a/MediaBrowser.Controller/Entities/IHasPreferredMetadataLanguage.cs b/MediaBrowser.Controller/Entities/IHasPreferredMetadataLanguage.cs
index facf71829f..e3a233e49e 100644
--- a/MediaBrowser.Controller/Entities/IHasPreferredMetadataLanguage.cs
+++ b/MediaBrowser.Controller/Entities/IHasPreferredMetadataLanguage.cs
@@ -11,5 +11,11 @@ namespace MediaBrowser.Controller.Entities
///
/// The preferred metadata language.
string PreferredMetadataLanguage { get; set; }
+
+ ///
+ /// Gets or sets the preferred metadata country code.
+ ///
+ /// The preferred metadata country code.
+ string PreferredMetadataCountryCode { get; set; }
}
}
diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
index 755f687ff7..6144bdd710 100644
--- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
+++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs
@@ -33,6 +33,12 @@ namespace MediaBrowser.Controller.Entities.Movies
public string PreferredMetadataLanguage { get; set; }
+ ///
+ /// Gets or sets the preferred metadata country code.
+ ///
+ /// The preferred metadata country code.
+ public string PreferredMetadataCountryCode { get; set; }
+
protected override bool GetBlockUnratedValue(UserConfiguration config)
{
return config.BlockUnratedMovies;
diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs
index 34845c3c30..f9d3f845c3 100644
--- a/MediaBrowser.Controller/Entities/Movies/Movie.cs
+++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs
@@ -21,6 +21,12 @@ namespace MediaBrowser.Controller.Entities.Movies
public List ThemeSongIds { get; set; }
public List ThemeVideoIds { get; set; }
+ ///
+ /// Gets or sets the preferred metadata country code.
+ ///
+ /// The preferred metadata country code.
+ public string PreferredMetadataCountryCode { get; set; }
+
public string PreferredMetadataLanguage { get; set; }
public Movie()
diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs
index 8338f76db7..f7e78ccd40 100644
--- a/MediaBrowser.Controller/Entities/TV/Series.cs
+++ b/MediaBrowser.Controller/Entities/TV/Series.cs
@@ -21,6 +21,12 @@ namespace MediaBrowser.Controller.Entities.TV
public int SeasonCount { get; set; }
+ ///
+ /// Gets or sets the preferred metadata country code.
+ ///
+ /// The preferred metadata country code.
+ public string PreferredMetadataCountryCode { get; set; }
+
public Series()
{
AirDays = new List();
diff --git a/MediaBrowser.Controller/Entities/Trailer.cs b/MediaBrowser.Controller/Entities/Trailer.cs
index f746ae6305..7000d04d31 100644
--- a/MediaBrowser.Controller/Entities/Trailer.cs
+++ b/MediaBrowser.Controller/Entities/Trailer.cs
@@ -14,6 +14,12 @@ namespace MediaBrowser.Controller.Entities
public List SoundtrackIds { get; set; }
public string PreferredMetadataLanguage { get; set; }
+
+ ///
+ /// Gets or sets the preferred metadata country code.
+ ///
+ /// The preferred metadata country code.
+ public string PreferredMetadataCountryCode { get; set; }
public Trailer()
{
diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
index f0c7d3149e..0c5c0a5cd5 100644
--- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj
+++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj
@@ -86,7 +86,6 @@
-
diff --git a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
index c9f57a9270..799f339f13 100644
--- a/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
+++ b/MediaBrowser.Controller/Providers/BaseItemXmlParser.cs
@@ -269,10 +269,10 @@ namespace MediaBrowser.Controller.Providers
{
var val = reader.ReadElementContentAsString();
- var hasLanguage = item as IHasLanguage;
+ var hasLanguage = item as IHasPreferredMetadataLanguage;
if (hasLanguage != null)
{
- hasLanguage.Language = val;
+ hasLanguage.PreferredMetadataLanguage = val;
}
break;
diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs
index 5f097dbccc..9adfcfa993 100644
--- a/MediaBrowser.Model/Dto/BaseItemDto.cs
+++ b/MediaBrowser.Model/Dto/BaseItemDto.cs
@@ -36,6 +36,9 @@ namespace MediaBrowser.Model.Dto
public int? AbsoluteEpisodeNumber { get; set; }
public bool? DisplaySpecialsWithSeasons { get; set; }
+ public string PreferredMetadataLanguage { get; set; }
+ public string PreferredMetadataCountryCode { get; set; }
+
///
/// Gets or sets the DVD season number.
///
@@ -209,12 +212,6 @@ namespace MediaBrowser.Model.Dto
/// The provider ids.
public Dictionary ProviderIds { get; set; }
- ///
- /// Gets or sets the language.
- ///
- /// The language.
- public string Language { get; set; }
-
///
/// Gets or sets a value indicating whether this instance is HD.
///
diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfoProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfoProvider.cs
index 673abea570..c380072888 100644
--- a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfoProvider.cs
+++ b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfoProvider.cs
@@ -151,8 +151,6 @@ namespace MediaBrowser.Providers.MediaInfo
// Disc number
audio.ParentIndexNumber = GetDictionaryDiscValue(tags, "disc");
- audio.Language = GetDictionaryValue(tags, "language");
-
audio.ProductionYear = GetDictionaryNumericValue(tags, "date");
// Several different forms of retaildate
diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs
index 52647b8a39..c6c9df6f7d 100644
--- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs
+++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs
@@ -499,6 +499,7 @@ namespace MediaBrowser.Providers.Movies
// Id could be ImdbId or TmdbId
var language = item.GetPreferredMetadataLanguage();
+ var country = item.GetPreferredMetadataCountryCode();
var dataFilePath = GetDataFilePath(item);
@@ -514,9 +515,7 @@ namespace MediaBrowser.Providers.Movies
tmdbId = mainResult.id.ToString(_usCulture);
- var movieDataPath = GetMovieDataPath(ConfigurationManager.ApplicationPaths, isBoxSet, tmdbId);
-
- dataFilePath = Path.Combine(movieDataPath, "all.json");
+ dataFilePath = GetDataFilePath(isBoxSet, tmdbId, language);
var directory = Path.GetDirectoryName(dataFilePath);
@@ -527,7 +526,7 @@ namespace MediaBrowser.Providers.Movies
if (isForcedRefresh || ConfigurationManager.Configuration.EnableTmdbUpdates || !HasAltMeta(item))
{
- dataFilePath = GetDataFilePath(isBoxSet, tmdbId);
+ dataFilePath = GetDataFilePath(isBoxSet, tmdbId, language);
if (!string.IsNullOrEmpty(dataFilePath))
{
@@ -543,19 +542,18 @@ namespace MediaBrowser.Providers.Movies
///
/// The id.
/// if set to true [is box set].
- /// The data path.
/// The preferred metadata language.
/// The cancellation token.
/// Task.
- internal async Task DownloadMovieInfo(string id, bool isBoxSet, string dataPath, string preferredMetadataLanguage, CancellationToken cancellationToken)
+ internal async Task DownloadMovieInfo(string id, bool isBoxSet, string preferredMetadataLanguage, CancellationToken cancellationToken)
{
var mainResult = await FetchMainResult(id, isBoxSet, preferredMetadataLanguage, cancellationToken).ConfigureAwait(false);
if (mainResult == null) return;
- var dataFilePath = Path.Combine(dataPath, "all.json");
+ var dataFilePath = GetDataFilePath(isBoxSet, id, preferredMetadataLanguage);
- Directory.CreateDirectory(dataPath);
+ Directory.CreateDirectory(Path.GetDirectoryName(dataFilePath));
JsonSerializer.SerializeToFile(mainResult, dataFilePath);
}
@@ -574,14 +572,17 @@ namespace MediaBrowser.Providers.Movies
return null;
}
- return GetDataFilePath(item is BoxSet, id);
+ return GetDataFilePath(item is BoxSet, id, item.GetPreferredMetadataLanguage());
}
- internal string GetDataFilePath(bool isBoxset, string tmdbId)
+ internal string GetDataFilePath(bool isBoxset, string tmdbId, string preferredLanguage)
{
var path = GetMovieDataPath(ConfigurationManager.ApplicationPaths, isBoxset, tmdbId);
- return Path.Combine(path, "all.json");
+ var filename = string.Format("all-{0}.json",
+ preferredLanguage ?? string.Empty);
+
+ return Path.Combine(path, filename);
}
///
@@ -730,16 +731,18 @@ namespace MediaBrowser.Providers.Movies
movie.VoteCount = movieData.vote_count;
}
+ var preferredCountryCode = movie.GetPreferredMetadataCountryCode();
+
//release date and certification are retrieved based on configured country and we fall back on US if not there and to minimun release date if still no match
if (movieData.releases != null && movieData.releases.countries != null)
{
- var ourRelease = movieData.releases.countries.FirstOrDefault(c => c.iso_3166_1.Equals(ConfigurationManager.Configuration.MetadataCountryCode, StringComparison.OrdinalIgnoreCase)) ?? new Country();
+ var ourRelease = movieData.releases.countries.FirstOrDefault(c => c.iso_3166_1.Equals(preferredCountryCode, StringComparison.OrdinalIgnoreCase)) ?? new Country();
var usRelease = movieData.releases.countries.FirstOrDefault(c => c.iso_3166_1.Equals("US", StringComparison.OrdinalIgnoreCase)) ?? new Country();
var minimunRelease = movieData.releases.countries.OrderBy(c => c.release_date).FirstOrDefault() ?? new Country();
if (!movie.LockedFields.Contains(MetadataFields.OfficialRating))
{
- var ratingPrefix = ConfigurationManager.Configuration.MetadataCountryCode.Equals("us", StringComparison.OrdinalIgnoreCase) ? "" : ConfigurationManager.Configuration.MetadataCountryCode + "-";
+ var ratingPrefix = string.Equals(preferredCountryCode, "us", StringComparison.OrdinalIgnoreCase) ? "" : preferredCountryCode + "-";
movie.OfficialRating = !string.IsNullOrEmpty(ourRelease.certification)
? ratingPrefix + ourRelease.certification
: !string.IsNullOrEmpty(usRelease.certification)
diff --git a/MediaBrowser.Providers/Movies/MovieUpdatesPrescanTask.cs b/MediaBrowser.Providers/Movies/MovieUpdatesPrescanTask.cs
index 4fe77b1238..291d2ff4dd 100644
--- a/MediaBrowser.Providers/Movies/MovieUpdatesPrescanTask.cs
+++ b/MediaBrowser.Providers/Movies/MovieUpdatesPrescanTask.cs
@@ -219,7 +219,7 @@ namespace MediaBrowser.Providers.Movies
{
try
{
- await UpdateMovie(id, isBoxSet, moviesDataPath, language, cancellationToken).ConfigureAwait(false);
+ await UpdateMovie(id, isBoxSet, language, cancellationToken).ConfigureAwait(false);
}
catch (Exception ex)
{
@@ -241,19 +241,14 @@ namespace MediaBrowser.Providers.Movies
///
/// The id.
/// if set to true [is box set].
- /// The data path.
/// The preferred metadata language.
/// The cancellation token.
/// Task.
- private Task UpdateMovie(string id, bool isBoxSet, string dataPath, string preferredMetadataLanguage, CancellationToken cancellationToken)
+ private Task UpdateMovie(string id, bool isBoxSet, string preferredMetadataLanguage, CancellationToken cancellationToken)
{
_logger.Info("Updating movie from tmdb " + id + ", language " + preferredMetadataLanguage);
- var itemDataPath = Path.Combine(dataPath, id);
-
- Directory.CreateDirectory(dataPath);
-
- return MovieDbProvider.Current.DownloadMovieInfo(id, isBoxSet, itemDataPath, preferredMetadataLanguage, cancellationToken);
+ return MovieDbProvider.Current.DownloadMovieInfo(id, isBoxSet, preferredMetadataLanguage, cancellationToken);
}
class Result
diff --git a/MediaBrowser.Providers/Savers/XmlSaverHelpers.cs b/MediaBrowser.Providers/Savers/XmlSaverHelpers.cs
index ff866fcb23..dc2d5eddd5 100644
--- a/MediaBrowser.Providers/Savers/XmlSaverHelpers.cs
+++ b/MediaBrowser.Providers/Savers/XmlSaverHelpers.cs
@@ -326,12 +326,12 @@ namespace MediaBrowser.Providers.Savers
}
}
- var hasLanguage = item as IHasLanguage;
+ var hasLanguage = item as IHasPreferredMetadataLanguage;
if (hasLanguage != null)
{
- if (!string.IsNullOrEmpty(hasLanguage.Language))
+ if (!string.IsNullOrEmpty(hasLanguage.PreferredMetadataLanguage))
{
- builder.Append("" + SecurityElement.Escape(hasLanguage.Language) + "");
+ builder.Append("" + SecurityElement.Escape(hasLanguage.PreferredMetadataLanguage) + "");
}
}
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
index d5faa25bfc..932c7ba3fd 100644
--- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs
+++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
@@ -739,10 +739,12 @@ namespace MediaBrowser.Server.Implementations.Dto
dto.MediaType = item.MediaType;
dto.LocationType = item.LocationType;
- var hasLanguage = item as IHasLanguage;
- if (hasLanguage != null)
+ var hasLang = item as IHasPreferredMetadataLanguage;
+
+ if (hasLang != null)
{
- dto.Language = hasLanguage.Language;
+ dto.PreferredMetadataCountryCode = hasLang.PreferredMetadataCountryCode;
+ dto.PreferredMetadataLanguage = hasLang.PreferredMetadataLanguage;
}
var hasCriticRating = item as IHasCriticRating;
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs
index dad0c915d7..6552c68926 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs
@@ -62,7 +62,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
if (program != null)
{
- dto.ProgramInfo = GetProgramInfoDto(program);
+ dto.ProgramInfo = GetProgramInfoDto(program, channel.ChannelInfo.Name);
dto.ProgramInfo.TimerId = dto.Id;
dto.ProgramInfo.SeriesTimerId = dto.SeriesTimerId;
@@ -260,7 +260,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return dto;
}
- public ProgramInfoDto GetProgramInfoDto(LiveTvProgram item, User user = null)
+ public ProgramInfoDto GetProgramInfoDto(LiveTvProgram item, string channelName, User user = null)
{
var program = item.ProgramInfo;
@@ -283,7 +283,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
AspectRatio = program.AspectRatio,
IsRepeat = program.IsRepeat,
EpisodeTitle = program.EpisodeTitle,
- ChannelName = program.ChannelName,
+ ChannelName = channelName,
IsMovie = program.IsMovie,
IsSeries = program.IsSeries,
IsSports = program.IsSports,
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
index 281f38e872..1d12e2d451 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -123,11 +123,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv
public LiveTvChannel GetInternalChannel(string id)
{
- var guid = new Guid(id);
+ return GetInternalChannel(new Guid(id));
+ }
+ private LiveTvChannel GetInternalChannel(Guid id)
+ {
LiveTvChannel channel = null;
- _channels.TryGetValue(guid, out channel);
+ _channels.TryGetValue(id, out channel);
return channel;
}
@@ -272,11 +275,24 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return item;
}
+ private LiveTvChannel GetChannel(LiveTvProgram program)
+ {
+ var programChannelId = program.ProgramInfo.ChannelId;
+
+ var internalProgramChannelId = _tvDtoService.GetInternalChannelId(program.ServiceName, programChannelId);
+
+ return GetInternalChannel(internalProgramChannelId);
+ }
+
public async Task GetProgram(string id, CancellationToken cancellationToken, User user = null)
{
var program = GetInternalProgram(id);
- var dto = _tvDtoService.GetProgramInfoDto(program, user);
+ var channel = GetChannel(program);
+
+ var channelName = channel == null ? null : channel.ChannelInfo.Name;
+
+ var dto = _tvDtoService.GetProgramInfoDto(program, channelName, user);
await AddRecordingInfo(new[] { dto }, cancellationToken).ConfigureAwait(false);
@@ -311,7 +327,14 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var returnArray = programs
.OrderBy(i => i.ProgramInfo.StartDate)
- .Select(i => _tvDtoService.GetProgramInfoDto(i, user))
+ .Select(i =>
+ {
+ var channel = GetChannel(i);
+
+ var channelName = channel == null ? null : channel.ChannelInfo.Name;
+
+ return _tvDtoService.GetProgramInfoDto(i, channelName, user);
+ })
.ToArray();
await AddRecordingInfo(returnArray, cancellationToken).ConfigureAwait(false);
@@ -447,7 +470,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var returnArray = entities
.Select(i =>
{
- var channel = string.IsNullOrEmpty(i.RecordingInfo.ChannelId) ? null : GetInternalChannel(_tvDtoService.GetInternalChannelId(service.Name, i.RecordingInfo.ChannelId).ToString("N"));
+ var channel = string.IsNullOrEmpty(i.RecordingInfo.ChannelId) ? null : GetInternalChannel(_tvDtoService.GetInternalChannelId(service.Name, i.RecordingInfo.ChannelId));
return _tvDtoService.GetRecordingInfoDto(i, channel, service, user);
})
.OrderByDescending(i => i.StartDate)
@@ -504,7 +527,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
.Select(i =>
{
var program = string.IsNullOrEmpty(i.ProgramId) ? null : GetInternalProgram(_tvDtoService.GetInternalProgramId(service.Name, i.ProgramId).ToString("N"));
- var channel = string.IsNullOrEmpty(i.ChannelId) ? null : GetInternalChannel(_tvDtoService.GetInternalChannelId(service.Name, i.ChannelId).ToString("N"));
+ var channel = string.IsNullOrEmpty(i.ChannelId) ? null : GetInternalChannel(_tvDtoService.GetInternalChannelId(service.Name, i.ChannelId));
return _tvDtoService.GetTimerInfoDto(i, service, program, channel);
})
@@ -603,7 +626,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
if (!string.IsNullOrEmpty(i.ChannelId))
{
var internalChannelId = _tvDtoService.GetInternalChannelId(service.Name, i.ChannelId);
- var channel = GetInternalChannel(internalChannelId.ToString("N"));
+ var channel = GetInternalChannel(internalChannelId);
channelName = channel == null ? null : channel.ChannelInfo.Name;
}
diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec
index c6177969d4..1df7b17bf3 100644
--- a/Nuget/MediaBrowser.Common.Internal.nuspec
+++ b/Nuget/MediaBrowser.Common.Internal.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Common.Internal
- 3.0.290
+ 3.0.292
MediaBrowser.Common.Internal
Luke
ebr,Luke,scottisafool
@@ -12,7 +12,7 @@
Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.
Copyright © Media Browser 2013
-
+
diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec
index 87411f9592..14e09d90cf 100644
--- a/Nuget/MediaBrowser.Common.nuspec
+++ b/Nuget/MediaBrowser.Common.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Common
- 3.0.290
+ 3.0.292
MediaBrowser.Common
Media Browser Team
ebr,Luke,scottisafool
diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec
index fc944e2f20..d49dfb85db 100644
--- a/Nuget/MediaBrowser.Server.Core.nuspec
+++ b/Nuget/MediaBrowser.Server.Core.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Server.Core
- 3.0.290
+ 3.0.292
Media Browser.Server.Core
Media Browser Team
ebr,Luke,scottisafool
@@ -12,7 +12,7 @@
Contains core components required to build plugins for Media Browser Server.
Copyright © Media Browser 2013
-
+