fix album save in metadata manager

pull/702/head
Luke Pulverenti 10 years ago
parent deb6e5a2ee
commit 3e442e0df4

@ -389,22 +389,28 @@ namespace MediaBrowser.Api
game.PlayersSupported = request.Players; game.PlayersSupported = request.Players;
} }
var hasAlbumArtists = item as IHasAlbumArtist; if (request.AlbumArtists != null)
if (hasAlbumArtists != null)
{ {
hasAlbumArtists.AlbumArtists = request var hasAlbumArtists = item as IHasAlbumArtist;
.AlbumArtists if (hasAlbumArtists != null)
.Select(i => i.Name) {
.ToList(); hasAlbumArtists.AlbumArtists = request
.AlbumArtists
.Select(i => i.Name)
.ToList();
}
} }
var hasArtists = item as IHasArtist; if (request.ArtistItems != null)
if (hasArtists != null)
{ {
hasArtists.Artists = request var hasArtists = item as IHasArtist;
.ArtistItems if (hasArtists != null)
.Select(i => i.Name) {
.ToList(); hasArtists.Artists = request
.ArtistItems
.Select(i => i.Name)
.ToList();
}
} }
var song = item as Audio; var song = item as Audio;

@ -233,6 +233,12 @@ namespace MediaBrowser.Server.Implementations.Devices
} }
var user = _userManager.GetUserById(userId); var user = _userManager.GetUserById(userId);
if (user == null)
{
throw new ArgumentException("user not found");
}
if (!CanAccessDevice(user.Policy, deviceId)) if (!CanAccessDevice(user.Policy, deviceId))
{ {
var capabilities = GetCapabilities(deviceId); var capabilities = GetCapabilities(deviceId);

@ -17,6 +17,7 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv; using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Querying; using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using System; using System;

@ -1,10 +1,12 @@
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv; using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Dto; using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Serialization;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -21,13 +23,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IMediaSourceManager _mediaSourceManager; private readonly IMediaSourceManager _mediaSourceManager;
private readonly IMediaEncoder _mediaEncoder; private readonly IMediaEncoder _mediaEncoder;
private readonly IServerApplicationHost _appHost;
public LiveTvMediaSourceProvider(ILiveTvManager liveTvManager, IJsonSerializer jsonSerializer, ILogManager logManager, IMediaSourceManager mediaSourceManager, IMediaEncoder mediaEncoder) public LiveTvMediaSourceProvider(ILiveTvManager liveTvManager, IJsonSerializer jsonSerializer, ILogManager logManager, IMediaSourceManager mediaSourceManager, IMediaEncoder mediaEncoder, IServerApplicationHost appHost)
{ {
_liveTvManager = liveTvManager; _liveTvManager = liveTvManager;
_jsonSerializer = jsonSerializer; _jsonSerializer = jsonSerializer;
_mediaSourceManager = mediaSourceManager; _mediaSourceManager = mediaSourceManager;
_mediaEncoder = mediaEncoder; _mediaEncoder = mediaEncoder;
_appHost = appHost;
_logger = logManager.GetLogger(GetType().Name); _logger = logManager.GetLogger(GetType().Name);
} }
@ -74,6 +78,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
} }
var list = sources.ToList(); var list = sources.ToList();
var serverUrl = _appHost.LocalApiUrl;
foreach (var source in list) foreach (var source in list)
{ {
@ -86,6 +91,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv
openKeys.Add(item.Id.ToString("N")); openKeys.Add(item.Id.ToString("N"));
openKeys.Add(source.Id ?? string.Empty); openKeys.Add(source.Id ?? string.Empty);
source.OpenToken = string.Join("|", openKeys.ToArray()); source.OpenToken = string.Join("|", openKeys.ToArray());
// Dummy this up so that direct play checks can still run
if (string.IsNullOrEmpty(source.Path) && source.Protocol == MediaProtocol.Http)
{
source.Path = serverUrl;
}
} }
_logger.Debug("MediaSources: {0}", _jsonSerializer.SerializeToString(list)); _logger.Debug("MediaSources: {0}", _jsonSerializer.SerializeToString(list));

@ -458,6 +458,13 @@ namespace MediaBrowser.Server.Implementations.Sync
var syncOptions = _config.GetSyncOptions(); var syncOptions = _config.GetSyncOptions();
var user = _userManager.GetUserById(job.UserId); var user = _userManager.GetUserById(job.UserId);
if (user == null)
{
jobItem.Status = SyncJobItemStatus.Failed;
_logger.Error("User not found. Cannot complete the sync job.");
await _syncManager.UpdateSyncJobItemInternal(jobItem).ConfigureAwait(false);
return;
}
var video = item as Video; var video = item as Video;
if (video != null) if (video != null)

Loading…
Cancel
Save