pull/1154/head
Luke Pulverenti 7 years ago
parent ca1ab81d3c
commit 38fe239f44

@ -426,6 +426,8 @@ namespace Emby.Server.Implementations.Channels
item.Name = channelInfo.Name;
}
item.OnMetadataChanged();
if (isNew)
{
_libraryManager.CreateItem(item, cancellationToken);
@ -1384,6 +1386,8 @@ namespace Emby.Server.Implementations.Channels
item.SetImagePath(ImageType.Primary, info.ImageUrl);
}
item.OnMetadataChanged();
if (isNew)
{
_libraryManager.CreateItem(item, cancellationToken);

@ -752,6 +752,11 @@ namespace Emby.Server.Implementations.LiveTv
}
}
if (isNew || isUpdated)
{
item.OnMetadataChanged();
}
return new Tuple<LiveTvProgram, bool, bool>(item, isNew, isUpdated);
}

@ -142,6 +142,8 @@ namespace Emby.Server.Implementations.LiveTv
var info = await _liveTvManager.GetChannelStream(keys[1], mediaSourceId, cancellationToken).ConfigureAwait(false);
stream = info.Item1;
directStreamProvider = info.Item2;
allowLiveStreamProbe = false;
}
else
{

@ -214,6 +214,8 @@ namespace MediaBrowser.Api
UpdateItem(request, item);
item.OnMetadataChanged();
await item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
if (isLockedChanged && item.IsFolder)

@ -89,7 +89,6 @@ namespace MediaBrowser.Api
private void SetWizardFinishValues(ServerConfiguration config)
{
config.EnableStandaloneMusicKeys = true;
config.EnableCaseSensitiveItemIds = true;
config.SkipDeserializationForBasicTypes = true;
config.EnableLocalizedGuids = true;

@ -154,46 +154,28 @@ namespace MediaBrowser.Controller.Entities.Audio
{
var list = base.GetUserDataKeys();
if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys)
{
var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000") : string.Empty;
if (ParentIndexNumber.HasValue)
{
songKey = ParentIndexNumber.Value.ToString("0000") + "-" + songKey;
}
songKey += Name;
var songKey = IndexNumber.HasValue ? IndexNumber.Value.ToString("0000") : string.Empty;
if (!string.IsNullOrWhiteSpace(Album))
{
songKey = Album + "-" + songKey;
}
var albumArtist = AlbumArtists.Length == 0 ? null : AlbumArtists[0];
if (!string.IsNullOrWhiteSpace(albumArtist))
{
songKey = albumArtist + "-" + songKey;
}
list.Insert(0, songKey);
}
else
if (ParentIndexNumber.HasValue)
{
var parent = AlbumEntity;
songKey = ParentIndexNumber.Value.ToString("0000") + "-" + songKey;
}
songKey += Name;
if (parent != null && IndexNumber.HasValue)
{
list.InsertRange(0, parent.GetUserDataKeys().Select(i =>
{
var songKey = (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ") : "")
+ IndexNumber.Value.ToString("0000 - ");
if (!string.IsNullOrWhiteSpace(Album))
{
songKey = Album + "-" + songKey;
}
return i + songKey;
}));
}
var albumArtist = AlbumArtists.Length == 0 ? null : AlbumArtists[0];
if (!string.IsNullOrWhiteSpace(albumArtist))
{
songKey = albumArtist + "-" + songKey;
}
list.Insert(0, songKey);
return list;
}

@ -145,13 +145,10 @@ namespace MediaBrowser.Controller.Entities.Audio
{
var list = base.GetUserDataKeys();
if (ConfigurationManager.Configuration.EnableStandaloneMusicKeys)
var albumArtist = AlbumArtist;
if (!string.IsNullOrWhiteSpace(albumArtist))
{
var albumArtist = AlbumArtist;
if (!string.IsNullOrWhiteSpace(albumArtist))
{
list.Insert(0, albumArtist + "-" + Name);
}
list.Insert(0, albumArtist + "-" + Name);
}
var id = this.GetProviderId(MetadataProviders.MusicBrainzAlbum);

@ -918,9 +918,10 @@ namespace MediaBrowser.Controller.Entities
{
get
{
if (!string.IsNullOrWhiteSpace(OfficialRating))
var officialRating = OfficialRating;
if (!string.IsNullOrWhiteSpace(officialRating))
{
return OfficialRating;
return officialRating;
}
var parent = DisplayParent;
@ -938,9 +939,10 @@ namespace MediaBrowser.Controller.Entities
{
get
{
if (!string.IsNullOrWhiteSpace(CustomRating))
var customRating = CustomRating;
if (!string.IsNullOrWhiteSpace(customRating))
{
return CustomRating;
return customRating;
}
var parent = DisplayParent;
@ -2480,5 +2482,21 @@ namespace MediaBrowser.Controller.Entities
{
return null;
}
public virtual ItemUpdateType OnMetadataChanged()
{
var updateType = ItemUpdateType.None;
var item = this;
var inheritedParentalRatingValue = item.GetInheritedParentalRatingValue() ?? 0;
if (inheritedParentalRatingValue != item.InheritedParentalRatingValue)
{
item.InheritedParentalRatingValue = inheritedParentalRatingValue;
updateType |= ItemUpdateType.MetadataImport;
}
return updateType;
}
}
}

@ -266,6 +266,8 @@ namespace MediaBrowser.Controller.Entities
int? ProductionYear { get; set; }
string[] Tags { get; set; }
ItemUpdateType OnMetadataChanged();
}
public static class HasMetadataExtensions

@ -179,7 +179,6 @@ namespace MediaBrowser.Model.Configuration
public int SchemaVersion { get; set; }
public bool EnableAnonymousUsageReporting { get; set; }
public bool EnableStandaloneMusicKeys { get; set; }
public bool EnableFolderView { get; set; }
public bool EnableGroupingIntoCollections { get; set; }
public bool DisplaySpecialsWithinSeasons { get; set; }

@ -14,9 +14,9 @@ namespace MediaBrowser.Providers.BoxSets
{
public class BoxSetMetadataService : MetadataService<BoxSet, BoxSetInfo>
{
protected override ItemUpdateType BeforeSave(BoxSet item, bool isFullRefresh, ItemUpdateType currentUpdateType)
protected override ItemUpdateType BeforeSaveInternal(BoxSet item, bool isFullRefresh, ItemUpdateType currentUpdateType)
{
var updateType = base.BeforeSave(item, isFullRefresh, currentUpdateType);
var updateType = base.BeforeSaveInternal(item, isFullRefresh, currentUpdateType);
if (isFullRefresh || currentUpdateType > ItemUpdateType.None)
{

@ -281,7 +281,16 @@ namespace MediaBrowser.Providers.Manager
/// <param name="isFullRefresh">if set to <c>true</c> [is full refresh].</param>
/// <param name="currentUpdateType">Type of the current update.</param>
/// <returns>ItemUpdateType.</returns>
protected virtual ItemUpdateType BeforeSave(TItemType item, bool isFullRefresh, ItemUpdateType currentUpdateType)
private ItemUpdateType BeforeSave(TItemType item, bool isFullRefresh, ItemUpdateType currentUpdateType)
{
var updateType = BeforeSaveInternal(item, isFullRefresh, currentUpdateType);
updateType |= item.OnMetadataChanged();
return updateType;
}
protected virtual ItemUpdateType BeforeSaveInternal(TItemType item, bool isFullRefresh, ItemUpdateType currentUpdateType)
{
var updateType = ItemUpdateType.None;
@ -295,13 +304,6 @@ namespace MediaBrowser.Providers.Manager
updateType |= ItemUpdateType.MetadataImport;
}
var inheritedParentalRatingValue = item.GetInheritedParentalRatingValue() ?? 0;
if (inheritedParentalRatingValue != item.InheritedParentalRatingValue)
{
item.InheritedParentalRatingValue = inheritedParentalRatingValue;
updateType |= ItemUpdateType.MetadataImport;
}
return updateType;
}

@ -16,9 +16,9 @@ namespace MediaBrowser.Providers.Music
{
public class AlbumMetadataService : MetadataService<MusicAlbum, AlbumInfo>
{
protected override ItemUpdateType BeforeSave(MusicAlbum item, bool isFullRefresh, ItemUpdateType currentUpdateType)
protected override ItemUpdateType BeforeSaveInternal(MusicAlbum item, bool isFullRefresh, ItemUpdateType currentUpdateType)
{
var updateType = base.BeforeSave(item, isFullRefresh, currentUpdateType);
var updateType = base.BeforeSaveInternal(item, isFullRefresh, currentUpdateType);
if (isFullRefresh || currentUpdateType > ItemUpdateType.None)
{

@ -15,9 +15,9 @@ namespace MediaBrowser.Providers.Music
{
public class ArtistMetadataService : MetadataService<MusicArtist, ArtistInfo>
{
protected override ItemUpdateType BeforeSave(MusicArtist item, bool isFullRefresh, ItemUpdateType currentUpdateType)
protected override ItemUpdateType BeforeSaveInternal(MusicArtist item, bool isFullRefresh, ItemUpdateType currentUpdateType)
{
var updateType = base.BeforeSave(item, isFullRefresh, currentUpdateType);
var updateType = base.BeforeSaveInternal(item, isFullRefresh, currentUpdateType);
if (isFullRefresh || currentUpdateType > ItemUpdateType.None)
{

@ -34,9 +34,9 @@ namespace MediaBrowser.Providers.Playlists
}
}
protected override ItemUpdateType BeforeSave(Playlist item, bool isFullRefresh, ItemUpdateType currentUpdateType)
protected override ItemUpdateType BeforeSaveInternal(Playlist item, bool isFullRefresh, ItemUpdateType currentUpdateType)
{
var updateType = base.BeforeSave(item, isFullRefresh, currentUpdateType);
var updateType = base.BeforeSaveInternal(item, isFullRefresh, currentUpdateType);
if (isFullRefresh || currentUpdateType > ItemUpdateType.None)
{

@ -16,9 +16,9 @@ namespace MediaBrowser.Providers.TV
{
public class EpisodeMetadataService : MetadataService<Episode, EpisodeInfo>
{
protected override ItemUpdateType BeforeSave(Episode item, bool isFullRefresh, ItemUpdateType currentUpdateType)
protected override ItemUpdateType BeforeSaveInternal(Episode item, bool isFullRefresh, ItemUpdateType currentUpdateType)
{
var updateType = base.BeforeSave(item, isFullRefresh, currentUpdateType);
var updateType = base.BeforeSaveInternal(item, isFullRefresh, currentUpdateType);
var seriesName = item.FindSeriesName();
if (!string.Equals(item.SeriesName, seriesName, StringComparison.Ordinal))

@ -17,9 +17,9 @@ namespace MediaBrowser.Providers.TV
{
public class SeasonMetadataService : MetadataService<Season, SeasonInfo>
{
protected override ItemUpdateType BeforeSave(Season item, bool isFullRefresh, ItemUpdateType currentUpdateType)
protected override ItemUpdateType BeforeSaveInternal(Season item, bool isFullRefresh, ItemUpdateType currentUpdateType)
{
var updateType = base.BeforeSave(item, isFullRefresh, currentUpdateType);
var updateType = base.BeforeSaveInternal(item, isFullRefresh, currentUpdateType);
if (item.IndexNumber.HasValue && item.IndexNumber.Value == 0)
{

@ -1,3 +1,3 @@
using System.Reflection;
[assembly: AssemblyVersion("3.2.30.18")]
[assembly: AssemblyVersion("3.2.30.19")]

Loading…
Cancel
Save