initial code

initial code
This commit is contained in:
CompoUK
2015-03-08 14:20:49 +00:00
parent 5658418d9e
commit 4f99e72bfe
12 changed files with 2324 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
using System;
using MediaBrowser.Model.Plugins;
namespace MediaBrowser.Plugins.VuPlus.Configuration
{
/// <summary>
/// Class PluginConfiguration
/// </summary>
public class PluginConfiguration : BasePluginConfiguration
{
public string HostName { get; set; }
public string StreamingPort { get; set; }
public string WebInterfacePort { get; set; }
public string WebInterfaceUsername { get; set; }
public string WebInterfacePassword { get; set; }
public Boolean UseSecureHTTPS { get; set; }
public Boolean OnlyOneBouquet { get; set; }
public string TVBouquet { get; set; }
public Boolean ZapToChannel { get; set; }
public Boolean FetchPiconsFromWebInterface { get; set; }
public string PiconsPath { get; set; }
public string RecordingPath { get; set; }
public Boolean EnableDebugLogging { get; set; }
public PluginConfiguration()
{
HostName = "http://localhost";
StreamingPort = "8001";
WebInterfacePort = "8000";
WebInterfaceUsername= "";
WebInterfacePassword = "";
UseSecureHTTPS = false;
OnlyOneBouquet = true;
TVBouquet = "Favourites (TV)";
ZapToChannel = false;
FetchPiconsFromWebInterface = true;
PiconsPath = "";
RecordingPath = "";
EnableDebugLogging = false;
}
}
}
@@ -0,0 +1,44 @@
using System.IO;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Controller.Plugins;
namespace MediaBrowser.Plugins.VuPlus.Configuration
{
/// <summary>
/// Class VuPlusConfigurationPage
/// </summary>
class VuPlusConfigurationPage : IPluginConfigurationPage
{
/// <summary>
/// Gets the type of the configuration page.
/// </summary>
/// <value>The type of the configuration page.</value>
public ConfigurationPageType ConfigurationPageType
{
get { return ConfigurationPageType.PluginConfiguration; }
}
/// <summary>
/// Gets the HTML stream.
/// </summary>
/// <returns>Stream.</returns>
public Stream GetHtmlStream()
{
return GetType().Assembly.GetManifestResourceStream("MediaBrowser.Plugins.VuPlus.Configuration.configPage.html");
}
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
public string Name
{
get { return "VuPlus"; }
}
public IPlugin Plugin
{
get { return VuPlus.Plugin.Instance; }
}
}
}
+209
View File
@@ -0,0 +1,209 @@
<!DOCTYPE html>
<html>
<head>
<title>Vu+</title>
</head>
<body>
<div data-role="page" class="page type-interior pluginConfigurationPage VuPlusConfigurationPage">
<div data-role="content">
<div class="content-primary">
<form class="VuPlusConfigurationForm">
<ul class="ulForm" data-role="listview">
<li>
<label for="txtHostName">Vu+ hostname or ip address:</label>
<input type="text" id="txtHostName" name="txtHostName" />
<div class="fieldDescription">
The host name (address) or ip address of your receiver
</div>
</li>
<li>
<label for="txtStreamingPort">Vu+ streaming port:</label>
<input type="text" id="txtStreamingPort" name="txtStreamingPort" />
<div class="fieldDescription">
The Streaming port of your receiver eg. 8001
</div>
</li>
<li>
<label for="txtWebInterfacePort">Vu+ Web Interface port:</label>
<input type="text" id="txtWebInterfacePort" name="txtWebInterfacePort" />
<div class="fieldDescription">
The web Interface port of your receiver eg. 8000
</div>
</li>
<li>
<label for="txtWebInterfaceUsername">Vu+ Web Interface username:</label>
<input type="text" id="txtWebInterfaceUsername" name="txtWebInterfaceUsername" />
<div class="fieldDescription">
The web Interface username of your receiver (optional)
</div>
</li>
<li>
<label for="txtWebInterfacePassword">Vu+ Web Interface password:</label>
<input type="text" id="txtWebInterfacePassword" name="txtWebInterfacePassword" />
<div class="fieldDescription">
The web Interface password of your receiver (optional)
</div>
</li>
<li>
<label for="chkUseSecureHTTPS">Use secure HTTP (HTTPS)</label>
<input type="checkbox" id="chkUseSecureHTTPS" data-mini="true" />
<div class="fieldDescription">
Use HTTPS to connect to your receiver
</div>
</li>
<li>
<label for="chkOnlyOneBouquet">Fetch Only one TV bouquet</label>
<input type="checkbox" id="chkOnlyOneBouquet" data-mini="true" />
<div class="fieldDescription">
Limit channels to only those contained within the specified TV Bouquet below (optional)
</div>
</li>
<li>
<label for="txtTVBouquet">Vu+ TVBouquet:</label>
<input type="text" id="txtTVBouquet" name="txtTVBouquet" />
<div class="fieldDescription">
The TV Bouquet to load channels for (optional)
</div>
</li>
<li>
<label for="chkZapToChannel">Zap before Channel switch (single tuner)</label>
<input type="checkbox" id="chkZapToChannel" data-mini="true" />
<div class="fieldDescription">
Set if only one tuner within receiver
</div>
</li>
<li>
<label for="chkFetchPiconsFromWebInterface">Fetch picons from webinterface</label>
<input type="checkbox" id="chkFetchPiconsFromWebInterface" data-mini="true" />
<div class="fieldDescription">
Set if you want to retrieve Picons from the web interface of the receiver
</div>
</li>
<li>
<label for="txtPiconsPath">Picons Path:</label>
<input type="text" id="txtPiconsPath" name="txtPiconsPath" />
<div class="fieldDescription">
The local location of your Picons eg. C:\Picons\ (optional)
</div>
</li>
<li>
<label for="txtRecordingPath">Recording Path:</label>
<input type="text" id="txtRecordingPath" name="txtRecordingPath" />
<div class="fieldDescription">
The location to store your recordings on your receiver eg. /hdd/movie/ (optional)
</div>
</li>
<li>
<label for="chkDebugLogging">Enable VuPlus debug logging</label>
<input type="checkbox" id="chkDebugLogging" data-mini="true" />
</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 VuPlusConfigurationPage = {
pluginUniqueId: "9564ac10-af23-39bc-449f-624f23cfa48f"
};
$('.VuPlusConfigurationPage').on('pageshow', function (event) {
Dashboard.showLoadingMsg();
var page = this;
ApiClient.getPluginConfiguration(VuPlusConfigurationPage.pluginUniqueId).done(function (config) {
$('#txtHostName', page).val(config.HostName || "");
$('#txtStreamingPort', page).val(config.StreamingPort || "");
$('#txtWebInterfacePort', page).val(config.WebInterfacePort || "");
$('#txtWebInterfaceUsername', page).val(config.WebInterfaceUsername || "");
$('#txtWebInterfacePassword', page).val(config.WebInterfacePassword || "");
$('#chkUseSecureHTTPS', page).checked(config.UseSecureHTTPS || false).checkboxradio("refresh");
$('#chkOnlyOneBouquet', page).checked(config.OnlyOneBouquet || false).checkboxradio("refresh");
$('#txtTVBouquet', page).val(config.TVBouquet || "");
$('#chkZapToChannel', page).checked(config.ZapToChannel || false).checkboxradio("refresh");
$('#chkFetchPiconsFromWebInterface', page).checked(config.FetchPiconsFromWebInterface || false).checkboxradio("refresh");
$('#txtPiconsPath', page).val(config.PiconsPath || "");
$('#txtRecordingPath', page).val(config.RecordingPath || "");
$('#chkDebugLogging', page).checked(config.EnableDebugLogging || false).checkboxradio("refresh");
Dashboard.hideLoadingMsg();
});
});
$('.VuPlusConfigurationForm').on('submit', function (e) {
Dashboard.showLoadingMsg();
var form = this;
ApiClient.getPluginConfiguration(VuPlusConfigurationPage.pluginUniqueId).done(function (config) {
//reset TV bouquet reference if TV Bouquet changed
//if (config.TVBouquet != $('#txtTVBouquet', form).val()) {
// config.tvBouquetSRef = '';
//}
//reset TV bouquet reference if Only 1 Bouquet not set
//if ($('#chkOnlyOneBouquet', form).checked()) {
//}
//else
//{
// config.tvBouquetSRef = '';
//}
config.HostName = $('#txtHostName', form).val();
config.StreamingPort = $('#txtStreamingPort', form).val();
config.WebInterfacePort = $('#txtWebInterfacePort', form).val();
config.WebInterfaceUsername = $('#txtWebInterfaceUsername', form).val();
config.WebInterfacePassword = $('#txtWebInterfacePassword', form).val();
config.UseSecureHTTPS = $('#chkUseSecureHTTPS', form).checked();
config.OnlyOneBouquet = $('#chkOnlyOneBouquet', form).checked();
config.TVBouquet = $('#txtTVBouquet', form).val();
config.ZapToChannel = $('#chkZapToChannel', form).checked();
config.FetchPiconsFromWebInterface = $('#chkFetchPiconsFromWebInterface', form).checked();
config.PiconsPath = $('#txtPiconsPath', form).val();
config.RecordingPath = $('#txtRecordingPath', form).val();
config.EnableDebugLogging = $('#chkDebugLogging', form).checked();
ApiClient.updatePluginConfiguration(VuPlusConfigurationPage.pluginUniqueId, config).done(Dashboard.processPluginConfigurationUpdateResult);
});
// Disable default form submission
return false;
});
</script>
</div>
</body>
</html>
+23
View File
@@ -0,0 +1,23 @@
using System;
using System.Security.Cryptography;
using System.Text;
namespace MediaBrowser.Plugins.VuPlus.Helpers
{
public static class EncryptionHelper
{
public static string GetMd5Hash(string value)
{
HashAlgorithm hashAlgorithm = HashAlgorithm.Create("MD5");
if (hashAlgorithm != null)
{
byte[] hashValue = hashAlgorithm.ComputeHash(new UTF8Encoding().GetBytes(value));
//Bit convertor return the byte to string as all caps hex values seperated by "-"
return BitConverter.ToString(hashValue).Replace("-", "").ToLowerInvariant();
}
return string.Empty;
}
}
}
+71
View File
@@ -0,0 +1,71 @@
using MediaBrowser.Model.LiveTv;
using System;
using MediaBrowser.Model.Logging;
namespace MediaBrowser.Plugins.VuPlus.Helpers
{
public static class ChannelHelper
{
public static ChannelType GetChannelType(string channelType)
{
ChannelType type = new ChannelType();
if (channelType == "0x1")
{
type = ChannelType.TV;
}
else if (channelType == "0xa")
{
type = ChannelType.Radio;
}
return type;
}
}
public static class UtilsHelper
{
public static void DebugInformation(ILogger logger, string message)
{
var config = Plugin.Instance.Configuration;
bool enableDebugLogging = config.EnableDebugLogging;
if (enableDebugLogging)
{
logger.Debug(message);
}
}
}
public static class RecordingHelper
{
}
public static class ApiHelper
{
private static readonly DateTime UnixEpoch =
new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public static long GetCurrentUnixTimestampMillis()
{
return (long)(DateTime.UtcNow - UnixEpoch).TotalMilliseconds;
}
public static DateTime DateTimeFromUnixTimestampMillis(long millis)
{
return UnixEpoch.AddMilliseconds(millis);
}
public static long GetCurrentUnixTimestampSeconds(DateTime date)
{
return (long)(date - UnixEpoch).TotalSeconds;
}
public static DateTime DateTimeFromUnixTimestampSeconds(long seconds)
{
return UnixEpoch.AddSeconds(seconds);
}
}
}
+23
View File
@@ -0,0 +1,23 @@
using System.Xml;
namespace MediaBrowser.Plugins.VuPlus.Helpers
{
public static class XmlHelper
{
public static XmlNode GetSingleNode(string input, string xPath)
{
var xml = new XmlDocument();
xml.LoadXml(input);
return xml.SelectSingleNode(xPath);
}
public static XmlNodeList GetMultipleNodes(string input, string xPath)
{
var xml = new XmlDocument();
xml.LoadXml(input);
return xml.SelectNodes(xPath);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

+1735
View File
File diff suppressed because it is too large Load Diff
+88
View File
@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{815AB3F4-6B55-4FC4-9441-9297A3A116CB}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MediaBrowser.Plugins.VuPlus</RootNamespace>
<AssemblyName>MediaBrowser.Plugins.VuPlus</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="MediaBrowser.Common, Version=3.0.5518.28641, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MediaBrowser.Common.3.0.566\lib\net45\MediaBrowser.Common.dll</HintPath>
</Reference>
<Reference Include="MediaBrowser.Controller, Version=3.0.5518.28640, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MediaBrowser.Server.Core.3.0.566\lib\net45\MediaBrowser.Controller.dll</HintPath>
</Reference>
<Reference Include="MediaBrowser.Model, Version=3.0.5518.28642, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\MediaBrowser.Common.3.0.566\lib\net45\MediaBrowser.Model.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\SharedVersion.cs">
<Link>Properties\SharedVersion.cs</Link>
</Compile>
<Compile Include="Configuration\VuPlusConfigurationPage.cs" />
<Compile Include="Configuration\PluginConfiguration.cs" />
<Compile Include="Helpers\GeneralHelpers.cs" />
<Compile Include="Helpers\EncryptionHelper.cs" />
<Compile Include="Helpers\XmlHelper.cs" />
<Compile Include="LiveTvService.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Configuration\configPage.html" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<PropertyGroup>
<PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)\..\MediaBrowser\ProgramData-Server\Plugins\" /y</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
+46
View File
@@ -0,0 +1,46 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Plugins;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Plugins.VuPlus.Configuration;
namespace MediaBrowser.Plugins.VuPlus
{
/// <summary>
/// Class Plugin
/// </summary>
public class Plugin : BasePlugin<PluginConfiguration>
{
public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer)
: base(applicationPaths, xmlSerializer)
{
Instance = this;
}
/// <summary>
/// Gets the name of the plugin
/// </summary>
/// <value>The name.</value>
public override string Name
{
get { return "VuPlus"; }
}
/// <summary>
/// Gets the description.
/// </summary>
/// <value>The description.</value>
public override string Description
{
get
{
return "Provides live tv using Vu+ / Enigma2 pvr as a back-end.";
}
}
/// <summary>
/// Gets the instance.
/// </summary>
/// <value>The instance.</value>
public static Plugin Instance { get; private set; }
}
}
+32
View File
@@ -0,0 +1,32 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MediaBrowser.Plugins.VuPlus")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MediaBrowser.Plugins.VuPlus")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("9564ac10-af23-39bc-449f-624f23cfa48f")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MediaBrowser.Common" version="1.0.0.0" targetFramework="net45" />
<package id="MediaBrowser.Server.Core" version="1.0.0.0" targetFramework="net45" />
</packages>