Pushing missing changes

This commit is contained in:
LukePulverenti
2013-02-20 20:33:05 -05:00
parent 845554722e
commit 767cdc1f6f
924 changed files with 103121 additions and 18677 deletions

View File

@@ -0,0 +1,46 @@
using MediaBrowser.Model.Plugins;
namespace MediaBrowser.Plugins.Trailers.Configuration
{
/// <summary>
/// Class PluginConfiguration
/// </summary>
public class PluginConfiguration : BasePluginConfiguration
{
/// <summary>
/// Gets or sets the name of the folder.
/// </summary>
/// <value>The name of the folder.</value>
public string FolderName { get; set; }
/// <summary>
/// Trailers older than this will not be downloaded and deleted if already downloaded.
/// </summary>
/// <value>The max trailer age.</value>
public int? MaxTrailerAge { get; set; }
/// <summary>
/// Gets the path to where trailers should be downloaded.
/// If not supplied then programdata/cache/trailers will be used.
/// </summary>
/// <value>The download path.</value>
public string DownloadPath { get; set; }
/// <summary>
/// Gets or sets a value indicating whether [delete old trailers].
/// </summary>
/// <value><c>true</c> if [delete old trailers]; otherwise, <c>false</c>.</value>
public bool DeleteOldTrailers { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="PluginConfiguration" /> class.
/// </summary>
public PluginConfiguration()
: base()
{
FolderName = "Trailers";
MaxTrailerAge = 60;
}
}
}

View File

@@ -0,0 +1,50 @@
using MediaBrowser.Common.Plugins;
using MediaBrowser.Controller.Plugins;
using System.ComponentModel.Composition;
using System.IO;
namespace MediaBrowser.Plugins.Trailers.Configuration
{
/// <summary>
/// Class TrailerConfigurationPage
/// </summary>
[Export(typeof(BaseConfigurationPage))]
class TrailerConfigurationPage : BaseConfigurationPage
{
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public override string Name
{
get { return "Trailers"; }
}
/// <summary>
/// Gets the HTML stream.
/// </summary>
/// <returns>Stream.</returns>
public override Stream GetHtmlStream()
{
return GetHtmlStreamFromManifestResource("MediaBrowser.Plugins.Trailers.Configuration.configPage.html");
}
/// <summary>
/// Gets the owner plugin.
/// </summary>
/// <returns>BasePlugin.</returns>
public override IPlugin GetOwnerPlugin()
{
return Plugin.Instance;
}
/// <summary>
/// Gets the type of the configuration page.
/// </summary>
/// <value>The type of the configuration page.</value>
public override ConfigurationPageType ConfigurationPageType
{
get { return ConfigurationPageType.PluginConfiguration; }
}
}
}

View File

@@ -0,0 +1,119 @@
<!DOCTYPE html>
<html>
<head>
<title>Trailers</title>
</head>
<body>
<div id="trailersConfigurationPage" data-role="page" class="page type-interior pluginConfigurationPage">
<div data-role="content">
<div class="content-primary">
<form id="trailersConfigurationForm">
<ul class="ulForm" data-role="listview">
<li>
<label for="txtFolderName">
Trailer collection name:
</label>
<input id="txtFolderName" name="txtFolderName" />
</li>
<li>
<label for="txtMaxTrailerAge">
Max trailer age (days):
</label>
<input type="number" id="txtMaxTrailerAge" name="txtMaxTrailerAge" pattern="[0-9]*" min="1" />
<div class="fieldDescription">
If specified, trailers older than this will not be downloaded
</div>
</li>
<li>
<input type="checkbox" id="chkDeleteOldTrailers" name="chkDeleteOldTrailers" />
<label for="chkDeleteOldTrailers">Delete trailers older than the max age</label>
</li>
<li>
<label for="txtDownloadPath">
Download path:
</label>
<div style="display: inline-block; width:92%;">
<input id="txtDownloadPath" name="txtDownloadPath" data-inline="true" />
</div>
<button type="button" data-icon="folder-close" data-iconpos="notext" data-inline="true" onclick="TrailersConfigurationPage.selectDirectory();">Select Directory</button>
<div class="fieldDescription">
By default, trailers are downloaded to an internal data directory. Using a different location may make it easier to share over your network.
</div>
</li>
<li>
<button type="submit" data-theme="b">Save</button>
<button type="button" onclick="history.back();">Cancel</button>
</li>
</ul>
</form>
</div>
</div>
<script type="text/javascript">
var TrailersConfigurationPage = {
pluginUniqueId: "986a7283-205a-4436-862d-23135c067f8a",
selectDirectory: function () {
Dashboard.selectDirectory({
callback: function (path) {
if (path) {
$('#txtDownloadPath', $.mobile.activePage).val(path);
}
$('#popupDirectoryPicker', $.mobile.activePage).popup("close");
},
header: "Select Trailer Path"
});
}
};
$('#trailersConfigurationPage').on('pageshow', function (event) {
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getPluginConfiguration(TrailersConfigurationPage.pluginUniqueId).done(function (config) {
$('#txtDownloadPath', page).val(config.DownloadPath);
$('#txtFolderName', page).val(config.FolderName);
$('#txtMaxTrailerAge', page).val(config.MaxTrailerAge || "");
$('#chkDeleteOldTrailers', page).checked(config.DeleteOldTrailers).checkboxradio("refresh");
Dashboard.hideLoadingMsg();
});
});
$('#trailersConfigurationForm').on('submit', function (e) {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getPluginConfiguration(TrailersConfigurationPage.pluginUniqueId).done(function (config) {
config.DownloadPath = $('#txtDownloadPath', form).val();
config.FolderName = $('#txtFolderName', form).val();
var maxTrailerAge = $('#txtMaxTrailerAge', form).val();
config.MaxTrailerAge = maxTrailerAge ? maxTrailerAge : null;
config.DeleteOldTrailers = $('#chkDeleteOldTrailers', form).checked();
ApiClient.updatePluginConfiguration(TrailersConfigurationPage.pluginUniqueId, config).done(Dashboard.processPluginConfigurationUpdateResult);
});
// Disable default form submission
return false;
});
</script>
</div>
</body>
</html>