aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-08-06 00:48:52 -0400
committerGitHub <noreply@github.com>2016-08-06 00:48:52 -0400
commit99ad574bb83296f004a54e20c2c9696dbdcb6eb0 (patch)
tree99d6514058d992775f91a76e7f585196c9a50e9b /MediaBrowser.Server.Implementations
parentbfe746d4e08e9b5d8422856000f0479853df64e4 (diff)
parent0706bd5237125c8b95a7b8fa1576aa061703a397 (diff)
Merge pull request #2027 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Server.Implementations')
-rw-r--r--MediaBrowser.Server.Implementations/Connect/ConnectManager.cs2
-rw-r--r--MediaBrowser.Server.Implementations/Dto/DtoService.cs2
-rw-r--r--MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs2
-rw-r--r--MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs2
-rw-r--r--MediaBrowser.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs2
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs2
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs2
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs11
-rw-r--r--MediaBrowser.Server.Implementations/Library/Validators/ArtistsValidator.cs34
-rw-r--r--MediaBrowser.Server.Implementations/Library/Validators/GameGenresValidator.cs17
-rw-r--r--MediaBrowser.Server.Implementations/Library/Validators/GenresValidator.cs17
-rw-r--r--MediaBrowser.Server.Implementations/Library/Validators/MusicGenresValidator.cs18
-rw-r--r--MediaBrowser.Server.Implementations/Library/Validators/StudiosValidator.cs16
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs4
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs2
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs20
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs2
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspSession.cs2
-rw-r--r--MediaBrowser.Server.Implementations/Notifications/SqliteNotificationsRepository.cs2
-rw-r--r--MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs30
20 files changed, 107 insertions, 82 deletions
diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
index 24750de94..4e913cf99 100644
--- a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
+++ b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
@@ -151,7 +151,7 @@ namespace MediaBrowser.Server.Implementations.Connect
{
DiscoveredWanIpAddress = address;
- UpdateConnectInfo();
+ var task = UpdateConnectInfo();
}
private async Task UpdateConnectInfo()
diff --git a/MediaBrowser.Server.Implementations/Dto/DtoService.cs b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
index 779afdcf2..cc165da6a 100644
--- a/MediaBrowser.Server.Implementations/Dto/DtoService.cs
+++ b/MediaBrowser.Server.Implementations/Dto/DtoService.cs
@@ -1620,7 +1620,7 @@ namespace MediaBrowser.Server.Implementations.Dto
{
size = _imageProcessor.GetImageSize(imageInfo);
}
- catch (Exception ex)
+ catch
{
//_logger.ErrorException("Failed to determine primary image aspect ratio for {0}", ex, path);
return null;
diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs b/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs
index 46ddf3dd8..a36583a41 100644
--- a/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs
+++ b/MediaBrowser.Server.Implementations/EntryPoints/ActivityLogEntryPoint.cs
@@ -29,7 +29,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
private readonly IInstallationManager _installationManager;
//private readonly ILogManager _logManager;
- private readonly ILogger _logger;
+ //private readonly ILogger _logger;
private readonly ISessionManager _sessionManager;
private readonly ITaskManager _taskManager;
private readonly IActivityManager _activityManager;
diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
index 64e3c56a6..280bec65b 100644
--- a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
+++ b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs
@@ -165,7 +165,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
CreateRules(device);
}
- catch (Exception ex)
+ catch
{
// I think it could be a good idea to log the exception because
// you are using permanent portmapping here (never expire) and that means that next time
diff --git a/MediaBrowser.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
index b616b7761..2bb010133 100644
--- a/MediaBrowser.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
+++ b/MediaBrowser.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs
@@ -92,7 +92,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
var changes = _changedItems.ToList();
_changedItems.Clear();
- SendNotifications(changes, CancellationToken.None);
+ var task = SendNotifications(changes, CancellationToken.None);
if (UpdateTimer != null)
{
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs
index 4121c5e5e..5cf0a246f 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/HttpListenerHost.cs
@@ -251,7 +251,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
httpRes.Close();
}
- catch (Exception errorEx)
+ catch
{
//_logger.ErrorException("Error this.ProcessRequest(context)(Exception while writing error to the response)", errorEx);
}
diff --git a/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs b/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs
index 71cd20743..488c630fe 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/RangeRequestWriter.cs
@@ -191,7 +191,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer
}
}
}
- catch (IOException ex)
+ catch (IOException)
{
throw;
}
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index 7af495f5a..055fde504 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -1385,6 +1385,17 @@ namespace MediaBrowser.Server.Implementations.Library
return ItemRepository.GetMusicGenres(query);
}
+ public QueryResult<Tuple<BaseItem, ItemCounts>> GetAllArtists(InternalItemsQuery query)
+ {
+ if (query.User != null)
+ {
+ AddUserToQuery(query, query.User);
+ }
+
+ SetTopParentOrAncestorIds(query);
+ return ItemRepository.GetAllArtists(query);
+ }
+
public QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query)
{
if (query.User != null)
diff --git a/MediaBrowser.Server.Implementations/Library/Validators/ArtistsValidator.cs b/MediaBrowser.Server.Implementations/Library/Validators/ArtistsValidator.cs
index 2b68f98ca..353be1a44 100644
--- a/MediaBrowser.Server.Implementations/Library/Validators/ArtistsValidator.cs
+++ b/MediaBrowser.Server.Implementations/Library/Validators/ArtistsValidator.cs
@@ -6,6 +6,7 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using MediaBrowser.Controller.Entities;
namespace MediaBrowser.Server.Implementations.Library.Validators
{
@@ -43,36 +44,39 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
/// <returns>Task.</returns>
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
{
- var allSongs = _libraryManager.RootFolder
- .GetRecursiveChildren(i => !i.IsFolder && i is IHasArtist)
- .Cast<IHasArtist>()
+ var items = _libraryManager.GetAllArtists(new InternalItemsQuery())
+ .Items
+ .Select(i => i.Item1)
.ToList();
- var allArtists = _libraryManager.GetArtists(allSongs).ToList();
-
var numComplete = 0;
- var numArtists = allArtists.Count;
+ var count = items.Count;
- foreach (var artistItem in allArtists)
+ foreach (var item in items)
{
- cancellationToken.ThrowIfCancellationRequested();
-
try
{
- await artistItem.RefreshMetadata(cancellationToken).ConfigureAwait(false);
+ await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
}
- catch (IOException ex)
+ catch (OperationCanceledException)
{
- _logger.ErrorException("Error validating Artist {0}", ex, artistItem.Name);
+ // Don't clutter the log
+ break;
+ }
+ catch (Exception ex)
+ {
+ _logger.ErrorException("Error refreshing {0}", ex, item.Name);
}
- // Update progress
numComplete++;
double percent = numComplete;
- percent /= numArtists;
+ percent /= count;
+ percent *= 100;
- progress.Report(100 * percent);
+ progress.Report(percent);
}
+
+ progress.Report(100);
}
}
}
diff --git a/MediaBrowser.Server.Implementations/Library/Validators/GameGenresValidator.cs b/MediaBrowser.Server.Implementations/Library/Validators/GameGenresValidator.cs
index a149da651..72864790b 100644
--- a/MediaBrowser.Server.Implementations/Library/Validators/GameGenresValidator.cs
+++ b/MediaBrowser.Server.Implementations/Library/Validators/GameGenresValidator.cs
@@ -34,21 +34,22 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
/// <returns>Task.</returns>
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
{
- var items = _libraryManager.RootFolder.GetRecursiveChildren(i => i is Game)
- .SelectMany(i => i.Genres)
- .DistinctNames()
+ var items = _libraryManager.GetGameGenres(new InternalItemsQuery
+ {
+ IncludeItemTypes = new[] { typeof(Game).Name }
+ })
+ .Items
+ .Select(i => i.Item1)
.ToList();
var numComplete = 0;
var count = items.Count;
- foreach (var name in items)
+ foreach (var item in items)
{
try
{
- var itemByName = _libraryManager.GetGameGenre(name);
-
- await itemByName.RefreshMetadata(cancellationToken).ConfigureAwait(false);
+ await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
}
catch (OperationCanceledException)
{
@@ -57,7 +58,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
- _logger.ErrorException("Error refreshing {0}", ex, name);
+ _logger.ErrorException("Error refreshing {0}", ex, item.Name);
}
numComplete++;
diff --git a/MediaBrowser.Server.Implementations/Library/Validators/GenresValidator.cs b/MediaBrowser.Server.Implementations/Library/Validators/GenresValidator.cs
index fac5cfc35..6a62d7fe4 100644
--- a/MediaBrowser.Server.Implementations/Library/Validators/GenresValidator.cs
+++ b/MediaBrowser.Server.Implementations/Library/Validators/GenresValidator.cs
@@ -35,21 +35,22 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
/// <returns>Task.</returns>
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
{
- var items = _libraryManager.RootFolder.GetRecursiveChildren(i => !(i is IHasMusicGenres) && !(i is Game))
- .SelectMany(i => i.Genres)
- .DistinctNames()
+ var items = _libraryManager.GetGenres(new InternalItemsQuery
+ {
+ ExcludeItemTypes = new[] { typeof(Audio).Name, typeof(MusicArtist).Name, typeof(MusicAlbum).Name, typeof(MusicVideo).Name, typeof(Game).Name }
+ })
+ .Items
+ .Select(i => i.Item1)
.ToList();
var numComplete = 0;
var count = items.Count;
- foreach (var name in items)
+ foreach (var item in items)
{
try
{
- var itemByName = _libraryManager.GetGenre(name);
-
- await itemByName.RefreshMetadata(cancellationToken).ConfigureAwait(false);
+ await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
}
catch (OperationCanceledException)
{
@@ -58,7 +59,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
- _logger.ErrorException("Error refreshing {0}", ex, name);
+ _logger.ErrorException("Error refreshing {0}", ex, item.Name);
}
numComplete++;
diff --git a/MediaBrowser.Server.Implementations/Library/Validators/MusicGenresValidator.cs b/MediaBrowser.Server.Implementations/Library/Validators/MusicGenresValidator.cs
index 81433e5b3..2668d84e9 100644
--- a/MediaBrowser.Server.Implementations/Library/Validators/MusicGenresValidator.cs
+++ b/MediaBrowser.Server.Implementations/Library/Validators/MusicGenresValidator.cs
@@ -5,6 +5,7 @@ using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using MediaBrowser.Controller.Entities;
namespace MediaBrowser.Server.Implementations.Library.Validators
{
@@ -34,21 +35,22 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
/// <returns>Task.</returns>
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
{
- var items = _libraryManager.RootFolder.GetRecursiveChildren(i => i is IHasMusicGenres)
- .SelectMany(i => i.Genres)
- .DistinctNames()
+ var items = _libraryManager.GetMusicGenres(new InternalItemsQuery
+ {
+ IncludeItemTypes = new[] { typeof(Audio).Name, typeof(MusicArtist).Name, typeof(MusicAlbum).Name, typeof(MusicVideo).Name }
+ })
+ .Items
+ .Select(i => i.Item1)
.ToList();
var numComplete = 0;
var count = items.Count;
- foreach (var name in items)
+ foreach (var item in items)
{
try
{
- var itemByName = _libraryManager.GetMusicGenre(name);
-
- await itemByName.RefreshMetadata(cancellationToken).ConfigureAwait(false);
+ await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
}
catch (OperationCanceledException)
{
@@ -57,7 +59,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
- _logger.ErrorException("Error refreshing {0}", ex, name);
+ _logger.ErrorException("Error refreshing {0}", ex, item.Name);
}
numComplete++;
diff --git a/MediaBrowser.Server.Implementations/Library/Validators/StudiosValidator.cs b/MediaBrowser.Server.Implementations/Library/Validators/StudiosValidator.cs
index 259878566..722b74891 100644
--- a/MediaBrowser.Server.Implementations/Library/Validators/StudiosValidator.cs
+++ b/MediaBrowser.Server.Implementations/Library/Validators/StudiosValidator.cs
@@ -1,10 +1,10 @@
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Logging;
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
+using MediaBrowser.Controller.Entities;
namespace MediaBrowser.Server.Implementations.Library.Validators
{
@@ -34,21 +34,19 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
/// <returns>Task.</returns>
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
{
- var items = _libraryManager.RootFolder.GetRecursiveChildren(i => true)
- .SelectMany(i => i.Studios)
- .DistinctNames()
+ var items = _libraryManager.GetStudios(new InternalItemsQuery())
+ .Items
+ .Select(i => i.Item1)
.ToList();
var numComplete = 0;
var count = items.Count;
- foreach (var name in items)
+ foreach (var item in items)
{
try
{
- var itemByName = _libraryManager.GetStudio(name);
-
- await itemByName.RefreshMetadata(cancellationToken).ConfigureAwait(false);
+ await item.RefreshMetadata(cancellationToken).ConfigureAwait(false);
}
catch (OperationCanceledException)
{
@@ -57,7 +55,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
}
catch (Exception ex)
{
- _logger.ErrorException("Error refreshing {0}", ex, name);
+ _logger.ErrorException("Error refreshing {0}", ex, item.Name);
}
numComplete++;
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
index a36eae8d2..ee8ab7c25 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs
@@ -55,8 +55,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
public static EmbyTV Current;
- public event EventHandler DataSourceChanged;
- public event EventHandler<RecordingStatusChangedEventArgs> RecordingStatusChanged;
+ public event EventHandler DataSourceChanged { add { } remove { } }
+ public event EventHandler<RecordingStatusChangedEventArgs> RecordingStatusChanged { add { } remove { } }
private readonly ConcurrentDictionary<string, ActiveRecordingInfo> _activeRecordings =
new ConcurrentDictionary<string, ActiveRecordingInfo>(StringComparer.OrdinalIgnoreCase);
diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
index 79b26468e..7fe271bea 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs
@@ -52,7 +52,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
catch (FileNotFoundException)
{
}
- catch (DirectoryNotFoundException ex)
+ catch (DirectoryNotFoundException)
{
}
catch (IOException ex)
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
index 26ec599fa..09d156661 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs
@@ -133,7 +133,10 @@ namespace MediaBrowser.Server.Implementations.LiveTv
void service_DataSourceChanged(object sender, EventArgs e)
{
- _taskManager.CancelIfRunningAndQueue<RefreshChannelsScheduledTask>();
+ if (!_isDisposed)
+ {
+ _taskManager.CancelIfRunningAndQueue<RefreshChannelsScheduledTask>();
+ }
}
public async Task<QueryResult<LiveTvChannel>> GetInternalChannels(LiveTvChannelQuery query, CancellationToken cancellationToken)
@@ -1238,7 +1241,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
var programs = new List<Guid>();
var channels = new List<Guid>();
- var guideDays = GetGuideDays(list.Count);
+ var guideDays = GetGuideDays();
_logger.Info("Refreshing guide with {0} days of guide data", guideDays);
@@ -1326,7 +1329,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
}
private const int MaxGuideDays = 14;
- private double GetGuideDays(int channelCount)
+ private double GetGuideDays()
{
var config = GetConfiguration();
@@ -1335,13 +1338,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return Math.Max(1, Math.Min(config.GuideDays.Value, MaxGuideDays));
}
- var programsPerDay = channelCount * 48;
-
- const int maxPrograms = 24000;
-
- var days = Math.Round((double)maxPrograms / programsPerDay);
-
- return Math.Max(3, Math.Min(days, MaxGuideDays));
+ return 7;
}
private async Task<IEnumerable<Tuple<string, ChannelInfo>>> GetChannels(ILiveTvService service, CancellationToken cancellationToken)
@@ -2309,6 +2306,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
}
private readonly object _disposeLock = new object();
+ private bool _isDisposed = false;
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
@@ -2317,6 +2315,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv
{
if (dispose)
{
+ _isDisposed = true;
+
lock (_disposeLock)
{
foreach (var stream in _openStreams.Values.ToList())
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
index 69b6fb5a9..fd4775938 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
@@ -431,7 +431,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
list.Add(await GetMediaSource(info, hdhrId, "mobile").ConfigureAwait(false));
}
}
- catch (Exception ex)
+ catch
{
}
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspSession.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspSession.cs
index 71b3f8a18..0f8682b7c 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspSession.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/SatIp/Rtsp/RtspSession.cs
@@ -649,7 +649,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.SatIp.Rtsp
#region Public Events
- public event PropertyChangedEventHandler PropertyChanged;
+ ////public event PropertyChangedEventHandler PropertyChanged;
#endregion
diff --git a/MediaBrowser.Server.Implementations/Notifications/SqliteNotificationsRepository.cs b/MediaBrowser.Server.Implementations/Notifications/SqliteNotificationsRepository.cs
index be8c6d48d..f30ba3e54 100644
--- a/MediaBrowser.Server.Implementations/Notifications/SqliteNotificationsRepository.cs
+++ b/MediaBrowser.Server.Implementations/Notifications/SqliteNotificationsRepository.cs
@@ -22,7 +22,7 @@ namespace MediaBrowser.Server.Implementations.Notifications
public event EventHandler<NotificationUpdateEventArgs> NotificationAdded;
public event EventHandler<NotificationReadEventArgs> NotificationsMarkedRead;
- public event EventHandler<NotificationUpdateEventArgs> NotificationUpdated;
+ ////public event EventHandler<NotificationUpdateEventArgs> NotificationUpdated;
public async Task Initialize()
{
diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs
index 2ef878a20..21785bcbd 100644
--- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs
+++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs
@@ -3817,37 +3817,42 @@ namespace MediaBrowser.Server.Implementations.Persistence
}
}
+ public QueryResult<Tuple<BaseItem, ItemCounts>> GetAllArtists(InternalItemsQuery query)
+ {
+ return GetItemValues(query, new[] { 0, 1 }, typeof(MusicArtist).FullName);
+ }
+
public QueryResult<Tuple<BaseItem, ItemCounts>> GetArtists(InternalItemsQuery query)
{
- return GetItemValues(query, 0, typeof(MusicArtist).FullName);
+ return GetItemValues(query, new[] { 0 }, typeof(MusicArtist).FullName);
}
public QueryResult<Tuple<BaseItem, ItemCounts>> GetAlbumArtists(InternalItemsQuery query)
{
- return GetItemValues(query, 1, typeof(MusicArtist).FullName);
+ return GetItemValues(query, new[] { 1 }, typeof(MusicArtist).FullName);
}
public QueryResult<Tuple<BaseItem, ItemCounts>> GetStudios(InternalItemsQuery query)
{
- return GetItemValues(query, 3, typeof(Studio).FullName);
+ return GetItemValues(query, new[] { 3 }, typeof(Studio).FullName);
}
public QueryResult<Tuple<BaseItem, ItemCounts>> GetGenres(InternalItemsQuery query)
{
- return GetItemValues(query, 2, typeof(Genre).FullName);
+ return GetItemValues(query, new[] { 2 }, typeof(Genre).FullName);
}
public QueryResult<Tuple<BaseItem, ItemCounts>> GetGameGenres(InternalItemsQuery query)
{
- return GetItemValues(query, 2, typeof(GameGenre).FullName);
+ return GetItemValues(query, new[] { 2 }, typeof(GameGenre).FullName);
}
public QueryResult<Tuple<BaseItem, ItemCounts>> GetMusicGenres(InternalItemsQuery query)
{
- return GetItemValues(query, 2, typeof(MusicGenre).FullName);
+ return GetItemValues(query, new[] { 2 }, typeof(MusicGenre).FullName);
}
- private QueryResult<Tuple<BaseItem, ItemCounts>> GetItemValues(InternalItemsQuery query, int itemValueType, string returnType)
+ private QueryResult<Tuple<BaseItem, ItemCounts>> GetItemValues(InternalItemsQuery query, int[] itemValueTypes, string returnType)
{
if (query == null)
{
@@ -3863,6 +3868,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
var now = DateTime.UtcNow;
+ var typeClause = itemValueTypes.Length == 1 ?
+ ("Type=" + itemValueTypes[0].ToString(CultureInfo.InvariantCulture)) :
+ ("Type in (" + string.Join(",", itemValueTypes.Select(i => i.ToString(CultureInfo.InvariantCulture)).ToArray()) + ")");
+
using (var cmd = _connection.CreateCommand())
{
var itemCountColumns = new List<Tuple<string, string>>();
@@ -3887,7 +3896,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
};
var whereClauses = GetWhereClauses(typeSubQuery, cmd, "itemTypes");
- whereClauses.Add("guid in (select ItemId from ItemValues where ItemValues.CleanValue=A.CleanName AND Type=@ItemValueType)");
+ whereClauses.Add("guid in (select ItemId from ItemValues where ItemValues.CleanValue=A.CleanName AND " + typeClause + ")");
var typeWhereText = whereClauses.Count == 0 ?
string.Empty :
@@ -3929,12 +3938,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
if (typesToCount.Count == 0)
{
- whereText += " And CleanName In (Select CleanValue from ItemValues where Type=@ItemValueType AND ItemId in (select guid from TypedBaseItems" + innerWhereText + "))";
+ whereText += " And CleanName In (Select CleanValue from ItemValues where " + typeClause + " AND ItemId in (select guid from TypedBaseItems" + innerWhereText + "))";
}
else
{
//whereText += " And itemTypes not null";
- whereText += " And CleanName In (Select CleanValue from ItemValues where Type=@ItemValueType AND ItemId in (select guid from TypedBaseItems" + innerWhereText + "))";
+ whereText += " And CleanName In (Select CleanValue from ItemValues where " + typeClause + " AND ItemId in (select guid from TypedBaseItems" + innerWhereText + "))";
}
var outerQuery = new InternalItemsQuery(query.User)
@@ -3964,7 +3973,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
cmd.CommandText += " group by PresentationUniqueKey";
cmd.Parameters.Add(cmd, "@SelectType", DbType.String).Value = returnType;
- cmd.Parameters.Add(cmd, "@ItemValueType", DbType.Int32).Value = itemValueType;
if (EnableJoinUserData(query))
{