diff --git a/MediaBrowser.Controller/Entities/Book.cs b/MediaBrowser.Controller/Entities/Book.cs
index 29d6e4084e..ea7ecfb4a0 100644
--- a/MediaBrowser.Controller/Entities/Book.cs
+++ b/MediaBrowser.Controller/Entities/Book.cs
@@ -1,7 +1,7 @@
-using System.Linq;
-using MediaBrowser.Controller.Providers;
+using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using System.Collections.Generic;
+using System.Linq;
namespace MediaBrowser.Controller.Entities
{
diff --git a/MediaBrowser.Controller/Entities/IHasSoundtracks.cs b/MediaBrowser.Controller/Entities/IHasSoundtracks.cs
index 31defc9f47..3ac2491fbc 100644
--- a/MediaBrowser.Controller/Entities/IHasSoundtracks.cs
+++ b/MediaBrowser.Controller/Entities/IHasSoundtracks.cs
@@ -13,5 +13,17 @@ namespace MediaBrowser.Controller.Entities
///
/// The soundtrack ids.
List SoundtrackIds { get; set; }
+
+ ///
+ /// Gets the name.
+ ///
+ /// The name.
+ string Name { get; }
+
+ ///
+ /// Gets the identifier.
+ ///
+ /// The identifier.
+ Guid Id { get; }
}
}
diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs
index e16683d6d0..fa85f0edce 100644
--- a/MediaBrowser.Controller/Entities/Video.cs
+++ b/MediaBrowser.Controller/Entities/Video.cs
@@ -127,11 +127,6 @@ namespace MediaBrowser.Controller.Entities
/// List{System.String}.
public List GetPlayableStreamFiles(string rootPath)
{
- if (PlayableStreamFileNames == null)
- {
- return null;
- }
-
var allFiles = Directory.EnumerateFiles(rootPath, "*", SearchOption.AllDirectories).ToList();
return PlayableStreamFileNames.Select(name => allFiles.FirstOrDefault(f => string.Equals(System.IO.Path.GetFileName(f), name, StringComparison.OrdinalIgnoreCase)))
diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvRecording.cs b/MediaBrowser.Controller/LiveTv/ILiveTvRecording.cs
index 668c3a414b..edf86cae8d 100644
--- a/MediaBrowser.Controller/LiveTv/ILiveTvRecording.cs
+++ b/MediaBrowser.Controller/LiveTv/ILiveTvRecording.cs
@@ -2,6 +2,7 @@
using MediaBrowser.Controller.Providers;
using System.Threading;
using System.Threading.Tasks;
+using MediaBrowser.Model.Library;
namespace MediaBrowser.Controller.LiveTv
{
@@ -20,5 +21,7 @@ namespace MediaBrowser.Controller.LiveTv
bool IsParentalAllowed(User user);
Task RefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken);
+
+ PlayAccess GetPlayAccess(User user);
}
}
diff --git a/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs b/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs
index 170d7eb734..d17e2a7f9a 100644
--- a/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs
+++ b/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs
@@ -5,6 +5,7 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
+using MediaBrowser.Model.Library;
namespace MediaBrowser.Model.LiveTv
{
@@ -44,6 +45,12 @@ namespace MediaBrowser.Model.LiveTv
/// The number.
public string Number { get; set; }
+ ///
+ /// Gets or sets the play access.
+ ///
+ /// The play access.
+ public PlayAccess PlayAccess { get; set; }
+
///
/// Gets or sets the name of the service.
///
diff --git a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs
index d761e88e67..f6b343bdbd 100644
--- a/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs
+++ b/MediaBrowser.Model/LiveTv/ProgramInfoDto.cs
@@ -5,6 +5,7 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
+using MediaBrowser.Model.Library;
namespace MediaBrowser.Model.LiveTv
{
@@ -46,6 +47,12 @@ namespace MediaBrowser.Model.LiveTv
/// The channel primary image tag.
public Guid? ChannelPrimaryImageTag { get; set; }
+ ///
+ /// Gets or sets the play access.
+ ///
+ /// The play access.
+ public PlayAccess PlayAccess { get; set; }
+
///
/// Gets or sets the name of the channel.
///
diff --git a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs b/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs
index 6df9ef7256..40aa5710e2 100644
--- a/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs
+++ b/MediaBrowser.Model/LiveTv/RecordingInfoDto.cs
@@ -5,6 +5,7 @@ using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.ComponentModel;
+using MediaBrowser.Model.Library;
namespace MediaBrowser.Model.LiveTv
{
@@ -39,6 +40,12 @@ namespace MediaBrowser.Model.LiveTv
///
public string ChannelId { get; set; }
+ ///
+ /// Gets or sets the play access.
+ ///
+ /// The play access.
+ public PlayAccess PlayAccess { get; set; }
+
///
/// Gets or sets the channel primary image tag.
///
diff --git a/MediaBrowser.Providers/Music/SoundtrackPostScanTask.cs b/MediaBrowser.Providers/Music/SoundtrackPostScanTask.cs
index 1fd3fb9d9f..0e5dfdb2b6 100644
--- a/MediaBrowser.Providers/Music/SoundtrackPostScanTask.cs
+++ b/MediaBrowser.Providers/Music/SoundtrackPostScanTask.cs
@@ -1,12 +1,12 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Common.Extensions;
+using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
-using MediaBrowser.Controller.Entities.Movies;
-using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Library;
-using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
+using System.Globalization;
using System.Linq;
+using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -39,126 +39,72 @@ namespace MediaBrowser.Providers.Music
.OfType()
.ToList();
- AttachMovieSoundtracks(allItems, musicAlbums, cancellationToken);
+ var itemsWithSoundtracks = allItems.OfType().ToList();
- progress.Report(25);
+ foreach (var item in itemsWithSoundtracks)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
- AttachTvSoundtracks(allItems, musicAlbums, cancellationToken);
+ item.SoundtrackIds = GetSoundtrackIds(item, musicAlbums).ToList();
+ }
progress.Report(50);
- AttachGameSoundtracks(allItems, musicAlbums, cancellationToken);
+ itemsWithSoundtracks = itemsWithSoundtracks.Where(i => i.SoundtrackIds.Count > 0).ToList();
- progress.Report(75);
-
- AttachAlbumLinks(allItems, musicAlbums, cancellationToken);
+ foreach (var album in musicAlbums)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+
+ album.SoundtrackIds = GetAlbumLinks(album.Id, itemsWithSoundtracks).ToList();
+ }
progress.Report(100);
}
- private void AttachMovieSoundtracks(IEnumerable allItems, List allAlbums, CancellationToken cancellationToken)
+ private IEnumerable GetSoundtrackIds(IHasSoundtracks item, IEnumerable albums)
{
- foreach (var movie in allItems
- .Where(i => (i is Movie) || (i is Trailer)))
- {
- var hasSoundtracks = (IHasSoundtracks) movie;
+ var itemName = GetComparableName(item.Name);
- cancellationToken.ThrowIfCancellationRequested();
-
- var tmdbId = movie.GetProviderId(MetadataProviders.Tmdb);
-
- if (string.IsNullOrEmpty(tmdbId))
- {
- hasSoundtracks.SoundtrackIds = new List();
- continue;
- }
-
- hasSoundtracks.SoundtrackIds = allAlbums
- .Where(i => string.Equals(tmdbId, i.GetProviderId(MetadataProviders.Tmdb), StringComparison.OrdinalIgnoreCase))
- .Select(i => i.Id)
- .ToList();
- }
+ return albums.Where(i => string.Equals(itemName, GetComparableName(i.Name), StringComparison.OrdinalIgnoreCase)).Select(i => i.Id);
}
- private void AttachTvSoundtracks(IEnumerable allItems, List allAlbums, CancellationToken cancellationToken)
+ private static string GetComparableName(string name)
{
- foreach (var series in allItems.OfType())
- {
- cancellationToken.ThrowIfCancellationRequested();
+ name = " " + name + " ";
- var tvdbId = series.GetProviderId(MetadataProviders.Tvdb);
+ name = name.Replace(".", " ")
+ .Replace("_", " ")
+ .Replace("&", " ")
+ .Replace("!", " ")
+ .Replace("(", " ")
+ .Replace(")", " ")
+ .Replace(",", " ")
+ .Replace("-", " ")
+ .Replace(" a ", String.Empty, StringComparison.OrdinalIgnoreCase)
+ .Replace(" the ", String.Empty, StringComparison.OrdinalIgnoreCase)
+ .Replace(" ", String.Empty);
- if (string.IsNullOrEmpty(tvdbId))
- {
- series.SoundtrackIds = new List();
- continue;
- }
-
- series.SoundtrackIds = allAlbums
- .Where(i => string.Equals(tvdbId, i.GetProviderId(MetadataProviders.Tvdb), StringComparison.OrdinalIgnoreCase))
- .Select(i => i.Id)
- .ToList();
- }
+ return name.Trim();
}
- private void AttachGameSoundtracks(IEnumerable allItems, List allAlbums, CancellationToken cancellationToken)
+ ///
+ /// Removes the diacritics.
+ ///
+ /// The text.
+ /// System.String.
+ private static string RemoveDiacritics(string text)
{
- foreach (var game in allItems.OfType())
- {
- cancellationToken.ThrowIfCancellationRequested();
-
- var gamesdb = game.GetProviderId(MetadataProviders.Gamesdb);
-
- if (string.IsNullOrEmpty(gamesdb))
- {
- game.SoundtrackIds = new List();
- continue;
- }
-
- game.SoundtrackIds = allAlbums
- .Where(i => string.Equals(gamesdb, i.GetProviderId(MetadataProviders.Gamesdb), StringComparison.OrdinalIgnoreCase))
- .Select(i => i.Id)
- .ToList();
- }
+ return String.Concat(
+ text.Normalize(NormalizationForm.FormD)
+ .Where(ch => CharUnicodeInfo.GetUnicodeCategory(ch) !=
+ UnicodeCategory.NonSpacingMark)
+ ).Normalize(NormalizationForm.FormC);
}
- private void AttachAlbumLinks(List allItems, IEnumerable allAlbums, CancellationToken cancellationToken)
+ private IEnumerable GetAlbumLinks(Guid albumId, IEnumerable items)
{
- foreach (var album in allAlbums)
- {
- cancellationToken.ThrowIfCancellationRequested();
-
- var tmdb = album.GetProviderId(MetadataProviders.Tmdb);
- var tvdb = album.GetProviderId(MetadataProviders.Tvdb);
- var gamesdb = album.GetProviderId(MetadataProviders.Gamesdb);
-
- if (string.IsNullOrEmpty(tmdb) && string.IsNullOrEmpty(tvdb) && string.IsNullOrEmpty(gamesdb))
- {
- album.SoundtrackIds = new List();
- continue;
- }
-
- album.SoundtrackIds = allItems.
- Where(i =>
- {
- if (!string.IsNullOrEmpty(tmdb) && string.Equals(tmdb, i.GetProviderId(MetadataProviders.Tmdb), StringComparison.OrdinalIgnoreCase) && i is Movie)
- {
- return true;
- }
- if (!string.IsNullOrEmpty(tmdb) && string.Equals(tmdb, i.GetProviderId(MetadataProviders.Tmdb), StringComparison.OrdinalIgnoreCase) && i is Trailer)
- {
- return true;
- }
- if (!string.IsNullOrEmpty(tvdb) && string.Equals(tvdb, i.GetProviderId(MetadataProviders.Tvdb), StringComparison.OrdinalIgnoreCase) && i is Series)
- {
- return true;
- }
-
- return !string.IsNullOrEmpty(gamesdb) && string.Equals(gamesdb, i.GetProviderId(MetadataProviders.Gamesdb), StringComparison.OrdinalIgnoreCase) && i is Game;
- })
- .Select(i => i.Id)
- .ToList();
- }
+ return items.Where(i => i.SoundtrackIds.Contains(albumId)).Select(i => i.Id);
}
}
}
diff --git a/MediaBrowser.Server.Implementations/FileOrganization/NameUtils.cs b/MediaBrowser.Server.Implementations/FileOrganization/NameUtils.cs
index 75e5d92c38..23d0363cb8 100644
--- a/MediaBrowser.Server.Implementations/FileOrganization/NameUtils.cs
+++ b/MediaBrowser.Server.Implementations/FileOrganization/NameUtils.cs
@@ -1,4 +1,5 @@
-using MediaBrowser.Controller.Entities;
+using MediaBrowser.Common.Extensions;
+using MediaBrowser.Controller.Entities;
using System;
using System.Globalization;
using System.Linq;
@@ -58,7 +59,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
name = RemoveDiacritics(name);
- name = " " + name.ToLower() + " ";
+ name = " " + name + " ";
name = name.Replace(".", " ")
.Replace("_", " ")
@@ -68,8 +69,8 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
.Replace(")", " ")
.Replace(",", " ")
.Replace("-", " ")
- .Replace(" a ", String.Empty)
- .Replace(" the ", String.Empty)
+ .Replace(" a ", String.Empty, StringComparison.OrdinalIgnoreCase)
+ .Replace(" the ", String.Empty, StringComparison.OrdinalIgnoreCase)
.Replace(" ", String.Empty);
return name.Trim();
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs
index 22d683e1b6..4e1bd860ba 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvDtoService.cs
@@ -251,6 +251,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
if (user != null)
{
dto.UserData = _dtoService.GetUserItemDataDto(_userDataManager.GetUserData(user.Id, recording.GetUserDataKey()));
+
+ dto.PlayAccess = recording.GetPlayAccess(user);
}
if (!string.IsNullOrEmpty(info.ProgramId))
@@ -321,6 +323,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
if (user != null)
{
dto.UserData = _dtoService.GetUserItemDataDto(_userDataManager.GetUserData(user.Id, info.GetUserDataKey()));
+
+ dto.PlayAccess = info.GetPlayAccess(user);
}
var imageTag = GetImageTag(info);
@@ -394,6 +398,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
if (user != null)
{
dto.UserData = _dtoService.GetUserItemDataDto(_userDataManager.GetUserData(user.Id, item.GetUserDataKey()));
+
+ dto.PlayAccess = item.GetPlayAccess(user);
}
return dto;
diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs
index db0f8eeb74..55c94a7d6f 100644
--- a/MediaBrowser.WebDashboard/Api/DashboardService.cs
+++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs
@@ -434,15 +434,13 @@ namespace MediaBrowser.WebDashboard.Api
{
var builder = new StringBuilder();
- builder.Append("");
-
var versionString = "?v=" + version;
var files = new[]
{
"scripts/all.js" + versionString,
- "thirdparty/jstree1.0/jquery.jstree.min.js"
+ "thirdparty/jstree1.0/jquery.jstree.min.js",
+ "https://www.gstatic.com/cv/js/sender/v1/cast_sender.js"
};
var tags = files.Select(s => string.Format("", s)).ToArray();
@@ -466,8 +464,9 @@ namespace MediaBrowser.WebDashboard.Api
"site.js",
"librarybrowser.js",
"editorsidebar.js",
-
"librarymenu.js",
+ "chromecast.js",
+
"ratingdialog.js",
"aboutpage.js",
"allusersettings.js",
@@ -547,7 +546,7 @@ namespace MediaBrowser.WebDashboard.Api
"supporterpage.js",
"episodes.js",
"tvgenres.js",
- "tvnextup.js",
+ "tvlatest.js",
"tvpeople.js",
"tvrecommended.js",
"tvshows.js",
diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
index fd05ee7b09..6627acf6df 100644
--- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
+++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj
@@ -424,6 +424,9 @@
PreserveNewest
+
+ PreserveNewest
+
PreserveNewest
@@ -1255,7 +1258,7 @@
PreserveNewest
-
+
PreserveNewest
@@ -1437,7 +1440,7 @@
PreserveNewest
-
+
PreserveNewest