read/write remote trailers to xml

pull/702/head
Luke Pulverenti 11 years ago
parent 80a56ddcfa
commit 42a2522637

@ -695,7 +695,7 @@ namespace MediaBrowser.Api.Playback
// This is arbitrary, but add a little buffer time when internet streaming
if (state.Item.LocationType == LocationType.Remote)
{
await Task.Delay(2000).ConfigureAwait(false);
await Task.Delay(4000).ConfigureAwait(false);
}
}

@ -68,6 +68,7 @@ namespace MediaBrowser.Controller.Providers
item.Genres.Clear();
item.People.Clear();
item.Tags.Clear();
item.RemoteTrailers.Clear();
//Fetch(item, metadataFile, settings, Encoding.GetEncoding("ISO-8859-1"), cancellationToken);
Fetch(item, metadataFile, settings, Encoding.UTF8, cancellationToken);
@ -482,6 +483,15 @@ namespace MediaBrowser.Controller.Providers
break;
}
case "Trailers":
{
using (var subtree = reader.ReadSubtree())
{
FetchDataFromTrailersNode(subtree, item);
}
break;
}
case "ReleaseYear":
case "ProductionYear":
{
@ -922,6 +932,35 @@ namespace MediaBrowser.Controller.Providers
}
}
private void FetchDataFromTrailersNode(XmlReader reader, T item)
{
reader.MoveToContent();
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element)
{
switch (reader.Name)
{
case "Trailer":
{
var val = reader.ReadElementContentAsString();
if (!string.IsNullOrWhiteSpace(val))
{
item.AddTrailerUrl(val, false);
}
break;
}
default:
reader.Skip();
break;
}
}
}
}
protected async Task FetchChaptersFromXmlNode(BaseItem item, XmlReader reader, IItemRepository repository, CancellationToken cancellationToken)
{
var runtime = item.RunTimeTicks ?? 0;

@ -63,6 +63,7 @@ namespace MediaBrowser.Providers.Savers
"TMDbCollectionId",
"TMDbId",
"Trailer",
"Trailers",
"TVcomId",
"TvDbId",
"Type",
@ -177,7 +178,7 @@ namespace MediaBrowser.Providers.Savers
}
}
}
return builder.ToString();
}
@ -269,7 +270,14 @@ namespace MediaBrowser.Providers.Savers
if (item.RemoteTrailers.Count > 0)
{
builder.Append("<Trailer>" + SecurityElement.Escape(item.RemoteTrailers[0].Url) + "</Trailer>");
builder.Append("<Trailers>");
foreach (var trailer in item.RemoteTrailers)
{
builder.Append("<Trailer>" + SecurityElement.Escape(trailer.Url) + "</Trailer>");
}
builder.Append("</Trailers>");
}
if (item.Budget.HasValue)

@ -430,7 +430,7 @@ namespace MediaBrowser.WebDashboard.Api
"http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js",
"http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js",
"scripts/all.js" + versionString,
"thirdparty/jstree1.0fix3/jquery.jstree.js"
"thirdparty/jstree1.0/jquery.jstree.js"
};
var tags = files.Select(s => string.Format("<script src=\"{0}\"></script>", s)).ToArray();

@ -610,76 +610,76 @@
<Content Include="dashboard-ui\thirdparty\html5slider.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\jquery.jstree.js">
<Content Include="dashboard-ui\thirdparty\jstree1.0\jquery.jstree.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\apple\bg.jpg">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\apple\bg.jpg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\apple\d.png">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\apple\d.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\apple\dot_for_ie.gif">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\apple\dot_for_ie.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\apple\style.css">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\apple\style.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\apple\throbber.gif">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\apple\throbber.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\classic\d.gif">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\classic\d.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\classic\d.png">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\classic\d.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\classic\dot_for_ie.gif">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\classic\dot_for_ie.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\classic\style.css">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\classic\style.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\classic\throbber.gif">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\classic\throbber.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\default-rtl\d.gif">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\default-rtl\d.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\default-rtl\d.png">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\default-rtl\d.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\default-rtl\dots.gif">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\default-rtl\dots.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\default-rtl\style.css">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\default-rtl\style.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\default-rtl\throbber.gif">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\default-rtl\throbber.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\default\d.gif">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\default\d.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\default\d.png">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\default\d.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\default\style.css">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\default\style.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\default\throbber.gif">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\default\throbber.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\mb3\d.gif">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\mb3\d.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\mb3\d.png">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\mb3\d.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\mb3\style.css">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\mb3\style.css">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\thirdparty\jstree1.0fix3\themes\mb3\throbber.gif">
<Content Include="dashboard-ui\thirdparty\jstree1.0\themes\mb3\throbber.gif">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="dashboard-ui\tvgenres.html">

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.203" targetFramework="net45" />
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.204" targetFramework="net45" />
<package id="ServiceStack.Common" version="3.9.70" targetFramework="net45" />
<package id="ServiceStack.Text" version="3.9.70" targetFramework="net45" />
</packages>
Loading…
Cancel
Save