added stub page to edit metatada for an item

pull/702/head
Luke Pulverenti 12 years ago
parent 7c2aa12db8
commit 9434d05a5f

@ -729,7 +729,7 @@ namespace MediaBrowser.Controller.Entities
foreach (var tuple in list)
{
if (tasks.Count > 5)
if (tasks.Count > 8)
{
await Task.WhenAll(tasks).ConfigureAwait(false);
}

@ -11,6 +11,7 @@ using System.Threading;
using System.Threading.Tasks;
using System.IO;
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Controller.Providers.Movies
{
@ -70,7 +71,7 @@ namespace MediaBrowser.Controller.Providers.Movies
{
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>
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
{
return true;
// Refresh if imdb id has changed
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
int page = 1;
using (Stream stream = HttpClient.Get(MovieSearchUrl(item.Name, page), _rottenTomatoesResourcePool, cancellationToken).Result)
var page = 1;
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)
{
@ -203,9 +202,9 @@ namespace MediaBrowser.Controller.Providers.Movies
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)
{
@ -223,9 +222,9 @@ namespace MediaBrowser.Controller.Providers.Movies
else
{
// 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))
{
@ -241,23 +240,20 @@ namespace MediaBrowser.Controller.Providers.Movies
item.CriticRatingSummary = hit.critics_concensus;
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();
foreach (var rtReview in result.reviews)
item.CriticReviews = result.reviews.Select(rtReview => new ItemReview
{
ItemReview review = new ItemReview();
review.ReviewerName = rtReview.critic;
review.Publisher = rtReview.publication;
review.Date = DateTime.Parse(rtReview.date).ToUniversalTime();
review.Caption = rtReview.quote;
review.Url = rtReview.links.review;
item.CriticReviews.Add(review);
}
ReviewerName = rtReview.critic,
Publisher = rtReview.publication,
Date = DateTime.Parse(rtReview.date).ToUniversalTime(),
Caption = rtReview.quote,
Url = rtReview.links.review
}).ToList();
if (data == null)
{
@ -286,7 +282,6 @@ namespace MediaBrowser.Controller.Providers.Movies
SetLastRefreshed(item, DateTime.UtcNow);
return Task.FromResult(true);
}

@ -83,7 +83,7 @@ namespace MediaBrowser.Controller.Providers.Music
{
get
{
return "11";
return "12";
}
}
@ -211,6 +211,8 @@ namespace MediaBrowser.Controller.Providers.Music
/// </summary>
private DateTime _lastMusicBrainzRequest = DateTime.MinValue;
private readonly SemaphoreSlim _musicBrainzSemaphore = new SemaphoreSlim(1, 1);
/// <summary>
/// Gets the music brainz response.
/// </summary>
@ -223,7 +225,7 @@ namespace MediaBrowser.Controller.Providers.Music
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
@ -236,7 +238,14 @@ namespace MediaBrowser.Controller.Providers.Music
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))
{
@ -248,6 +257,8 @@ namespace MediaBrowser.Controller.Providers.Music
}
finally
{
_lastMusicBrainzRequest = DateTime.Now;
_musicBrainzResourcePool.Release();
}
}

@ -455,6 +455,7 @@ namespace MediaBrowser.WebDashboard.Api
"boxsets.js",
"clientsettings.js",
"dashboardpage.js",
"edititemmetadata.js",
"edititemimages.js",
"edituserpage.js",
"gamesrecommendedpage.js",

@ -213,6 +213,9 @@
<Content Include="dashboard-ui\edititemimages.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\edititemmetadata.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\gamegenres.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -276,6 +279,9 @@
<Content Include="dashboard-ui\scripts\edititemimages.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\edititemmetadata.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\scripts\musicrecommended.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

Loading…
Cancel
Save