sync updates

pull/702/head
Luke Pulverenti 10 years ago
parent ee00f8bf72
commit 6755937800

@ -32,7 +32,7 @@ namespace MediaBrowser.Controller.Channels
return config.BlockUnratedItems.Contains(UnratedItem.ChannelContent);
}
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
return ExternalId;
}

@ -40,7 +40,7 @@ namespace MediaBrowser.Controller.Channels
return false;
}
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
return ExternalId;
}

@ -28,8 +28,8 @@ namespace MediaBrowser.Controller.Channels
public string OriginalImageUrl { get; set; }
public List<ChannelMediaInfo> ChannelMediaSources { get; set; }
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
if (ContentType == ChannelMediaContentType.MovieExtra)
{

@ -169,7 +169,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
var parent = FindParent<MusicAlbum>();
@ -186,7 +186,7 @@ namespace MediaBrowser.Controller.Entities.Audio
}
}
return base.GetUserDataKey();
return base.CreateUserDataKey();
}
protected override bool GetBlockUnratedValue(UserPolicy config)

@ -136,7 +136,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
var id = this.GetProviderId(MetadataProviders.MusicBrainzReleaseGroup);
@ -152,7 +152,7 @@ namespace MediaBrowser.Controller.Entities.Audio
return "MusicAlbum-Musicbrainz-" + id;
}
return base.GetUserDataKey();
return base.CreateUserDataKey();
}
protected override bool GetBlockUnratedValue(UserPolicy config)

@ -68,7 +68,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
return GetUserDataKey(this);
}

@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Entities.Audio
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
return "MusicGenre-" + Name;
}

@ -359,7 +359,7 @@ namespace MediaBrowser.Controller.Entities
{
get
{
if (!string.IsNullOrEmpty(ForcedSortName))
if (!string.IsNullOrWhiteSpace(ForcedSortName))
{
return ForcedSortName;
}
@ -887,11 +887,22 @@ namespace MediaBrowser.Controller.Entities
get { return null; }
}
private string _userDataKey;
/// <summary>
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public virtual string GetUserDataKey()
public string GetUserDataKey()
{
if (!string.IsNullOrWhiteSpace(_userDataKey))
{
return _userDataKey;
}
return _userDataKey ?? (_userDataKey = CreateUserDataKey());
}
protected virtual string CreateUserDataKey()
{
return Id.ToString();
}
@ -1701,6 +1712,9 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
public virtual bool BeforeMetadataRefresh()
{
_userDataKey = null;
_sortName = null;
var hasChanges = false;
if (string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(Path))

@ -807,7 +807,7 @@ namespace MediaBrowser.Controller.Entities
protected QueryResult<BaseItem> SortAndFilter(IEnumerable<BaseItem> items, InternalItemsQuery query)
{
return UserViewBuilder.SortAndFilter(items, this, null, query, LibraryManager, UserDataManager);
return UserViewBuilder.FilterAndSort(items, this, null, query, LibraryManager, UserDataManager);
}
/// <summary>

@ -88,7 +88,7 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
public List<string> MultiPartGameFiles { get; set; }
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
var id = this.GetProviderId(MetadataProviders.Gamesdb);
@ -96,7 +96,7 @@ namespace MediaBrowser.Controller.Entities
{
return "Game-Gamesdb-" + id;
}
return base.GetUserDataKey();
return base.CreateUserDataKey();
}
public override IEnumerable<string> GetDeletePaths()

@ -10,7 +10,7 @@ namespace MediaBrowser.Controller.Entities
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
return "GameGenre-" + Name;
}

@ -35,13 +35,13 @@ namespace MediaBrowser.Controller.Entities
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
if (!string.IsNullOrEmpty(GameSystemName))
{
return "GameSystem-" + GameSystemName;
}
return base.GetUserDataKey();
return base.CreateUserDataKey();
}
protected override bool GetBlockUnratedValue(UserPolicy config)

@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Entities
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
return "Genre-" + Name;
}

