dlna fix for media monkey

This commit is contained in:
Luke Pulverenti 2015-04-24 16:06:37 -04:00
parent db66b73a4f
commit 4d57e9b63e
5 changed files with 32 additions and 15 deletions

View File

@ -1522,6 +1522,10 @@ namespace MediaBrowser.Api.Playback
{ {
request.LiveStreamId = val; request.LiveStreamId = val;
} }
else if (i == 24)
{
// Duplicating ItemId because of MediaMonkey
}
} }
} }

View File

@ -638,6 +638,17 @@ namespace MediaBrowser.Dlna.ContentDirectory
Guid itemId; Guid itemId;
StubType? stubType = null; StubType? stubType = null;
// After using PlayTo, MediaMonkey sends a request to the server trying to get item info
const string paramsSrch = "Params=";
var paramsIndex = id.IndexOf(paramsSrch, StringComparison.OrdinalIgnoreCase);
if (paramsIndex != -1)
{
id = id.Substring(paramsIndex + paramsSrch.Length);
var parts = id.Split(';');
id = parts[24];
}
if (id.StartsWith("folder_", StringComparison.OrdinalIgnoreCase)) if (id.StartsWith("folder_", StringComparison.OrdinalIgnoreCase))
{ {
stubType = StubType.Folder; stubType = StubType.Folder;

View File

@ -233,6 +233,11 @@ namespace MediaBrowser.Model.Dlna
string liveStreamId = item.MediaSource == null ? null : item.MediaSource.LiveStreamId; string liveStreamId = item.MediaSource == null ? null : item.MediaSource.LiveStreamId;
list.Add(new NameValuePair("LiveStreamId", liveStreamId ?? string.Empty)); list.Add(new NameValuePair("LiveStreamId", liveStreamId ?? string.Empty));
if (isDlna)
{
list.Add(new NameValuePair("ItemId", item.ItemId));
}
return list; return list;
} }

View File

@ -360,7 +360,7 @@ namespace MediaBrowser.Providers.Manager
// If replacing all metadata, run internet providers first // If replacing all metadata, run internet providers first
if (options.ReplaceAllMetadata) if (options.ReplaceAllMetadata)
{ {
var remoteResult = await ExecuteRemoteProviders(item, temp, logName, id, providers.OfType<IRemoteMetadataProvider<TItemType, TIdType>>(), cancellationToken) var remoteResult = await ExecuteRemoteProviders(temp, logName, id, providers.OfType<IRemoteMetadataProvider<TItemType, TIdType>>(), cancellationToken)
.ConfigureAwait(false); .ConfigureAwait(false);
refreshResult.UpdateType = refreshResult.UpdateType | remoteResult.UpdateType; refreshResult.UpdateType = refreshResult.UpdateType | remoteResult.UpdateType;
@ -372,9 +372,8 @@ namespace MediaBrowser.Providers.Manager
var hasLocalMetadata = false; var hasLocalMetadata = false;
var userDataList = new List<UserItemData>(); var userDataList = new List<UserItemData>();
var localProviders = providers.OfType<ILocalMetadataProvider<TItemType>>().ToList();
foreach (var provider in localProviders) foreach (var provider in providers.OfType<ILocalMetadataProvider<TItemType>>().ToList())
{ {
var providerName = provider.GetType().Name; var providerName = provider.GetType().Name;
Logger.Debug("Running {0} for {1}", providerName, logName); Logger.Debug("Running {0} for {1}", providerName, logName);
@ -433,7 +432,7 @@ namespace MediaBrowser.Providers.Manager
// Local metadata is king - if any is found don't run remote providers // Local metadata is king - if any is found don't run remote providers
if (!options.ReplaceAllMetadata && (!hasLocalMetadata || options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh)) if (!options.ReplaceAllMetadata && (!hasLocalMetadata || options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh))
{ {
var remoteResult = await ExecuteRemoteProviders(item, temp, logName, id, providers.OfType<IRemoteMetadataProvider<TItemType, TIdType>>(), cancellationToken) var remoteResult = await ExecuteRemoteProviders(temp, logName, id, providers.OfType<IRemoteMetadataProvider<TItemType, TIdType>>(), cancellationToken)
.ConfigureAwait(false); .ConfigureAwait(false);
refreshResult.UpdateType = refreshResult.UpdateType | remoteResult.UpdateType; refreshResult.UpdateType = refreshResult.UpdateType | remoteResult.UpdateType;
@ -447,17 +446,15 @@ namespace MediaBrowser.Providers.Manager
if (providers.Any(i => !(i is ICustomMetadataProvider))) if (providers.Any(i => !(i is ICustomMetadataProvider)))
{ {
// If no local providers and doing a full refresh, take data from item itself
if (options.MetadataRefreshMode == MetadataRefreshMode.FullRefresh &&
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
MergeData(item, temp, new List<MetadataFields>(), false, true);
}
if (refreshResult.UpdateType > ItemUpdateType.None) if (refreshResult.UpdateType > ItemUpdateType.None)
{ {
// If no local metadata, take data from item itself
if (!hasLocalMetadata)
{
// 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);
}
MergeData(temp, item, item.LockedFields, true, true); MergeData(temp, item, item.LockedFields, true, true);
} }
} }
@ -529,7 +526,7 @@ namespace MediaBrowser.Providers.Manager
return new TItemType(); return new TItemType();
} }
private async Task<RefreshResult> ExecuteRemoteProviders(TItemType item, TItemType temp, string logName, TIdType id, IEnumerable<IRemoteMetadataProvider<TItemType, TIdType>> providers, CancellationToken cancellationToken) private async Task<RefreshResult> ExecuteRemoteProviders(TItemType temp, string logName, TIdType id, IEnumerable<IRemoteMetadataProvider<TItemType, TIdType>> providers, CancellationToken cancellationToken)
{ {
var refreshResult = new RefreshResult(); var refreshResult = new RefreshResult();

View File

@ -1432,7 +1432,7 @@
"MyPreferencesWelcomeMessage2": "Would you like to set your preferences now?", "MyPreferencesWelcomeMessage2": "Would you like to set your preferences now?",
"ToAccessPreferencesHelp": "To access your preferences later, click your user icon in the top right header and select My Preferences.", "ToAccessPreferencesHelp": "To access your preferences later, click your user icon in the top right header and select My Preferences.",
"HeaderViewStyles": "View Styles", "HeaderViewStyles": "View Styles",
"LabelSelectViewStyles": "Enable rich presentations for:", "LabelSelectViewStyles": "Enable enhanced presentations for:",
"LabelSelectViewStylesHelp": "If enabled, views will be built with metadata to offer categories such as Suggestions, Latest, Genres, and more. If disabled, they'll be displayed with simple folders.", "LabelSelectViewStylesHelp": "If enabled, views will be built with metadata to offer categories such as Suggestions, Latest, Genres, and more. If disabled, they'll be displayed with simple folders.",
"TabPhotos": "Photos", "TabPhotos": "Photos",
"TabVideos": "Videos" "TabVideos": "Videos"