Merge pull request #2880 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2017-09-13 14:42:21 -04:00 committed by GitHub
commit 77b7d1486a
18 changed files with 80 additions and 68 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -918,9 +918,10 @@ namespace MediaBrowser.Controller.Entities
{ {
get get
{ {
if (!string.IsNullOrWhiteSpace(OfficialRating)) var officialRating = OfficialRating;
if (!string.IsNullOrWhiteSpace(officialRating))
{ {
return OfficialRating; return officialRating;
} }
var parent = DisplayParent; var parent = DisplayParent;
@ -938,9 +939,10 @@ namespace MediaBrowser.Controller.Entities
{ {
get get
{ {
if (!string.IsNullOrWhiteSpace(CustomRating)) var customRating = CustomRating;
if (!string.IsNullOrWhiteSpace(customRating))
{ {
return CustomRating; return customRating;
} }
var parent = DisplayParent; var parent = DisplayParent;
@ -2480,5 +2482,21 @@ namespace MediaBrowser.Controller.Entities
{ {
return null; 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;
}
} }
} }

View File

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

View File

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

View File

@ -14,9 +14,9 @@ namespace MediaBrowser.Providers.BoxSets
{ {
public class BoxSetMetadataService : MetadataService<BoxSet, BoxSetInfo> 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) if (isFullRefresh || currentUpdateType > ItemUpdateType.None)
{ {

View File

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

View File

@ -16,9 +16,9 @@ namespace MediaBrowser.Providers.Music
{ {
public class AlbumMetadataService : MetadataService<MusicAlbum, AlbumInfo> 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) if (isFullRefresh || currentUpdateType > ItemUpdateType.None)
{ {

View File

@ -15,9 +15,9 @@ namespace MediaBrowser.Providers.Music
{ {
public class ArtistMetadataService : MetadataService<MusicArtist, ArtistInfo> 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) if (isFullRefresh || currentUpdateType > ItemUpdateType.None)
{ {

View File

@ -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) if (isFullRefresh || currentUpdateType > ItemUpdateType.None)
{ {

View File

@ -16,9 +16,9 @@ namespace MediaBrowser.Providers.TV
{ {
public class EpisodeMetadataService : MetadataService<Episode, EpisodeInfo> 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(); var seriesName = item.FindSeriesName();
if (!string.Equals(item.SeriesName, seriesName, StringComparison.Ordinal)) if (!string.Equals(item.SeriesName, seriesName, StringComparison.Ordinal))

View File

@ -17,9 +17,9 @@ namespace MediaBrowser.Providers.TV
{ {
public class SeasonMetadataService : MetadataService<Season, SeasonInfo> 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) if (item.IndexNumber.HasValue && item.IndexNumber.Value == 0)
{ {

View File

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