@ -100,9 +100,9 @@ namespace MediaBrowser.Controller.Entities.Movies
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
return this.GetProviderId(MetadataProviders.Tmdb) ?? this.GetProviderId(MetadataProviders.Imdb) ?? base.GetUserDataKey();
return this.GetProviderId(MetadataProviders.Tmdb) ?? this.GetProviderId(MetadataProviders.Imdb) ?? base.CreateUserDataKey();
}
protected override async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, List<FileSystemInfo> fileSystemChildren, CancellationToken cancellationToken)

@ -47,21 +47,6 @@ namespace MediaBrowser.Controller.Entities
}
}
/// <summary>
/// TODO: Remove
/// </summary>
public string Artist
{
get { return Artists.FirstOrDefault(); }
set
{
if (!string.IsNullOrEmpty(value) && !Artists.Contains(value, StringComparer.OrdinalIgnoreCase))
{
Artists.Add(value);
}
}
}
/// <summary>
/// Determines whether the specified name has artist.
/// </summary>
@ -76,9 +61,9 @@ namespace MediaBrowser.Controller.Entities
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
return this.GetProviderId(MetadataProviders.Tmdb) ?? this.GetProviderId(MetadataProviders.Imdb) ?? base.GetUserDataKey();
return this.GetProviderId(MetadataProviders.Tmdb) ?? this.GetProviderId(MetadataProviders.Imdb) ?? base.CreateUserDataKey();
}
protected override bool GetBlockUnratedValue(UserPolicy config)

@ -20,7 +20,7 @@ namespace MediaBrowser.Controller.Entities
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
return "Person-" + Name;
}

@ -20,7 +20,7 @@ namespace MediaBrowser.Controller.Entities
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
return "Studio-" + Name;
}

@ -117,7 +117,7 @@ namespace MediaBrowser.Controller.Entities.TV
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
var series = Series;
@ -126,7 +126,7 @@ namespace MediaBrowser.Controller.Entities.TV
return series.GetUserDataKey() + ParentIndexNumber.Value.ToString("000") + IndexNumber.Value.ToString("000");
}
return base.GetUserDataKey();
return base.CreateUserDataKey();
}
/// <summary>

@ -92,7 +92,7 @@ namespace MediaBrowser.Controller.Entities.TV
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
if (Series != null)
{
@ -100,7 +100,7 @@ namespace MediaBrowser.Controller.Entities.TV
return Series.GetUserDataKey() + seasonNo.ToString("000");
}
return base.GetUserDataKey();
return base.CreateUserDataKey();
}
/// <summary>

@ -117,9 +117,9 @@ namespace MediaBrowser.Controller.Entities.TV
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
return this.GetProviderId(MetadataProviders.Tvdb) ?? this.GetProviderId(MetadataProviders.Tvcom) ?? base.GetUserDataKey();
return this.GetProviderId(MetadataProviders.Tvdb) ?? this.GetProviderId(MetadataProviders.Tvcom) ?? base.CreateUserDataKey();
}
/// <summary>

@ -79,7 +79,7 @@ namespace MediaBrowser.Controller.Entities
}
}
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
var key = this.GetProviderId(MetadataProviders.Imdb) ?? this.GetProviderId(MetadataProviders.Tmdb);
@ -96,7 +96,7 @@ namespace MediaBrowser.Controller.Entities
return key;
}
return base.GetUserDataKey();
return base.CreateUserDataKey();
}
protected override bool GetBlockUnratedValue(UserPolicy config)

