added stub page to edit metatada for an item
This commit is contained in:
parent
7c2aa12db8
commit
9434d05a5f
|
@ -729,7 +729,7 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
foreach (var tuple in list)
|
foreach (var tuple in list)
|
||||||
{
|
{
|
||||||
if (tasks.Count > 5)
|
if (tasks.Count > 8)
|
||||||
{
|
{
|
||||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.Providers.Movies
|
namespace MediaBrowser.Controller.Providers.Movies
|
||||||
{
|
{
|
||||||
|
@ -70,7 +71,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "1";
|
return "2";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,8 +140,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
||||||
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
|
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
|
||||||
{
|
{
|
||||||
return true;
|
|
||||||
|
|
||||||
// Refresh if imdb id has changed
|
// Refresh if imdb id has changed
|
||||||
if (providerInfo.Data != GetComparisonData(item.GetProviderId(MetadataProviders.Imdb)))
|
if (providerInfo.Data != GetComparisonData(item.GetProviderId(MetadataProviders.Imdb)))
|
||||||
{
|
{
|
||||||
|
@ -174,10 +173,10 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
{
|
{
|
||||||
// No IMDB Id, search RT for an ID
|
// No IMDB Id, search RT for an ID
|
||||||
|
|
||||||
int page = 1;
|
var page = 1;
|
||||||
using (Stream stream = HttpClient.Get(MovieSearchUrl(item.Name, page), _rottenTomatoesResourcePool, cancellationToken).Result)
|
using (var stream = HttpClient.Get(MovieSearchUrl(item.Name, page), _rottenTomatoesResourcePool, cancellationToken).Result)
|
||||||
{
|
{
|
||||||
RTSearchResults result = JsonSerializer.DeserializeFromStream<RTSearchResults>(stream);
|
var result = JsonSerializer.DeserializeFromStream<RTSearchResults>(stream);
|
||||||
|
|
||||||
if (result.total == 1)
|
if (result.total == 1)
|
||||||
{
|
{
|
||||||
|
@ -203,9 +202,9 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
|
|
||||||
if (hit == null)
|
if (hit == null)
|
||||||
{
|
{
|
||||||
using (Stream newPageStream = HttpClient.Get(MovieSearchUrl(item.Name, page++), _rottenTomatoesResourcePool, cancellationToken).Result)
|
using (var newPageStream = HttpClient.Get(MovieSearchUrl(item.Name, page++), _rottenTomatoesResourcePool, cancellationToken).Result)
|
||||||
{
|
{
|
||||||
result = JsonSerializer.DeserializeFromStream<RTSearchResults>(stream);
|
result = JsonSerializer.DeserializeFromStream<RTSearchResults>(newPageStream);
|
||||||
|
|
||||||
if (result.total == 0)
|
if (result.total == 0)
|
||||||
{
|
{
|
||||||
|
@ -223,9 +222,9 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Have IMDB Id
|
// Have IMDB Id
|
||||||
using (Stream stream = HttpClient.Get(MovieImdbUrl(imdbId), _rottenTomatoesResourcePool, cancellationToken).Result)
|
using (var stream = HttpClient.Get(MovieImdbUrl(imdbId), _rottenTomatoesResourcePool, cancellationToken).Result)
|
||||||
{
|
{
|
||||||
RTMovieSearchResult result = JsonSerializer.DeserializeFromStream<RTMovieSearchResult>(stream);
|
var result = JsonSerializer.DeserializeFromStream<RTMovieSearchResult>(stream);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(result.id))
|
if (!string.IsNullOrEmpty(result.id))
|
||||||
{
|
{
|
||||||
|
@ -241,23 +240,20 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
item.CriticRatingSummary = hit.critics_concensus;
|
item.CriticRatingSummary = hit.critics_concensus;
|
||||||
item.CriticRating = float.Parse(hit.ratings.critics_score);
|
item.CriticRating = float.Parse(hit.ratings.critics_score);
|
||||||
|
|
||||||
using (Stream stream = HttpClient.Get(MovieReviewsUrl(hit.id), _rottenTomatoesResourcePool, cancellationToken).Result)
|
using (var stream = HttpClient.Get(MovieReviewsUrl(hit.id), _rottenTomatoesResourcePool, cancellationToken).Result)
|
||||||
{
|
{
|
||||||
|
|
||||||
RTReviewList result = JsonSerializer.DeserializeFromStream<RTReviewList>(stream);
|
var result = JsonSerializer.DeserializeFromStream<RTReviewList>(stream);
|
||||||
|
|
||||||
item.CriticReviews.Clear();
|
item.CriticReviews = result.reviews.Select(rtReview => new ItemReview
|
||||||
foreach (var rtReview in result.reviews)
|
|
||||||
{
|
{
|
||||||
ItemReview review = new ItemReview();
|
ReviewerName = rtReview.critic,
|
||||||
|
Publisher = rtReview.publication,
|
||||||
|
Date = DateTime.Parse(rtReview.date).ToUniversalTime(),
|
||||||
|
Caption = rtReview.quote,
|
||||||
|
Url = rtReview.links.review
|
||||||
|
|
||||||
review.ReviewerName = rtReview.critic;
|
}).ToList();
|
||||||
review.Publisher = rtReview.publication;
|
|
||||||
review.Date = DateTime.Parse(rtReview.date).ToUniversalTime();
|
|
||||||
review.Caption = rtReview.quote;
|
|
||||||
review.Url = rtReview.links.review;
|
|
||||||
item.CriticReviews.Add(review);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data == null)
|
if (data == null)
|
||||||
{
|
{
|
||||||
|
@ -286,7 +282,6 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
|
|
||||||
SetLastRefreshed(item, DateTime.UtcNow);
|
SetLastRefreshed(item, DateTime.UtcNow);
|
||||||
|
|
||||||
|
|
||||||
return Task.FromResult(true);
|
return Task.FromResult(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ namespace MediaBrowser.Controller.Providers.Music
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "11";
|
return "12";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,6 +211,8 @@ namespace MediaBrowser.Controller.Providers.Music
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private DateTime _lastMusicBrainzRequest = DateTime.MinValue;
|
private DateTime _lastMusicBrainzRequest = DateTime.MinValue;
|
||||||
|
|
||||||
|
private readonly SemaphoreSlim _musicBrainzSemaphore = new SemaphoreSlim(1, 1);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the music brainz response.
|
/// Gets the music brainz response.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -223,7 +225,7 @@ namespace MediaBrowser.Controller.Providers.Music
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var diff = 1000 - (DateTime.Now - _lastMusicBrainzRequest).TotalMilliseconds;
|
var diff = 1500 - (DateTime.Now - _lastMusicBrainzRequest).TotalMilliseconds;
|
||||||
|
|
||||||
// MusicBrainz is extremely adamant about limiting to one request per second
|
// MusicBrainz is extremely adamant about limiting to one request per second
|
||||||
|
|
||||||
|
@ -236,7 +238,14 @@ namespace MediaBrowser.Controller.Providers.Music
|
||||||
|
|
||||||
var doc = new XmlDocument();
|
var doc = new XmlDocument();
|
||||||
|
|
||||||
using (var xml = await HttpClient.Get(url, cancellationToken).ConfigureAwait(false))
|
using (var xml = await HttpClient.Get(new HttpRequestOptions
|
||||||
|
{
|
||||||
|
Url = url,
|
||||||
|
CancellationToken = cancellationToken,
|
||||||
|
ResourcePool = _musicBrainzSemaphore,
|
||||||
|
UserAgent = "MediaBrowserServer/www.mediabrowser3.com"
|
||||||
|
|
||||||
|
}).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
using (var oReader = new StreamReader(xml, Encoding.UTF8))
|
using (var oReader = new StreamReader(xml, Encoding.UTF8))
|
||||||
{
|
{
|
||||||
|
@ -248,6 +257,8 @@ namespace MediaBrowser.Controller.Providers.Music
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
_lastMusicBrainzRequest = DateTime.Now;
|
||||||
|
|
||||||
_musicBrainzResourcePool.Release();
|
_musicBrainzResourcePool.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -455,6 +455,7 @@ namespace MediaBrowser.WebDashboard.Api
|
||||||
"boxsets.js",
|
"boxsets.js",
|
||||||
"clientsettings.js",
|
"clientsettings.js",
|
||||||
"dashboardpage.js",
|
"dashboardpage.js",
|
||||||
|
"edititemmetadata.js",
|
||||||
"edititemimages.js",
|
"edititemimages.js",
|
||||||
"edituserpage.js",
|
"edituserpage.js",
|
||||||
"gamesrecommendedpage.js",
|
"gamesrecommendedpage.js",
|
||||||
|
|
|
@ -213,6 +213,9 @@
|
||||||
<Content Include="dashboard-ui\edititemimages.html">
|
<Content Include="dashboard-ui\edititemimages.html">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\edititemmetadata.html">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\gamegenres.html">
|
<Content Include="dashboard-ui\gamegenres.html">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
@ -276,6 +279,9 @@
|
||||||
<Content Include="dashboard-ui\scripts\edititemimages.js">
|
<Content Include="dashboard-ui\scripts\edititemimages.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="dashboard-ui\scripts\edititemmetadata.js">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="dashboard-ui\scripts\musicrecommended.js">
|
<Content Include="dashboard-ui\scripts\musicrecommended.js">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user