don't save metadata when video content type is unset

pull/702/head
Luke Pulverenti 10 years ago
parent 36295aa833
commit e27040f61b

@ -1577,6 +1577,11 @@ namespace MediaBrowser.Controller.Entities
foreach (var newImage in images)
{
if (newImage == null)
{
throw new ArgumentException("null image found in list");
}
var existing = existingImages
.FirstOrDefault(i => string.Equals(i.Path, newImage.FullName, StringComparison.OrdinalIgnoreCase));

@ -1,6 +1,7 @@
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Users;
using System;
using System.Collections.Generic;
using System.IO;
@ -8,7 +9,6 @@ using System.Linq;
using System.Runtime.Serialization;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.Users;
namespace MediaBrowser.Controller.Entities.Movies
{

@ -19,11 +19,13 @@ namespace MediaBrowser.LocalMetadata.Savers
{
private readonly IItemRepository _itemRepository;
private readonly IServerConfigurationManager _config;
private readonly ILibraryManager _libraryManager;
public MovieXmlSaver(IItemRepository itemRepository, IServerConfigurationManager config)
public MovieXmlSaver(IItemRepository itemRepository, IServerConfigurationManager config, ILibraryManager libraryManager)
{
_itemRepository = itemRepository;
_config = config;
_libraryManager = libraryManager;
}
public string Name
@ -52,6 +54,15 @@ namespace MediaBrowser.LocalMetadata.Savers
// Check parent for null to avoid running this against things like video backdrops
if (video != null && !(item is Episode) && !video.IsOwnedItem)
{
// If it's a plain video, skip if content type is unset (unless editing)
if (video.GetType() == typeof(Video))
{
if (updateType < ItemUpdateType.MetadataEdit && string.IsNullOrEmpty(_libraryManager.GetContentType(video)))
{
return false;
}
}
return updateType >= ItemUpdateType.MetadataDownload;
}

@ -32,6 +32,12 @@ namespace MediaBrowser.Model.Configuration
/// <value><c>true</c> if [enable internet providers]; otherwise, <c>false</c>.</value>
public bool EnableInternetProviders { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this instance is port authorized.
/// </summary>
/// <value><c>true</c> if this instance is port authorized; otherwise, <c>false</c>.</value>
public bool IsPortAuthorized { get; set; }
/// <summary>
/// Gets or sets the item by name path.
/// </summary>

@ -1,6 +1,4 @@
using System.Net;
using System.Text;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.IO;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Channels;
@ -10,7 +8,6 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Localization;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Model.Channels;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
@ -24,9 +21,10 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Server.Implementations.Library;
namespace MediaBrowser.Server.Implementations.Channels
{
@ -1293,16 +1291,16 @@ namespace MediaBrowser.Server.Implementations.Channels
}
}
private async Task RefreshIfNeeded(BaseItem program, CancellationToken cancellationToken)
private readonly Task _cachedTask = Task.FromResult(true);
private Task RefreshIfNeeded(BaseItem program, CancellationToken cancellationToken)
{
if (_refreshedItems.ContainsKey(program.Id))
if (!_refreshedItems.ContainsKey(program.Id))
{
return;
_refreshedItems.TryAdd(program.Id, true);
return program.RefreshMetadata(cancellationToken);
}
await program.RefreshMetadata(cancellationToken).ConfigureAwait(false);
_refreshedItems.TryAdd(program.Id, true);
return _cachedTask;
}
internal IChannel GetChannelProvider(Channel channel)

@ -309,16 +309,16 @@ namespace MediaBrowser.Server.Implementations.LiveTv
return Task.FromResult(true);
}
private async Task RefreshIfNeeded(LiveTvProgram program, CancellationToken cancellationToken)
private readonly Task _cachedTask = Task.FromResult(true);
private Task RefreshIfNeeded(LiveTvProgram program, CancellationToken cancellationToken)
{
if (_refreshedPrograms.ContainsKey(program.Id))
if (!_refreshedPrograms.ContainsKey(program.Id))
{
return;
_refreshedPrograms.TryAdd(program.Id, true);
return program.RefreshMetadata(cancellationToken);
}
_refreshedPrograms.TryAdd(program.Id, true);
await program.RefreshMetadata(cancellationToken).ConfigureAwait(false);
return _cachedTask;
}
public async Task<ILiveTvRecording> GetInternalRecording(string id, CancellationToken cancellationToken)

@ -294,7 +294,7 @@
"LabelNewProgram": "NEW",
"LabelPremiereProgram": "PREMIERE",
"LabelHDProgram": "HD",
"HeaderChangeFolderType": "Change Folder Type",
"HeaderChangeFolderType": "Change Content Type",
"HeaderChangeFolderTypeHelp": "To change the type, please remove and rebuild the folder with the new type.",
"HeaderAlert": "Alert",
"MessagePleaseRestart": "Please restart to finish updating.",
@ -627,7 +627,7 @@
"MessageInvitationSentToUser": "An email has been sent to {0}, inviting them to accept your sharing invitation.",
"MessageInvitationSentToNewUser": "An email has been sent to {0} inviting them to sign up with Media Browser.",
"HeaderConnectionFailure": "Connection Failure",
"MessageUnableToConnectToServer": "We're unable to connect to the selected server right now. Please try again later.",
"MessageUnableToConnectToServer": "We're unable to connect to the selected server right now. Please ensure it is running and try again.",
"ButtonSelectServer": "Select server",
"MessagePluginConfigurationRequiresLocalAccess": "To configure this plugin please sign in to your local server directly.",
"MessageLoggedOutParentalControl": "Access is currently restricted. Please try again later.",

@ -241,10 +241,12 @@
"VisitMediaBrowserWebsite": "Visit the Media Browser Web Site",
"VisitMediaBrowserWebsiteLong": "Visit the Media Browser Web site to catch the latest news and keep up with the developer blog.",
"OptionHideUser": "Hide this user from login screens",
"OptionHideUserFromLoginHelp": "Useful for private or hidden administrator accounts. The user will need to sign in manually by entering their username and password.",
"OptionDisableUser": "Disable this user",
"OptionDisableUserHelp": "If disabled the server will not allow any connections from this user. Existing connections will be abruptly terminated.",
"HeaderAdvancedControl": "Advanced Control",
"LabelName": "Name:",
"ButtonHelp": "Help",
"OptionAllowUserToManageServer": "Allow this user to manage the server",
"HeaderFeatureAccess": "Feature Access",
"OptionAllowMediaPlayback": "Allow media playback",

@ -750,7 +750,14 @@ namespace MediaBrowser.Server.Startup.Common
/// </summary>
protected override void FindParts()
{
if (IsFirstRun)
// TODO: Remove after next release
if (!IsFirstRun && !ServerConfigurationManager.Configuration.IsPortAuthorized)
{
ServerConfigurationManager.Configuration.IsPortAuthorized = true;
ConfigurationManager.SaveConfiguration();
}
if (!ServerConfigurationManager.Configuration.IsPortAuthorized)
{
RegisterServerWithAdministratorAccess();
}
@ -824,6 +831,9 @@ namespace MediaBrowser.Server.Startup.Common
if (!HttpServer.UrlPrefixes.SequenceEqual(HttpServerUrlPrefixes, StringComparer.OrdinalIgnoreCase))
{
ServerConfigurationManager.Configuration.IsPortAuthorized = false;
ServerConfigurationManager.SaveConfiguration();
NotifyPendingRestart();
}
}

@ -36,7 +36,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
return false;
}
return item is MusicAlbum && updateType >= ItemUpdateType.ImageUpdate;
return item is MusicAlbum && updateType >= MinimumUpdateType;
}
protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)