@ -18,6 +18,7 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MoreLinq;
namespace MediaBrowser.Controller.Entities
{
@ -412,7 +413,19 @@ namespace MediaBrowser.Controller.Entities
{
if (query.Recursive)
{
return GetResult(GetRecursiveChildren(parent, user, new[] { CollectionType.Movies, CollectionType.BoxSets, string.Empty }).Where(i => i is Movie || i is BoxSet), parent, query);
var recursiveItems = GetRecursiveChildren(parent, user,
new[] {CollectionType.Movies, CollectionType.BoxSets, string.Empty})
.Where(i => i is Movie || i is BoxSet);
//var collections = _collectionManager.CollapseItemsWithinBoxSets(recursiveItems, user).ToList();
//if (collections.Count > 0)
//{
// recursiveItems.AddRange(_collectionManager.CollapseItemsWithinBoxSets(recursiveItems, user));
// recursiveItems = recursiveItems.DistinctBy(i => i.Id).ToList();
//}
return GetResult(recursiveItems, parent, query);
}
var list = new List<BaseItem>();
@ -744,10 +757,10 @@ namespace MediaBrowser.Controller.Entities
InternalItemsQuery query)
where T : BaseItem
{
return SortAndFilter(items, queryParent, totalRecordLimit, query, _libraryManager, _userDataManager);
return FilterAndSort(items, queryParent, totalRecordLimit, query, _libraryManager, _userDataManager);
}
public static QueryResult<BaseItem> SortAndFilter(IEnumerable<BaseItem> items,
public static QueryResult<BaseItem> FilterAndSort(IEnumerable<BaseItem> items,
BaseItem queryParent,
int? totalRecordLimit,
InternalItemsQuery query,

@ -13,7 +13,7 @@ namespace MediaBrowser.Controller.Entities
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
return "Year-" + Name;
}

@ -12,7 +12,7 @@ namespace MediaBrowser.Controller.LiveTv
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
var name = GetClientTypeName();

@ -16,7 +16,7 @@ namespace MediaBrowser.Controller.LiveTv
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
return GetClientTypeName() + "-" + Name;
}

@ -16,7 +16,7 @@ namespace MediaBrowser.Controller.LiveTv
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
return GetClientTypeName() + "-" + Name;
}

@ -12,7 +12,7 @@ namespace MediaBrowser.Controller.LiveTv
/// Gets the user data key.
/// </summary>
/// <returns>System.String.</returns>
public override string GetUserDataKey()
protected override string CreateUserDataKey()
{
var name = GetClientTypeName();

@ -437,8 +437,7 @@ namespace MediaBrowser.Providers.Manager
localProviders.Count == 0 &&
refreshResult.UpdateType > ItemUpdateType.None)
{
// TODO: If the new metadata from above has some blank data, this
// can cause old data to get filled into those empty fields
// TODO: If the new metadata from above has some blank data, this can cause old data to get filled into those empty fields
MergeData(item, temp, new List<MetadataFields>(), false, true);
}

@ -1,4 +1,5 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Movies;
using System.Linq;
namespace MediaBrowser.Server.Implementations.Collections
@ -14,7 +15,8 @@ namespace MediaBrowser.Server.Implementations.Collections
public override bool IsVisible(User user)
{
return base.IsVisible(user) && GetChildren(user, false)
.Any();
.OfType<BoxSet>()
.Any(i => i.IsVisible(user));
}
public override bool IsHidden

@ -54,9 +54,6 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
private static string GetComparableName(string name)
{
// TODO: Improve this - should ignore spaces, periods, underscores, most likely all symbols and
// possibly remove sorting words like "the", "and", etc.
name = RemoveDiacritics(name);
name = " " + name + " ";

@ -88,24 +88,10 @@ namespace MediaBrowser.Server.Implementations.Library
list.Add(await GetUserView(CollectionType.Games, string.Empty, cancellationToken).ConfigureAwait(false));
}
if (user.Configuration.DisplayCollectionsView)
if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase)))
{
bool showCollectionView;
if (_config.Configuration.EnableLegacyCollections)
{
showCollectionView = folders
.Except(standaloneFolders)
.SelectMany(i => i.GetRecursiveChildren(user, false)).OfType<BoxSet>().Any();
}
else
{
showCollectionView = _collectionManager.GetCollections(user).Any();
}
if (showCollectionView)
{
list.Add(await GetUserView(CollectionType.BoxSets, string.Empty, cancellationToken).ConfigureAwait(false));
}
//list.Add(_collectionManager.GetCollectionsFolder(user.Id.ToString("N")));
list.Add(await GetUserView(CollectionType.BoxSets, string.Empty, cancellationToken).ConfigureAwait(false));
}
if (foldersWithViewTypes.Any(i => string.Equals(i.CollectionType, CollectionType.Playlists, StringComparison.OrdinalIgnoreCase)))

@ -55,6 +55,8 @@
"HeaderAudio": "Audio",
"HeaderVideo": "Video",
"HeaderPaths": "Paths",
"HeaderSyncRequiresSupporterMembership": "Sync Requires a Supporter Membership",
"HeaderEnjoyDayTrial": "Enjoy a 14 Day Free Trial",
"LabelSyncTempPath": "Temporary file path:",
"LabelSyncTempPathHelp": "Specify a custom sync working folder. Converted media created during the sync process will be stored here.",
"LabelCustomCertificatePath": "Custom certificate path:",

@ -306,6 +306,7 @@
<Compile Include="Sorting\VideoBitRateComparer.cs" />
<Compile Include="Sync\AppSyncProvider.cs" />
<Compile Include="Sync\CloudSyncProvider.cs" />
<Compile Include="Sync\SyncRegistrationInfo.cs" />
<Compile Include="Sync\SyncConfig.cs" />
<Compile Include="Sync\SyncJobProcessor.cs" />
<Compile Include="Sync\SyncManager.cs" />

@ -90,7 +90,7 @@ namespace MediaBrowser.Server.Implementations.Sync
continue;
}
var index = jobItems.Count == 0 ?
var index = jobItems.Count == 0 ?
0 :
(jobItems.Select(i => i.JobItemIndex).Max() + 1);
@ -348,10 +348,20 @@ namespace MediaBrowser.Server.Implementations.Sync
private void CleanDeadSyncFiles()
{
// TODO
// Clean files in sync temp folder that are not linked to any sync jobs
}
public async Task SyncJobItems(SyncJobItem[] items, bool enableConversion, IProgress<double> progress, CancellationToken cancellationToken)
{
if (items.Length > 0)
{
if (!SyncRegistrationInfo.Instance.IsRegistered)
{
_logger.Debug("Cancelling sync job processing. Please obtain a supporter membership.");
return;
}
}
var numComplete = 0;
foreach (var item in items)

@ -0,0 +1,31 @@
using MediaBrowser.Common.Security;
using System.Threading.Tasks;
namespace MediaBrowser.Server.Implementations.Sync
{
public class SyncRegistrationInfo : IRequiresRegistration
{
private readonly ISecurityManager _securityManager;
public static SyncRegistrationInfo Instance;
public SyncRegistrationInfo(ISecurityManager securityManager)
{
_securityManager = securityManager;
Instance = this;
}
private bool _registered;
public bool IsRegistered
{
get { return _registered; }
}
public async Task LoadRegistrationInfoAsync()
{
var info = await _securityManager.GetRegistrationStatus("sync").ConfigureAwait(false);
_registered = info.IsValid;
}
}
}

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common.Internal</id>
<version>3.0.545</version>
<version>3.0.546</version>
<title>MediaBrowser.Common.Internal</title>
<authors>Luke</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains common components shared by Media Browser Theater and Media Browser Server. Not intended for plugin developer consumption.</description>
<copyright>Copyright © Media Browser 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.545" />
<dependency id="MediaBrowser.Common" version="3.0.546" />
<dependency id="NLog" version="3.1.0.0" />
<dependency id="SimpleInjector" version="2.6.1" />
</dependencies>

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Common</id>
<version>3.0.545</version>
<version>3.0.546</version>
<title>MediaBrowser.Common</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>MediaBrowser.Model.Signed</id>
<version>3.0.545</version>
<version>3.0.546</version>
<title>MediaBrowser.Model - Signed Edition</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>

@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>MediaBrowser.Server.Core</id>
<version>3.0.545</version>
<version>3.0.546</version>
<title>Media Browser.Server.Core</title>
<authors>Media Browser Team</authors>
<owners>ebr,Luke,scottisafool</owners>
@ -12,7 +12,7 @@
<description>Contains core components required to build plugins for Media Browser Server.</description>
<copyright>Copyright © Media Browser 2013</copyright>
<dependencies>
<dependency id="MediaBrowser.Common" version="3.0.545" />
<dependency id="MediaBrowser.Common" version="3.0.546" />
</dependencies>
</metadata>
<files>

Loading…
Cancel
Save