@ -36,7 +36,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
return false;
}
return item is MusicArtist && updateType >= ItemUpdateType.ImageUpdate;
return item is MusicArtist && updateType >= MinimumUpdateType;
}
protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)

@ -119,6 +119,19 @@ namespace MediaBrowser.XbmcMetadata.Savers
protected IUserDataManager UserDataManager { get; private set; }
protected ILogger Logger { get; private set; }
protected ItemUpdateType MinimumUpdateType
{
get
{
if (ConfigurationManager.GetNfoConfiguration().SaveImagePathsInNfo)
{
return ItemUpdateType.ImageUpdate;
}
return ItemUpdateType.MetadataDownload;
}
}
public string Name
{
get

@ -35,7 +35,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
return false;
}
return item is Episode && updateType >= ItemUpdateType.ImageUpdate;
return item is Episode && updateType >= MinimumUpdateType;
}
protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)

@ -55,7 +55,15 @@ namespace MediaBrowser.XbmcMetadata.Savers
// Check parent for null to avoid running this against things like video backdrops
if (video != null && !(item is Episode) && !video.IsOwnedItem)
{
return updateType >= ItemUpdateType.ImageUpdate;
// If it's a plain video, skip if content type is unset (unless editing)
if (video.GetType() == typeof (Video))
{
if (updateType < ItemUpdateType.MetadataEdit && string.IsNullOrEmpty(LibraryManager.GetContentType(video)))
{
return false;
}
}
return updateType >= MinimumUpdateType;
}
return false;
@ -95,8 +103,6 @@ namespace MediaBrowser.XbmcMetadata.Savers
}
}
private static readonly CultureInfo UsCulture = new CultureInfo("en-US");
protected override List<string> GetTagsUsed()
{
var list = new List<string>

@ -39,7 +39,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
return false;
}
return updateType >= ItemUpdateType.ImageUpdate || (updateType >= ItemUpdateType.MetadataImport && File.Exists(GetSavePath(item)));
return updateType >= MinimumUpdateType || (updateType >= ItemUpdateType.MetadataImport && File.Exists(GetSavePath(item)));
}
protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)

@ -35,7 +35,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
return false;
}
return item is Series && updateType >= ItemUpdateType.ImageUpdate;
return item is Series && updateType >= MinimumUpdateType;
}
protected override void WriteCustomElements(IHasMetadata item, XmlWriter writer)

Loading…
Cancel
Save