From: <do...@us...> - 2008-08-26 11:38:52
|
Revision: 2092 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=2092&view=rev Author: dot-i Date: 2008-08-26 11:38:47 +0000 (Tue, 26 Aug 2008) Log Message: ----------- Added ForTheRecord.RecorderTuners.MediaPortalTvServer and all needed referenced assemblies (For The Record 1.2.1). Added Paths: ----------- trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.suo trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateShareForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateShareForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateShareForm.resx trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/PostBuild.cmd trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.resx trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SyncEpgThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Gentle.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Gentle.Framework.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll Added: trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln 2008-08-26 11:38:47 UTC (rev 2092) @@ -0,0 +1,27 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "RecorderTuner Server Plugin", "RecorderTuner Server Plugin", "{84E6B02A-0674-4406-911E-88CAB7CE17E6}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GUI Client Plugin", "GUI Client Plugin", "{2A217BB8-A9FF-4013-ACAC-B1D1EBB39349}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForTheRecord.RecorderTuners.MediaPortalTvServer", "ForTheRecord.RecorderTuners.MediaPortalTvServer\ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj", "{6CF22F4E-FFFD-448D-A1A8-2156CB0133ED}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6CF22F4E-FFFD-448D-A1A8-2156CB0133ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6CF22F4E-FFFD-448D-A1A8-2156CB0133ED}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6CF22F4E-FFFD-448D-A1A8-2156CB0133ED}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6CF22F4E-FFFD-448D-A1A8-2156CB0133ED}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {6CF22F4E-FFFD-448D-A1A8-2156CB0133ED} = {84E6B02A-0674-4406-911E-88CAB7CE17E6} + EndGlobalSection +EndGlobal Property changes on: trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.suo ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateShareForm.Designer.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateShareForm.Designer.cs (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateShareForm.Designer.cs 2008-08-26 11:38:47 UTC (rev 2092) @@ -0,0 +1,128 @@ +namespace ForTheRecord.RecorderTuners.MediaPortalTvServer +{ + partial class CreateShareForm + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this._pathLabel = new System.Windows.Forms.Label(); + this._localPathLabel = new System.Windows.Forms.Label(); + this._shareLabel = new System.Windows.Forms.Label(); + this._shareNameTextBox = new System.Windows.Forms.TextBox(); + this._okButton = new System.Windows.Forms.Button(); + this._cancelButton = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // _pathLabel + // + this._pathLabel.AutoSize = true; + this._pathLabel.Location = new System.Drawing.Point(12, 15); + this._pathLabel.Name = "_pathLabel"; + this._pathLabel.Size = new System.Drawing.Size(60, 13); + this._pathLabel.TabIndex = 0; + this._pathLabel.Text = "Local path:"; + // + // _localPathLabel + // + this._localPathLabel.AutoEllipsis = true; + this._localPathLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this._localPathLabel.Location = new System.Drawing.Point(85, 15); + this._localPathLabel.Name = "_localPathLabel"; + this._localPathLabel.Size = new System.Drawing.Size(297, 20); + this._localPathLabel.TabIndex = 1; + // + // _shareLabel + // + this._shareLabel.AutoSize = true; + this._shareLabel.Location = new System.Drawing.Point(12, 41); + this._shareLabel.Name = "_shareLabel"; + this._shareLabel.Size = new System.Drawing.Size(67, 13); + this._shareLabel.TabIndex = 2; + this._shareLabel.Text = "Share name:"; + // + // _shareNameTextBox + // + this._shareNameTextBox.Location = new System.Drawing.Point(85, 38); + this._shareNameTextBox.Name = "_shareNameTextBox"; + this._shareNameTextBox.Size = new System.Drawing.Size(297, 20); + this._shareNameTextBox.TabIndex = 3; + // + // _okButton + // + this._okButton.Location = new System.Drawing.Point(226, 72); + this._okButton.Name = "_okButton"; + this._okButton.Size = new System.Drawing.Size(75, 23); + this._okButton.TabIndex = 4; + this._okButton.Text = "OK"; + this._okButton.UseVisualStyleBackColor = true; + this._okButton.Click += new System.EventHandler(this._okButton_Click); + // + // _cancelButton + // + this._cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this._cancelButton.Location = new System.Drawing.Point(307, 72); + this._cancelButton.Name = "_cancelButton"; + this._cancelButton.Size = new System.Drawing.Size(75, 23); + this._cancelButton.TabIndex = 5; + this._cancelButton.Text = "Cancel"; + this._cancelButton.UseVisualStyleBackColor = true; + // + // CreateShareForm + // + this.AcceptButton = this._okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this._cancelButton; + this.ClientSize = new System.Drawing.Size(394, 104); + this.Controls.Add(this._cancelButton); + this.Controls.Add(this._okButton); + this.Controls.Add(this._shareNameTextBox); + this.Controls.Add(this._shareLabel); + this.Controls.Add(this._localPathLabel); + this.Controls.Add(this._pathLabel); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "CreateShareForm"; + this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Create UNC Share"; + this.Load += new System.EventHandler(this.CreateShareForm_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label _pathLabel; + private System.Windows.Forms.Label _localPathLabel; + private System.Windows.Forms.Label _shareLabel; + private System.Windows.Forms.TextBox _shareNameTextBox; + private System.Windows.Forms.Button _okButton; + private System.Windows.Forms.Button _cancelButton; + } +} \ No newline at end of file Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateShareForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateShareForm.cs (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateShareForm.cs 2008-08-26 11:38:47 UTC (rev 2092) @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace ForTheRecord.RecorderTuners.MediaPortalTvServer +{ + public partial class CreateShareForm : Form + { + public CreateShareForm() + { + InitializeComponent(); + } + + private string _localPath; + + public string LocalPath + { + get { return _localPath; } + set { _localPath = value; } + } + + private void CreateShareForm_Load(object sender, EventArgs e) + { + _localPathLabel.Text = _localPath; + } + + private void _okButton_Click(object sender, EventArgs e) + { + if (_shareNameTextBox.Text.IndexOfAny(System.IO.Path.GetInvalidPathChars()) >= 0) + { + MessageBox.Show(this, "Invalid share name, don't use special characters.", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + return; + } + try + { + if (Common.Utility.CreateUncShare(_shareNameTextBox.Text.Trim(), _localPath)) + { + this.DialogResult = DialogResult.OK; + Close(); + } + else + { + MessageBox.Show(this, "Failed to create share, name not unique?", null, MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + catch (Exception ex) + { + MessageBox.Show(this, ex.Message, null, MessageBoxButtons.OK, MessageBoxIcon.Error); + } + } + } +} Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateShareForm.resx =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateShareForm.resx (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateShareForm.resx 2008-08-26 11:38:47 UTC (rev 2092) @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root> \ No newline at end of file Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj 2008-08-26 11:38:47 UTC (rev 2092) @@ -0,0 +1,146 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{6CF22F4E-FFFD-448D-A1A8-2156CB0133ED}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>ForTheRecord.RecorderTuners.MediaPortalTvServer</RootNamespace> + <AssemblyName>ForTheRecord.RecorderTuners.MediaPortalTvServer</AssemblyName> + <SccProjectName> + </SccProjectName> + <SccLocalPath> + </SccLocalPath> + <SccAuxPath> + </SccAuxPath> + <SccProvider> + </SccProvider> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + <TargetFrameworkVersion>v3.0</TargetFrameworkVersion> + </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="ForTheRecord.Entities, Version=1.2.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\ForTheRecord.Entities.dll</HintPath> + </Reference> + <Reference Include="ForTheRecord.RecorderTuners.Common, Version=1.2.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\ForTheRecord.RecorderTuners.Common.dll</HintPath> + </Reference> + <Reference Include="ForTheRecord.ServiceAgents, Version=1.2.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\ForTheRecord.ServiceAgents.dll</HintPath> + </Reference> + <Reference Include="ForTheRecord.ServiceContracts, Version=1.2.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\ForTheRecord.ServiceContracts.dll</HintPath> + </Reference> + <Reference Include="Gentle.Common, Version=1.2.9.1285, Culture=neutral, PublicKeyToken=80b5de62e27be49b"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\Gentle.Common.dll</HintPath> + </Reference> + <Reference Include="Gentle.Framework, Version=1.2.9.1286, Culture=neutral, PublicKeyToken=80b5de62e27be49b"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\Gentle.Framework.dll</HintPath> + </Reference> + <Reference Include="PluginBase, Version=0.9.2.16175, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\PluginBase.dll</HintPath> + </Reference> + <Reference Include="SetupControls, Version=0.9.2.16173, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\SetupControls.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + <Reference Include="TvBusinessLayer, Version=0.9.2.16193, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\TvBusinessLayer.dll</HintPath> + </Reference> + <Reference Include="TvControl, Version=0.9.2.16194, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\TvControl.dll</HintPath> + </Reference> + <Reference Include="TVDatabase, Version=0.9.2.16193, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\TVDatabase.dll</HintPath> + </Reference> + <Reference Include="TvLibrary.Interfaces, Version=0.9.2.16192, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\TvLibrary.Interfaces.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="CreateShareForm.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="CreateShareForm.Designer.cs"> + <DependentUpon>CreateShareForm.cs</DependentUpon> + </Compile> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="RecordingThread.cs" /> + <Compile Include="SettingName.cs" /> + <Compile Include="SetupForm.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="SetupForm.Designer.cs"> + <DependentUpon>SetupForm.cs</DependentUpon> + </Compile> + <Compile Include="MediaPortalRecorderTunerService.cs" /> + <Compile Include="TvServerPlugin.cs" /> + <Compile Include="SyncEpgThread.cs" /> + <Compile Include="Utility.cs" /> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="CreateShareForm.resx"> + <DependentUpon>CreateShareForm.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> + <EmbeddedResource Include="SetupForm.resx"> + <DependentUpon>SetupForm.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <None Include="PostBuild.cmd" /> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- 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> + --> + <PropertyGroup> + <PostBuildEvent>$(ProjectDir)PostBuild.cmd $(TargetDir) $(TargetPath) $(ConfigurationName) +</PostBuildEvent> + </PropertyGroup> +</Project> \ No newline at end of file Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2008-08-26 11:38:47 UTC (rev 2092) @@ -0,0 +1,287 @@ +/* + * Copyright (C) 2007-2008 ForTheRecord + * http://www.4therecord.eu + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ +using System; +using System.Collections.Generic; +using System.Text; +using System.Collections; +using System.Reflection; +using System.IO; +using System.ServiceModel; +using System.Diagnostics; +using System.Globalization; + +using Gentle.Framework; +using TvControl; +using TvDatabase; +using TvLibrary.Interfaces; +using TvLibrary.Log; + +using ForTheRecord.Entities; +using ForTheRecord.ServiceContracts; +using ForTheRecord.ServiceAgents; +using ForTheRecord.RecorderTuners.Common; + +namespace ForTheRecord.RecorderTuners.MediaPortalTvServer +{ + [ServiceBehavior( +#if DEBUG + IncludeExceptionDetailInFaults = true, +#endif + ConcurrencyMode = ConcurrencyMode.Reentrant, + InstanceContextMode = InstanceContextMode.Single)] + public class MediaPortalRecorderTunerService : ThreadedRecorderTunerService<RecordingThread> + { + protected override string Name + { + get { return "MediaPortal TV Server"; } + } + + public override string AllocateCard(Guid tvChannelId, string tvChannelName, CardChannelAllocation[] alreadyAllocated) + { + try + { + // + // Find the channel in MediaPortal (match by DisplayName) and get all the + // channel's tuning details and the cards it is mapped to. + // + Channel channel; + IList tuningDetails; + List<Card> availableCards = GetCardsForChannel(tvChannelName, out channel, out tuningDetails); + + // Sort the cards by priority. + availableCards.Sort(delegate(Card c1, Card c2) { return -c1.Priority.CompareTo(c2.Priority); }); + + // + // Now remove all card that were previously allocated. + // + foreach (CardChannelAllocation allocation in alreadyAllocated) + { + Card cardToRemove = null; + foreach (Card card in availableCards) + { + if (card.DevicePath == allocation.CardId) + { + // + // This card was already allocated before, but we may be able to reuse the card. + // So first, let's check if the if the card (and CAM) allow this. + // + // Note: "!ChannelAlreadyAllocatedOn(alreadyAllocated, allocation.CardId, tvChannelId)" was + // not added since TV Server can record the same channel several times on the same transponder. + if (channel.FreeToAir + || CountNumTimesAllocated(alreadyAllocated, allocation.CardId) < card.DecryptLimit) + { + // Get the previously allocated channel's tuning details and let's check if the + // channel we want is on the same transponder as that channel. + IList allocatedTuningDetails; + Channel allocatedChannel = GetChannelAndTuningByDisplayName(allocation.TvChannelName, out allocatedTuningDetails); + if (allocatedChannel != null) + { + foreach(TuningDetail tuning in tuningDetails) + { + foreach(TuningDetail allocatedTuning in allocatedTuningDetails) + { + if (tuning.ChannelType >= 2 && tuning.ChannelType <= 4 // DVB-x channel? + && tuning.ChannelType == allocatedTuning.ChannelType + && tuning.Frequency == allocatedTuning.Frequency + && tuning.Symbolrate == allocatedTuning.Symbolrate + && tuning.Polarisation == allocatedTuning.Polarisation + && tuning.Bandwidth == allocatedTuning.Bandwidth + && tuning.Modulation == allocatedTuning.Modulation) + { + // Same transponder, so we can re-use the card. + return allocation.CardId; + } + } + } + } + } + cardToRemove = card; + break; + } + } + if (cardToRemove != null) + { + availableCards.Remove(cardToRemove); + } + } + + // + // If there's still at least one card available, return the card + // with the highest priority. + // + if (availableCards.Count > 0) + { + return availableCards[0].DevicePath; + } + } + catch (Exception ex) + { + Log(TraceEventType.Error, ex.Message); + } + return null; + } + + public override bool StartRecording(string tvSchedulerHostName, int tvSchedulerTcpPort, CardChannelAllocation channelAllocation, DateTime startTime, DateTime stopTime, UpcomingProgram recordingProgram) + { + bool result = false; + + Card recordOnCard = GetCardByDevicePath(channelAllocation.CardId); + if (recordOnCard != null) + { + Channel channel = GetChannelByDisplayName(channelAllocation.TvChannelName); + if (channel != null) + { + result = this.RecordingThreads.StartNewThread(new RecordingThread(this.RecorderTunerId, + tvSchedulerHostName, tvSchedulerTcpPort, channelAllocation, startTime, stopTime, + recordingProgram, recordOnCard, channel)); + if (!result) + { + Log(TraceEventType.Error, "{0} - Already recording {1}", this.Name, recordingProgram.CreateProgramTitle()); + } + } + else + { + Log(TraceEventType.Error, "{0} - Channel {1} not found", this.Name, channelAllocation.TvChannelName); + } + } + else + { + Log(TraceEventType.Error, "{0} - Card {1} not found", this.Name, channelAllocation.CardId); + } + + return result; + } + + public override string[] GetRecordingShares() + { + List<string> shares = new List<string>(); + + List<Card> cards = Utility.GetAllCards(); + foreach (Card card in cards) + { + if (!String.IsNullOrEmpty(card.RecordingFolder)) + { + string uncRecordingFolder = Common.ShareExplorer.GetUncPathForLocalPath(card.RecordingFolder); + shares.Add(String.IsNullOrEmpty(uncRecordingFolder) ? card.RecordingFolder : uncRecordingFolder); + } + } + + return shares.ToArray(); + } + + protected override void OnWriteLog(TraceEventType severity, string message) + { + if (severity == TraceEventType.Error) + { + TvLibrary.Log.Log.Error(message); + } + else + { + TvLibrary.Log.Log.Write(message); + } + } + + #region Private Methods + + private List<Card> GetCardsForChannel(string tvChannelName, out Channel channel, out IList tuningDetails) + { + List<Card> availableCards = new List<Card>(); + + channel = GetChannelAndTuningByDisplayName(tvChannelName, out tuningDetails); + if (channel != null + && tuningDetails.Count > 0) + { + // + // Now build a list of all available cards by getting a list of all the cards that + // can are mapped to that card. + // + IList allCards = Card.ListAll(); + foreach (Card card in allCards) + { + if (!availableCards.Contains(card) + && card.Enabled) + { + ChannelMap channelMap = null; + foreach (ChannelMap map in channel.ReferringChannelMap()) + { + if (map.ReferencedCard().DevicePath == card.DevicePath) + { + channelMap = map; + break; + } + } + if (channelMap != null) + { + availableCards.Add(card); + } + } + } + } + return availableCards; + } + + private static Card GetCardByDevicePath(string devicePath) + { + IList allCards = Card.ListAll(); + foreach (Card card in allCards) + { + if (card.DevicePath == devicePath) + { + return card; + } + } + return null; + } + + private Channel GetChannelAndTuningByDisplayName(string displayName, out IList tuningDetails) + { + Channel channel = GetChannelByDisplayName(displayName); + if (channel != null) + { + tuningDetails = channel.ReferringTuningDetail(); + return channel; + } + tuningDetails = new List<TuningDetail>(); + return null; + } + + private Channel GetChannelByDisplayName(string displayName) + { + SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Channel)); + sb.AddConstraint(Operator.Equals, "displayName", displayName); + SqlResult result = Broker.Execute(sb.GetStatement()); + if (result.Rows.Count > 0) + { + IList channels = ObjectFactory.GetCollection(typeof(Channel), result); + foreach (Channel channel in channels) + { + if (channel.VisibleInGuide) + { + return channel; + } + } + } + return null; + } + + #endregion + } +} Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/PostBuild.cmd =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/PostBuild.cmd (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/PostBuild.cmd 2008-08-26 11:38:47 UTC (rev 2092) @@ -0,0 +1,20 @@ +if %3 == Release goto reallyEnd + set pluginDir="C:\Program Files\Team MediaPortal\MediaPortal TV Server\Plugins" +IF NOT EXIST %pluginDir% goto end + net stop TvService + copy %1ForTheRecord.ServiceContracts.dll %pluginDir% + copy %1ForTheRecord.ServiceAgents.dll %pluginDir% + copy %1ForTheRecord.Entities.dll %pluginDir% + copy %1ForTheRecord.RecorderTuners.Common.dll %pluginDir% + copy %2 %pluginDir% +:end + set pluginDir="C:\Program Files (x86)\Team MediaPortal\MediaPortal TV Server\Plugins" +IF NOT EXIST %pluginDir% goto reallyEnd + net stop TvService + copy %1ForTheRecord.ServiceContracts.dll %pluginDir% + copy %1ForTheRecord.ServiceAgents.dll %pluginDir% + copy %1ForTheRecord.Entities.dll %pluginDir% + copy %1ForTheRecord.RecorderTuners.Common.dll %pluginDir% + copy %2 %pluginDir% +:reallyEnd + exit 0 Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs 2008-08-26 11:38:47 UTC (rev 2092) @@ -0,0 +1,36 @@ +using System; +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("ForTheRecord.RecorderTuners.MediaPortalTvServer")] +[assembly: AssemblyDescription("For The Record MediaPortal TV Server plugin")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ForTheRecord.RecorderTuners.MediaPortalTvServer")] +[assembly: AssemblyCopyright("Copyright © ForTheRecord 2007-2008")] +[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("59900cc9-9229-46a7-8a35-836110f9fbc1")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion(ForTheRecord.Entities.Constants.AssemblyVersion)] +[assembly: AssemblyFileVersion(ForTheRecord.Entities.Constants.AssemblyVersion)] Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2008-08-26 11:38:47 UTC (rev 2092) @@ -0,0 +1,234 @@ +/* + * Copyright (C) 2007-2008 ForTheRecord + * http://www.4therecord.eu + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ +using System; +using System.Collections.Generic; +using System.Text; +using System.IO; +using System.Threading; +using System.Diagnostics; +using System.Globalization; + +using TvLibrary.Interfaces; +using TvEngine.Events; +using TvLibrary.Log; +using TvDatabase; +using TvControl; +using Gentle.Framework; + +using ForTheRecord.Entities; +using ForTheRecord.ServiceAgents; +using ForTheRecord.RecorderTuners.Common; + +namespace ForTheRecord.RecorderTuners.MediaPortalTvServer +{ + public class RecordingThread : RecordingThreadBase + { + private static object _startRecordingLock = new object(); + + private Card _recordOnCard; + private Channel _channel; + + public RecordingThread(Guid recorderTunerId, string tvSchedulerHostName, int tvSchedulerTcpPort, CardChannelAllocation channelAllocation, + DateTime startTime, DateTime stopTime, UpcomingProgram recordingProgram, Card recordOnCard, Channel channel) + : base(recorderTunerId, tvSchedulerHostName, tvSchedulerTcpPort, channelAllocation, startTime, stopTime, recordingProgram, true) + { + _recordOnCard = recordOnCard; + _channel = channel; + } + + #region Overrides + + protected override TimeSpan? FileSizeCheckerInterval + { + get + { + return new TimeSpan(0, 5, 0); + } + } + + private User _tve3User; + private string _tve3RecordingFileName; + + protected override bool OnPrepareRecording(RecorderTunerCallbackServiceAgent callbackAgent, ref string errorMessage) + { + DeleteAllMediaPortalSchedules(); + + string userName = String.Format(CultureInfo.InvariantCulture, "ForTheRecord{0}", Thread.CurrentThread.ManagedThreadId); + _tve3User = new User(userName, true, _recordOnCard.IdCard); + _tve3User.IdChannel = _channel.IdChannel; + _tve3User.SubChannel = -1; + + return EnsureCardFree(ref errorMessage); + } + + protected override string OnStartRecording(RecorderTunerCallbackServiceAgent callbackAgent, ref string errorMessage) + { + string fileName = Path.Combine(_recordOnCard.RecordingFolder, + Common.Utility.BuildRecordingBaseFileName(null, this.RecordingProgram)); + string extension = (_recordOnCard.RecordingFormat == 0) ? ".ts" : ".mpg"; + _tve3RecordingFileName = Common.Utility.GetFreeFileName(fileName, extension); + + string uncRecordingFolder = Common.ShareExplorer.GetUncPathForLocalPath(Path.GetDirectoryName(_tve3RecordingFileName)); + if (String.IsNullOrEmpty(uncRecordingFolder)) + { + errorMessage = "Failed to convert '" + Path.GetDirectoryName(_tve3RecordingFileName) + "' to UNC path, please add required share"; + return null; + } + + if (!EnsureCardFree(ref errorMessage)) + { + return null; + } + + IChannel tuningChannel = Utility.FindTuningChannelOnCard(_channel, _recordOnCard.IdCard); + if (tuningChannel == null) + { + errorMessage = "Failed to find tuning details for channel " + _channel.DisplayName; + return null; + } + + // Make sure only one thread can tune and start a recording at the same time. + lock (_startRecordingLock) + { + if (TvServerPlugin.TvController.Tune(ref _tve3User, tuningChannel, _channel.IdChannel) != TvResult.Succeeded) + { + errorMessage = "Failed to tune to channel " + _channel.DisplayName; + return null; + } + + if (!TvServerPlugin.TvController.StartRecording(ref _tve3User, ref _tve3RecordingFileName, false, 0)) + { + errorMessage = "TV Server failed to start recording on channel " + _channel.DisplayName; + return null; + } + } + + return Path.Combine(uncRecordingFolder, Path.GetFileName(_tve3RecordingFileName)); + } + + protected override bool OnCheckRecordingActive() + { + // IMPORTANT: disabled the code below, for some reason this is *not* working! + // If _tve3User is still null, we are in the prepare phase, but we also + // consider this as good, the file will (as far as we know) still be recorded. + //return (_tve3User == null || TvServerPlugin.TvController.IsRecording(ref _tve3User)); + return true; + } + + protected override bool OnStopRecording(RecorderTunerCallbackServiceAgent callbackAgent, bool abort) + { + if (_tve3User != null) + { + if (StopMediaPortalRecording(_tve3User)) + { + _tve3User = null; + return true; + } + } + return false; + } + + protected override void OnError() + { + if (_tve3User != null + && TvServerPlugin.TvController.IsRecording(ref _tve3User)) + { + StopMediaPortalRecording(_tve3User); + } + } + + protected override void OnWriteLog(TraceEventType severity, string message) + { + if (severity == TraceEventType.Error) + { + Log.Error(message); + } + else + { + Log.Write(message); + } + } + + #endregion + + #region Private Methods + + private bool EnsureCardFree(ref string errorMessage) + { + User[] cardUsers = TvServerPlugin.TvController.GetUsersForCard(_recordOnCard.IdCard); + foreach (User cardUser in cardUsers) + { + if (!cardUser.Name.StartsWith("ForTheRecord")) + { + User tmpUser = cardUser; + if (TvServerPlugin.TvController.IsRecording(ref tmpUser)) + { + if (!TvServerPlugin.TvController.StopRecording(ref tmpUser)) + { + errorMessage = "Failed to stop recording on channel " + _channel.DisplayName; + return false; + } + } + else if (TvServerPlugin.TvController.IsTimeShifting(ref tmpUser)) + { + if (!TvServerPlugin.TvController.StopTimeShifting(ref tmpUser, TvStoppedReason.RecordingStarted)) + { + errorMessage = "Failed to stop timeshifting on channel " + _channel.DisplayName; + return false; + } + } + } + } + return true; + } + + private static void DeleteAllMediaPortalSchedules() + { + try + { + foreach (Schedule schedule in Schedule.ListAll()) + { + schedule.Delete(); + } + } + catch { } + } + + private static bool StopMediaPortalRecording(User tve3User) + { + for (int count = 0; count < 60; count++) + { + try + { + if (TvServerPlugin.TvController.StopRecording(ref tve3User)) + { + return true; + } + } + catch { } + Thread.Sleep(250); + } + return false; + } + + #endregion + } +} Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs 2008-08-26 11:38:47 UTC (rev 2092) @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ForTheRecord.RecorderTuners.MediaPortalTvServer +{ + internal static class SettingName + { + public const string ServerName = "ForTheRecord_ServerName"; + public const string Port = "ForTheRecord_Port"; + public const string ResetTvServerOnResume = "ForTheRecord_ResetTvServerOnResume"; + public const string EpgSyncOn = "ForTheRecord_EpgSyncOn"; + public const string EpgSyncAutoCreateChannels = "ForTheRecord_EpgSyncAutoCreateChannels"; + public const string EpgSyncAllHours = "ForTheRecord_EpgSyncAllHours"; + public const string RecorderTunerTcpPort = "ForTheRecord_RecorderTunerTcpPort"; + } +} Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.Designer.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.Designer.cs (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.Designer.cs 2008-08-26 11:38:47 UTC (rev 2092) @@ -0,0 +1,612 @@ +namespace ForTheRecord.RecorderTuners.MediaPortalTvServer +{ + + partial class SetupForm + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SetupForm)); + this._tvSchedulerGroupBox = new System.Windows.Forms.GroupBox(); + this._connectButton = new System.Windows.Forms.Button(); + this._portNumericUpDown = new System.Windows.Forms.NumericUpDown(); + this._tcpPortLabel = new System.Windows.Forms.Label(); + this._restartTcpLabel = new System.Windows.Forms.Label(); + this._serverTextBox = new System.Windows.Forms.TextBox(); + this._pluginTcpNumericUpDown = new System.Windows.Forms.NumericUpDown(); + this._serverLabel = new System.Windows.Forms.Label(); + this._pluginTcpLabel = new System.Windows.Forms.Label(); + this._channelMappingGroupBox = new System.Windows.Forms.GroupBox(); + this._channelsPanel = new System.Windows.Forms.Panel(); + this._refreshChannelsButton = new System.Windows.Forms.Button(); + this._channelsDataGridView = new System.Windows.Forms.DataGridView(); + this._tvSchedulerChannelColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this._mediaPortalChannelColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this._channelItemsBindingSource = new System.Windows.Forms.BindingSource(this.components); + this._notConnectedPanel = new System.Windows.Forms.Panel(); + this._notConnectedLabel = new System.Windows.Forms.Label(); + this._generalGroupBox = new System.Windows.Forms.GroupBox(); + this._createUncShareButton = new System.Windows.Forms.Button(); + this._refreshUncButton = new System.Windows.Forms.Button(); + this._uncPathsDataGridView = new System.Windows.Forms.DataGridView(); + this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this._uncPathsBindingSource = new System.Windows.Forms.BindingSource(this.components); + this._syncInfoLabel = new System.Windows.Forms.Label(); + this._hoursLabel = new System.Windows.Forms.Label(); + this._allProgramsHoursNumericUpDown = new System.Windows.Forms.NumericUpDown(); + this._allProgramsEveryLabel = new System.Windows.Forms.Label(); + this._syncTve3EpgcheckBox = new System.Windows.Forms.CheckBox(); + this._epgGroupBox = new System.Windows.Forms.GroupBox(); + this._epgAutoCreateChannelsCheckBox = new System.Windows.Forms.CheckBox(); + this._tabControl = new System.Windows.Forms.TabControl(); + this._configTabPage = new System.Windows.Forms.TabPage(); + this._powerGroupBox = new System.Windows.Forms.GroupBox(); + this._restartOnResumeCheckBox = new System.Windows.Forms.CheckBox(); + this._channelsTabPage = new System.Windows.Forms.TabPage(); + this._tvSchedulerGroupBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this._portNumericUpDown)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this._pluginTcpNumericUpDown)).BeginInit(); + this._channelMappingGroupBox.SuspendLayout(); + this._channelsPanel.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this._channelsDataGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this._channelItemsBindingSource)).BeginInit(); + this._notConnectedPanel.SuspendLayout(); + this._generalGroupBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this._uncPathsDataGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this._uncPathsBindingSource)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this._allProgramsHoursNumericUpDown)).BeginInit(); + this._epgGroupBox.SuspendLayout(); + this._tabControl.SuspendLayout(); + this._configTabPage.SuspendLayout(); + this._powerGroupBox.SuspendLayout(); + this._channelsTabPage.SuspendLayout(); + this.SuspendLayout(); + // + // _tvSchedulerGroupBox + // + this._tvSchedulerGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._tvSchedulerGroupBox.Controls.Add(this._connectButton); + this._tvSchedulerGroupBox.Controls.Add(this._portNumericUpDown); + this._tvSchedulerGroupBox.Controls.Add(this._tcpPortLabel); + this._tvSchedulerGroupBox.Cont... [truncated message content] |
From: <do...@us...> - 2008-08-26 12:09:55
|
Revision: 2093 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=2093&view=rev Author: dot-i Date: 2008-08-26 12:09:39 +0000 (Tue, 26 Aug 2008) Log Message: ----------- Added ForTheRecord.UI.MediaPortal and ForTheRecord.UI.Process projects. Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln Added Paths: ----------- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordHome.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordHome2.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/PostBuild.cmd trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Resources/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Resources/GlobalText.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Resources/GlobalText.nl.resx trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Resources/GlobalText.resx trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.resx trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVConflicts.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVOverlay.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVPriorities.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVRecordedInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVScheduler.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVSearch.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVTuningDetails.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVZapOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvChannelSettings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvCropManager.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvCropSettings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvEpgSettings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideDialog.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvMiniGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvNewScheduleSearch.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvNewScheduleSearchType.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvNotifyManager.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvProgramInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvRecorded.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvRecordingSettings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvSetup.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvSetupAudioLanguageForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvSetupAudioLanguageForm.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvSetupAudioLanguageForm.resx trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvSetupForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvSetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvSetupForm.resx trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/WindowId.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_Active.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_FullScreen.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_RecordedTvInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR__FullScreen.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR__Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR__ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR__RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR__TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR__dialogTvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_dialogTvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_Alert.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_AlertCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_AlertSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_AlertSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_Recording.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_RecordingCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_RecordingInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_RecordingSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_RecordingSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_RecordingSeriesInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_RecordingSeriesWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_RecordingWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_Suggestion.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_SuggestionCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_SuggestionSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_SuggestionSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_Active.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_FullScreen.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_RecordedTvInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR__FullScreen.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR__Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR__ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR__RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR__TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR__dialogTvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_dialogTvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_Alert.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_AlertCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_AlertSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_AlertSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_Recording.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_RecordingCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_RecordingInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_RecordingSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_RecordingSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_RecordingSeriesInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_RecordingSeriesWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_RecordingWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_Suggestion.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_SuggestionCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_SuggestionSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_SuggestionSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_Active.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_FullScreen.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_RecordedTvInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR__FullScreen.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR__Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR__ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR__RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR__TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR__dialogTvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_dialogTvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_Alert.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_AlertCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_AlertSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_AlertSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_Recording.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_RecordingCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_RecordingInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_RecordingSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_RecordingSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_RecordingSeriesInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_RecordingSeriesWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_RecordingWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_Suggestion.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_SuggestionCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_SuggestionSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_SuggestionSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_Active.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_FullScreen.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_RecordedTvInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR__FullScreen.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR__Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR__ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR__RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR__TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR__dialogTvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_dialogTvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_Alert.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_AlertCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_AlertSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_AlertSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_Recording.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_RecordingCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_RecordingInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_RecordingSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_RecordingSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_RecordingSeriesInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_RecordingSeriesWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_RecordingWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_Suggestion.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_SuggestionCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_SuggestionSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_SuggestionSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/ trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/TitleRuleTypeIndex.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ForTheRecord.UI.Process.csproj trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/KeepUntilControlUtility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ProcessUtility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Properties/ trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/RecorderTuners.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Recordings/ trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Recordings/RecordingsController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Recordings/RecordingsModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SerializableDictionary.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SortableBindingList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvGuide/ trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvGuide/TvGuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvGuide/TvGuideModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvGuide/TvGuideUpcomingProgram.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingProgramsList.cs Modified: trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln 2008-08-26 11:38:47 UTC (rev 2092) +++ trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln 2008-08-26 12:09:39 UTC (rev 2093) @@ -7,6 +7,10 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForTheRecord.RecorderTuners.MediaPortalTvServer", "ForTheRecord.RecorderTuners.MediaPortalTvServer\ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj", "{6CF22F4E-FFFD-448D-A1A8-2156CB0133ED}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForTheRecord.UI.Process", "ForTheRecord.UI.Process\ForTheRecord.UI.Process.csproj", "{A35F0ED7-98ED-4EE2-99C6-EA2AF880F8CD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForTheRecord.UI.MediaPortal", "ForTheRecord.UI.MediaPortal\ForTheRecord.UI.MediaPortal.csproj", "{1526A789-1DE2-4A8B-AA4B-5382A617C4F8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -17,11 +21,21 @@ {6CF22F4E-FFFD-448D-A1A8-2156CB0133ED}.Debug|Any CPU.Build.0 = Debug|Any CPU {6CF22F4E-FFFD-448D-A1A8-2156CB0133ED}.Release|Any CPU.ActiveCfg = Release|Any CPU {6CF22F4E-FFFD-448D-A1A8-2156CB0133ED}.Release|Any CPU.Build.0 = Release|Any CPU + {A35F0ED7-98ED-4EE2-99C6-EA2AF880F8CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A35F0ED7-98ED-4EE2-99C6-EA2AF880F8CD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A35F0ED7-98ED-4EE2-99C6-EA2AF880F8CD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A35F0ED7-98ED-4EE2-99C6-EA2AF880F8CD}.Release|Any CPU.Build.0 = Release|Any CPU + {1526A789-1DE2-4A8B-AA4B-5382A617C4F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1526A789-1DE2-4A8B-AA4B-5382A617C4F8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1526A789-1DE2-4A8B-AA4B-5382A617C4F8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1526A789-1DE2-4A8B-AA4B-5382A617C4F8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {6CF22F4E-FFFD-448D-A1A8-2156CB0133ED} = {84E6B02A-0674-4406-911E-88CAB7CE17E6} + {A35F0ED7-98ED-4EE2-99C6-EA2AF880F8CD} = {2A217BB8-A9FF-4013-ACAC-B1D1EBB39349} + {1526A789-1DE2-4A8B-AA4B-5382A617C4F8} = {2A217BB8-A9FF-4013-ACAC-B1D1EBB39349} EndGlobalSection EndGlobal Added: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2008-08-26 12:09:39 UTC (rev 2093) @@ -0,0 +1,621 @@ +#region Copyright (C) 2005-2008 Team MediaPortal + +/* + * Copyright (C) 2005-2008 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Threading; + +using MediaPortal.Dialogs; +using MediaPortal.GUI.Library; +using MediaPortal.Player; +using MediaPortal.Services; +using MediaPortal.Threading; +using MediaPortal.Util; +using MediaPortal.Configuration; +using Toub.MediaCenter.Dvrms.Metadata; + +using ForTheRecord.Entities; +using ForTheRecord.ServiceAgents; +using ForTheRecord.ServiceContracts; +using ForTheRecord.UI.Process.Recordings; +using ForTheRecord.UI.MediaPortal.Resources; + +namespace ForTheRecord.UI.MediaPortal +{ + public class ActiveRecordings : GUIWindow, IComparer<GUIListItem> + { + #region variables + + private enum SortMethod + { + Channel = 0, + Date = 1, + Name = 2, + Genre = 3, + Played = 4, + Duration = 5 + } + + private SortMethod _currentSortMethod = SortMethod.Date; + + private bool _sortAscending = true; + private int _selectedItemIndex; + + [SkinControl(10)] + protected GUIListControl _viewsList; + + #endregion + + public ActiveRecordings() + { + GetID = (int)WindowId.ActiveRecordings; + } + + #region Service Agents + + private TvSchedulerServiceAgent _tvSchedulerAgent; + + public ITvSchedulerService TvSchedulerAgent + { + get + { + if (_tvSchedulerAgent == null) + { + _tvSchedulerAgent = new TvSchedulerServiceAgent(); + } + return _tvSchedulerAgent; + } + } + + private TvGuideServiceAgent _tvGuideAgent; + + public ITvGuideService TvGuideAgent + { + get + { + if (_tvGuideAgent == null) + { + _tvGuideAgent = new TvGuideServiceAgent(); + } + return _tvGuideAgent; + } + } + + private TvControlServiceAgent _tvControlAgent; + + public ITvControlService TvControlAgent + { + get + { + if (_tvControlAgent == null) + { + _tvControlAgent = new TvControlServiceAgent(); + } + return _tvControlAgent; + } + } + + private ConfigurationServiceAgent _configurationAgent; + + public IConfigurationService ConfigurationAgent + { + get + { + if (_configurationAgent == null) + { + _configurationAgent = new ConfigurationServiceAgent(); + } + return _configurationAgent; + } + } + + #endregion + + public override void OnAdded() + { + Log.Info("ActiveRecordings:OnAdded"); + Restore(); + PreInit(); + ResetAllControls(); + } + + public override bool IsTv + { + get { return true; } + } + + #region Serialisation + + private void LoadSettings() + { + } + + private void SaveSettings() + { + } + + #endregion + + #region overrides + + public override bool Init() + { + bool bResult = Load(GUIGraphicsContext.Skin + @"\4TR_Active.xml"); + LoadSettings(); + Restore(); + PreInit(); + ResetAllControls(); + return bResult; + } + + public override void OnAction(Action action) + { + switch (action.wID) + { + case Action.ActionType.ACTION_DELETE_ITEM: + { + int itemIndex = GetSelectedItemNo(); + if (itemIndex >= 0) + { + OnAbortRecording(GetItem(itemIndex)); + } + } + break; + } + base.OnAction(action); + } + + protected override void OnPageDestroy(int newWindowId) + { + _selectedItemIndex = GetSelectedItemNo(); + SaveSettings(); + if (_tvSchedulerAgent != null) + { + _tvSchedulerAgent.Dispose(); + } + if (_tvGuideAgent != null) + { + _tvGuideAgent.Dispose(); + } + if (_tvControlAgent != null) + { + _tvControlAgent.Dispose(); + } + if (_configurationAgent != null) + { + _configurationAgent.Dispose(); + } + base.OnPageDestroy(newWindowId); + } + + protected override void OnPageLoad() + { + base.OnPageLoad(); + + LoadSettings(); + LoadActiveRecordings(); + + GUIControl.FocusControl(GetID, 10); + + //_sortByButton.SortChanged += new SortEventHandler(SortChanged); + } + + protected override void OnClicked(int controlId, GUIControl control, global::MediaPortal.GUI.Library.Action.ActionType actionType) + { + base.OnClicked(controlId, control, actionType); + + if (control == _viewsList) + { + GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECTED, GetID, 0, control.GetID, 0, 0, null); + OnMessage(msg); + int iItem = (int)msg.Param1; + if (actionType == Action.ActionType.ACTION_SELECT_ITEM) + { + OnPlayRecording(iItem); + } + if (actionType == Action.ActionType.ACTION_SHOW_INFO) + { + OnShowContextMenu(); + } + } + } + + public override bool OnMessage(GUIMessage message) + { + switch (message.Message) + { + case GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS_CHANGED: + UpdateProperties(); + break; + } + return base.OnMessage(message); + } + + protected override void OnShowContextMenu() + { + int iItem = GetSelectedItemNo(); + GUIListItem pItem = GetItem(iItem); + if (pItem == null) return; + if (pItem.IsFolder) return; + ActiveRecording activeRecording = pItem.TVTag as ActiveRecording; + if (activeRecording != null) + { + GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); + if (dlg == null) return; + dlg.Reset(); + dlg.SetHeading(activeRecording.Program.Title); + dlg.AddLocalizedString(655); //Play recorded tv + dlg.AddLocalizedString(1449); //Stop recording + dlg.DoModal(GetID); + switch (dlg.SelectedId) + { + case 655: // Play + OnPlayRecording(activeRecording); + break; + + case 1449: // Abort + OnAbortRecording(pItem); + break; + } + } + } + + private void OnAbortRecording(GUIListItem item) + { + if (item == null) return; + ActiveRecording activeRecording = item.TVTag as ActiveRecording; + if (activeRecording != null) + { + GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); + if (dlgYesNo != null) + { + UpcomingProgram program = activeRecording.Program; + + dlgYesNo.SetHeading(GUILocalizeStrings.Get(1449)); + dlgYesNo.SetLine(1, program.TvChannel.DisplayName); + dlgYesNo.SetLine(2, program.Title); + dlgYesNo.SetLine(3, string.Empty); + dlgYesNo.SetDefaultToYes(false); + dlgYesNo.DoModal(GetID); + + if (dlgYesNo.IsConfirmed) + { + this.TvSchedulerAgent.CancelUpcomingProgram(program.TvScheduleId, program.GuideProgramId, + program.TvChannel.TvChannelId, program.StartTime); + _viewsList.ListItems.Remove(item); + GUIControl.RefreshControl(GetID, _viewsList.GetID); + UpdateProperties(); + _selectedItemIndex = GetSelectedItemNo(); + } + } + } + } + + private bool OnPlayRecording(int itemIndex) + { + GUIListItem item = GetItem(itemIndex); + if (item == null) return false; + + ActiveRecording activeRecording = item.TVTag as ActiveRecording; + if (activeRecording != null) + { + return OnPlayRecording(activeRecording); + } + return false; + } + + private bool OnPlayRecording(ActiveRecording activeRecording) + { + TvRecording recording = this.TvControlAgent.GetRecordingById(activeRecording.TvRecordingId); + if (recording != null) + { + TvRecorded.PlayRecording(recording); + return true; + } + return false; + } + + public override void Process() + { + base.Process(); + } + + #endregion + + #region recording methods + + private void LoadActiveRecordings() + { + string strDefaultUnseenIcon = GUIGraphicsContext.Skin + @"\Media\defaultVideoBig.png"; + string strDefaultSeenIcon = GUIGraphicsContext.Skin + @"\Media\defaultVideoSeenBig.png"; + GUIControl.ClearControl(GetID, _viewsList.GetID); + + List<ActiveRecording> activeRecordings = new List<ActiveRecording>( + this.TvControlAgent.GetActiveRecordings()); + foreach (ActiveRecording recording in activeRecordings) + { + GUIListItem item = CreateListItem(recording); + _viewsList.Add(item); + } + + string strObjects = string.Format("{0} {1}", _viewsList.Count, GlobalText.RecordingsListItemsSuffix); + GUIPropertyManager.SetProperty("#itemcount", strObjects); + + GUIControl cntlLabel = GetControl(12); + cntlLabel.YPosition = _viewsList.SpinY; + + UpdateButtonStates(); // OnSort(); + UpdateProperties(); + + if (GetItemCount() > 0) + { + while (_selectedItemIndex >= GetItemCount() && _selectedItemIndex > 0) + { + _selectedItemIndex--; + } + GUIControl.SelectItemControl(GetID, _viewsList.GetID, _selectedItemIndex); + } + } + + private GUIListItem CreateListItem(ActiveRecording activeRecording) + { + GUIListItem item = new GUIListItem(); + string title = activeRecording.Program.CreateProgramTitle(); + item.Label = title; + //item.OnItemSelected += new global::MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected); + string logoImagePath = Utility.GetLogoImage(activeRecording.Program.TvChannel, TvSchedulerAgent); + if (!System.IO.File.Exists(logoImagePath)) + { + item.Label = String.Format("[{0}] {1}", activeRecording.Program.TvChannel.DisplayName, title); + logoImagePath = "defaultVideoBig.png"; + } + item.PinImage = Utility.GetIconImageFileName(activeRecording); + item.TVTag = activeRecording; + item.ThumbnailImage = logoImagePath; + item.IconImageBig = logoImagePath; + item.IconImage = logoImagePath; + item.Label2 = String.Format("{0} {1} - {2}", Utility.GetShortDayDateString(activeRecording.Program.StartTime), + activeRecording.Program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), + activeRecording.Program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); + return item; + } + + private void UpdateButtonStates() + { + //_sortByButton.IsAscending = _sortAscending; + _viewsList.IsVisible = true; + } + + private void UpdateProperties() + { + ActiveRecording recording = null; + GUIListItem item = GetItem(GetSelectedItemNo()); + if (item != null) + { + recording = item.TVTag as ActiveRecording; + } + SetProperties(recording); + } + + private void SetProperties(ActiveRecording recording) + { + if (recording == null) + { + GUIPropertyManager.SetProperty("#TV.Active.Title", String.Empty); + GUIPropertyManager.SetProperty("#TV.Active.Genre", String.Empty); + GUIPropertyManager.SetProperty("#TV.Active.Time", String.Empty); + GUIPropertyManager.SetProperty("#TV.Active.Description", " "); + GUIPropertyManager.SetProperty("#TV.Active.thumb", String.Empty); + } + else + { + GuideProgram guideProgram = recording.Program.GuideProgramId.HasValue ? + this.TvGuideAgent.GetProgramById(recording.Program.GuideProgramId.Value) : null; + + string strTime = string.Format("{0} {1} - {2}", + Utility.GetShortDayDateString(recording.Program.StartTime), + recording.Program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), + recording.Program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); + + GUIPropertyManager.SetProperty("#TV.Active.Title", recording.Program.Title); + GUIPropertyManager.SetProperty("#TV.Active.Genre", recording.Program.Category); + GUIPropertyManager.SetProperty("#TV.Active.Time", strTime); + GUIPropertyManager.SetProperty("#TV.Active.Description", Utility.GetComposedDescription( + recording.Program.CreateEpisodeTitle(), guideProgram == null ? String.Empty : guideProgram.Description)); + + string logo = Utility.GetLogoImage(recording.Program.TvChannel.TvChannelId, + recording.Program.TvChannel.DisplayName, TvSchedulerAgent); + if (System.IO.File.Exists(logo)) + { + GUIPropertyManager.SetProperty("#TV.Active.thumb", logo); + } + else + { + GUIPropertyManager.SetProperty("#TV.Active.thumb", "defaultVideoBig.png"); + } + } + } + + #endregion + + #region Album/List View Management + + private GUIListItem GetSelectedItem() + { + int controlId = _viewsList.GetID; + return GUIControl.GetSelectedListItem(GetID, controlId); + } + + private GUIListItem GetItem(int iItem) + { + if (iItem < 0 || iItem >= GetItemCount()) + { + return null; + } + return _viewsList[iItem]; + } + + private int GetSelectedItemNo() + { + int controlId = _viewsList.GetID; + GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECTED, GetID, 0, controlId, 0, 0, null); + OnMessage(msg); + return (int)msg.Param1; + } + + private int GetItemCount() + { + return _viewsList.Count; + } + + #endregion + + #region Sort Members + + private void OnSort() + { + _viewsList.Sort(this); + UpdateButtonStates(); + } + + public int Compare(GUIListItem item1, GUIListItem item2) + { + int result = 0; + + int resultLower = _sortAscending ? -1 : 1; + int resultUpper = -resultLower; + + if (item1 == item2 || item1 == null || item2 == null) + { + return 0; + } + if (item1.IsFolder && !item2.IsFolder) + { + return -1; + } + else if (!item1.IsFolder && item2.IsFolder) + { + return 1; + } + else if (item1.IsFolder && item2.IsFolder) + { + switch (_currentSortMethod) + { + case SortMethod.Name: + result = resultUpper * String.Compare(item1.Label, item2.Label, true); + if (result == 0) + { + goto case SortMethod.Channel; + } + break; + + case SortMethod.Channel: + case SortMethod.Played: + case SortMethod.Date: + case SortMethod.Genre: + TvRecordingGroup group1 = item1.TVTag as TvRecordingGroup; + TvRecordingGroup group2 = item2.TVTag as TvRecordingGroup; + result = (group1.LatestProgramStartTime < group1.LatestProgramStartTime) ? resultUpper : resultLower; + break; + } + } + else + { + TvRecording rec1 = item1.TVTag as TvRecording; + TvRecording rec2 = item2.TVTag as TvRecording; + + switch (_currentSortMethod) + { + case SortMethod.Played: + //item1.Label2 = string.Format("{0} {1}", rec1.TimesWatched, GUILocalizeStrings.Get(677));//times + //item2.Label2 = string.Format("{0} {1}", rec2.TimesWatched, GUILocalizeStrings.Get(677));//times + if (rec1.LastWatchedPosition == rec2.LastWatchedPosition) + { + goto case SortMethod.Name; + } + result = rec2.LastWatchedPosition.HasValue ? resultUpper : resultLower; + break; + + case SortMethod.Name: + result = resultUpper * String.Compare(rec1.CreateProgramTitle(), rec2.CreateProgramTitle(), true); + if (result == 0) + { + goto case SortMethod.Channel; + } + break; + + case SortMethod.Channel: + result = resultUpper * String.Compare(rec1.TvChannelDisplayName, rec2.TvChannelDisplayName, true); + if (result == 0) + { + goto case SortMethod.Date; + } + break; + + case SortMethod.Date: + if (rec1.ProgramStartTime != rec2.ProgramStartTime) + { + result = (rec1.ProgramStartTime < rec2.ProgramStartTime) ? resultUpper : resultLower; + } + break; + + case SortMethod.Genre: + item1.Label2 = rec1.Category; + item2.Label2 = rec2.Category; + result = resultUpper * String.Compare(rec1.Category, rec2.Category, true); + if (result == 0) + { + if (rec1.ProgramStartTime != rec2.ProgramStartTime) + { + result = (rec1.ProgramStartTime < rec2.ProgramStartTime) ? resultUpper : resultLower; + } + else if (rec1.TvChannelId != rec2.TvChannelId) + { + result = resultUpper * String.Compare(rec1.TvChannelDisplayName, rec2.TvChannelDisplayName); + } + else + { + result = resultUpper * String.Compare(rec1.CreateProgramTitle(), rec2.CreateProgramTitle()); + } + } + break; + } + } + + return result; + } + + void SortChanged(object sender, SortEventArgs e) + { + _sortAscending = e.Order != System.Windows.Forms.SortOrder.Descending; + OnSort(); + } + + #endregion + } +} Added: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj 2008-08-26 12:09:39 UTC (rev 2093) @@ -0,0 +1,310 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{1526A789-1DE2-4A8B-AA4B-5382A617C4F8}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>ForTheRecord.UI.MediaPortal</RootNamespace> + <AssemblyName>ForTheRecord.UI.MediaPortal</AssemblyName> + <SccProjectName> + </SccProjectName> + <SccLocalPath> + </SccLocalPath> + <SccAuxPath> + </SccAuxPath> + <SccProvider> + </SccProvider> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <IsWebBootstrapper>false</IsWebBootstrapper> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> + <TargetFrameworkVersion>v3.0</TargetFrameworkVersion> + <TargetFrameworkSubset> + </TargetFrameworkSubset> + </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> + <PlatformTarget>x86</PlatformTarget> + </PropertyGroup> + <ItemGroup> + <Reference Include="Core, Version=0.2.3.18279, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\Core.dll</HintPath> + </Reference> + <Reference Include="Databases, Version=0.2.3.18279, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\Databases.dll</HintPath> + </Reference> + <Reference Include="Dialogs, Version=0.2.3.18279, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\Dialogs.dll</HintPath> + </Reference> + <Reference Include="ForTheRecord.Entities, Version=1.2.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\ForTheRecord.Entities.dll</HintPath> + </Reference> + <Reference Include="ForTheRecord.ServiceAgents, Version=1.2.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\ForTheRecord.ServiceAgents.dll</HintPath> + </Reference> + <Reference Include="ForTheRecord.ServiceContracts, Version=1.2.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\ForTheRecord.ServiceContracts.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\Program Files\Reference Assemblies\Microsoft\WinFX\v3.0\System.Runtime.Remoting.dll</HintPath> + </Reference> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + <Reference Include="Utils, Version=0.2.3.18279, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\ReferencedAssemblies\Utils.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="ActiveRecordings.cs" /> + <Compile Include="UpcomingPrograms.cs" /> + <Compile Include="Resources\GlobalText.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>GlobalText.resx</DependentUpon> + </Compile> + <Compile Include="SetupForm.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="SetupForm.Designer.cs"> + <DependentUpon>SetupForm.cs</DependentUpon> + </Compile> + <Compile Include="ForTheRecordHome.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="TvFullScreen.cs" /> + <Compile Include="TvGuide.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="TvGuideBase.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="TvGuideDialog.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="TvProgramInfo.cs" /> + <Compile Include="TvRecorded.cs" /> + <Compile Include="Utility.cs" /> + <Compile Include="WindowId.cs" /> + </ItemGroup> + <ItemGroup> + <Content Include="skin\BlueTwo wide\4TR_FullScreen.xml" /> + <Content Include="skin\BlueTwo wide\4TR_dialogTvGuide.xml" /> + <Content Include="skin\BlueTwo wide\4TR_Home.xml" /> + <Content Include="skin\BlueTwo wide\4TR_TvGuide.xml" /> + <Content Include="skin\BlueTwo wide\4TR_Upcoming.xml" /> + <Content Include="skin\BlueTwo wide\4TR_Active.xml" /> + <Content Include="skin\BlueTwo wide\4TR__Home.xml" /> + <Content Include="skin\BlueTwo wide\4TR__TvGuide.xml" /> + <Content Include="skin\BlueTwo wide\4TR__ProgramInfo.xml" /> + <Content Include="skin\BlueTwo wide\4TR__dialogTvGuide.xml" /> + <Content Include="skin\BlueTwo wide\4TR__FullScreen.xml" /> + <Content Include="skin\BlueTwo wide\4TR__RecordedTv.xml" /> + <Content Include="skin\BlueTwo wide\Media\4TR_Alert.png" /> + <Content Include="skin\BlueTwo wide\Media\4TR_AlertCancelled.png" /> + <Content Include="skin\BlueTwo wide\Media\4TR_AlertSeries.png" /> + <Content Include="skin\BlueTwo wide\Media\4TR_AlertSeriesCancelled.png" /> + <Content Include="skin\BlueTwo wide\Media\4TR_Recording.png" /> + <Content Include="skin\BlueTwo wide\Media\4TR_RecordingCancelled.png" /> + <Content Include="skin\BlueTwo wide\Media\4TR_RecordingInConflict.png" /> + <Content Include="skin\BlueTwo wide\Media\4TR_RecordingSeries.png" /> + <Content Include="skin\BlueTwo wide\Media\4TR_RecordingSeriesCancelled.png" /> + <Content Include="skin\BlueTwo wide\Media\4TR_RecordingSeriesInConflict.png" /> + <Content Include="skin\BlueTwo wide\Media\4TR_RecordingSeriesWithWarning.png" /> + <Content Include="skin\BlueTwo wide\Media\4TR_RecordingWithWarning.png" /> + <Content Include="skin\BlueTwo wide\4TR_ProgramInfo.xml" /> + <Content Include="skin\BlueTwo wide\4TR_RecordedTvInfo.xml" /> + <Content Include="skin\BlueTwo wide\4TR_RecordedTv.xml" /> + <Content Include="skin\BlueTwo wide\Media\4TR_Suggestion.png" /> + <Content Include="skin\BlueTwo wide\Media\4TR_SuggestionCancelled.png" /> + <Content Include="skin\BlueTwo wide\Media\4TR_SuggestionSeries.png" /> + <Content Include="skin\BlueTwo wide\Media\4TR_SuggestionSeriesCancelled.png" /> + <Content Include="skin\BlueTwo\4TR_FullScreen.xml" /> + <Content Include="skin\BlueTwo\4TR_dialogTvGuide.xml" /> + <Content Include="skin\BlueTwo\4TR_Home.xml" /> + <Content Include="skin\BlueTwo\4TR_TvGuide.xml" /> + <Content Include="skin\BlueTwo\4TR_Upcoming.xml" /> + <Content Include="skin\BlueTwo\4TR_Active.xml" /> + <Content Include="skin\BlueTwo\4TR__TvGuide.xml" /> + <Content Include="skin\BlueTwo\4TR__Home.xml" /> + <Content Include="skin\BlueTwo\4TR__ProgramInfo.xml" /> + <Content Include="skin\BlueTwo\4TR__dialogTvGuide.xml" /> + <Content Include="skin\BlueTwo\4TR__FullScreen.xml" /> + <Content Include="skin\BlueTwo\4TR__RecordedTv.xml" /> + <Content Include="skin\BlueTwo\Media\4TR_AlertSeries.png" /> + <Content Include="skin\BlueTwo\Media\4TR_AlertSeriesCancelled.png" /> + <Content Include="skin\BlueTwo\Media\4TR_Recording.png" /> + <Content Include="skin\BlueTwo\Media\4TR_RecordingSeries.png" /> + <Content Include="skin\BlueTwo\Media\4TR_RecordingInConflict.png" /> + <Content Include="skin\BlueTwo\Media\4TR_Alert.png" /> + <Content Include="skin\BlueTwo\Media\4TR_AlertCancelled.png" /> + <Content Include="skin\BlueTwo\Media\4TR_RecordingWithWarning.png" /> + <Content Include="skin\BlueTwo\Media\4TR_RecordingSeriesInConflict.png" /> + <Content Include="skin\BlueTwo\Media\4TR_RecordingSeriesCancelled.png" /> + <Content Include="skin\BlueTwo\Media\4TR_RecordingSeriesWithWarning.png" /> + <Content Include="skin\BlueTwo\Media\4TR_RecordingCancelled.png" /> + <Content Include="skin\BlueTwo\4TR_ProgramInfo.xml" /> + <Content Include="skin\BlueTwo\4TR_RecordedTvInfo.xml" /> + <Content Include="skin\BlueTwo\4TR_RecordedTv.xml" /> + <Content Include="skin\BlueTwo\Media\4TR_Suggestion.png" /> + <Content Include="skin\BlueTwo\Media\4TR_SuggestionCancelled.png" /> + <Content Include="skin\BlueTwo\Media\4TR_SuggestionSeries.png" /> + <Content Include="skin\BlueTwo\Media\4TR_SuggestionSeriesCancelled.png" /> + <Content Include="skin\Indigo\4TR_Active.xml" /> + <Content Include="skin\Indigo\4TR_dialogTvGuide.xml" /> + <Content Include="skin\Indigo\4TR_FullScreen.xml" /> + <Content Include="skin\Indigo\4TR_Home.xml" /> + <Content Include="skin\Indigo\4TR_ProgramInfo.xml" /> + <Content Include="skin\Indigo\4TR_RecordedTv.xml" /> + <Content Include="skin\Indigo\4TR_RecordedTvInfo.xml" /> + <Content Include="skin\Indigo\4TR_TvGuide.xml" /> + <Content Include="skin\Indigo\4TR_Upcoming.xml" /> + <Content Include="skin\Indigo\4TR__dialogTvGuide.xml" /> + <Content Include="skin\Indigo\4TR__FullScreen.xml" /> + <Content Include="skin\Indigo\4TR__Home.xml" /> + <Content Include="skin\Indigo\4TR__ProgramInfo.xml" /> + <Content Include="skin\Indigo\4TR__RecordedTv.xml" /> + <Content Include="skin\Indigo\4TR__TvGuide.xml" /> + <Content Include="skin\Indigo\Media\4TR_Alert.png" /> + <Content Include="skin\Indigo\Media\4TR_AlertCancelled.png" /> + <Content Include="skin\Indigo\Media\4TR_AlertSeries.png" /> + <Content Include="skin\Indigo\Media\4TR_AlertSeriesCancelled.png" /> + <Content Include="skin\Indigo\Media\4TR_Recording.png" /> + <Content Include="skin\Indigo\Media\4TR_RecordingCancelled.png" /> + <Content Include="skin\Indigo\Media\4TR_RecordingInConflict.png" /> + <Content Include="skin\Indigo\Media\4TR_RecordingSeries.png" /> + <Content Include="skin\Indigo\Media\4TR_RecordingSeriesCancelled.png" /> + <Content Include="skin\Indigo\Media\4TR_RecordingSeriesInConflict.png" /> + <Content Include="skin\Indigo\Media\4TR_RecordingSeriesWithWarning.png" /> + <Content Include="skin\Indigo\Media\4TR_RecordingWithWarning.png" /> + <Content Include="skin\Indigo\Media\4TR_Suggestion.png" /> + <Content Include="skin\Indigo\Media\4TR_SuggestionCancelled.png" /> + <Content Include="skin\Indigo\Media\4TR_SuggestionSeries.png" /> + <Content Include="skin\Indigo\Media\4TR_SuggestionSeriesCancelled.png" /> + <Content Include="skin\Monochrome\4TR_Active.xml" /> + <Content Include="skin\Monochrome\4TR_dialogTvGuide.xml" /> + <Content Include="skin\Monochrome\4TR_FullScreen.xml" /> + <Content Include="skin\Monochrome\4TR_Home.xml" /> + <Content Include="skin\Monochrome\4TR_ProgramInfo.xml" /> + <Content Include="skin\Monochrome\4TR_RecordedTv.xml" /> + <Content Include="skin\Monochrome\4TR_RecordedTvInfo.xml" /> + <Content Include="skin\Monochrome\4TR_TvGuide.xml" /> + <Content Include="skin\Monochrome\4TR_Upcoming.xml" /> + <Content Include="skin\Monochrome\4TR__dialogTvGuide.xml" /> + <Content Include="skin\Monochrome\4TR__FullScreen.xml" /> + <Content Include="skin\Monochrome\4TR__Home.xml" /> + <Content Include="skin\Monochrome\4TR__ProgramInfo.xml" /> + <Content Include="skin\Monochrome\4TR__RecordedTv.xml" /> + <Content Include="skin\Monochrome\4TR__TvGuide.xml" /> + <Content Include="skin\Monochrome\Media\4TR_Alert.png" /> + <Content Include="skin\Monochrome\Media\4TR_AlertCancelled.png" /> + <Content Include="skin\Monochrome\Media\4TR_AlertSeries.png" /> + <Content Include="skin\Monochrome\Media\4TR_AlertSeriesCancelled.png" /> + <Content Include="skin\Monochrome\Media\4TR_Recording.png" /> + <Content Include="skin\Monochrome\Media\4TR_RecordingCancelled.png" /> + <Content Include="skin\Monochrome\Media\4TR_RecordingInConflict.png" /> + <Content Include="skin\Monochrome\Media\4TR_RecordingSeries.png" /> + <Content Include="skin\Monochrome\Media\4TR_RecordingSeriesCancelled.png" /> + <Content Include="skin\Monochrome\Media\4TR_RecordingSeriesInConflict.png" /> + <Content Include="skin\Monochrome\Media\4TR_RecordingSeriesWithWarning.png" /> + <Content Include="skin\Monochrome\Media\4TR_RecordingWithWarning.png" /> + <Content Include="skin\Monochrome\Media\4TR_Suggestion.png" /> + <Content Include="skin\Monochrome\Media\4TR_SuggestionCancelled.png" /> + <Content Include="skin\Monochrome\Media\4TR_SuggestionSeries.png" /> + <Content Include="skin\Monochrome\Media\4TR_SuggestionSeriesCancelled.png" /> + </ItemGroup> + <ItemGroup> + <None Include="PostBuild.cmd" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\ForTheRecord.UI.Process\ForTheRecord.UI.Process.csproj"> + <Project>{A35F0ED7-98ED-4EE2-99C6-EA2AF880F8CD}</Project> + <Name>ForTheRecord.UI.Process</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <BootstrapperPackage Include="Microsoft.Net.Framework.2.0"> + <Visible>False</Visible> + <ProductName>.NET Framework 2.0 %28x86%29</ProductName> + <Install>true</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.0"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.0 %28x86%29</ProductName> + <Install>false</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5</ProductName> + <Install>false</Install> + </BootstrapperPackage> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="Resources\GlobalText.nl.resx"> + <SubType>Designer</SubType> + </EmbeddedResource> + <EmbeddedResource Include="Resources\GlobalText.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>GlobalText.Designer.cs</LastGenOutput> + <SubType>Designer</SubType> + </EmbeddedResource> + <EmbeddedResource Include="SetupForm.resx"> + <DependentUpon>SetupForm.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- 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> + --> + <PropertyGroup> + <PostBuildEvent>$(ProjectDir)PostBuild.cmd $(TargetDir) $(TargetPath) $(ConfigurationName... [truncated message content] |
From: <do...@us...> - 2008-10-29 12:48:42
|
Revision: 2278 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=2278&view=rev Author: dot-i Date: 2008-10-29 12:48:34 +0000 (Wed, 29 Oct 2008) Log Message: ----------- Updated to 1.3.0.0 plugin and recorder/tuner. Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SyncEpgThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordHome.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/PostBuild.cmd trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideDialog.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvProgramInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvRecorded.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/WindowId.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ForTheRecord.UI.Process.csproj trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SortableBindingList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvGuide/TvGuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvGuide/TvGuideModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvGuide/TvGuideUpcomingProgram.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingProgramView.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll Added Paths: ----------- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVZapOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TextId.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Translator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvCropManager.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvCropSettings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideSearch.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvMiniGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_da.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_de.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_en.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_nl.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_Active.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_RecordedTvInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_TvGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_Alert.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_AlertCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_AlertSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_AlertSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_Recording.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_RecordingCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_RecordingCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_RecordingInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_RecordingSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_RecordingSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_RecordingSeriesCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_RecordingSeriesInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_RecordingSeriesWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_RecordingWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_Suggestion.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_SuggestionCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_SuggestionSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/Media/4TR_SuggestionSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/RecorderTunersCache.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ScheduleNamesCache.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SearchGuide/ trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SearchGuide/SearchGuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SearchGuide/SearchGuideModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvChannelProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvChannelProgramsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvGuide/ChannelPrograms.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingGuideProgramsDictionary.cs Removed Paths: ------------- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Resources/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_FullScreen.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR__FullScreen.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR__Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR__ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR__RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR__TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR__dialogTvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_dialogTvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_FullScreen.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR__FullScreen.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR__Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR__ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR__RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR__TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR__dialogTvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_dialogTvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_FullScreen.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR__FullScreen.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR__Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR__ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR__RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR__TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR__dialogTvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_dialogTvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_FullScreen.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR__FullScreen.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR__Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR__ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR__RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR__TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR__dialogTvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_dialogTvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/RecorderTuners.cs Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj 2008-10-27 12:45:24 UTC (rev 2277) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj 2008-10-29 12:48:34 UTC (rev 2278) @@ -9,14 +9,10 @@ <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>ForTheRecord.RecorderTuners.MediaPortalTvServer</RootNamespace> <AssemblyName>ForTheRecord.RecorderTuners.MediaPortalTvServer</AssemblyName> - <SccProjectName> - </SccProjectName> - <SccLocalPath> - </SccLocalPath> - <SccAuxPath> - </SccAuxPath> - <SccProvider> - </SccProvider> + <SccProjectName>SAK</SccProjectName> + <SccLocalPath>SAK</SccLocalPath> + <SccAuxPath>SAK</SccAuxPath> + <SccProvider>SAK</SccProvider> <FileUpgradeFlags> </FileUpgradeFlags> <OldToolsVersion>2.0</OldToolsVersion> @@ -42,19 +38,19 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="ForTheRecord.Entities, Version=1.2.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <Reference Include="ForTheRecord.Entities, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\ReferencedAssemblies\ForTheRecord.Entities.dll</HintPath> </Reference> - <Reference Include="ForTheRecord.RecorderTuners.Common, Version=1.2.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <Reference Include="ForTheRecord.RecorderTuners.Common, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\ReferencedAssemblies\ForTheRecord.RecorderTuners.Common.dll</HintPath> </Reference> - <Reference Include="ForTheRecord.ServiceAgents, Version=1.2.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <Reference Include="ForTheRecord.ServiceAgents, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\ReferencedAssemblies\ForTheRecord.ServiceAgents.dll</HintPath> </Reference> - <Reference Include="ForTheRecord.ServiceContracts, Version=1.2.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <Reference Include="ForTheRecord.ServiceContracts, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\ReferencedAssemblies\ForTheRecord.ServiceContracts.dll</HintPath> </Reference> Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2008-10-27 12:45:24 UTC (rev 2277) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2008-10-29 12:48:34 UTC (rev 2278) @@ -49,6 +49,12 @@ InstanceContextMode = InstanceContextMode.Single)] public class MediaPortalRecorderTunerService : ThreadedRecorderTunerService<RecordingThread> { + private const string _ftrLiveUserName = "FTRLive"; + + private object _tvStreamsLock = new object(); + private Dictionary<string, LiveTvStream> _tvStreams = new Dictionary<string, LiveTvStream>(); + private Dictionary<string, User> _tvStreamUsers = new Dictionary<string, User>(); + protected override string Name { get { return "MediaPortal TV Server"; } @@ -60,14 +66,13 @@ { // // Find the channel in MediaPortal (match by DisplayName) and get all the - // channel's tuning details and the cards it is mapped to. + // cards this channel is mapped to. // Channel channel; - IList tuningDetails; - List<Card> availableCards = GetCardsForChannel(tvChannelName, out channel, out tuningDetails); + List<Card> availableCards = GetCardsForChannel(tvChannelName, out channel); - // Sort the cards by priority. - availableCards.Sort(delegate(Card c1, Card c2) { return -c1.Priority.CompareTo(c2.Priority); }); + // Sort the cards by reverse(!) priority. + availableCards.Sort(delegate(Card c1, Card c2) { return c1.Priority.CompareTo(c2.Priority); }); // // Now remove all card that were previously allocated. @@ -77,7 +82,9 @@ Card cardToRemove = null; foreach (Card card in availableCards) { - if (GetCardId(card) == allocation.CardId) + TuningDetail tuning = Utility.FindTuningDetailOnCard(channel, card.IdCard); + if (GetCardId(card) == allocation.CardId + && tuning != null) { // // This card was already allocated before, but we may be able to reuse the card. @@ -88,28 +95,17 @@ if (channel.FreeToAir || CountNumTimesAllocated(alreadyAllocated, allocation.CardId) < card.DecryptLimit) { - // Get the previously allocated channel's tuning details and let's check if the + // Get the previously allocated channel and its tuning details and let's check if the // channel we want is on the same transponder as that channel. - IList allocatedTuningDetails; - Channel allocatedChannel = GetChannelAndTuningByDisplayName(allocation.TvChannelName, out allocatedTuningDetails); - if (allocatedChannel != null) + Channel allocatedChannel = GetChannelByDisplayName(allocation.TvChannelName); + Card allocatedCard = GetCardByCardId(allocation.CardId); + if (allocatedChannel != null + && allocatedCard != null) { - foreach(TuningDetail tuning in tuningDetails) + if (Utility.IsSameTransponder(allocatedCard.IdCard, tuning, allocatedChannel)) { - foreach(TuningDetail allocatedTuning in allocatedTuningDetails) - { - if (tuning.ChannelType >= 1 && tuning.ChannelType <= 4 // ATSC or DVB-x channel? - && tuning.ChannelType == allocatedTuning.ChannelType - && tuning.Frequency == allocatedTuning.Frequency - && tuning.Symbolrate == allocatedTuning.Symbolrate - && tuning.Polarisation == allocatedTuning.Polarisation - && tuning.Bandwidth == allocatedTuning.Bandwidth - && tuning.Modulation == allocatedTuning.Modulation) - { - // Same transponder, so we can re-use the card. - return allocation.CardId; - } - } + // Same transponder, so we can re-use the card. + return allocation.CardId; } } } @@ -127,9 +123,13 @@ // If there's still at least one card available, return the card // with the highest priority. // - if (availableCards.Count > 0) + foreach (Card card in availableCards) { - return GetCardId(availableCards[0]); + TuningDetail tuning = Utility.FindTuningDetailOnCard(channel, card.IdCard); + if (tuning != null) + { + return GetCardId(card); + } } } catch (Exception ex) @@ -149,8 +149,6 @@ Channel channel = GetChannelByDisplayName(channelAllocation.TvChannelName); if (channel != null) { - Log(TraceEventType.Information, "{0} - Starting recording thread for card {1}, channel {2}: {3}", - this.Name, recordOnCard.IdCard, channel.DisplayName, recordingProgram.CreateProgramTitle()); result = this.RecordingThreads.StartNewThread(new RecordingThread(this.RecorderTunerId, tvSchedulerHostName, tvSchedulerTcpPort, channelAllocation, startTime, stopTime, recordingProgram, recordOnCard, channel)); @@ -189,6 +187,241 @@ return shares.ToArray(); } + public override LiveTvResult TuneLiveTvStream(Guid tvChannelId, string tvChannelName, ref LiveTvStream liveTvStream) + { + try + { + Channel channel; + List<Card> availableCards = GetCardsForChannel(tvChannelName, out channel); + + // Sort the cards by priority. + availableCards.Sort(delegate(Card c1, Card c2) { return -c1.Priority.CompareTo(c2.Priority); }); + + if (liveTvStream != null + && _tvStreamUsers.ContainsKey(liveTvStream.RtspUrl)) + { + User tve3User = _tvStreamUsers[liveTvStream.RtspUrl]; + foreach (Card card in availableCards) + { + if (card.IdCard == tve3User.CardId) + { + if (CardFreeOrUsingSameTransponder(card.IdCard, channel, tve3User)) + { + LiveTvResult result = StartTimeShifting(card, channel, ref tve3User, ref liveTvStream); + if (result != LiveTvResult.NoFreeCardFound) + { + return result; + } + } + } + } + } + + if (liveTvStream != null) + { + StopLiveTvStream(liveTvStream); + liveTvStream = null; + } + + foreach (Card card in availableCards) + { + if (CardFreeOrUsingSameTransponder(card.IdCard, channel, null)) + { + string userName = String.Format(CultureInfo.InvariantCulture, "{0}{1}", _ftrLiveUserName, Guid.NewGuid()); + + User tve3User = new User(userName, true, card.IdCard); + tve3User.IdChannel = channel.IdChannel; + tve3User.SubChannel = -1; + + LiveTvResult result = StartTimeShifting(card, channel, ref tve3User, ref liveTvStream); + if (result != LiveTvResult.NoFreeCardFound) + { + return result; + } + } + } + } + catch (Exception ex) + { + Log(TraceEventType.Error, ex.Message); + } + + return LiveTvResult.NoFreeCardFound; + } + + private bool CardFreeOrUsingSameTransponder(int cardId, Channel channel, User userToIgnore) + { + User[] cardUsers = TvServerPlugin.TvController.GetUsersForCard(cardId); + if (cardUsers != null) + { + TuningDetail tuning = Utility.FindTuningDetailOnCard(channel, cardId); + foreach (User cardUser in cardUsers) + { + if (userToIgnore == null + || cardUser.Name != userToIgnore.Name) + { + if (!Utility.IsSameTransponder(cardId, tuning, cardUser.IdChannel)) + { + return false; + } + } + } + } + return true; + } + + private LiveTvResult StartTimeShifting(Card card, Channel channel, ref User tve3User, ref LiveTvStream liveTvStream) + { + IChannel tuningChannel = Utility.FindTuningChannelOnCard(channel, card.IdCard); + if (tuningChannel != null) + { + if (TvServerPlugin.TvController.Tune(ref tve3User, tuningChannel, channel.IdChannel) == TvResult.Succeeded) + { + string fileName = Path.Combine(card.TimeShiftFolder, + String.Format(CultureInfo.InvariantCulture, @"live{0}-{1}.ts", tve3User.CardId, tve3User.SubChannel)); + + switch (TvServerPlugin.TvController.StartTimeShifting(ref tve3User, ref fileName)) + { + case TvResult.Succeeded: + if (liveTvStream == null) + { + lock (_tvStreamsLock) + { + liveTvStream = new LiveTvStream(TvServerPlugin.TvController.GetStreamingUrl(tve3User)); + _tvStreams.Add(liveTvStream.RtspUrl, liveTvStream); + _tvStreamUsers.Add(liveTvStream.RtspUrl, tve3User); + } + } + return LiveTvResult.Succeeded; + + case TvResult.AllCardsBusy: + return LiveTvResult.NoFreeCardFound; + + default: + return LiveTvResult.UnknownError; + } + } + else + { + return LiveTvResult.ChannelTuneFailed; + } + } + else + { + return LiveTvResult.ChannelTuneFailed; + } + } + + public override void StopLiveTvStream(LiveTvStream liveTvStream) + { + lock (_tvStreamsLock) + { + try + { + if (_tvStreams.ContainsKey(liveTvStream.RtspUrl)) + { + User tve3User = _tvStreamUsers[liveTvStream.RtspUrl]; + if (TvServerPlugin.TvController.IsTimeShifting(ref tve3User)) + { + if (!TvServerPlugin.TvController.StopTimeShifting(ref tve3User)) + { + Log(TraceEventType.Error, "Failed to stop TV stream '{0}'", liveTvStream.RtspUrl); + } + } + _tvStreams.Remove(liveTvStream.RtspUrl); + _tvStreamUsers.Remove(liveTvStream.RtspUrl); + } + } + catch (Exception ex) + { + Log(TraceEventType.Error, ex.Message); + } + } + } + + public override LiveTvStream[] GetLiveTvStreams() + { + List<LiveTvStream> liveTvStreams = new List<LiveTvStream>(); + lock (_tvStreamsLock) + { + try + { + // Get cards in reverse priority. + List<Card> cards = Utility.GetAllCards(); + cards.Sort(delegate(Card c1, Card c2) { return c1.Priority.CompareTo(c2.Priority); }); + + // Get the list of live streams from TV Server + Dictionary<string, User> mpStreams = new Dictionary<string, User>(); + foreach (Card card in cards) + { + User[] cardUsers = TvServerPlugin.TvController.GetUsersForCard(card.IdCard); + if (cardUsers != null) + { + foreach (User user in cardUsers) + { + if (user.Name.StartsWith(_ftrLiveUserName)) + { + User tve3User = user; + if (TvServerPlugin.TvController.IsTimeShifting(ref tve3User)) + { + mpStreams.Add(TvServerPlugin.TvController.GetStreamingUrl(tve3User), tve3User); + } + } + } + } + } + + // Now loop our own list and check if all those streams are indeed still up. + List<string> keysToRemove = new List<string>(); + + foreach (LiveTvStream tvStream in _tvStreams.Values) + { + if (mpStreams.ContainsKey(tvStream.RtspUrl)) + { + liveTvStreams.Add(tvStream); + } + else + { + keysToRemove.Add(tvStream.RtspUrl); + } + } + + // Remove streams that no longer exist. + foreach(string keyToRemove in keysToRemove) + { + _tvStreams.Remove(keyToRemove); + } + + // Check if there are any live streams within MP that we don't know about. + // If so, stop those streams (they may be left-overs from client crashes). + foreach (string rtspUrl in mpStreams.Keys) + { + if (!_tvStreams.ContainsKey(rtspUrl)) + { + User tve3User = mpStreams[rtspUrl]; + TvServerPlugin.TvController.StopTimeShifting(ref tve3User, TvStoppedReason.KickedByAdmin); + } + } + } + catch (Exception ex) + { + Log(TraceEventType.Error, ex.Message); + } + } + return liveTvStreams.ToArray(); + } + + public override void KeepLiveTvStreamAlive(LiveTvStream liveTvStream) + { + lock (_tvStreamsLock) + { + if (_tvStreams.ContainsKey(liveTvStream.RtspUrl)) + { + _tvStreams[liveTvStream.RtspUrl].StreamLastAliveTime = liveTvStream.StreamLastAliveTime; + } + } + } + protected override void OnWriteLog(TraceEventType severity, string message) { if (severity == TraceEventType.Error) @@ -203,13 +436,12 @@ #region Private Methods - private List<Card> GetCardsForChannel(string tvChannelName, out Channel channel, out IList tuningDetails) + private List<Card> GetCardsForChannel(string tvChannelName, out Channel channel) { List<Card> availableCards = new List<Card>(); - channel = GetChannelAndTuningByDisplayName(tvChannelName, out tuningDetails); - if (channel != null - && tuningDetails.Count > 0) + channel = GetChannelByDisplayName(tvChannelName); + if (channel != null) { // // Now build a list of all available cards by getting a list of all the cards that @@ -258,18 +490,6 @@ return null; } - private Channel GetChannelAndTuningByDisplayName(string displayName, out IList tuningDetails) - { - Channel channel = GetChannelByDisplayName(displayName); - if (channel != null) - { - tuningDetails = channel.ReferringTuningDetail(); - return channel; - } - tuningDetails = new List<TuningDetail>(); - return null; - } - private Channel GetChannelByDisplayName(string displayName) { SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Channel)); Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2008-10-27 12:45:24 UTC (rev 2277) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2008-10-29 12:48:34 UTC (rev 2278) @@ -173,6 +173,8 @@ private bool EnsureCardFree(ref string errorMessage) { + TuningDetail tuning = Utility.FindTuningDetailOnCard(_channel, _recordOnCard.IdCard); + User[] cardUsers = TvServerPlugin.TvController.GetUsersForCard(_recordOnCard.IdCard); foreach (User cardUser in cardUsers) { @@ -189,10 +191,13 @@ } else if (TvServerPlugin.TvController.IsTimeShifting(ref tmpUser)) { - if (!TvServerPlugin.TvController.StopTimeShifting(ref tmpUser, TvStoppedReason.RecordingStarted)) + if (!Utility.IsSameTransponder(_recordOnCard.IdCard, tuning, tmpUser.IdChannel)) { - errorMessage = "Failed to stop timeshifting on channel " + _channel.DisplayName; - return false; + if (!TvServerPlugin.TvController.StopTimeShifting(ref tmpUser, TvStoppedReason.RecordingStarted)) + { + errorMessage = "Failed to stop timeshifting on channel " + _channel.DisplayName; + return false; + } } } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SyncEpgThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SyncEpgThread.cs 2008-10-27 12:45:24 UTC (rev 2277) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SyncEpgThread.cs 2008-10-29 12:48:34 UTC (rev 2278) @@ -152,73 +152,95 @@ TvBusinessLayer layer = new TvBusinessLayer(); bool epgSyncAutoCreateChannels = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncAutoCreateChannels, false.ToString()).Value); - IList mpChannels = Channel.ListAll(); - foreach (Channel channel in mpChannels) + _tvGuideAgent.StartGuideImport(); + try { - // only execute for tv channels - if (channel.IsTv) + bool aborted = false; + + IList mpChannels = Channel.ListAll(); + foreach (Channel channel in mpChannels) { - TvChannel tvChannel = _tvSchedulerAgent.GetChannelByDisplayName(channel.DisplayName); - if (tvChannel == null - && epgSyncAutoCreateChannels) + // only execute for tv channels + if (channel.IsTv) { - Guid tvChannelId = _tvSchedulerAgent.EnsureChannel(channel.DisplayName, "DVB-EPG"); - tvChannel = _tvSchedulerAgent.GetChannelById(tvChannelId); - } - if (tvChannel != null) - { - Guid guideChannelId; - if (!tvChannel.GuideChannelId.HasValue) + TvChannel tvChannel = _tvSchedulerAgent.GetChannelByDisplayName(channel.DisplayName); + if (tvChannel == null + && epgSyncAutoCreateChannels) { - string externalId = channel.ExternalId; - if (String.IsNullOrEmpty(externalId)) + Guid tvChannelId = _tvSchedulerAgent.EnsureChannel(channel.DisplayName, "DVB-EPG"); + tvChannel = _tvSchedulerAgent.GetChannelById(tvChannelId); + } + if (tvChannel != null) + { + Guid guideChannelId; + if (!tvChannel.GuideChannelId.HasValue) { - externalId = tvChannel.TvChannelId.ToString("N", CultureInfo.InvariantCulture); + string externalId = channel.ExternalId; + if (String.IsNullOrEmpty(externalId)) + { + externalId = tvChannel.TvChannelId.ToString("N", CultureInfo.InvariantCulture); + } + guideChannelId = _tvGuideAgent.EnsureChannel(externalId, channel.DisplayName); + _tvSchedulerAgent.AttachChannelToGuide(tvChannel.TvChannelId, guideChannelId); } - guideChannelId = _tvGuideAgent.EnsureChannel(externalId, channel.DisplayName); - _tvSchedulerAgent.AttachChannelToGuide(tvChannel.TvChannelId, guideChannelId); - } - else - { - guideChannelId = tvChannel.GuideChannelId.Value; - } + else + { + guideChannelId = tvChannel.GuideChannelId.Value; + } - IList mpPrograms = layer.GetPrograms(channel, synchronizeAll ? DateTime.Today : latestProgramTime, DateTime.Today.AddDays(14)); - List<GuideProgram> guidePrograms = new List<GuideProgram>(); - foreach (Program program in mpPrograms) - { - if (program.StartTime < program.EndTime) + IList mpPrograms = layer.GetPrograms(channel, synchronizeAll ? DateTime.Today : latestProgramTime, DateTime.Today.AddDays(14)); + List<GuideProgram> guidePrograms = new List<GuideProgram>(); + foreach (Program program in mpPrograms) { - GuideProgram guideProgram = new GuideProgram(); - guideProgram.GuideChannelId = guideChannelId; - guideProgram.Category = program.Genre; - guideProgram.Description = program.Description; - guideProgram.EpisodeNumberDisplay = program.EpisodeNum; - guideProgram.Rating = program.Classification; - guideProgram.StartTime = program.StartTime; - guideProgram.StopTime = program.EndTime; - guideProgram.Title = program.Title; - guidePrograms.Add(guideProgram); + if (program.StartTime < program.EndTime) + { + GuideProgram guideProgram = new GuideProgram(); + guideProgram.GuideChannelId = guideChannelId; + guideProgram.Category = program.Genre; + guideProgram.Description = program.Description; + guideProgram.EpisodeNumberDisplay = program.EpisodeNum; + guideProgram.Rating = program.Classification; + guideProgram.StartTime = program.StartTime; + guideProgram.StopTime = program.EndTime; + guideProgram.Title = program.Title; + guidePrograms.Add(guideProgram); - if (guideProgram.StartTime > latestProgramTime) - { - latestProgramTime = guideProgram.StartTime; + if (guideProgram.StartTime > latestProgramTime) + { + latestProgramTime = guideProgram.StartTime; + } + + if (guidePrograms.Count >= _syncBatchSize) + { + _tvGuideAgent.ImportPrograms(guidePrograms.ToArray(), GuideSource.DvbEpg); + guidePrograms.Clear(); + } } - if (guidePrograms.Count >= _syncBatchSize) + aborted = this.StopThreadEvent.WaitOne(0, false); + if (aborted) { - _tvGuideAgent.ImportPrograms(guidePrograms.ToArray(), GuideSource.DvbEpg); - guidePrograms.Clear(); + break; } } + if (!aborted + && guidePrograms.Count > 0) + { + _tvGuideAgent.ImportPrograms(guidePrograms.ToArray(), GuideSource.DvbEpg); + } } - if (guidePrograms.Count > 0) - { - _tvGuideAgent.ImportPrograms(guidePrograms.ToArray(), GuideSource.DvbEpg); - } } + + if (aborted) + { + break; + } } } + finally + { + _tvGuideAgent.EndGuideImport(); + } return latestProgramTime; } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs 2008-10-27 12:45:24 UTC (rev 2277) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs 2008-10-29 12:48:34 UTC (rev 2278) @@ -63,6 +63,44 @@ return foundChannel; } + public static TuningDetail FindTuningDetailOnCard(Channel channel, int cardId) + { + try + { + CardType cardType = TvServerPlugin.TvController.Type(cardId); + IList tuningDetails = channel.ReferringTuningDetail(); + foreach (TuningDetail tuningDetail in tuningDetails) + { + if (CardTunesChannelType(cardType, tuningDetail.ChannelType)) + { + return tuningDetail; + } + } + } + catch + { + } + return null; + } + + public static bool CardTunesChannelType(CardType cardType, int channelType) + { + switch (cardType) + { + case CardType.Analog: + return (channelType == 0); + case CardType.Atsc: + return (channelType == 1); + case CardType.DvbC: + return (channelType == 2); + case CardType.DvbS: + return (channelType == 3); + case CardType.DvbT: + return (channelType == 4); + } + return false; + } + public static IChannel FindTuningChannelOnCard(Channel channel, int cardId) { IChannel tuningChannel = null; @@ -71,7 +109,7 @@ List<IChannel> tunings = new TvBusinessLayer().GetTuningChannelByName(channel); foreach (IChannel tuning in tunings) { - if (RemoteControl.Instance.CanTune(cardId, tuning)) + if (TvServerPlugin.TvController.CanTune(cardId, tuning)) { tuningChannel = tuning; break; @@ -99,5 +137,35 @@ } return cards; } + + public static bool IsSameTransponder(int cardId, TuningDetail tuning, int otherChannelId) + { + Channel otherChannel = Channel.Retrieve(otherChannelId); + if (otherChannel != null) + { + return IsSameTransponder(cardId, tuning, otherChannel); + } + return false; + } + + public static bool IsSameTransponder(int cardId, TuningDetail tuning, Channel otherChannel) + { + TuningDetail otherTuning = Utility.FindTuningDetailOnCard(otherChannel, cardId); + if (tuning != null + && otherTuning != null) + { + if (tuning.ChannelType >= 2 && tuning.ChannelType <= 4 // DVB-x channel? ,no Atsc(==1) + && tuning.ChannelType == otherTuning.ChannelType + && tuning.Frequency == otherTuning.Frequency + && tuning.Symbolrate == otherTuning.Symbolrate + && tuning.Polarisation == otherTuning.Polarisation + && tuning.Bandwidth == otherTuning.Bandwidth + && tuning.Modulation == otherTuning.Modulation) + { + return true; + } + } + return false; + } } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2008-10-27 12:45:24 UTC (rev 2277) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2008-10-29 12:48:34 UTC (rev 2278) @@ -43,7 +43,6 @@ using ForTheRecord.ServiceAgents; using ForTheRecord.ServiceContracts; using ForTheRecord.UI.Process.Recordings; -using ForTheRecord.UI.MediaPortal.Resources; namespace ForTheRecord.UI.MediaPortal { @@ -275,7 +274,7 @@ switch (dlg.SelectedId) { case 655: // Play - OnPlayRecording(activeRecording); + PlayRecording(activeRecording, false); break; case 1449: // Abort @@ -296,7 +295,7 @@ { UpcomingProgram program = activeRecording.Program; - dlgYesNo.SetHeading(GUILocalizeStrings.Get(1449)); + dlgYesNo.SetHeading(Utility.GetLocalizedText(TextId.StopRecording)); dlgYesNo.SetLine(1, program.TvChannel.DisplayName); dlgYesNo.SetLine(2, program.Title); dlgYesNo.SetLine(3, string.Empty); @@ -324,20 +323,29 @@ ActiveRecording activeRecording = item.TVTag as ActiveRecording; if (activeRecording != null) { - return OnPlayRecording(activeRecording); + return PlayRecording(activeRecording, false); } return false; } - private bool OnPlayRecording(ActiveRecording activeRecording) + internal static bool PlayRecording(ActiveRecording activeRecording, bool jumpToLivePoint) { - TvRecording recording = this.TvControlAgent.GetRecordingById(activeRecording.TvRecordingId); - if (recording != null) + using (TvControlServiceAgent tvControlAgent = new TvControlServiceAgent()) { - TvRecorded.PlayRecording(recording); - return true; + TvRecording recording = tvControlAgent.GetRecordingById(activeRecording.TvRecordingId); + if (recording != null) + { + int? jumpTo = null; + if (jumpToLivePoint) + { + TimeSpan duration = DateTime.Now - activeRecording.RecordingStartTime; + jumpTo = (int)duration.TotalSeconds - 3; + } + TvRecorded.PlayRecording(recording, jumpTo); + return true; + } + return false; } - return false; } public override void Process() @@ -363,7 +371,7 @@ _viewsList.Add(item); } - string strObjects = string.Format("{0} {1}", _viewsList.Count, GlobalText.RecordingsListItemsSuffix); + string strObjects = string.Format("{0} {1}", _viewsList.Count, Utility.GetLocalizedText(TextId.RecordingsListItemsSuffix)); GUIPropertyManager.SetProperty("#itemcount", strObjects); GUIControl cntlLabel = GetControl(12); @@ -552,8 +560,8 @@ switch (_currentSortMethod) { case SortMethod.Played: - //item1.Label2 = string.Format("{0} {1}", rec1.TimesWatched, GUILocalizeStrings.Get(677));//times - //item2.Label2 = string.Format("{0} {1}", rec2.TimesWatched, GUILocalizeStrings.Get(677));//times + //item1.Label2 = string.Format("{0} {1}", rec1.TimesWatched, Utility.GetLocalizedText(TextId.Times)); + //item2.Label2 = string.Format("{0} {1}", rec2.TimesWatched, Utility.GetLocalizedText(TextId.Times)); if (rec1.LastWatchedPosition == rec2.LastWatchedPosition) { goto case SortMethod.Name; Added: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2008-10-29 12:48:34 UTC (rev 2278) @@ -0,0 +1,804 @@ +#region Copyright (C) 2005-2008 Team MediaPortal + +/* + * Copyright (C) 2005-2008 Team MediaPortal + * http://www.team-mediaportal.com + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ + +#endregion + +using System; +using System.Collections.Generic; +using System.Text; + +using MediaPortal.Configuration; +using MediaPortal.GUI.Library; +using MediaPortal.Player; +using MediaPortal.Dialogs; + +using ForTheRecord.Entities; +using ForTheRecord.ServiceAgents; + +namespace ForTheRecord.UI.MediaPortal +{ + internal class ChannelNavigator + { + private List<TvChannelGroup> _groups = new List<TvChannelGroup>(); + private TvChannelGroup _currentChannelGroup; + private List<TvChannel> _channels = new List<TvChannel>(); + private CurrentAndNextProgram _currentNextProgram; + private GuideProgram _currentProgram; + private GuideProgram _nextProgram; + private TvChannel _currentChannel; + private TvChannel _previousChannel; + private TvChannelGroup _previousChannelGroup; + private TvChannelGroup _zapGroup; + private TvChannel _zapChannel; + private DateTime _zapTime; + private GuideProgram _zapProgram; + private long _zapDelayMs; + + public ChannelNavigator() + { + RefreshChannelGroups(); + } + + #region Public properties + + /// <summary> + /// Gets the channel that we currently watch. + /// Returns empty string if there is no current channel. + /// </summary> + public string CurrentChannelName + { + get + { + return _currentChannel == null ? String.Empty : _currentChannel.DisplayName; + } + } + + public TvChannel CurrentChannel + { + get { return _currentChannel; } + } + + public string ZapChannelName + { + get + { + return _zapChannel == null ? String.Empty : _zapChannel.DisplayName; + } + } + + public TvChannel ZapChannel + { + get { return _zapChannel; } + } + + /// <summary> + /// Gets and sets the last viewed channel, null if there is none. + /// </summary> + public TvChannel PreviousChannel + { + get { return _previousChannel; } + set { _previousChannel = value; } + } + + /// <summary> + /// Gets the currently active tv channel group. + /// </summary> + public TvChannelGroup CurrentGroup + { + get { return _currentChannelGroup; } + set { _currentChannelGroup = value; RefreshChannelsInGroup(); } + } + + /// <summary> + /// Gets the list of tv channel groups. + /// </summary> + public List<TvChannelGroup> Groups + { + get { return _groups; } + } + + public GuideProgram CurrentProgram + { + get { return _currentProgram; } + } + + public GuideProgram NextProgram + { + get { return _nextProgram; } + } + + public GuideProgram ZapProgram + { + get { return _zapProgram; } + } + + public bool IsLiveTvOn + { + get { return _liveTvStream != null; } + } + + #endregion + + #region Public methods + + public void RefreshChannelGroups() + { + try + { + using (TvSchedulerServiceAgent tvSchedulerAgent = new TvSchedulerServiceAgent()) + { + _groups = new List<TvChannelGroup>(tvSchedulerAgent.GetAllChannelGroups(true)); + if (_currentChannelGroup != null + && _currentChannelGroup.TvChannelGroupId != Guid.Empty) + { + bool currentFound = false; + foreach (TvChannelGroup group in _groups) + { + if (group.TvChannelGroupId == _currentChannelGroup.TvChannelGroupId) + { + currentFound = true; + break; + } + } + if (!currentFound) + { + _currentChannelGroup = null; + } + } + + bool hideAllChannelsGroup = false; + using (global::MediaPortal.Profile.Settings xmlreader = + new global::MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) + { + hideAllChannelsGroup = xmlreader.GetValueAsBool("mytv", "hideAllChannelsGroup", false); + } + + if (!hideAllChannelsGroup) + { + _groups.Add(new TvChannelGroup(Guid.Empty, Utility.GetLocalizedText(TextId.AllChannels), true, int.MaxValue, 0)); + } + if (_currentChannelGroup == null + && _groups.Count > 0) + { + _currentChannelGroup = _groups[0]; + RefreshChannelsInGroup(tvSchedulerAgent); + } + } + } + catch (Exception ex) + { + Log.Error("ChannelNavigator: Error in LoadChannelGroups - {0}", ex.Message); + } + } + + public void ZapNow() + { + _zapTime = DateTime.Now.AddSeconds(-1); + } + + private bool _reentrant = false; + + /// <summary> + /// Checks if it is time to zap to a different channel. This is called during Process(). + /// </summary> + public bool CheckChannelChange() + { + if (_reentrant) + { + return false; + } + try + { + _reentrant = true; + + //UpdateCurrentChannel(); + + // Make sure current and next is up to date. + if (_currentNextProgram != null) + { + if ((_currentNextProgram.Current != null + && _currentNextProgram.Current.StopTime < DateTime.Now) + || (_currentNextProgram.Next != null + && _currentNextProgram.Next.StartTime < DateTime.Now)) + { + RefreshCurrentAndNext(); + } + } + + // Zapping to another group or channel? + if (_zapGroup != null || _zapChannel != null) + { + // Time to zap? + if (DateTime.Now >= _zapTime) + { + // Zapping to another group? +... [truncated message content] |
From: <do...@us...> - 2009-01-08 12:26:08
|
Revision: 2498 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=2498&view=rev Author: dot-i Date: 2009-01-08 12:01:05 +0000 (Thu, 08 Jan 2009) Log Message: ----------- Updated to version 1.3.1.0. Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SyncEpgThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordHome.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TextId.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideSearch.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvMiniGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvProgramInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvRecorded.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_de.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_nl.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_Active.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_TvGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ForTheRecord.UI.Process.csproj trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ProcessUtility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SortableBindingList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvChannelProgramsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvGuide/TvGuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvGuide/TvGuideModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingGuideProgramsDictionary.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll Added Paths: ----------- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.resx trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvRecordingOverlay.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_sv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/4TR_Active.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/4TR_TvGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_Alert.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_AlertCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_AlertSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_AlertSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_Recording.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_RecordingCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_RecordingCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_RecordingInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_RecordingSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_RecordingSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_RecordingSeriesCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_RecordingSeriesInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_RecordingSeriesWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_RecordingWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_Suggestion.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_SuggestionCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_SuggestionSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/4TR_SuggestionSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/togglebutton-off-focus.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/togglebutton-off-nofocus.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/togglebutton-on-focus.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/Media/togglebutton-on-nofocus.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/common.window.short.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/4TR_Active.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/4TR_TvGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_Alert.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_AlertCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_AlertSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_AlertSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_Recording.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_RecordingCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_RecordingCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_RecordingInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_RecordingSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_RecordingSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_RecordingSeriesCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_RecordingSeriesInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_RecordingSeriesWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_RecordingWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_Suggestion.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_SuggestionCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_SuggestionSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/Media/4TR_SuggestionSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_TvGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_RecordingCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/Media/4TR_RecordingSeriesCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_RecordingCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/Media/4TR_RecordingSeriesCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_TvGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_RecordingCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/Media/4TR_RecordingSeriesCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_TvGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_RecordingCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/Media/4TR_RecordingSeriesCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingOrActiveProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingOrActiveProgramsList.cs Removed Paths: ------------- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_RecordedTvInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_RecordedTvInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_RecordedTvInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_RecordedTvInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_RecordedTvInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingProgramsList.cs Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs 2009-01-08 12:01:05 UTC (rev 2498) @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2007-2008 ForTheRecord + * http://www.4therecord.eu + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ +using System; +using System.Collections.Generic; +using System.Text; +using System.Xml.XPath; +using System.Xml; + +namespace ForTheRecord.RecorderTuners.MediaPortalTvServer.Channels +{ + internal class ChannelLink + { + public ChannelLink(Guid tvChannelId, string tvChannelName, int mpChannelId, string mpChannelName) + { + this.TvChannelId = tvChannelId; + this.TvChannelName = tvChannelName; + this.MPChannelId = mpChannelId; + this.MPChannelName = mpChannelName; + } + + public static ChannelLink Parse(XPathNavigator navigator) + { + ChannelLink result = null; + Guid tvChannelId = Guid.Empty; + string id = navigator.GetAttribute("id", String.Empty); + if (!String.IsNullOrEmpty(id)) + { + tvChannelId = new Guid(id); + } + int mpChannelId = -1; + string mpId = navigator.GetAttribute("mpId", String.Empty); + if (!String.IsNullOrEmpty(id)) + { + mpChannelId = Int32.Parse(mpId); + } + if (tvChannelId != Guid.Empty + && mpChannelId >= 0) + { + string tvChannelName = navigator.GetAttribute("name", String.Empty); + string mpChannelName = navigator.GetAttribute("mpName", String.Empty); + result = new ChannelLink(tvChannelId, tvChannelName, mpChannelId, mpChannelName); + } + return result; + } + + public void WriteToXml(XmlTextWriter xmlWriter) + { + xmlWriter.WriteStartElement("link"); + xmlWriter.WriteAttributeString("id", this.TvChannelId.ToString()); + xmlWriter.WriteAttributeString("name", this.TvChannelName.ToString()); + xmlWriter.WriteAttributeString("mpId", this.MPChannelId.ToString()); + xmlWriter.WriteAttributeString("mpName", this.MPChannelName.ToString()); + xmlWriter.WriteEndElement(); + } + + public Guid TvChannelId { get; set; } + + public string TvChannelName { get; set; } + + public int MPChannelId { get; set; } + + public string MPChannelName { get; set; } + + public string MPChannelDisplayName { get; set; } + } +} Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs 2009-01-08 12:01:05 UTC (rev 2498) @@ -0,0 +1,224 @@ +/* + * Copyright (C) 2007-2008 ForTheRecord + * http://www.4therecord.eu + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ +using System; +using System.Collections.Generic; +using System.IO; +using System.Xml.XPath; +using System.Xml; +using System.Collections; +using System.Text; + +using TvDatabase; + +using ForTheRecord.Entities; +using Gentle.Framework; + +namespace ForTheRecord.RecorderTuners.MediaPortalTvServer.Channels +{ + internal class ChannelLinks + { + private Dictionary<Guid, ChannelLink> _linksById = new Dictionary<Guid, ChannelLink>(); + + private ChannelLinks() + { + Load(); + } + + public static ChannelLinks LoadChannelLinks() + { + return new ChannelLinks(); + } + + public LinkedMediaPortalChannel GetLinkedMediaPortalChannel(TvChannel tvChannel) + { + bool isAutoLinked; + bool duplicateChannelsFound; + return GetLinkedMediaPortalChannel(tvChannel, out isAutoLinked, out duplicateChannelsFound); + } + + public LinkedMediaPortalChannel GetLinkedMediaPortalChannel(Guid tvChannelId, string displayName) + { + bool isAutoLinked; + bool duplicateChannelsFound; + return GetLinkedMediaPortalChannel(tvChannelId, displayName, out isAutoLinked, out duplicateChannelsFound); + } + + public LinkedMediaPortalChannel GetLinkedMediaPortalChannel(TvChannel tvChannel, out bool isAutoLinked, out bool duplicateChannelsFound) + { + return GetLinkedMediaPortalChannel(tvChannel.TvChannelId, tvChannel.DisplayName, out isAutoLinked, out duplicateChannelsFound); + } + + public LinkedMediaPortalChannel GetLinkedMediaPortalChannel(Guid tvChannelId, string displayName, out bool isAutoLinked, out bool duplicateChannelsFound) + { + isAutoLinked = false; + duplicateChannelsFound = false; + + if (_linksById.ContainsKey(tvChannelId)) + { + ChannelLink link = _linksById[tvChannelId]; + return new LinkedMediaPortalChannel(link.MPChannelId, link.MPChannelName, link.MPChannelDisplayName); + } + + Channel channel = GetChannelByDisplayName(displayName, out duplicateChannelsFound); + if (channel != null) + { + isAutoLinked = true; + return new LinkedMediaPortalChannel(channel.IdChannel, channel.Name, channel.DisplayName); + } + + return null; + } + + public void SetLinkedMediaPortalChannel(TvChannel tvChannel, Channel mpChannel) + { + ClearLinkedMediaPortalChannel(tvChannel); + ChannelLink link = new ChannelLink(tvChannel.TvChannelId, tvChannel.DisplayName, mpChannel.IdChannel, mpChannel.Name); + link.MPChannelDisplayName = mpChannel.DisplayName; + _linksById.Add(link.TvChannelId, link); + } + + public void ClearLinkedMediaPortalChannel(TvChannel tvChannel) + { + if (_linksById.ContainsKey(tvChannel.TvChannelId)) + { + _linksById.Remove(tvChannel.TvChannelId); + } + } + + public ChannelLink GetChannelLinkForMediaPortalChannel(Channel channel) + { + foreach (ChannelLink link in _linksById.Values) + { + if (link.MPChannelId == channel.IdChannel + && link.MPChannelName == channel.Name) + { + return link; + } + } + return null; + } + + #region Serialization + + private string SettingsFileName + { + get + { + return Path.Combine( + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "For The Record"), + "MediaPortalTvServer.Channels.config"); + } + } + + private void Load() + { + _linksById.Clear(); + string settingsFileName = this.SettingsFileName; + if (File.Exists(settingsFileName)) + { + using (StreamReader reader = new StreamReader(settingsFileName, Encoding.UTF8)) + { + XPathDocument xpathDocument = new XPathDocument(reader); + XPathNavigator navigator = xpathDocument.CreateNavigator(); + XPathNodeIterator iterator = navigator.Select("/links/link"); + while (iterator.MoveNext()) + { + ChannelLink link = ChannelLink.Parse(iterator.Current); + if (link != null) + { + Channel channel = GetChannelById(link.MPChannelId); + if (channel == null + || channel.Name != link.MPChannelName) + { + channel = GetChannelByName(link.MPChannelName); + } + if (channel != null) + { + link.MPChannelDisplayName = channel.DisplayName; + _linksById.Add(link.TvChannelId, link); + } + } + } + } + } + } + + public void Save() + { + string settingsFileName = this.SettingsFileName; + string settingsDirName = Path.GetDirectoryName(settingsFileName); + if (!Directory.Exists(settingsDirName)) + { + Directory.CreateDirectory(settingsDirName); + } + using (XmlTextWriter xmlWriter = new XmlTextWriter(this.SettingsFileName, Encoding.UTF8)) + { + xmlWriter.Formatting = Formatting.Indented; + xmlWriter.WriteStartDocument(); + xmlWriter.WriteStartElement("links"); + foreach (ChannelLink link in _linksById.Values) + { + link.WriteToXml(xmlWriter); + } + xmlWriter.WriteEndElement(); + } + } + + #endregion + + #region Private Methods + + private Channel GetChannelByDisplayName(string displayName, out bool duplicateChannelsFound) + { + return InternalGetChannelBy("displayName", displayName, out duplicateChannelsFound); + } + + private Channel GetChannelById(int id) + { + bool duplicateChannelsFound; + return InternalGetChannelBy("idChannel", id, out duplicateChannelsFound); + } + + private Channel GetChannelByName(string name) + { + bool duplicateChannelsFound; + return InternalGetChannelBy("name", name, out duplicateChannelsFound); + } + + private Channel InternalGetChannelBy(string columnName, object value, out bool duplicateChannelsFound) + { + SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Channel)); + sb.AddConstraint(Operator.Equals, columnName, value); + sb.AddConstraint(Operator.Equals, "visibleInGuide", true); + SqlResult result = Broker.Execute(sb.GetStatement()); + if (result.Rows.Count == 1) + { + duplicateChannelsFound = false; + IList channels = ObjectFactory.GetCollection(typeof(Channel), result); + return channels[0] as Channel; + } + duplicateChannelsFound = (result.Rows.Count > 0); + return null; + } + + #endregion + } +} Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs 2009-01-08 12:01:05 UTC (rev 2498) @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2007-2008 ForTheRecord + * http://www.4therecord.eu + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ +using System; +using System.Collections.Generic; +using System.Text; + +namespace ForTheRecord.RecorderTuners.MediaPortalTvServer.Channels +{ + internal class LinkedMediaPortalChannel + { + public LinkedMediaPortalChannel(int id, string name, string displayName) + { + this.Id = id; + this.Name = name; + this.DisplayName = displayName; + } + + public int Id { get; set; } + public string Name { get; set; } + public string DisplayName { get; set; } + } +} Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.Designer.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.Designer.cs (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.Designer.cs 2009-01-08 12:01:05 UTC (rev 2498) @@ -0,0 +1,212 @@ +namespace ForTheRecord.RecorderTuners.MediaPortalTvServer +{ + partial class CreateChannelLinkForm + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this._channelLabel = new System.Windows.Forms.Label(); + this._channelNameLabel = new System.Windows.Forms.Label(); + this._linkLabel = new System.Windows.Forms.Label(); + this._okButton = new System.Windows.Forms.Button(); + this._cancelButton = new System.Windows.Forms.Button(); + this._clearLinkButton = new System.Windows.Forms.Button(); + this._groupsBindingSource = new System.Windows.Forms.BindingSource(this.components); + this._channelsBindingSource = new System.Windows.Forms.BindingSource(this.components); + this._groupsListView = new System.Windows.Forms.ListView(); + this._groupNameColumn = new System.Windows.Forms.ColumnHeader(); + this._lvImageList = new System.Windows.Forms.ImageList(this.components); + this._channelsListView = new System.Windows.Forms.ListView(); + this._channelNameColumn = new System.Windows.Forms.ColumnHeader(); + ((System.ComponentModel.ISupportInitialize)(this._groupsBindingSource)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this._channelsBindingSource)).BeginInit(); + this.SuspendLayout(); + // + // _channelLabel + // + this._channelLabel.AutoSize = true; + this._channelLabel.Location = new System.Drawing.Point(12, 15); + this._channelLabel.Name = "_channelLabel"; + this._channelLabel.Size = new System.Drawing.Size(49, 13); + this._channelLabel.TabIndex = 0; + this._channelLabel.Text = "Channel:"; + // + // _channelNameLabel + // + this._channelNameLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._channelNameLabel.AutoEllipsis = true; + this._channelNameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this._channelNameLabel.Location = new System.Drawing.Point(67, 15); + this._channelNameLabel.Name = "_channelNameLabel"; + this._channelNameLabel.Size = new System.Drawing.Size(365, 20); + this._channelNameLabel.TabIndex = 1; + // + // _linkLabel + // + this._linkLabel.AutoSize = true; + this._linkLabel.Location = new System.Drawing.Point(12, 41); + this._linkLabel.Name = "_linkLabel"; + this._linkLabel.Size = new System.Drawing.Size(42, 13); + this._linkLabel.TabIndex = 2; + this._linkLabel.Text = "Link to:"; + // + // _okButton + // + this._okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this._okButton.Location = new System.Drawing.Point(165, 327); + this._okButton.Name = "_okButton"; + this._okButton.Size = new System.Drawing.Size(85, 23); + this._okButton.TabIndex = 4; + this._okButton.Text = "OK"; + this._okButton.UseVisualStyleBackColor = true; + this._okButton.Click += new System.EventHandler(this._okButton_Click); + // + // _cancelButton + // + this._cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this._cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this._cancelButton.Location = new System.Drawing.Point(347, 327); + this._cancelButton.Name = "_cancelButton"; + this._cancelButton.Size = new System.Drawing.Size(85, 23); + this._cancelButton.TabIndex = 5; + this._cancelButton.Text = "Cancel"; + this._cancelButton.UseVisualStyleBackColor = true; + // + // _clearLinkButton + // + this._clearLinkButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this._clearLinkButton.Location = new System.Drawing.Point(256, 327); + this._clearLinkButton.Name = "_clearLinkButton"; + this._clearLinkButton.Size = new System.Drawing.Size(85, 23); + this._clearLinkButton.TabIndex = 8; + this._clearLinkButton.Text = "Remove Link"; + this._clearLinkButton.UseVisualStyleBackColor = true; + this._clearLinkButton.Click += new System.EventHandler(this._clearLinkButton_Click); + // + // _groupsListView + // + this._groupsListView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._groupsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this._groupNameColumn}); + this._groupsListView.FullRowSelect = true; + this._groupsListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this._groupsListView.HideSelection = false; + this._groupsListView.Location = new System.Drawing.Point(67, 38); + this._groupsListView.MultiSelect = false; + this._groupsListView.Name = "_groupsListView"; + this._groupsListView.Size = new System.Drawing.Size(365, 104); + this._groupsListView.SmallImageList = this._lvImageList; + this._groupsListView.TabIndex = 11; + this._groupsListView.UseCompatibleStateImageBehavior = false; + this._groupsListView.View = System.Windows.Forms.View.Details; + this._groupsListView.SelectedIndexChanged += new System.EventHandler(this._groupNameListView_SelectedIndexChanged); + // + // _groupNameColumn + // + this._groupNameColumn.Text = "Channel Group"; + this._groupNameColumn.Width = 340; + // + // _lvImageList + // + this._lvImageList.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit; + this._lvImageList.ImageSize = new System.Drawing.Size(1, 18); + this._lvImageList.TransparentColor = System.Drawing.Color.Transparent; + // + // _channelsListView + // + this._channelsListView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._channelsListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this._channelNameColumn}); + this._channelsListView.FullRowSelect = true; + this._channelsListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable; + this._channelsListView.HideSelection = false; + this._channelsListView.Location = new System.Drawing.Point(67, 148); + this._channelsListView.MultiSelect = false; + this._channelsListView.Name = "_channelsListView"; + this._channelsListView.Size = new System.Drawing.Size(365, 161); + this._channelsListView.SmallImageList = this._lvImageList; + this._channelsListView.TabIndex = 12; + this._channelsListView.UseCompatibleStateImageBehavior = false; + this._channelsListView.View = System.Windows.Forms.View.Details; + this._channelsListView.DoubleClick += new System.EventHandler(this._channelsListView_DoubleClick); + // + // _channelNameColumn + // + this._channelNameColumn.Text = "MediaPortal Channel"; + this._channelNameColumn.Width = 340; + // + // CreateChannelLinkForm + // + this.AcceptButton = this._okButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.CancelButton = this._cancelButton; + this.ClientSize = new System.Drawing.Size(444, 359); + this.Controls.Add(this._clearLinkButton); + this.Controls.Add(this._cancelButton); + this.Controls.Add(this._okButton); + this.Controls.Add(this._linkLabel); + this.Controls.Add(this._channelNameLabel); + this.Controls.Add(this._channelLabel); + this.Controls.Add(this._groupsListView); + this.Controls.Add(this._channelsListView); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "CreateChannelLinkForm"; + this.ShowIcon = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Create Channel Link"; + this.Load += new System.EventHandler(this.CreateShareForm_Load); + ((System.ComponentModel.ISupportInitialize)(this._groupsBindingSource)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this._channelsBindingSource)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label _channelLabel; + private System.Windows.Forms.Label _channelNameLabel; + private System.Windows.Forms.Label _linkLabel; + private System.Windows.Forms.Button _okButton; + private System.Windows.Forms.Button _cancelButton; + private System.Windows.Forms.Button _clearLinkButton; + private System.Windows.Forms.BindingSource _groupsBindingSource; + private System.Windows.Forms.BindingSource _channelsBindingSource; + private System.Windows.Forms.ListView _groupsListView; + private System.Windows.Forms.ColumnHeader _groupNameColumn; + private System.Windows.Forms.ListView _channelsListView; + private System.Windows.Forms.ColumnHeader _channelNameColumn; + private System.Windows.Forms.ImageList _lvImageList; + } +} \ No newline at end of file Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.cs (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.cs 2009-01-08 12:01:05 UTC (rev 2498) @@ -0,0 +1,200 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +using TvDatabase; +using Gentle.Framework; + +using ForTheRecord.Entities; +using ForTheRecord.RecorderTuners.MediaPortalTvServer.Channels; + +namespace ForTheRecord.RecorderTuners.MediaPortalTvServer +{ + public partial class CreateChannelLinkForm : Form + { + public CreateChannelLinkForm() + { + InitializeComponent(); + } + + internal ChannelLinks ChannelLinks { set; get; } + + internal TvChannel TvChannel { set; get; } + + private void CreateShareForm_Load(object sender, EventArgs e) + { + _channelNameLabel.Text = this.TvChannel.DisplayName; + LoadGroups(); + + LinkedMediaPortalChannel linkedChannel = this.ChannelLinks.GetLinkedMediaPortalChannel(this.TvChannel); + if (linkedChannel != null) + { + SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(GroupMap)); + sb.AddConstraint(Operator.Equals, "idChannel", linkedChannel.Id); + SqlResult result = Broker.Execute(sb.GetStatement()); + List<GroupMap> groupMaps = (List<GroupMap>) + ObjectFactory.GetCollection(typeof(GroupMap), result, new List<GroupMap>()); + if (groupMaps.Count > 0) + { + foreach (ListViewItem item in _groupsListView.Items) + { + ChannelGroup channelGroup = item.Tag as ChannelGroup; + if (channelGroup.IdGroup == groupMaps[0].IdGroup) + { + item.Selected = true; + _groupsListView.EnsureVisible(item.Index); + break; + } + else + { + item.Selected = false; + } + } + + foreach (ListViewItem item in _channelsListView.Items) + { + ChannelItem channelItem = item.Tag as ChannelItem; + if (channelItem.Channel.IdChannel == linkedChannel.Id) + { + item.Selected = true; + _channelsListView.EnsureVisible(item.Index); + break; + } + else + { + item.Selected = false; + } + } + } + } + } + + private void LoadGroups() + { + SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(ChannelGroup)); + sb.AddOrderByField("groupName"); + SqlResult result = Broker.Execute(sb.GetStatement()); + List<ChannelGroup> channelGroups = (List<ChannelGroup>) + ObjectFactory.GetCollection(typeof(ChannelGroup), result, new List<ChannelGroup>()); + _groupsListView.Items.Clear(); + foreach (ChannelGroup channelGroup in channelGroups) + { + ListViewItem item = new ListViewItem(channelGroup.GroupName); + item.Tag = channelGroup; + _groupsListView.Items.Add(item); + } + ListViewItem allItem = new ListViewItem("All Channels"); + allItem.Tag = null; + _groupsListView.Items.Add(allItem); + } + + private void _okButton_Click(object sender, EventArgs e) + { + if (_channelsListView.SelectedItems.Count > 0) + { + ChannelItem channelItem = _channelsListView.SelectedItems[0].Tag as ChannelItem; + this.ChannelLinks.SetLinkedMediaPortalChannel(this.TvChannel, channelItem.Channel); + } + else + { + this.ChannelLinks.ClearLinkedMediaPortalChannel(this.TvChannel); + } + this.DialogResult = DialogResult.OK; + this.Close(); + } + + private void _clearLinkButton_Click(object sender, EventArgs e) + { + this.ChannelLinks.ClearLinkedMediaPortalChannel(this.TvChannel); + this.DialogResult = DialogResult.OK; + this.Close(); + } + + private void _channelsListView_DoubleClick(object sender, EventArgs e) + { + if (_channelsListView.SelectedItems.Count > 0) + { + _okButton_Click(this, EventArgs.Empty); + } + } + + private void _groupNameListView_SelectedIndexChanged(object sender, EventArgs e) + { + if (_groupsListView.SelectedItems.Count > 0) + { + ChannelGroup group = _groupsListView.SelectedItems[0].Tag as ChannelGroup; + + List<ChannelItem> channelItems = new List<ChannelItem>(); + if (group == null) + { + SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Channel)); + sb.AddConstraint(Operator.Equals, "visibleInGuide", true); + sb.AddOrderByField("displayName"); + SqlResult result = Broker.Execute(sb.GetStatement()); + List<Channel> channels = (List<Channel>)ObjectFactory.GetCollection(typeof(Channel), result, new List<Channel>()); + foreach(Channel channel in channels) + { + channelItems.Add(new ChannelItem(channel)); + } + } + else + { + SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(GroupMap)); + sb.AddConstraint(Operator.Equals, "idGroup", group.IdGroup); + SqlResult result = Broker.Execute(sb.GetStatement()); + List<GroupMap> groupMaps = (List<GroupMap>) + ObjectFactory.GetCollection(typeof(GroupMap), result, new List<GroupMap>()); + + foreach (GroupMap groupMap in groupMaps) + { + channelItems.Add(new ChannelItem(groupMap.ReferencedChannel())); + } + channelItems.Sort( + delegate(ChannelItem c1, ChannelItem c2) { return c1.Channel.DisplayName.CompareTo(c2.Channel.DisplayName); }); + } + + _channelsListView.Items.Clear(); + foreach (ChannelItem channelItem in channelItems) + { + ListViewItem item = new ListViewItem(channelItem.ChannelName); + item.Tag = channelItem; + _channelsListView.Items.Add(item); + } + } + else + { + _channelsListView.Items.Clear(); + } + } + + private class ChannelItem + { + private Channel _channel; + + public ChannelItem(Channel channel) + { + _channel = channel; + } + + public Channel Channel + { + get { return _channel; } + } + + public string ChannelName + { + get + { + if (String.Equals(_channel.DisplayName, _channel.Name)) + { + return _channel.DisplayName; + } + return _channel.DisplayName + " (" + _channel.Name + ")"; + } + } + } + } +} Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.resx =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.resx (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.resx 2009-01-08 12:01:05 UTC (rev 2498) @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <metadata name="_groupsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <metadata name="_channelsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>191, 17</value> + </metadata> + <metadata name="_lvImageList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>374, 17</value> + </metadata> +</root> \ No newline at end of file Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj 2009-01-08 11:06:54 UTC (rev 2497) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj 2009-01-08 12:01:05 UTC (rev 2498) @@ -9,10 +9,10 @@ <AppDesignerFolder>Properties</AppDesignerFolder> <RootNamespace>ForTheRecord.RecorderTuners.MediaPortalTvServer</RootNamespace> <AssemblyName>ForTheRecord.RecorderTuners.MediaPortalTvServer</AssemblyName> - <SccProjectName>SAK</SccProjectName> - <SccLocalPath>SAK</SccLocalPath> - <SccAuxPath>SAK</SccAuxPath> - <SccProvider>SAK</SccProvider> + <SccProjectName>Svn</SccProjectName> + <SccLocalPath>Svn</SccLocalPath> + <SccAuxPath>Svn</SccAuxPath> + <SccProvider>SubversionScc</SccProvider> <FileUpgradeFlags> </FileUpgradeFlags> <OldToolsVersion>2.0</OldToolsVersion> @@ -38,37 +38,37 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="ForTheRecord.Entities, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <Reference Include="ForTheRecord.Entities, Version=1.3.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\ReferencedAssemblies\ForTheRecord.Entities.dll</HintPath> </Reference> - <Reference Include="ForTheRecord.RecorderTuners.Common, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <Reference Include="ForTheRecord.RecorderTuners.Common, Version=1.3.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\ReferencedAssemblies\ForTheRecord.RecorderTuners.Common.dll</HintPath> </Reference> - <Reference Include="ForTheRecord.ServiceAgents, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <Reference Include="ForTheRecord.ServiceAgents, Version=1.3.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\ReferencedAssemblies\ForTheRecord.ServiceAgents.dll</HintPath> </Reference> - <Reference Include="ForTheRecord.ServiceContracts, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <Reference Include="ForTheRecord.ServiceContracts, Version=1.3.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\ReferencedAssemblies\ForTheRecord.ServiceContracts.dll</HintPath> </Reference> <Reference Include="Gentle.Common, Version=1.2.9.1285, Culture=neutral, PublicKeyToken=80b5de62e27be49b"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\ReferencedAssemblies\Gentle.Common.dll</HintPath> + <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\Gentle.Common.dll</HintPath> </Reference> <Reference Include="Gentle.Framework, Version=1.2.9.1286, Culture=neutral, PublicKeyToken=80b5de62e27be49b"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\ReferencedAssemblies\Gentle.Framework.dll</HintPath> + <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\Gentle.Framework.dll</HintPath> </Reference> - <Reference Include="PluginBase, Version=0.9.2.16175, Culture=neutral, processorArchitecture=x86"> + <Reference Include="PluginBase, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\ReferencedAssemblies\PluginBase.dll</HintPath> + <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\PluginBase.dll</HintPath> </Reference> - <Reference Include="SetupControls, Version=0.9.2.16173, Culture=neutral, processorArchitecture=x86"> + <Reference Include="SetupControls, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVer... [truncated message content] |
From: <do...@us...> - 2009-01-15 16:10:58
|
Revision: 2510 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=2510&view=rev Author: dot-i Date: 2009-01-15 16:10:32 +0000 (Thu, 15 Jan 2009) Log Message: ----------- Updated to version 1.3.2 of For The Record. Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.resx trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordHome.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvRecorded.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/RecorderTunersCache.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ScheduleNamesCache.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvGuide/TvGuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingOrActiveProgramsList.cs Added Paths: ----------- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/4TR_TvGuideSearch.xml Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2009-01-15 08:29:58 UTC (rev 2509) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2009-01-15 16:10:32 UTC (rev 2510) @@ -143,7 +143,8 @@ return null; } - public override bool StartRecording(string tvSchedulerHostName, int tvSchedulerTcpPort, CardChannelAllocation channelAllocation, DateTime startTime, DateTime stopTime, UpcomingProgram recordingProgram) + public override bool StartRecording(string tvSchedulerHostName, int tvSchedulerTcpPort, CardChannelAllocation channelAllocation, + DateTime startTime, DateTime stopTime, UpcomingProgram recordingProgram, string suggestedBaseFileName) { bool result = false; @@ -157,7 +158,7 @@ { result = this.RecordingThreads.StartNewThread(new RecordingThread(this.RecorderTunerId, tvSchedulerHostName, tvSchedulerTcpPort, channelAllocation, startTime, stopTime, - recordingProgram, recordOnCard, channel)); + recordingProgram, suggestedBaseFileName, recordOnCard, channel)); if (!result) { Log(TraceEventType.Error, "{0} - Already recording {1}", this.Name, recordingProgram.CreateProgramTitle()); @@ -188,6 +189,10 @@ string uncRecordingFolder = Common.ShareExplorer.GetUncPathForLocalPath(card.RecordingFolder); shares.Add(String.IsNullOrEmpty(uncRecordingFolder) ? card.RecordingFolder : uncRecordingFolder); } + else + { + shares.Add(String.Empty); + } } return shares.ToArray(); @@ -224,27 +229,29 @@ } } } - - if (liveTvStream != null) + else { - StopLiveTvStream(liveTvStream); - liveTvStream = null; - } + if (liveTvStream != null) + { + StopLiveTvStream(liveTvStream); + liveTvStream = null; + } - foreach (Card card in availableCards) - { - if (CardFreeOrUsingSameTransponder(card.IdCard, channel, null)) + foreach (Card card in availableCards) { - string userName = String.Format(CultureInfo.InvariantCulture, "{0}{1}", _ftrLiveUserName, Guid.NewGuid()); + if (CardFreeOrUsingSameTransponder(card.IdCard, channel, null)) + { + string userName = String.Format(CultureInfo.InvariantCulture, "{0}{1}", _ftrLiveUserName, Guid.NewGuid()); - User tve3User = new User(userName, true, card.IdCard); - tve3User.IdChannel = channel.IdChannel; - tve3User.SubChannel = -1; + User tve3User = new User(userName, true, card.IdCard); + tve3User.IdChannel = channel.IdChannel; + tve3User.SubChannel = -1; - LiveTvResult result = StartTimeShifting(card, channel, ref tve3User, ref liveTvStream); - if (result != LiveTvResult.NoFreeCardFound) - { - return result; + LiveTvResult result = StartTimeShifting(card, channel, ref tve3User, ref liveTvStream); + if (result != LiveTvResult.NoFreeCardFound) + { + return result; + } } } } @@ -285,19 +292,22 @@ { if (TvServerPlugin.TvController.Tune(ref tve3User, tuningChannel, channel.IdChannel) == TvResult.Succeeded) { - string fileName = Path.Combine(card.TimeShiftFolder, - String.Format(CultureInfo.InvariantCulture, @"live{0}-{1}.ts", tve3User.CardId, tve3User.SubChannel)); + string timeshiftFileName = Path.Combine(card.TimeShiftFolder, + String.Format(CultureInfo.InvariantCulture, @"live{0}-{1}", tve3User.CardId, tve3User.SubChannel)); - switch (TvServerPlugin.TvController.StartTimeShifting(ref tve3User, ref fileName)) + switch (TvServerPlugin.TvController.StartTimeShifting(ref tve3User, ref timeshiftFileName)) { case TvResult.Succeeded: if (liveTvStream == null) { + string rtspUrl = TvServerPlugin.TvController.GetStreamingUrl(tve3User); + string tsBufferFile = GetTsBufferFile(tve3User); lock (_tvStreamsLock) { - liveTvStream = new LiveTvStream(TvServerPlugin.TvController.GetStreamingUrl(tve3User)); - _tvStreams.Add(liveTvStream.RtspUrl, liveTvStream); - _tvStreamUsers.Add(liveTvStream.RtspUrl, tve3User); + liveTvStream = new LiveTvStream(rtspUrl); + liveTvStream.TimeshiftFile = tsBufferFile; + _tvStreams[liveTvStream.RtspUrl] = liveTvStream; + _tvStreamUsers[liveTvStream.RtspUrl] = tve3User; } } return LiveTvResult.Succeeded; @@ -339,6 +349,7 @@ _tvStreams.Remove(liveTvStream.RtspUrl); _tvStreamUsers.Remove(liveTvStream.RtspUrl); } + CleanUpTimeshiftingFiles(liveTvStream.TimeshiftFile); } catch (Exception ex) { @@ -347,6 +358,23 @@ } } + private void CleanUpTimeshiftingFiles(string timeshiftFile) + { + try + { + DirectoryInfo dirInfo = new DirectoryInfo(Path.GetDirectoryName(timeshiftFile)); + foreach (FileInfo fileInfo in dirInfo.GetFiles(Path.GetFileName(timeshiftFile) + "*")) + { + try { File.Delete(fileInfo.FullName); } + catch { } + } + } + catch + { + Log(TraceEventType.Error, "Failed to clean up timeshifting files for '{0}'", timeshiftFile); + } + } + public override LiveTvStream[] GetLiveTvStreams() { List<LiveTvStream> liveTvStreams = new List<LiveTvStream>(); @@ -359,7 +387,7 @@ cards.Sort(delegate(Card c1, Card c2) { return c1.Priority.CompareTo(c2.Priority); }); // Get the list of live streams from TV Server - Dictionary<string, User> mpStreams = new Dictionary<string, User>(); + Dictionary<string, User> mpStreamUsers = new Dictionary<string, User>(); foreach (Card card in cards) { User[] cardUsers = TvServerPlugin.TvController.GetUsersForCard(card.IdCard); @@ -372,7 +400,7 @@ User tve3User = user; if (TvServerPlugin.TvController.IsTimeShifting(ref tve3User)) { - mpStreams.Add(TvServerPlugin.TvController.GetStreamingUrl(tve3User), tve3User); + mpStreamUsers.Add(TvServerPlugin.TvController.GetStreamingUrl(tve3User), tve3User); } } } @@ -384,7 +412,7 @@ foreach (LiveTvStream tvStream in _tvStreams.Values) { - if (mpStreams.ContainsKey(tvStream.RtspUrl)) + if (mpStreamUsers.ContainsKey(tvStream.RtspUrl)) { liveTvStreams.Add(tvStream); } @@ -398,15 +426,16 @@ foreach(string keyToRemove in keysToRemove) { _tvStreams.Remove(keyToRemove); + _tvStreamUsers.Remove(keyToRemove); } // Check if there are any live streams within MP that we don't know about. // If so, stop those streams (they may be left-overs from client crashes). - foreach (string rtspUrl in mpStreams.Keys) + foreach (string rtspUrl in mpStreamUsers.Keys) { if (!_tvStreams.ContainsKey(rtspUrl)) { - User tve3User = mpStreams[rtspUrl]; + User tve3User = mpStreamUsers[rtspUrl]; TvServerPlugin.TvController.StopTimeShifting(ref tve3User, TvStoppedReason.KickedByAdmin); } } @@ -444,6 +473,17 @@ #region Private Methods + private static string GetTsBufferFile(User tve3User) + { + string tsBufferFile = TvServerPlugin.TvController.TimeShiftFileName(ref tve3User); + string uncTimeshiftFolder = Common.ShareExplorer.GetUncPathForLocalPath(Path.GetDirectoryName(tsBufferFile)); + if (!String.IsNullOrEmpty(uncTimeshiftFolder)) + { + return Path.Combine(uncTimeshiftFolder, Path.GetFileName(tsBufferFile)); + } + return null; + } + private List<Card> GetCardsForChannel(ChannelLinks channelLinks, Guid tvChannelId, string tvChannelName, out Channel channel) { List<Card> availableCards = new List<Card>(); Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2009-01-15 08:29:58 UTC (rev 2509) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2009-01-15 16:10:32 UTC (rev 2510) @@ -43,13 +43,15 @@ { private static object _startRecordingLock = new object(); + private string _suggestedBaseFileName; private Card _recordOnCard; private Channel _channel; public RecordingThread(Guid recorderTunerId, string tvSchedulerHostName, int tvSchedulerTcpPort, CardChannelAllocation channelAllocation, - DateTime startTime, DateTime stopTime, UpcomingProgram recordingProgram, Card recordOnCard, Channel channel) + DateTime startTime, DateTime stopTime, UpcomingProgram recordingProgram, string suggestedBaseFileName, Card recordOnCard, Channel channel) : base(recorderTunerId, tvSchedulerHostName, tvSchedulerTcpPort, channelAllocation, startTime, stopTime, recordingProgram, true) { + _suggestedBaseFileName = suggestedBaseFileName; _recordOnCard = recordOnCard; _channel = channel; } @@ -60,7 +62,7 @@ { get { - return new TimeSpan(0, 2, 0); + return new TimeSpan(0, 3, 0); } } @@ -81,12 +83,26 @@ protected override string OnStartRecording(RecorderTunerCallbackServiceAgent callbackAgent, ref string errorMessage) { - string fileName = Path.Combine(_recordOnCard.RecordingFolder, - Common.Utility.BuildRecordingBaseFileName(null, this.RecordingProgram)); + string baseFileName = _suggestedBaseFileName; + if (String.IsNullOrEmpty(baseFileName)) + { + baseFileName = Common.Utility.BuildRecordingBaseFileName(null, this.RecordingProgram); + } + else + { + this.UsedSuggestedBaseFileName = true; + } + + string fileName = Path.Combine(_recordOnCard.RecordingFolder, baseFileName); string extension = (_recordOnCard.RecordingFormat == 0) ? ".ts" : ".mpg"; _tve3RecordingFileName = Common.Utility.GetFreeFileName(fileName, extension); + string tve3RecordingDirectory = Path.GetDirectoryName(_tve3RecordingFileName); + if (!Directory.Exists(tve3RecordingDirectory)) + { + Directory.CreateDirectory(tve3RecordingDirectory); + } - string uncRecordingFolder = Common.ShareExplorer.GetUncPathForLocalPath(Path.GetDirectoryName(_tve3RecordingFileName)); + string uncRecordingFolder = Common.ShareExplorer.GetUncPathForLocalPath(tve3RecordingDirectory); if (String.IsNullOrEmpty(uncRecordingFolder)) { errorMessage = "Failed to convert '" + Path.GetDirectoryName(_tve3RecordingFileName) + "' to UNC path, please add required share"; Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.Designer.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.Designer.cs 2009-01-15 08:29:58 UTC (rev 2509) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.Designer.cs 2009-01-15 16:10:32 UTC (rev 2510) @@ -35,6 +35,8 @@ System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SetupForm)); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); this._tvSchedulerGroupBox = new System.Windows.Forms.GroupBox(); this._connectButton = new System.Windows.Forms.Button(); this._portNumericUpDown = new System.Windows.Forms.NumericUpDown(); @@ -54,13 +56,13 @@ this._channelItemsBindingSource = new System.Windows.Forms.BindingSource(this.components); this._notConnectedPanel = new System.Windows.Forms.Panel(); this._notConnectedLabel = new System.Windows.Forms.Label(); - this._generalGroupBox = new System.Windows.Forms.GroupBox(); + this._uncRecordingGroupBox = new System.Windows.Forms.GroupBox(); this._createUncShareButton = new System.Windows.Forms.Button(); - this._refreshUncButton = new System.Windows.Forms.Button(); this._uncPathsDataGridView = new System.Windows.Forms.DataGridView(); this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this._uncPathsBindingSource = new System.Windows.Forms.BindingSource(this.components); + this._refreshUncButton = new System.Windows.Forms.Button(); this._syncInfoLabel = new System.Windows.Forms.Label(); this._hoursLabel = new System.Windows.Forms.Label(); this._allProgramsHoursNumericUpDown = new System.Windows.Forms.NumericUpDown(); @@ -72,6 +74,13 @@ this._configTabPage = new System.Windows.Forms.TabPage(); this._powerGroupBox = new System.Windows.Forms.GroupBox(); this._restartOnResumeCheckBox = new System.Windows.Forms.CheckBox(); + this._uncPathsTabPage = new System.Windows.Forms.TabPage(); + this._uncTimeshiftGroupBox = new System.Windows.Forms.GroupBox(); + this._createTimeshiftingShareButton = new System.Windows.Forms.Button(); + this._uncTimeshiftingDataGridView = new System.Windows.Forms.DataGridView(); + this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this._uncTimeshiftingBindingSource = new System.Windows.Forms.BindingSource(this.components); this._channelsTabPage = new System.Windows.Forms.TabPage(); this._tvSchedulerGroupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this._portNumericUpDown)).BeginInit(); @@ -81,7 +90,7 @@ ((System.ComponentModel.ISupportInitialize)(this._channelsDataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._channelItemsBindingSource)).BeginInit(); this._notConnectedPanel.SuspendLayout(); - this._generalGroupBox.SuspendLayout(); + this._uncRecordingGroupBox.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this._uncPathsDataGridView)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._uncPathsBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this._allProgramsHoursNumericUpDown)).BeginInit(); @@ -89,6 +98,10 @@ this._tabControl.SuspendLayout(); this._configTabPage.SuspendLayout(); this._powerGroupBox.SuspendLayout(); + this._uncPathsTabPage.SuspendLayout(); + this._uncTimeshiftGroupBox.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this._uncTimeshiftingDataGridView)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this._uncTimeshiftingBindingSource)).BeginInit(); this._channelsTabPage.SuspendLayout(); this.SuspendLayout(); // @@ -315,25 +328,23 @@ this._notConnectedLabel.TabIndex = 0; this._notConnectedLabel.Text = "Not connected to For The Record, check server settings in Configuration."; // - // _generalGroupBox + // _uncRecordingGroupBox // - this._generalGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this._uncRecordingGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this._generalGroupBox.Controls.Add(this._createUncShareButton); - this._generalGroupBox.Controls.Add(this._refreshUncButton); - this._generalGroupBox.Controls.Add(this._uncPathsDataGridView); - this._generalGroupBox.Location = new System.Drawing.Point(6, 86); - this._generalGroupBox.Name = "_generalGroupBox"; - this._generalGroupBox.Size = new System.Drawing.Size(580, 128); - this._generalGroupBox.TabIndex = 1; - this._generalGroupBox.TabStop = false; - this._generalGroupBox.Text = "UNC Recording Paths"; + this._uncRecordingGroupBox.Controls.Add(this._createUncShareButton); + this._uncRecordingGroupBox.Controls.Add(this._uncPathsDataGridView); + this._uncRecordingGroupBox.Location = new System.Drawing.Point(6, 6); + this._uncRecordingGroupBox.Name = "_uncRecordingGroupBox"; + this._uncRecordingGroupBox.Size = new System.Drawing.Size(580, 152); + this._uncRecordingGroupBox.TabIndex = 1; + this._uncRecordingGroupBox.TabStop = false; + this._uncRecordingGroupBox.Text = "UNC Recording Paths"; // // _createUncShareButton // this._createUncShareButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this._createUncShareButton.Location = new System.Drawing.Point(6, 99); + this._createUncShareButton.Location = new System.Drawing.Point(6, 123); this._createUncShareButton.Name = "_createUncShareButton"; this._createUncShareButton.Size = new System.Drawing.Size(100, 23); this._createUncShareButton.TabIndex = 11; @@ -341,17 +352,6 @@ this._createUncShareButton.UseVisualStyleBackColor = true; this._createUncShareButton.Click += new System.EventHandler(this._createUncShareButton_Click); // - // _refreshUncButton - // - this._refreshUncButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this._refreshUncButton.Location = new System.Drawing.Point(499, 99); - this._refreshUncButton.Name = "_refreshUncButton"; - this._refreshUncButton.Size = new System.Drawing.Size(75, 23); - this._refreshUncButton.TabIndex = 12; - this._refreshUncButton.Text = "Refresh"; - this._refreshUncButton.UseVisualStyleBackColor = true; - this._refreshUncButton.Click += new System.EventHandler(this._refreshUncButton_Click); - // // _uncPathsDataGridView // this._uncPathsDataGridView.AllowUserToAddRows = false; @@ -385,7 +385,7 @@ dataGridViewCellStyle4.SelectionForeColor = System.Drawing.Color.Black; this._uncPathsDataGridView.RowsDefaultCellStyle = dataGridViewCellStyle4; this._uncPathsDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this._uncPathsDataGridView.Size = new System.Drawing.Size(568, 76); + this._uncPathsDataGridView.Size = new System.Drawing.Size(568, 100); this._uncPathsDataGridView.StandardTab = true; this._uncPathsDataGridView.TabIndex = 10; this._uncPathsDataGridView.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this._uncPathsDataGridView_CellFormatting); @@ -409,6 +409,17 @@ this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; this.dataGridViewTextBoxColumn2.ReadOnly = true; // + // _refreshUncButton + // + this._refreshUncButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this._refreshUncButton.Location = new System.Drawing.Point(511, 322); + this._refreshUncButton.Name = "_refreshUncButton"; + this._refreshUncButton.Size = new System.Drawing.Size(75, 23); + this._refreshUncButton.TabIndex = 12; + this._refreshUncButton.Text = "Refresh"; + this._refreshUncButton.UseVisualStyleBackColor = true; + this._refreshUncButton.Click += new System.EventHandler(this._refreshUncButton_Click); + // // _syncInfoLabel // this._syncInfoLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0))); @@ -472,7 +483,7 @@ // // _epgGroupBox // - this._epgGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + this._epgGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this._epgGroupBox.Controls.Add(this._epgAutoCreateChannelsCheckBox); this._epgGroupBox.Controls.Add(this._allProgramsEveryLabel); @@ -480,7 +491,7 @@ this._epgGroupBox.Controls.Add(this._hoursLabel); this._epgGroupBox.Controls.Add(this._syncTve3EpgcheckBox); this._epgGroupBox.Controls.Add(this._syncInfoLabel); - this._epgGroupBox.Location = new System.Drawing.Point(6, 266); + this._epgGroupBox.Location = new System.Drawing.Point(6, 138); this._epgGroupBox.Name = "_epgGroupBox"; this._epgGroupBox.Size = new System.Drawing.Size(580, 106); this._epgGroupBox.TabIndex = 2; @@ -500,6 +511,7 @@ // _tabControl // this._tabControl.Controls.Add(this._configTabPage); + this._tabControl.Controls.Add(this._uncPathsTabPage); this._tabControl.Controls.Add(this._channelsTabPage); this._tabControl.Dock = System.Windows.Forms.DockStyle.Fill; this._tabControl.Location = new System.Drawing.Point(0, 0); @@ -513,7 +525,6 @@ // this._configTabPage.Controls.Add(this._powerGroupBox); this._configTabPage.Controls.Add(this._tvSchedulerGroupBox); - this._configTabPage.Controls.Add(this._generalGroupBox); this._configTabPage.Controls.Add(this._epgGroupBox); this._configTabPage.Location = new System.Drawing.Point(4, 22); this._configTabPage.Name = "_configTabPage"; @@ -525,9 +536,10 @@ // // _powerGroupBox // - this._powerGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this._powerGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this._powerGroupBox.Controls.Add(this._restartOnResumeCheckBox); - this._powerGroupBox.Location = new System.Drawing.Point(6, 218); + this._powerGroupBox.Location = new System.Drawing.Point(6, 88); this._powerGroupBox.Name = "_powerGroupBox"; this._powerGroupBox.Size = new System.Drawing.Size(580, 44); this._powerGroupBox.TabIndex = 3; @@ -544,6 +556,99 @@ this._restartOnResumeCheckBox.Text = "Re-initialize TV Server when the system resumes from standby"; this._restartOnResumeCheckBox.UseVisualStyleBackColor = true; // + // _uncPathsTabPage + // + this._uncPathsTabPage.Controls.Add(this._uncTimeshiftGroupBox); + this._uncPathsTabPage.Controls.Add(this._refreshUncButton); + this._uncPathsTabPage.Controls.Add(this._uncRecordingGroupBox); + this._uncPathsTabPage.Location = new System.Drawing.Point(4, 22); + this._uncPathsTabPage.Name = "_uncPathsTabPage"; + this._uncPathsTabPage.Size = new System.Drawing.Size(592, 374); + this._uncPathsTabPage.TabIndex = 2; + this._uncPathsTabPage.Text = "UNC Paths"; + this._uncPathsTabPage.UseVisualStyleBackColor = true; + // + // _uncTimeshiftGroupBox + // + this._uncTimeshiftGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._uncTimeshiftGroupBox.Controls.Add(this._createTimeshiftingShareButton); + this._uncTimeshiftGroupBox.Controls.Add(this._uncTimeshiftingDataGridView); + this._uncTimeshiftGroupBox.Location = new System.Drawing.Point(6, 164); + this._uncTimeshiftGroupBox.Name = "_uncTimeshiftGroupBox"; + this._uncTimeshiftGroupBox.Size = new System.Drawing.Size(580, 152); + this._uncTimeshiftGroupBox.TabIndex = 13; + this._uncTimeshiftGroupBox.TabStop = false; + this._uncTimeshiftGroupBox.Text = "UNC Timeshift Paths"; + // + // _createTimeshiftingShareButton + // + this._createTimeshiftingShareButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this._createTimeshiftingShareButton.Location = new System.Drawing.Point(6, 123); + this._createTimeshiftingShareButton.Name = "_createTimeshiftingShareButton"; + this._createTimeshiftingShareButton.Size = new System.Drawing.Size(100, 23); + this._createTimeshiftingShareButton.TabIndex = 11; + this._createTimeshiftingShareButton.Text = "Create Share"; + this._createTimeshiftingShareButton.UseVisualStyleBackColor = true; + this._createTimeshiftingShareButton.Click += new System.EventHandler(this._createTimeshiftingShareButton_Click); + // + // _uncTimeshiftingDataGridView + // + this._uncTimeshiftingDataGridView.AllowUserToAddRows = false; + this._uncTimeshiftingDataGridView.AllowUserToDeleteRows = false; + this._uncTimeshiftingDataGridView.AllowUserToResizeRows = false; + dataGridViewCellStyle5.BackColor = System.Drawing.Color.WhiteSmoke; + dataGridViewCellStyle5.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle5.SelectionBackColor = System.Drawing.Color.Silver; + dataGridViewCellStyle5.SelectionForeColor = System.Drawing.Color.Black; + this._uncTimeshiftingDataGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle5; + this._uncTimeshiftingDataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this._uncTimeshiftingDataGridView.AutoGenerateColumns = false; + this._uncTimeshiftingDataGridView.BackgroundColor = System.Drawing.Color.White; + this._uncTimeshiftingDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; + this._uncTimeshiftingDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing; + this._uncTimeshiftingDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.dataGridViewTextBoxColumn3, + this.dataGridViewTextBoxColumn4}); + this._uncTimeshiftingDataGridView.DataSource = this._uncTimeshiftingBindingSource; + this._uncTimeshiftingDataGridView.GridColor = System.Drawing.Color.White; + this._uncTimeshiftingDataGridView.Location = new System.Drawing.Point(6, 19); + this._uncTimeshiftingDataGridView.MultiSelect = false; + this._uncTimeshiftingDataGridView.Name = "_uncTimeshiftingDataGridView"; + this._uncTimeshiftingDataGridView.ReadOnly = true; + this._uncTimeshiftingDataGridView.RowHeadersVisible = false; + dataGridViewCellStyle6.BackColor = System.Drawing.Color.White; + dataGridViewCellStyle6.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.Silver; + dataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.Black; + this._uncTimeshiftingDataGridView.RowsDefaultCellStyle = dataGridViewCellStyle6; + this._uncTimeshiftingDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; + this._uncTimeshiftingDataGridView.Size = new System.Drawing.Size(568, 100); + this._uncTimeshiftingDataGridView.StandardTab = true; + this._uncTimeshiftingDataGridView.TabIndex = 10; + this._uncTimeshiftingDataGridView.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this._uncPathsDataGridView_CellFormatting); + this._uncTimeshiftingDataGridView.SelectionChanged += new System.EventHandler(this._uncTimeshiftingDataGridView_SelectionChanged); + // + // dataGridViewTextBoxColumn3 + // + this.dataGridViewTextBoxColumn3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.dataGridViewTextBoxColumn3.DataPropertyName = "CardName"; + this.dataGridViewTextBoxColumn3.FillWeight = 30F; + this.dataGridViewTextBoxColumn3.HeaderText = "Card"; + this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3"; + this.dataGridViewTextBoxColumn3.ReadOnly = true; + // + // dataGridViewTextBoxColumn4 + // + this.dataGridViewTextBoxColumn4.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.dataGridViewTextBoxColumn4.DataPropertyName = "Message"; + this.dataGridViewTextBoxColumn4.FillWeight = 70F; + this.dataGridViewTextBoxColumn4.HeaderText = "Path"; + this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4"; + this.dataGridViewTextBoxColumn4.ReadOnly = true; + // // _channelsTabPage // this._channelsTabPage.Controls.Add(this._channelMappingGroupBox); @@ -570,7 +675,7 @@ ((System.ComponentModel.ISupportInitialize)(this._channelItemsBindingSource)).EndInit(); this._notConnectedPanel.ResumeLayout(false); this._notConnectedPanel.PerformLayout(); - this._generalGroupBox.ResumeLayout(false); + this._uncRecordingGroupBox.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this._uncPathsDataGridView)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._uncPathsBindingSource)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this._allProgramsHoursNumericUpDown)).EndInit(); @@ -580,6 +685,10 @@ this._configTabPage.ResumeLayout(false); this._powerGroupBox.ResumeLayout(false); this._powerGroupBox.PerformLayout(); + this._uncPathsTabPage.ResumeLayout(false); + this._uncTimeshiftGroupBox.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this._uncTimeshiftingDataGridView)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this._uncTimeshiftingBindingSource)).EndInit(); this._channelsTabPage.ResumeLayout(false); this.ResumeLayout(false); @@ -599,7 +708,7 @@ private System.Windows.Forms.Panel _channelsPanel; private System.Windows.Forms.Label _notConnectedLabel; private System.Windows.Forms.BindingSource _channelItemsBindingSource; - private System.Windows.Forms.GroupBox _generalGroupBox; + private System.Windows.Forms.GroupBox _uncRecordingGroupBox; private System.Windows.Forms.Label _hoursLabel; private System.Windows.Forms.NumericUpDown _allProgramsHoursNumericUpDown; private System.Windows.Forms.Label _allProgramsEveryLabel; @@ -625,5 +734,12 @@ private System.Windows.Forms.GroupBox _powerGroupBox; private System.Windows.Forms.CheckBox _restartOnResumeCheckBox; private System.Windows.Forms.Button _linkChannelButton; + private System.Windows.Forms.TabPage _uncPathsTabPage; + private System.Windows.Forms.GroupBox _uncTimeshiftGroupBox; + private System.Windows.Forms.Button _createTimeshiftingShareButton; + private System.Windows.Forms.DataGridView _uncTimeshiftingDataGridView; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3; + private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4; + private System.Windows.Forms.BindingSource _uncTimeshiftingBindingSource; } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs 2009-01-15 08:29:58 UTC (rev 2509) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs 2009-01-15 16:10:32 UTC (rev 2510) @@ -239,44 +239,23 @@ { bool anyError = false; - IList mediaPortalCards = Card.ListAll(); - List<UncPathItem> pathItems = new List<UncPathItem>(); + List<UncPathItem> tsPathItems = new List<UncPathItem>(); + List<Card> mediaPortalCards = Utility.GetAllCards(); foreach (Card card in mediaPortalCards) { - if (card.Enabled - && !card.DevicePath.Equals("(builtin)", StringComparison.CurrentCultureIgnoreCase) - && !String.IsNullOrEmpty(card.RecordingFolder)) - { - bool hasError = true; - string message; - - string recordingPath = card.RecordingFolder; - string uncPath = ShareExplorer.GetUncPathForLocalPath(recordingPath); - if (!String.IsNullOrEmpty(uncPath)) - { - message = uncPath; - recordingPath = uncPath; - hasError = false; - } - else - { - message = card.RecordingFolder; - hasError = true; - } - - anyError = anyError | hasError; - pathItems.Add(new UncPathItem(card.Name, recordingPath, message, hasError)); - } + anyError = anyError | AddUncPathItem(pathItems, card.Name, card.RecordingFolder); + anyError = anyError | AddUncPathItem(tsPathItems, card.Name, card.TimeShiftFolder); } _uncPathsBindingSource.DataSource = pathItems; + _uncTimeshiftingBindingSource.DataSource = tsPathItems; EnableUncButtons(); if (anyError) { - MessageBox.Show(this, "You must set up a share with full permissions for" + Environment.NewLine + "the SYSTEM account for all recording folders!", null, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); + MessageBox.Show(this, "You must set up a share with full permissions for the core" + Environment.NewLine + "services account for all recording folders!", null, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception ex) @@ -285,6 +264,29 @@ } } + private static bool AddUncPathItem(List<UncPathItem> pathItems, string name, string path) + { + bool hasError = true; + string message; + + string uncPath = ShareExplorer.GetUncPathForLocalPath(path); + if (!String.IsNullOrEmpty(uncPath)) + { + message = uncPath; + path = uncPath; + hasError = false; + } + else + { + message = path; + hasError = true; + } + + pathItems.Add(new UncPathItem(name, path, message, hasError)); + + return hasError; + } + private void LoadChannels() { try @@ -317,11 +319,12 @@ private void _uncPathsDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { + DataGridView dataGridView = sender as DataGridView; if (e.ColumnIndex == 1 && e.RowIndex >= 0 && e.RowIndex < _uncPathsBindingSource.Count) { - UncPathItem linkItem = _uncPathsDataGridView.Rows[e.RowIndex].DataBoundItem as UncPathItem; + UncPathItem linkItem = dataGridView.Rows[e.RowIndex].DataBoundItem as UncPathItem; if (linkItem != null && linkItem.HasError) { @@ -351,16 +354,6 @@ } } - private void _uncPathsDataGridView_SelectionChanged(object sender, EventArgs e) - { - EnableUncButtons(); - } - - private void _refreshUncButton_Click(object sender, EventArgs e) - { - LoadUncPaths(); - } - private void EnableUncButtons() { if (_uncPathsDataGridView.SelectedRows.Count > 0) @@ -372,6 +365,15 @@ { _createUncShareButton.Enabled = false; } + if (_uncTimeshiftingDataGridView.SelectedRows.Count > 0) + { + UncPathItem linkItem = _uncTimeshiftingDataGridView.SelectedRows[0].DataBoundItem as UncPathItem; + _createTimeshiftingShareButton.Enabled = linkItem.HasError; + } + else + { + _createTimeshiftingShareButton.Enabled = false; + } } private void EnableChannelButtons() @@ -379,25 +381,21 @@ _linkChannelButton.Enabled = (_channelsDataGridView.SelectedRows.Count == 1); } - private void _createUncShareButton_Click(object sender, EventArgs e) + private void _syncTve3EpgcheckBox_CheckedChanged(object sender, EventArgs e) { - if (_uncPathsDataGridView.SelectedRows.Count > 0) - { - CreateShareForm form = new CreateShareForm(); - UncPathItem linkItem = _uncPathsDataGridView.SelectedRows[0].DataBoundItem as UncPathItem; - form.LocalPath = linkItem.RecordingPath; - if (form.ShowDialog(this) == DialogResult.OK) - { - LoadUncPaths(); - } - } + _epgAutoCreateChannelsCheckBox.Enabled = _syncTve3EpgcheckBox.Checked; } - private void _syncTve3EpgcheckBox_CheckedChanged(object sender, EventArgs e) + private void _refreshUncButton_Click(object sender, EventArgs e) { - _epgAutoCreateChannelsCheckBox.Enabled = _syncTve3EpgcheckBox.Checked; + LoadUncPaths(); } + private void _uncPathsDataGridView_SelectionChanged(object sender, EventArgs e) + { + EnableUncButtons(); + } + private void _channelsDataGridView_SelectionChanged(object sender, EventArgs e) { EnableChannelButtons(); @@ -459,5 +457,36 @@ rowColor = Color.DarkGreen; } } + + private void _uncTimeshiftingDataGridView_SelectionChanged(object sender, EventArgs e) + { + EnableUncButtons(); + } + + private void _createUncShareButton_Click(object sender, EventArgs e) + { + if (_uncPathsDataGridView.SelectedRows.Count > 0) + { + ShowCreateShareForm(_uncPathsDataGridView.SelectedRows[0].DataBoundItem as UncPathItem); + } + } + + private void _createTimeshiftingShareButton_Click(object sender, EventArgs e) + { + if (_uncTimeshiftingDataGridView.SelectedRows.Count > 0) + { + ShowCreateShareForm(_uncTimeshiftingDataGridView.SelectedRows[0].DataBoundItem as UncPathItem); + } + } + + private void ShowCreateShareForm(UncPathItem linkItem) + { + CreateShareForm form = new CreateShareForm(); + form.LocalPath = linkItem.RecordingPath; + if (form.ShowDialog(this) == DialogResult.OK) + { + LoadUncPaths(); + } + } } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.resx =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.resx 2009-01-15 08:29:58 UTC (rev 2509) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.resx 2009-01-15 16:10:32 UTC (rev 2510) @@ -138,4 +138,13 @@ <data name="_syncInfoLabel.Text" xml:space="preserve"> <value>Only turn this on when you do *not* use XMLTV guide data and want the DVB-EPG data collected by TV Server copied over to For The Record (not recommended)! Channels you want to be synced must be created in For The Record and shown as linked in Channels.</value> </data> + <metadata name="dataGridViewTextBoxColumn3.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="dataGridViewTextBoxColumn4.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> + <value>True</value> + </metadata> + <metadata name="_uncTimeshiftingBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>413, 16</value> + </metadata> </root> \ No newline at end of file Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2009-01-15 08:29:58 UTC (rev 2509) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2009-01-15 16:10:32 UTC (rev 2510) @@ -26,6 +26,7 @@ using System; using System.Collections.Generic; using System.Text; +using System.Threading; using MediaPortal.Configuration; using MediaPortal.GUI.Library; @@ -554,6 +555,7 @@ #region Live TV private LiveTvStream _liveTvStream; + private LiveTvStream _pendingStopLiveTvStream; private void TuneLiveTv(TvChannel tvChannel) { @@ -565,77 +567,96 @@ if (currentAndNext != null) { LiveTvStream liveTvStream = _liveTvStream; - if (liveTvStream == null) + + if (liveTvStream != null) { - LiveTvResult result = this.TvControlAgent.TuneLiveTvStream(currentAndNext.TvChannel, ref liveTvStream); - if (result == LiveTvResult.Succeeded) + bool resumeGraph = true; + g_Player.PauseGraph(); + LiveTvResult firstResult = LiveTvResult.Succeeded; + LiveTvResult result = LiveTvResult.UnknownError; + try { - SetCurrentAndNext(currentAndNext); - _currentChannel = tvChannel; - _liveTvStream = liveTvStream; + string lastRtspUrl = liveTvStream.RtspUrl; + result = this.TvControlAgent.TuneLiveTvStream(currentAndNext.TvChannel, ref liveTvStream); + if (result == LiveTvResult.Succeeded) + { + SetCurrentAndNext(currentAndNext); + _currentChannel = tvChannel; - if (_currentProgram != null) - { - g_Player.currentTitle = _currentProgram.CreateProgramTitle(); - g_Player.currentDescription = Utility.GetComposedDescription(_currentProgram); + if (liveTvStream.RtspUrl != lastRtspUrl) + { + result = PlayLiveTv(liveTvStream); + } + else + { + string fileName; + int seekOffset; + GetPlayerFileNameAndOffset(liveTvStream, out fileName, out seekOffset); + g_Player.SeekAbsolute(g_Player.Duration + seekOffset); + } } else { - g_Player.currentTitle = String.Empty; - g_Player.currentDescription = String.Empty; - } + firstResult = result; + tvChannel = _currentChannel; - if (g_Player.Play(_liveTvStream.RtspUrl, g_Player.MediaType.TV)) - { - if (_autoFullScreen) + g_Player.ContinueGraph(); + resumeGraph = false; + SilentlyStopLiveTv(liveTvStream); + + liveTvStream = null; + result = this.TvControlAgent.TuneLiveTvStream(tvChannel, ref liveTvStream); + if (result == LiveTvResult.Succeeded) { - g_Player.ShowFullScreenWindow(); + result = PlayLiveTv(liveTvStream); + _currentChannel = tvChannel; } } } - else + catch { + result = LiveTvResult.UnknownError; + } + finally + { + if (resumeGraph) + { + g_Player.ContinueGraph(); + } + } + + if (result != LiveTvResult.Succeeded) + { + SilentlyStopLiveTv(liveTvStream); ShowLiveTvError(result); - _liveTvStream = null; } + else if (firstResult != LiveTvResult.Succeeded) + { + ShowLiveTvError(firstResult); + } } - else + + if (liveTvStream == null) { - g_Player.PauseGraph(); - bool resumePlayer = true; - - string lastRtspUrl = liveTvStream.RtspUrl; + StopPendingLiveTvStream(); LiveTvResult result = this.TvControlAgent.TuneLiveTvStream(currentAndNext.TvChannel, ref liveTvStream); if (result == LiveTvResult.Succeeded) { SetCurrentAndNext(currentAndNext); _currentChannel = tvChannel; - if (liveTvStream.RtspUrl != lastRtspUrl) + result = PlayLiveTv(liveTvStream); + if (result == LiveTvResult.Succeeded) { - if (g_Player.Play(liveTvStream.RtspUrl, g_Player.MediaType.TV)) + if (_autoFullScreen) { - g_Player.ContinueGraph(); - resumePlayer = false; - _liveTvStream = liveTvStream; + g_Player.ShowFullScreenWindow(); } - else - { - _liveTvStream = null; - } } } - - if (resumePlayer) + else { - g_Player.SeekAbsolute(g_Player.Duration + 10); - g_Player.ContinueGraph(); - } - - if (result != LiveTvResult.Succeeded) - { ShowLiveTvError(result); - _liveTvStream = null; } } } @@ -643,6 +664,47 @@ } } + private LiveTvResult PlayLiveTv(LiveTvStream liveTvStream) + { + LiveTvResult result = LiveTvResult.Succeeded; + + string fileName; + int seekOffset; + GetPlayerFileNameAndOffset(liveTvStream, out fileName, out seekOffset); + + if (g_Player.Play(fileName, g_Player.MediaType.TV)) + { + _liveTvStream = liveTvStream; + g_Player.SeekAbsolute(g_Player.Duration + seekOffset); + } + else + { + result = LiveTvResult.UnknownError; + } + + return result; + } + + private void SilentlyStopLiveTv(LiveTvStream liveTvStream) + { + _liveTvStream = null; + g_Player.Stop(); + _liveTvStream = liveTvStream; + StopLiveTv(); + } + + private static void GetPlayerFileNameAndOffset(LiveTvStream liveTvStream, out string fileName, out int seekOffset) + { + seekOffset = 10; + fileName = liveTvStream.RtspUrl; + if (ForTheRecordHome.AvoidRtspForLiveTv + && !String.IsNullOrEmpty(liveTvStream.TimeshiftFile)) + { + fileName = liveTvStream.TimeshiftFile; + seekOffset = 0; + } + } + private void SetCurrentAndNext(CurrentAndNextProgram currentAndNext) { _currentNextProgram = currentAndNext; @@ -662,6 +724,20 @@ } } } + if (g_Player.Playing + && g_Player.IsTV) + { + if (_currentProgram != null) + { + g_Player.currentTitle = _currentProgram.CreateProgramTitle(); + g_Player.currentDescription = Utility.GetComposedDescription(_currentProgram); + } + else + { + g_Player.currentTitle = String.Empty; + g_Player.currentDescription = String.Empty; + } + } } private void RefreshCurrentAndNext() @@ -676,8 +752,29 @@ } } + private Thread _asyncStopLiveTvThread; + private object _asyncStopLiveTvLock = new object(); + + public void AsyncStopLiveTv() + { + if (_liveTvStream != null) + { + lock (_asyncStopLiveTvLock) + { + _pendingStopLiveTvStream = _liveTvStream; + _liveTvStream = null; + _previousChannel = _currentChannel; + _asyncStopLiveTvThread = new Thread(new ThreadStart(AsyncStopLiveTvThreadMain)); + _asyncStopLiveTvThread.Start(); + } + } + _currentChannel = null; + _currentNextProgram = null; + } + public void StopLiveTv() { + StopPendingLiveTvStream(); if (_liveTvStream != null) { this.TvControlAgent.StopLiveTvStream(_liveTvStream); @@ -727,6 +824,29 @@ #region Private methods + private void AsyncStopLiveTvThreadMain() + { + while ((g_Player.Playing || GUIGraphicsContext.IsPlaying) + && g_Player.IsTV) + { + Thread.Sleep(100); + } + Thread.Sleep(500); + StopPendingLiveTvStream(); + } + + private void StopPendingLiveTvStream() + { + lock (_asyncStopLiveTvLock) + { + if (_pendingStopLiveTvStream != null) + { + this.TvControlAgent.StopLiveTvStream(_pendingStopLiveTvStream); + _pendingStopLiveTvStream = null; + } + } + } + private void RefreshChannelsInGroup() { using (TvSchedulerServiceAgent tvSchedulerAgent = new TvSchedulerServiceAgent())... [truncated message content] |
From: <do...@us...> - 2009-02-07 15:41:33
|
Revision: 2613 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=2613&view=rev Author: dot-i Date: 2009-02-07 15:41:24 +0000 (Sat, 07 Feb 2009) Log Message: ----------- Updated to source code for version 1.3.3.0. Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SyncEpgThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordHome.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/PostBuild.cmd trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVZapOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TextId.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Translator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideSearch.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvMiniGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvProgramInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvRecorded.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/WindowId.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/TitleRuleTypeIndex.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/KeepUntilControlUtility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ProcessUtility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/RecorderTunersCache.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Recordings/RecordingsController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Recordings/RecordingsModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ScheduleNamesCache.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SearchGuide/SearchGuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SearchGuide/SearchGuideModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SerializableDictionary.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SortableBindingList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvChannelProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvChannelProgramsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvGuide/ChannelPrograms.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvGuide/TvGuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvGuide/TvGuideModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvGuide/TvGuideUpcomingProgram.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingOrActiveProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingOrActiveProgramsList.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2008 ForTheRecord + * Copyright (C) 2007-2009 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2008 ForTheRecord + * Copyright (C) 2007-2009 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2008 ForTheRecord + * Copyright (C) 2007-2009 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2008 ForTheRecord + * Copyright (C) 2007-2009 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -228,6 +228,8 @@ } } } + + return LiveTvResult.NoRetunePossible; } else { @@ -254,14 +256,15 @@ } } } + + return LiveTvResult.NoFreeCardFound; } } catch (Exception ex) { Log(TraceEventType.Error, ex.Message); + return LiveTvResult.UnknownError; } - - return LiveTvResult.NoFreeCardFound; } private bool CardFreeOrUsingSameTransponder(int cardId, Channel channel, User userToIgnore) Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -11,7 +11,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ForTheRecord.RecorderTuners.MediaPortalTvServer")] -[assembly: AssemblyCopyright("Copyright © ForTheRecord 2007-2008")] +[assembly: AssemblyCopyright("Copyright © ForTheRecord 2007-2009")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2008 ForTheRecord + * Copyright (C) 2007-2009 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2008 ForTheRecord + * Copyright (C) 2007-2009 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2008 ForTheRecord + * Copyright (C) 2007-2009 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SyncEpgThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SyncEpgThread.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SyncEpgThread.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2008 ForTheRecord + * Copyright (C) 2007-2009 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -55,210 +55,177 @@ set { _plugin = value; } } - private TvSchedulerServiceAgent _tvSchedulerAgent; - private TvGuideServiceAgent _tvGuideAgent; - protected override void Run() { - Thread.Sleep(5 * 60 * 1000); + Thread.Sleep(3 * 60 * 1000); - try + bool aborted = false; + DateTime lastSyncTime = DateTime.MinValue; + DateTime lastAllSyncTime = DateTime.MinValue; + DateTime latestProgramTime = DateTime.Today; + while (!aborted) { - bool aborted = false; - DateTime lastSyncTime = DateTime.MinValue; - DateTime lastAllSyncTime = DateTime.MinValue; - DateTime latestProgramTime = DateTime.Today; - while (!aborted) + try { - try - { - TvBusinessLayer layer = new TvBusinessLayer(); - bool epgSyncOn = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncOn, false.ToString()).Value); - int epgSyncAllHours = Convert.ToInt32(layer.GetSetting(SettingName.EpgSyncAllHours, TvServerPlugin.DefaultSyncAllHours.ToString()).Value); + TvBusinessLayer layer = new TvBusinessLayer(); + bool epgSyncOn = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncOn, false.ToString()).Value); + int epgSyncAllHours = Convert.ToInt32(layer.GetSetting(SettingName.EpgSyncAllHours, TvServerPlugin.DefaultSyncAllHours.ToString()).Value); - if (epgSyncOn) + if (epgSyncOn) + { + if (EnsureConnection()) { - if (EnsureAgents()) + if (DateTime.Now - lastSyncTime >= new TimeSpan(1, 0, 0)) { - if (DateTime.Now - lastSyncTime >= new TimeSpan(1, 0, 0)) + lastSyncTime = DateTime.Now; + bool syncAll = (lastSyncTime - lastAllSyncTime >= new TimeSpan(epgSyncAllHours, 0, 0)); + latestProgramTime = SynchronizeEpg(latestProgramTime, syncAll); + if (syncAll) { - lastSyncTime = DateTime.Now; - bool syncAll = (lastSyncTime - lastAllSyncTime >= new TimeSpan(epgSyncAllHours, 0, 0)); - latestProgramTime = SynchronizeEpg(latestProgramTime, syncAll); - if (syncAll) - { - lastAllSyncTime = lastSyncTime; - } + lastAllSyncTime = lastSyncTime; } } } + } #if DEBUG - aborted = this.StopThreadEvent.WaitOne(5000, false); + aborted = this.StopThreadEvent.WaitOne(5000, false); #else - aborted = this.StopThreadEvent.WaitOne(5 * 60 * 1000, false); + aborted = this.StopThreadEvent.WaitOne(5 * 60 * 1000, false); #endif - } - catch (Exception ex) - { - Log.Error("Run(): {0}", ex.Message); - DisposeAgents(); - // Delay for a short while and then restart. - aborted = this.StopThreadEvent.WaitOne(30 * 1000, false); - } } + catch (Exception ex) + { + Log.Error("ForTheRecordSyncEpg error: {0}", ex.Message); + // Delay for a short while and then restart. + aborted = this.StopThreadEvent.WaitOne(30 * 1000, false); + } } - finally - { - DisposeAgents(); - } } - private bool EnsureAgents() + private bool EnsureConnection() { if (!_plugin.IsTvSchedulerConnectionInitialized) { _plugin.InitializeTvSchedulerConnection(null); } - if (_plugin.IsTvSchedulerConnectionInitialized) - { - if (_tvSchedulerAgent == null) - { - _tvSchedulerAgent = new TvSchedulerServiceAgent(); - } - if (_tvGuideAgent == null) - { - _tvGuideAgent = new TvGuideServiceAgent(); - } - return true; - } - return false; + return _plugin.IsTvSchedulerConnectionInitialized; } - private void DisposeAgents() - { - if (_tvSchedulerAgent != null) - { - _tvSchedulerAgent.Dispose(); - _tvSchedulerAgent = null; - } - if (_tvGuideAgent != null) - { - _tvGuideAgent.Dispose(); - _tvGuideAgent = null; - } - } - private DateTime SynchronizeEpg(DateTime latestProgramTime, bool synchronizeAll) { - TvBusinessLayer layer = new TvBusinessLayer(); - bool epgSyncAutoCreateChannels = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncAutoCreateChannels, false.ToString()).Value); - - ChannelLinks channelLinks = ChannelLinks.LoadChannelLinks(); - - _tvGuideAgent.StartGuideImport(); - try + using (TvSchedulerServiceAgent tvSchedulerAgent = new TvSchedulerServiceAgent()) + using (TvGuideServiceAgent tvGuideAgent = new TvGuideServiceAgent()) { - bool aborted = false; + TvBusinessLayer layer = new TvBusinessLayer(); + bool epgSyncAutoCreateChannels = Convert.ToBoolean(layer.GetSetting(SettingName.EpgSyncAutoCreateChannels, false.ToString()).Value); - IList mpChannels = Channel.ListAll(); - foreach (Channel channel in mpChannels) + ChannelLinks channelLinks = ChannelLinks.LoadChannelLinks(); + + tvGuideAgent.StartGuideImport(); + try { - // only execute for tv channels - if (channel.IsTv) + bool aborted = false; + + IList mpChannels = Channel.ListAll(); + foreach (Channel channel in mpChannels) { - ChannelLink channelLink = channelLinks.GetChannelLinkForMediaPortalChannel(channel); - TvChannel tvChannel = null; - if (channelLink != null) + // only execute for tv channels + if (channel.IsTv) { - tvChannel = _tvSchedulerAgent.GetChannelById(channelLink.TvChannelId); - if (tvChannel == null) + ChannelLink channelLink = channelLinks.GetChannelLinkForMediaPortalChannel(channel); + TvChannel tvChannel = null; + if (channelLink != null) { - tvChannel = _tvSchedulerAgent.GetChannelByDisplayName(channelLink.TvChannelName); - } - } - if (tvChannel == null) - { - tvChannel = _tvSchedulerAgent.GetChannelByDisplayName(channel.DisplayName); - } - if (tvChannel == null - && epgSyncAutoCreateChannels) - { - Guid tvChannelId = _tvSchedulerAgent.EnsureChannel(channel.DisplayName, "DVB-EPG"); - tvChannel = _tvSchedulerAgent.GetChannelById(tvChannelId); - } - if (tvChannel != null) - { - Guid guideChannelId; - if (!tvChannel.GuideChannelId.HasValue) - { - string externalId = channel.ExternalId; - if (String.IsNullOrEmpty(externalId)) + tvChannel = tvSchedulerAgent.GetChannelById(channelLink.TvChannelId); + if (tvChannel == null) { - externalId = tvChannel.TvChannelId.ToString("N", CultureInfo.InvariantCulture); + tvChannel = tvSchedulerAgent.GetChannelByDisplayName(channelLink.TvChannelName); } - guideChannelId = _tvGuideAgent.EnsureChannel(externalId, channel.DisplayName); - _tvSchedulerAgent.AttachChannelToGuide(tvChannel.TvChannelId, guideChannelId); } - else + if (tvChannel == null) { - guideChannelId = tvChannel.GuideChannelId.Value; + tvChannel = tvSchedulerAgent.GetChannelByDisplayName(channel.DisplayName); } - - IList mpPrograms = layer.GetPrograms(channel, synchronizeAll ? DateTime.Today : latestProgramTime, DateTime.Today.AddDays(14)); - List<GuideProgram> guidePrograms = new List<GuideProgram>(); - foreach (Program program in mpPrograms) + if (tvChannel == null + && epgSyncAutoCreateChannels) { - if (program.StartTime < program.EndTime) + Guid tvChannelId = tvSchedulerAgent.EnsureChannel(channel.DisplayName, "DVB-EPG"); + tvChannel = tvSchedulerAgent.GetChannelById(tvChannelId); + } + if (tvChannel != null) + { + Guid guideChannelId; + if (!tvChannel.GuideChannelId.HasValue) { - GuideProgram guideProgram = new GuideProgram(); - guideProgram.GuideChannelId = guideChannelId; - guideProgram.Category = program.Genre; - guideProgram.Description = program.Description; - guideProgram.EpisodeNumberDisplay = program.EpisodeNum; - guideProgram.Rating = program.Classification; - guideProgram.StartTime = program.StartTime; - guideProgram.StopTime = program.EndTime; - guideProgram.Title = program.Title; - guidePrograms.Add(guideProgram); + string externalId = channel.ExternalId; + if (String.IsNullOrEmpty(externalId)) + { + externalId = tvChannel.TvChannelId.ToString("N", CultureInfo.InvariantCulture); + } + guideChannelId = tvGuideAgent.EnsureChannel(externalId, channel.DisplayName); + tvSchedulerAgent.AttachChannelToGuide(tvChannel.TvChannelId, guideChannelId); + } + else + { + guideChannelId = tvChannel.GuideChannelId.Value; + } - if (guideProgram.StartTime > latestProgramTime) + IList mpPrograms = layer.GetPrograms(channel, synchronizeAll ? DateTime.Today : latestProgramTime, DateTime.Today.AddDays(14)); + List<GuideProgram> guidePrograms = new List<GuideProgram>(); + foreach (Program program in mpPrograms) + { + if (program.StartTime < program.EndTime) { - latestProgramTime = guideProgram.StartTime; + GuideProgram guideProgram = new GuideProgram(); + guideProgram.GuideChannelId = guideChannelId; + guideProgram.Category = program.Genre; + guideProgram.Description = program.Description; + guideProgram.EpisodeNumberDisplay = program.EpisodeNum; + guideProgram.Rating = program.Classification; + guideProgram.StartTime = program.StartTime; + guideProgram.StopTime = program.EndTime; + guideProgram.Title = program.Title; + guidePrograms.Add(guideProgram); + + if (guideProgram.StartTime > latestProgramTime) + { + latestProgramTime = guideProgram.StartTime; + } + + if (guidePrograms.Count >= _syncBatchSize) + { + tvGuideAgent.ImportPrograms(guidePrograms.ToArray(), GuideSource.DvbEpg); + guidePrograms.Clear(); + } } - if (guidePrograms.Count >= _syncBatchSize) + aborted = this.StopThreadEvent.WaitOne(0, false); + if (aborted) { - _tvGuideAgent.ImportPrograms(guidePrograms.ToArray(), GuideSource.DvbEpg); - guidePrograms.Clear(); + break; } } - - aborted = this.StopThreadEvent.WaitOne(0, false); - if (aborted) + if (!aborted + && guidePrograms.Count > 0) { - break; + tvGuideAgent.ImportPrograms(guidePrograms.ToArray(), GuideSource.DvbEpg); } } - if (!aborted - && guidePrograms.Count > 0) - { - _tvGuideAgent.ImportPrograms(guidePrograms.ToArray(), GuideSource.DvbEpg); - } } - } - if (aborted) - { - break; + if (aborted) + { + break; + } } } - } - finally - { - _tvGuideAgent.EndGuideImport(); - } + finally + { + tvGuideAgent.EndGuideImport(); + } - return latestProgramTime; + return latestProgramTime; + } } } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2008 ForTheRecord + * Copyright (C) 2007-2009 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2008 ForTheRecord + * Copyright (C) 2007-2009 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -394,7 +394,8 @@ item.Label = title; //item.OnItemSelected += new global::MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected); string logoImagePath = Utility.GetLogoImage(activeRecording.Program.TvChannel, TvSchedulerAgent); - if (!System.IO.File.Exists(logoImagePath)) + if (logoImagePath == null + || !System.IO.File.Exists(logoImagePath)) { item.Label = String.Format("[{0}] {1}", activeRecording.Program.TvChannel.DisplayName, title); logoImagePath = "defaultVideoBig.png"; @@ -453,11 +454,11 @@ string description; if (guideProgram == null) { - description = Utility.GetComposedDescription(recording.Program.CreateEpisodeTitle(), null, null, null); + description = String.Empty; } else { - description = Utility.GetComposedDescription(guideProgram); + description = guideProgram.CreateCombinedDescription(true); } GUIPropertyManager.SetProperty("#TV.Active.Description", description); Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -43,6 +43,8 @@ private List<TvChannelGroup> _groups = new List<TvChannelGroup>(); private TvChannelGroup _currentChannelGroup; private List<TvChannel> _channels = new List<TvChannel>(); + private Dictionary<int, TvChannel> _channelsByNumber = new Dictionary<int, TvChannel>(); + private Dictionary<int, TvChannelGroup> _groupsByChannelNumber = new Dictionary<int, TvChannelGroup>(); private CurrentAndNextProgram _currentNextProgram; private GuideProgram _currentProgram; private GuideProgram _nextProgram; @@ -52,7 +54,7 @@ private TvChannelGroup _zapGroup; private TvChannel _zapChannel; private DateTime _zapTime; - private GuideProgram _zapProgram; + private GuideProgramSummary _zapProgram; private long _zapDelayMs; private bool _autoFullScreen; @@ -148,7 +150,7 @@ get { return _nextProgram; } } - public GuideProgram ZapProgram + public GuideProgramSummary ZapProgram { get { return _zapProgram; } } @@ -213,17 +215,84 @@ } } - public TvChannel GetChannelByNumber(int channelNr) + public TvChannel GetChannelByIndex(int channelIndex) { if (_channels != null - && channelNr >= 1 - && channelNr <= _channels.Count) + && channelIndex >= 1 + && channelIndex <= _channels.Count) { - return _channels[channelNr - 1]; + return _channels[channelIndex - 1]; } return null; } + public TvChannel GetChannelByNumber(int channelNr) + { + TvChannelGroup tvChannelGroup; + return GetChannelByNumber(channelNr, out tvChannelGroup); + } + + public TvChannel GetChannelByNumber(int channelNr, out TvChannelGroup tvChannelGroup) + { + tvChannelGroup = _currentChannelGroup; + if (_channelsByNumber.ContainsKey(channelNr)) + { + tvChannelGroup = _groupsByChannelNumber[channelNr]; + return _channelsByNumber[channelNr]; + } + TvChannel channel = null; + if (_channels != null) + { + channel = FindChannelByNumber(_channels, channelNr); + if (channel == null) + { + try + { + using (TvSchedulerServiceAgent tvSchedulerAgent = new TvSchedulerServiceAgent()) + { + foreach (TvChannelGroup group in _groups) + { + if (group != _currentChannelGroup) + { + channel = FindChannelInGroupByNumber(tvSchedulerAgent, group.TvChannelGroupId, channelNr); + if (channel != null) + { + tvChannelGroup = group; + break; + } + } + } + } + } + catch (Exception ex) + { + Log.Error("ChannelNavigator: Error in GetChannelByNumber - {0}", ex.Message); + } + } + } + _channelsByNumber[channelNr] = channel; + _groupsByChannelNumber[channelNr] = tvChannelGroup; + return channel; + } + + private TvChannel FindChannelByNumber(List<TvChannel> channels, int channelNr) + { + foreach (TvChannel channel in channels) + { + if (channel.LogicalChannelNumber.HasValue + && channel.LogicalChannelNumber.Value == channelNr) + { + return channel; + } + } + return null; + } + + private TvChannel FindChannelInGroupByNumber(TvSchedulerServiceAgent tvSchedulerAgent, Guid tvChannelGroupId, int channelNr) + { + return FindChannelByNumber(new List<TvChannel>(tvSchedulerAgent.GetChannelsInGroup(tvChannelGroupId, true)), channelNr); + } + public void ZapNow() { _zapTime = DateTime.Now.AddSeconds(-1); @@ -249,10 +318,8 @@ // Make sure current and next is up to date. if (_currentNextProgram != null) { - if ((_currentNextProgram.Current != null - && _currentNextProgram.Current.StopTime < DateTime.Now) - || (_currentNextProgram.Next != null - && _currentNextProgram.Next.StartTime < DateTime.Now)) + if ((_currentNextProgram.Current != null && _currentNextProgram.Current.StopTime < DateTime.Now) + || (_currentNextProgram.Next != null && _currentNextProgram.Next.StartTime < DateTime.Now)) { RefreshCurrentAndNext(); } @@ -267,7 +334,7 @@ // Zapping to another group? if (_zapGroup != null && _zapGroup != _currentChannelGroup) { - // Change current group and zap to the first channel of the group + // Change current group (and possibly zap to the first channel of the group) _previousChannelGroup = _currentChannelGroup; _currentChannelGroup = _zapGroup; RefreshChannelsInGroup(); @@ -300,58 +367,18 @@ return false; } - ///// <summary> - ///// Ensures that the navigator has the correct current channel (retrieved from the Recorder). - ///// </summary> - //public void UpdateCurrentChannel() - //{ - // Channel newChannel = null; - // //if current card is watching tv then use that channel - // int id; + public bool ZapToChannelNumber(int channelNr, bool useZapDelay) + { + TvChannelGroup tvChannelGroup; + TvChannel channel = GetChannelByNumber(channelNr, out tvChannelGroup); + if (channel != null) + { + ZapToChannel(tvChannelGroup, channel, useZapDelay); + return true; + } + return false; + } - - // if (!TVHome.HandleServerNotConnected()) - // { - - // if (TVHome.Card.IsTimeShifting || TVHome.Card.IsRecording) - // { - // id = TVHome.Card.IdChannel; - // if (id >= 0) - // newChannel = Channel.Retrieve(id); - // } - // else - // { - // // else if any card is recording - // // then get & use that channel - // TvServer server = new TvServer(); - // if (server.IsAnyCardRecording()) - // { - // for (int i = 0; i < server.Count; ++i) - // { - // User user = new User(); - // VirtualCard card = server.CardByIndex(user, i); - // if (card.IsRecording) - // { - // id = card.IdChannel; - // if (id >= 0) - // { - // newChannel = Channel.Retrieve(id); - // break; - // } - // } - // } - // } - // } - // if (newChannel == null) - // newChannel = m_currentChannel; - // if (m_currentChannel != newChannel && newChannel != null) - // { - // m_currentChannel = newChannel; - // m_currentChannel.CurrentGroup = CurrentGroup; - // } - // } - //} - /// <summary> /// Changes the current channel after a specified delay. /// </summary> @@ -384,7 +411,7 @@ { using (TvGuideServiceAgent tvGuideAgent = new TvGuideServiceAgent()) { - GuideProgram[] programs = tvGuideAgent.GetChannelProgramsBetween(_zapChannel.GuideChannelId.Value, _zapTime, _zapTime); + GuideProgramSummary[] programs = tvGuideAgent.GetChannelProgramsBetween(_zapChannel.GuideChannelId.Value, _zapTime, _zapTime); if (programs.Length > 0) { _zapProgram = programs[0]; @@ -576,41 +603,51 @@ LiveTvResult result = LiveTvResult.UnknownError; try { - string lastRtspUrl = liveTvStream.RtspUrl; + // + // First try to re-tune the existing TV stream (staying on the same card). + // result = this.TvControlAgent.TuneLiveTvStream(currentAndNext.TvChannel, ref liveTvStream); if (result == LiveTvResult.Succeeded) { SetCurrentAndNext(currentAndNext); _currentChannel = tvChannel; - if (liveTvStream.RtspUrl != lastRtspUrl) - { - result = PlayLiveTv(liveTvStream); - } - else - { - string fileName; - int seekOffset; - GetPlayerFileNameAndOffset(liveTvStream, out fileName, out seekOffset); - g_Player.SeekAbsolute(g_Player.Duration + seekOffset); - } + string fileName; + int seekOffset; + GetPlayerFileNameAndOffset(liveTvStream, out fileName, out seekOffset); + g_Player.SeekAbsolute(g_Player.Duration + seekOffset); } else { - firstResult = result; - tvChannel = _currentChannel; - + // Seems a re-tune has failed, so keep track of the channel that + // was already being streamed and stop the current stream. + TvChannel resumeChannel = _currentChannel; g_Player.ContinueGraph(); resumeGraph = false; SilentlyStopLiveTv(liveTvStream); + // Now re-try the new channel with a new stream. liveTvStream = null; result = this.TvControlAgent.TuneLiveTvStream(tvChannel, ref liveTvStream); if (result == LiveTvResult.Succeeded) { + // Success! Let's show the new stream. result = PlayLiveTv(liveTvStream); _currentChannel = tvChannel; } + else + { + // Still nothing :-( So keep track of the error-code and let's + // try to re-tune to the original channel. + firstResult = result; + liveTvStream = null; + result = this.TvControlAgent.TuneLiveTvStream(resumeChannel, ref liveTvStream); + if (result == LiveTvResult.Succeeded) + { + result = PlayLiveTv(liveTvStream); + _currentChannel = resumeChannel; + } + } } } catch @@ -672,6 +709,7 @@ int seekOffset; GetPlayerFileNameAndOffset(liveTvStream, out fileName, out seekOffset); + TvRecorded.RememberActiveRecordingPosition(); if (g_Player.Play(fileName, g_Player.MediaType.TV)) { _liveTvStream = liveTvStream; @@ -730,7 +768,7 @@ if (_currentProgram != null) { g_Player.currentTitle = _currentProgram.CreateProgramTitle(); - g_Player.currentDescription = Utility.GetComposedDescription(_currentProgram); + g_Player.currentDescription = _currentProgram.CreateCombinedDescription(true); } else { @@ -744,11 +782,7 @@ { using (TvSchedulerServiceAgent tvSchedulerAgent = new TvSchedulerServiceAgent()) { - CurrentAndNextProgram currentAndNext = tvSchedulerAgent.GetCurrentAndNextForChannel(_currentChannel.TvChannelId); - if (currentAndNext != null) - { - _currentNextProgram = currentAndNext; - } + SetCurrentAndNext(tvSchedulerAgent.GetCurrentAndNextForChannel(_currentChannel.TvChannelId)); } } @@ -768,8 +802,8 @@ _asyncStopLiveTvThread.Start(); } } + SetCurrentAndNext(null); _currentChannel = null; - _currentNextProgram = null; } public void StopLiveTv() @@ -781,8 +815,8 @@ _liveTvStream = null; _previousChannel = _currentChannel; } + SetCurrentAndNext(null); _currentChannel = null; - _currentNextProgram = null; } public void SendLiveTvKeepAlive() @@ -811,6 +845,10 @@ dlg.SetLine(1, "Not supported on your recorder/tuner(s)"); break; + case LiveTvResult.NoRetunePossible: + dlg.SetLine(1, "It was not possible to re-tune live TV"); + break; + case LiveTvResult.UnknownError: dlg.SetLine(1, "Unknown error"); break; @@ -868,6 +906,8 @@ { _channels = new List<TvChannel>(); } + _channelsByNumber.Clear(); + _groupsByChannelNumber.Clear(); } catch (Exception ex) { Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordHome.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordHome.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordHome.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -705,7 +705,7 @@ internal static bool AvoidRtspForLiveTv { - get { return GetCachedBooleanSetting(SettingName.AvoidRtspForLiveTv, true); } + get { return GetCachedBooleanSetting(SettingName.AvoidRtspForLiveTv, false); } } private static Dictionary<string, bool> _booleanSettings = new Dictionary<string, bool>(); @@ -830,7 +830,7 @@ GUIPropertyManager.SetProperty("#TV.View.remaining", global::MediaPortal.Util.Utils.SecondsToHMSString(current.StopTime - current.StartTime)); GUIPropertyManager.SetProperty("#TV.View.genre", current.Category); GUIPropertyManager.SetProperty("#TV.View.title", current.Title); - GUIPropertyManager.SetProperty("#TV.View.description", Utility.GetComposedDescription(current)); + GUIPropertyManager.SetProperty("#TV.View.description", current.CreateCombinedDescription(true)); } if (next == null) @@ -848,7 +848,7 @@ GUIPropertyManager.SetProperty("#TV.Next.remaining", global::MediaPortal.Util.Utils.SecondsToHMSString(next.StopTime - next.StartTime)); GUIPropertyManager.SetProperty("#TV.Next.genre", next.Category); GUIPropertyManager.SetProperty("#TV.Next.title", next.Title); - GUIPropertyManager.SetProperty("#TV.Next.description", Utility.GetComposedDescription(next)); + GUIPropertyManager.SetProperty("#TV.Next.description", next.CreateCombinedDescription(true)); } string logo = Utility.GetLogoImage(ForTheRecordHome.Navigator.CurrentChannel, tvSchedulerAgent); @@ -1189,11 +1189,11 @@ { using (TvGuideServiceAgent tvGuideAgent = new TvGuideServiceAgent()) { - GuideProgram[] programs = + GuideProgramSummary[] programs = tvGuideAgent.GetChannelProgramsBetween(channel.GuideChannelId.Value, time, time); if (programs.Length > 0) { - return programs[0]; + return tvGuideAgent.GetProgramById(programs[0].GuideProgramId); } } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/PostBuild.cmd =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/PostBuild.cmd 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/PostBuild.cmd 2009-02-07 15:41:24 UTC (rev 2613) @@ -19,6 +19,6 @@ xcopy /S /Y /I %1..\..\skin %mpDir%\skin xcopy /S /Y /I %1..\..\language %mpDir%\language :reallyEnd - IF EXIST "C:\ProgramData\Team MediaPortal\MediaPortal\Cache" DEL /S /Q "C:\ProgramData\Team MediaPortal\MediaPortal\Cache" - IF EXIST "C:\Documents And Settings\All Users\Application Data\Team Mediaportal\Mediaportal\Cache" DEL /S /Q "C:\Documents And Settings\All Users\Application Data\Team Mediaportal\Mediaportal\Cache" + REM IF EXIST "C:\ProgramData\Team MediaPortal\MediaPortal\Cache" DEL /S /Q "C:\ProgramData\Team MediaPortal\MediaPortal\Cache" + REM IF EXIST "C:\Documents And Settings\All Users\Application Data\Team Mediaportal\Mediaportal\Cache" DEL /S /Q "C:\Documents And Settings\All Users\Application Data\Team Mediaportal\Mediaportal\Cache" exit 0 Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/AssemblyInfo.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/AssemblyInfo.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ForTheRecord.UI.MediaPortal")] -[assembly: AssemblyCopyright("Copyright © ForTheRecord 2007-2008")] +[assembly: AssemblyCopyright("Copyright © ForTheRecord 2007-2009")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2008 ForTheRecord + * Copyright (C) 2007-2009 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVZapOSD.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVZapOSD.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVZapOSD.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -180,7 +180,7 @@ void Get_TimeInfo() { string strTime = channelName; - GuideProgram prog = ForTheRecordHome.Navigator.ZapProgram; + GuideProgramSummary prog = ForTheRecordHome.Navigator.ZapProgram; if (prog != null) { strTime = String.Format("{0}-{1}", prog.StartTime.ToShortTimeString(), prog.StopTime.ToShortTimeString()); @@ -388,7 +388,7 @@ void UpdateProgressBar() { double fPercent = 0.0; - GuideProgram prog = ForTheRecordHome.Navigator.ZapProgram; + GuideProgramSummary prog = ForTheRecordHome.Navigator.ZapProgram; if (prog != null) { string strTime = String.Format("{0}-{1}", prog.StartTime.ToShortTimeString(), prog.StopTime.ToShortTimeString()); Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TextId.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TextId.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TextId.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2008 ForTheRecord + * Copyright (C) 2007-2009 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Translator.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Translator.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Translator.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2008 ForTheRecord + * Copyright (C) 2007-2009 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -1408,11 +1408,14 @@ { case 4: //TVGuide { +#if false TvGuideDialog dlgTvGuide = (TvGuideDialog)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_TVGUIDE); - _isDialogVisible = true; dlgTvGuide.DoModal(GetID); _isDialogVisible = false; +#else + GUIWindowManager.ActivateWindow(WindowId.TvGuide); +#endif break; } @@ -2215,22 +2218,24 @@ _channelName += chKey; GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_LABEL_SET, GetID, 0, (int)Control.LABEL_ROW1, 0, 0, null); - string displayedChannelName = string.Empty; + string displayedChannelName = String.Empty; - if (_byIndex) + int channelNr; + if (!Int32.TryParse(_channelName, out channelNr)) + return; + TvChannel tvChannel = _byIndex ? + ForTheRecordHome.Navigator.GetChannelByIndex(channelNr) : ForTheRecordHome.Navigator.GetChannelByNumber(channelNr); + if (tvChannel != null) { - int channelNr; - if (!Int32.TryParse(_channelName, out channelNr)) - return; - if (channelNr > ForTheRecordHome.Navigator.ChannelCount) - return; - TvChannel tvChannel = ForTheRecordHome.Navigator.GetChannelByNumber(channelNr); - displayedChannelName = tvChannel == null ? String.Empty : tvChannel.DisplayName; + displayedChannelName = tvChannel.DisplayName; } - if (displayedChannelName != string.Empty) - msg.Label = String.Format("{0} ({1})", _channelName, displayedChannelName); // Channel + + string channelText; + if (displayedChannelName != String.Empty) + channelText = String.Format("{0} ({1})", _channelName, displayedChannelName); else - msg.Label = String.Format("{0}", _channelName); // Channel + channelText = String.Format("{0}", _channelName); + msg.Label = channelText.Substring(0, Math.Min(12, channelText.Length)); GUIControl cntTarget = base.GetControl((int)Control.LABEL_ROW1); if (cntTarget != null) @@ -2280,13 +2285,24 @@ { Log.Debug("ChangeChannelNr()"); - TvChannel tvChannel = ForTheRecordHome.Navigator.GetChannelByNumber(channelNr); - if (tvChannel != null) + if (_byIndex) { - ForTheRecordHome.Navigator.ZapToChannel(tvChannel, false); - UpdateOSD(); - _zapTimeOutTimer = DateTime.Now; + TvChannel tvChannel = ForTheRecordHome.Navigator.GetChannelByIndex(channelNr); + if (tvChannel != null) + { + ForTheRecordHome.Navigator.ZapToChannel(tvChannel, false); + UpdateOSD(); + _zapTimeOutTimer = DateTime.Now; + } } + else + { + if (ForTheRecordHome.Navigator.ZapToChannelNumber(channelNr, false)) + { + UpdateOSD(); + _zapTimeOutTimer = DateTime.Now; + } + } } public void ZapPreviousChannel() Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideBase.cs 2009-02-07 15:15:14 UTC (rev 2612) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideBase.cs 2009-02-07 15:41:24 UTC (rev 2613) @@ -128,6 +128,8 @@ int _backupChannelOffset = 0; DateTime _updateTimer = DateTime.Now; + bool _showChannelNumber = false; + #endregion #region ctor @@ -176,6 +178,7 @@ _currentChannelName = xmlreader.GetValueAsString("tvguide", "channel", String.Empty); _cursorX = xmlreader.GetValueAsInt("tvguide", "ypos", 0); _channelOffset = xmlreader.GetValueAsInt("tvguide", "yoffset", 0); + _showChannelNumber = xmlreader.GetValueAsBool("mytv", "showchannelnumber", false); } } @@ -1177,7 +1180,7 @@ GUIPropertyManager.SetProperty("#TV.Guide.Title", _currentProgram.Title); GUIPropertyManager.SetProperty("#TV.Guide.Time", strTime); - GUIPropertyManager.SetProperty("#TV.Guide.Description", Utility.GetComposedDescrip... [truncated message content] |
From: <do...@us...> - 2009-05-26 08:32:27
|
Revision: 2869 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=2869&view=rev Author: dot-i Date: 2009-05-26 08:32:13 +0000 (Tue, 26 May 2009) Log Message: ----------- Updated to For The Record 1.4 plugin source code. Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.resx trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVZapOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TextId.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideDialog.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideSearch.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvProgramInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvRecorded.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvRecordingOverlay.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/WindowId.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_da.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_de.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_en.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_nl.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_sv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ForTheRecord.UI.Process.csproj trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/KeepUntilControlUtility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ProcessUtility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Recordings/RecordingsController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Recordings/RecordingsModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ScheduleNamesCache.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SearchGuide/SearchGuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SearchGuide/SearchGuideModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingGuideProgramsDictionary.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingOrActiveProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingOrActiveProgramsList.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Gentle.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Gentle.Framework.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll Added Paths: ----------- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/Resources.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/Resources.resx trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Resources/ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Resources/WizardHeader.bmp trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ThreeStateTreeView.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.resx trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.resx trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.resx trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.resx trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordMain.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Hamming.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/MiniGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioGuideSearch.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioHome.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioRecorded.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TeletextPageRenderer.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullscreenTeletext.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvTeletext.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvTeletextBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_pl.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/4TR_RadioGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/4TR_RadioGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/4TR_RadioHome.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/4TR_RecordedRadio.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_RadioGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_RadioGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_RadioHome.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_RecordedRadio.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/4TR_RadioGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/4TR_RadioGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/4TR_RadioHome.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/4TR_RecordedRadio.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_RadioGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_RadioGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_RadioHome.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_RecordedRadio.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_RadioGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_RadioGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_RadioHome.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_RecordedRadio.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ChannelProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ChannelProgramsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/ trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/ChannelPrograms.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideUpcomingProgram.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/LiveStreamView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/LiveStreamsList.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Client.Common.dll Removed Paths: ------------- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SyncEpgThread.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordHome.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvMiniGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/BlueTwo wide/ trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvChannelProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvChannelProgramsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/TvGuide/ Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs 2009-05-22 21:00:13 UTC (rev 2868) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs 2009-05-26 08:32:13 UTC (rev 2869) @@ -23,15 +23,17 @@ using System.Text; using System.Xml.XPath; using System.Xml; +using ForTheRecord.Entities; namespace ForTheRecord.RecorderTuners.MediaPortalTvServer.Channels { internal class ChannelLink { - public ChannelLink(Guid tvChannelId, string tvChannelName, int mpChannelId, string mpChannelName) + public ChannelLink(ChannelType channelType, Guid channelId, string channelName, int mpChannelId, string mpChannelName) { - this.TvChannelId = tvChannelId; - this.TvChannelName = tvChannelName; + this.ChannelType = channelType; + this.ChannelId = channelId; + this.ChannelName = channelName; this.MPChannelId = mpChannelId; this.MPChannelName = mpChannelName; } @@ -39,11 +41,11 @@ public static ChannelLink Parse(XPathNavigator navigator) { ChannelLink result = null; - Guid tvChannelId = Guid.Empty; + Guid channelId = Guid.Empty; string id = navigator.GetAttribute("id", String.Empty); if (!String.IsNullOrEmpty(id)) { - tvChannelId = new Guid(id); + channelId = new Guid(id); } int mpChannelId = -1; string mpId = navigator.GetAttribute("mpId", String.Empty); @@ -51,12 +53,22 @@ { mpChannelId = Int32.Parse(mpId); } - if (tvChannelId != Guid.Empty + if (channelId != Guid.Empty && mpChannelId >= 0) { - string tvChannelName = navigator.GetAttribute("name", String.Empty); + string channelName = navigator.GetAttribute("name", String.Empty); + ChannelType channelType; + string type = navigator.GetAttribute("type", String.Empty); + if (String.IsNullOrEmpty(type)) + { + channelType = ChannelType.Television; + } + else + { + channelType = (ChannelType)Enum.Parse(typeof(ChannelType), type); + } string mpChannelName = navigator.GetAttribute("mpName", String.Empty); - result = new ChannelLink(tvChannelId, tvChannelName, mpChannelId, mpChannelName); + result = new ChannelLink(channelType, channelId, channelName, mpChannelId, mpChannelName); } return result; } @@ -64,17 +76,20 @@ public void WriteToXml(XmlTextWriter xmlWriter) { xmlWriter.WriteStartElement("link"); - xmlWriter.WriteAttributeString("id", this.TvChannelId.ToString()); - xmlWriter.WriteAttributeString("name", this.TvChannelName.ToString()); + xmlWriter.WriteAttributeString("id", this.ChannelId.ToString()); + xmlWriter.WriteAttributeString("name", this.ChannelName.ToString()); + xmlWriter.WriteAttributeString("type", this.ChannelType.ToString()); xmlWriter.WriteAttributeString("mpId", this.MPChannelId.ToString()); xmlWriter.WriteAttributeString("mpName", this.MPChannelName.ToString()); xmlWriter.WriteEndElement(); } - public Guid TvChannelId { get; set; } + public ChannelType ChannelType { get; set; } - public string TvChannelName { get; set; } + public Guid ChannelId { get; set; } + public string ChannelName { get; set; } + public int MPChannelId { get; set; } public string MPChannelName { get; set; } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs 2009-05-22 21:00:13 UTC (rev 2868) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs 2009-05-26 08:32:13 UTC (rev 2869) @@ -26,94 +26,102 @@ using System.Collections; using System.Text; -using TvDatabase; +using System.Threading; -using ForTheRecord.Entities; using Gentle.Framework; +using ForTheRecord.Entities; + namespace ForTheRecord.RecorderTuners.MediaPortalTvServer.Channels { internal class ChannelLinks { + private ReaderWriterLock _readerWriterLock = new ReaderWriterLock(); + private Dictionary<Guid, ChannelLink> _linksById = new Dictionary<Guid, ChannelLink>(); + private Dictionary<int, bool> _autoLinkedMPChannels = new Dictionary<int, bool>(); private ChannelLinks() { - Load(); + LoadChannelLinks(true); } - public static ChannelLinks LoadChannelLinks() + #region Singleton + + private static ChannelLinks Instance { - return new ChannelLinks(); + get + { + return Nested.instance; + } } - public LinkedMediaPortalChannel GetLinkedMediaPortalChannel(TvChannel tvChannel) + private class Nested { + // Explicit static constructor to tell C# compiler + // not to mark type as beforefieldinit + static Nested() + { + } + + internal static readonly ChannelLinks instance = new ChannelLinks(); + } + + #endregion + + public static LinkedMediaPortalChannel GetLinkedMediaPortalChannel(Channel channel) + { bool isAutoLinked; bool duplicateChannelsFound; - return GetLinkedMediaPortalChannel(tvChannel, out isAutoLinked, out duplicateChannelsFound); + return GetLinkedMediaPortalChannel(channel, out isAutoLinked, out duplicateChannelsFound); } - public LinkedMediaPortalChannel GetLinkedMediaPortalChannel(Guid tvChannelId, string displayName) + public static LinkedMediaPortalChannel GetLinkedMediaPortalChannel(ChannelType channelType, Guid channelId, string displayName) { bool isAutoLinked; bool duplicateChannelsFound; - return GetLinkedMediaPortalChannel(tvChannelId, displayName, out isAutoLinked, out duplicateChannelsFound); + return GetLinkedMediaPortalChannel(channelType, channelId, displayName, out isAutoLinked, out duplicateChannelsFound); } - public LinkedMediaPortalChannel GetLinkedMediaPortalChannel(TvChannel tvChannel, out bool isAutoLinked, out bool duplicateChannelsFound) + public static LinkedMediaPortalChannel GetLinkedMediaPortalChannel(Channel channel, out bool isAutoLinked, out bool duplicateChannelsFound) { - return GetLinkedMediaPortalChannel(tvChannel.TvChannelId, tvChannel.DisplayName, out isAutoLinked, out duplicateChannelsFound); + return GetLinkedMediaPortalChannel(channel.ChannelType, channel.ChannelId, channel.DisplayName, out isAutoLinked, out duplicateChannelsFound); } - public LinkedMediaPortalChannel GetLinkedMediaPortalChannel(Guid tvChannelId, string displayName, out bool isAutoLinked, out bool duplicateChannelsFound) + public static LinkedMediaPortalChannel GetLinkedMediaPortalChannel(ChannelType channelType, Guid channelId, string displayName, + out bool isAutoLinked, out bool duplicateChannelsFound) { - isAutoLinked = false; - duplicateChannelsFound = false; + return Instance.GetLinkedMediaPortalChannelInternal(channelType, channelId, displayName, out isAutoLinked, out duplicateChannelsFound); + } - if (_linksById.ContainsKey(tvChannelId)) - { - ChannelLink link = _linksById[tvChannelId]; - return new LinkedMediaPortalChannel(link.MPChannelId, link.MPChannelName, link.MPChannelDisplayName); - } + public static bool IsAutoLinked(TvDatabase.Channel mpChannel) + { + return Instance.IsAutoLinkedInternal(mpChannel); + } - Channel channel = GetChannelByDisplayName(displayName, out duplicateChannelsFound); - if (channel != null) - { - isAutoLinked = true; - return new LinkedMediaPortalChannel(channel.IdChannel, channel.Name, channel.DisplayName); - } + public static void SetLinkedMediaPortalChannel(Channel channel, TvDatabase.Channel mpChannel) + { + Instance.SetLinkedMediaPortalChannelInternal(channel, mpChannel); + } - return null; + public static void ClearLinkedMediaPortalChannel(Channel channel) + { + Instance.ClearLinkedMediaPortalChannelInternal(channel); } - public void SetLinkedMediaPortalChannel(TvChannel tvChannel, Channel mpChannel) + public static ChannelLink GetChannelLinkForMediaPortalChannel(TvDatabase.Channel channel) { - ClearLinkedMediaPortalChannel(tvChannel); - ChannelLink link = new ChannelLink(tvChannel.TvChannelId, tvChannel.DisplayName, mpChannel.IdChannel, mpChannel.Name); - link.MPChannelDisplayName = mpChannel.DisplayName; - _linksById.Add(link.TvChannelId, link); + return Instance.GetChannelLinkForMediaPortalChannelInternal(channel); } - public void ClearLinkedMediaPortalChannel(TvChannel tvChannel) + public static void RemoveObsoleteLinks(ChannelType channelType, List<Channel> channels) { - if (_linksById.ContainsKey(tvChannel.TvChannelId)) - { - _linksById.Remove(tvChannel.TvChannelId); - } + Instance.RemoveObsoleteLinksInternal(channelType, channels); } - public ChannelLink GetChannelLinkForMediaPortalChannel(Channel channel) + public static void Save() { - foreach (ChannelLink link in _linksById.Values) - { - if (link.MPChannelId == channel.IdChannel - && link.MPChannelName == channel.Name) - { - return link; - } - } - return null; + Instance.SaveChannelLinks(); } #region Serialization @@ -128,97 +136,294 @@ } } - private void Load() + private DateTime _lastFileWriteTimeUtc = DateTime.MinValue; + + private void EnsureLoaded() { - _linksById.Clear(); + LoadChannelLinks(false); + } + + private void LoadChannelLinks(bool forceLoad) + { string settingsFileName = this.SettingsFileName; - if (File.Exists(settingsFileName)) + if (!File.Exists(settingsFileName)) { - using (StreamReader reader = new StreamReader(settingsFileName, Encoding.UTF8)) + _readerWriterLock.AcquireWriterLock(Timeout.Infinite); + try { - XPathDocument xpathDocument = new XPathDocument(reader); - XPathNavigator navigator = xpathDocument.CreateNavigator(); - XPathNodeIterator iterator = navigator.Select("/links/link"); - while (iterator.MoveNext()) + _linksById.Clear(); + _autoLinkedMPChannels.Clear(); + return; + } + finally + { + _readerWriterLock.ReleaseWriterLock(); + } + } + + DateTime lastWriteTimeUtc = File.GetLastWriteTimeUtc(settingsFileName); + if (forceLoad + || lastWriteTimeUtc != _lastFileWriteTimeUtc) + { + _readerWriterLock.AcquireWriterLock(Timeout.Infinite); + try + { + _lastFileWriteTimeUtc = lastWriteTimeUtc; + _linksById.Clear(); + _autoLinkedMPChannels.Clear(); + using (StreamReader reader = new StreamReader(settingsFileName, Encoding.UTF8)) { - ChannelLink link = ChannelLink.Parse(iterator.Current); - if (link != null) + XPathDocument xpathDocument = new XPathDocument(reader); + XPathNavigator navigator = xpathDocument.CreateNavigator(); + XPathNodeIterator iterator = navigator.Select("/links/link"); + while (iterator.MoveNext()) { - Channel channel = GetChannelById(link.MPChannelId); - if (channel == null - || channel.Name != link.MPChannelName) + ChannelLink link = ChannelLink.Parse(iterator.Current); + if (link != null) { - channel = GetChannelByName(link.MPChannelName); + TvDatabase.Channel mpChannel = GetChannelById(link.ChannelType, link.MPChannelId); + if (mpChannel == null + || mpChannel.Name != link.MPChannelName) + { + mpChannel = GetChannelByName(link.ChannelType, link.MPChannelName); + } + if (mpChannel != null) + { + link.MPChannelDisplayName = mpChannel.DisplayName; + _linksById.Add(link.ChannelId, link); + } } - if (channel != null) - { - link.MPChannelDisplayName = channel.DisplayName; - _linksById.Add(link.TvChannelId, link); - } } } } + finally + { + _readerWriterLock.ReleaseWriterLock(); + } } } - public void Save() + private void SaveChannelLinks() { - string settingsFileName = this.SettingsFileName; - string settingsDirName = Path.GetDirectoryName(settingsFileName); - if (!Directory.Exists(settingsDirName)) + _readerWriterLock.AcquireReaderLock(Timeout.Infinite); + try { - Directory.CreateDirectory(settingsDirName); + string settingsFileName = this.SettingsFileName; + string settingsDirName = Path.GetDirectoryName(settingsFileName); + if (!Directory.Exists(settingsDirName)) + { + Directory.CreateDirectory(settingsDirName); + } + using (XmlTextWriter xmlWriter = new XmlTextWriter(this.SettingsFileName, Encoding.UTF8)) + { + xmlWriter.Formatting = Formatting.Indented; + xmlWriter.WriteStartDocument(); + xmlWriter.WriteStartElement("links"); + foreach (ChannelLink link in _linksById.Values) + { + link.WriteToXml(xmlWriter); + } + xmlWriter.WriteEndElement(); + } + _lastFileWriteTimeUtc = File.GetLastWriteTimeUtc(settingsFileName); } - using (XmlTextWriter xmlWriter = new XmlTextWriter(this.SettingsFileName, Encoding.UTF8)) + finally { - xmlWriter.Formatting = Formatting.Indented; - xmlWriter.WriteStartDocument(); - xmlWriter.WriteStartElement("links"); + _readerWriterLock.ReleaseReaderLock(); + } + } + + #endregion + + #region Private Methods + + private LinkedMediaPortalChannel GetLinkedMediaPortalChannelInternal(ChannelType channelType, Guid channelId, string displayName, out bool isAutoLinked, out bool duplicateChannelsFound) + { + EnsureLoaded(); + + _readerWriterLock.AcquireReaderLock(Timeout.Infinite); + try + { + isAutoLinked = false; + duplicateChannelsFound = false; + + if (_linksById.ContainsKey(channelId)) + { + ChannelLink link = _linksById[channelId]; + return new LinkedMediaPortalChannel(link.MPChannelId, link.MPChannelName, link.MPChannelDisplayName); + } + + TvDatabase.Channel channel = GetChannelByDisplayName(channelType, displayName, + out duplicateChannelsFound); + if (channel != null) + { + isAutoLinked = true; + _autoLinkedMPChannels[channel.IdChannel] = true; + return new LinkedMediaPortalChannel(channel.IdChannel, channel.Name, channel.DisplayName); + } + + return null; + } + finally + { + _readerWriterLock.ReleaseReaderLock(); + } + } + + private ChannelLink GetChannelLinkForMediaPortalChannelInternal(TvDatabase.Channel channel) + { + EnsureLoaded(); + + _readerWriterLock.AcquireReaderLock(Timeout.Infinite); + try + { foreach (ChannelLink link in _linksById.Values) { - link.WriteToXml(xmlWriter); + if (link.MPChannelId == channel.IdChannel + && link.MPChannelName == channel.Name) + { + return link; + } } - xmlWriter.WriteEndElement(); + return null; } + finally + { + _readerWriterLock.ReleaseReaderLock(); + } } - #endregion + public bool IsAutoLinkedInternal(TvDatabase.Channel mpChannel) + { + EnsureLoaded(); - #region Private Methods + _readerWriterLock.AcquireReaderLock(Timeout.Infinite); + try + { + return _autoLinkedMPChannels.ContainsKey(mpChannel.IdChannel); + } + finally + { + _readerWriterLock.ReleaseReaderLock(); + } + } - private Channel GetChannelByDisplayName(string displayName, out bool duplicateChannelsFound) + public void SetLinkedMediaPortalChannelInternal(Channel channel, TvDatabase.Channel mpChannel) { - return InternalGetChannelBy("displayName", displayName, out duplicateChannelsFound); + EnsureLoaded(); + + _readerWriterLock.AcquireWriterLock(Timeout.Infinite); + try + { + ClearLinkedMediaPortalChannel(channel); + ChannelLink link = new ChannelLink(channel.ChannelType, channel.ChannelId, channel.DisplayName, mpChannel.IdChannel, mpChannel.Name); + link.MPChannelDisplayName = mpChannel.DisplayName; + _linksById.Add(link.ChannelId, link); + } + finally + { + _readerWriterLock.ReleaseWriterLock(); + } } - private Channel GetChannelById(int id) + public void ClearLinkedMediaPortalChannelInternal(Channel channel) { + EnsureLoaded(); + + _readerWriterLock.AcquireWriterLock(Timeout.Infinite); + try + { + if (_linksById.ContainsKey(channel.ChannelId)) + { + _linksById.Remove(channel.ChannelId); + } + } + finally + { + _readerWriterLock.ReleaseWriterLock(); + } + } + + private void RemoveObsoleteLinksInternal(ChannelType channelType, List<Channel> channels) + { + EnsureLoaded(); + + _readerWriterLock.AcquireWriterLock(Timeout.Infinite); + try + { + List<Guid> obsoleteLinks = new List<Guid>(); + foreach (Guid channelId in _linksById.Keys) + { + if (_linksById[channelId].ChannelType == channelType + && !ChannelListContains(channels, channelId)) + { + obsoleteLinks.Add(channelId); + } + } + foreach (Guid channelId in obsoleteLinks) + { + _linksById.Remove(channelId); + } + } + finally + { + _readerWriterLock.ReleaseWriterLock(); + } + } + + private TvDatabase.Channel GetChannelByDisplayName(ChannelType channelType, string displayName, out bool duplicateChannelsFound) + { + return InternalGetChannelBy(channelType, "displayName", displayName, out duplicateChannelsFound); + } + + private TvDatabase.Channel GetChannelById(ChannelType channelType, int id) + { bool duplicateChannelsFound; - return InternalGetChannelBy("idChannel", id, out duplicateChannelsFound); + return InternalGetChannelBy(channelType, "idChannel", id, out duplicateChannelsFound); } - private Channel GetChannelByName(string name) + private TvDatabase.Channel GetChannelByName(ChannelType channelType, string name) { bool duplicateChannelsFound; - return InternalGetChannelBy("name", name, out duplicateChannelsFound); + return InternalGetChannelBy(channelType, "name", name, out duplicateChannelsFound); } - private Channel InternalGetChannelBy(string columnName, object value, out bool duplicateChannelsFound) + private TvDatabase.Channel InternalGetChannelBy(ChannelType channelType, string columnName, object value, out bool duplicateChannelsFound) { - SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Channel)); + SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(TvDatabase.Channel)); sb.AddConstraint(Operator.Equals, columnName, value); sb.AddConstraint(Operator.Equals, "visibleInGuide", true); + if (channelType == ChannelType.Television) + { + sb.AddConstraint(Operator.Equals, "isTv", true); + } + else + { + sb.AddConstraint(Operator.Equals, "isRadio", true); + } SqlResult result = Broker.Execute(sb.GetStatement()); if (result.Rows.Count == 1) { duplicateChannelsFound = false; - IList channels = ObjectFactory.GetCollection(typeof(Channel), result); - return channels[0] as Channel; + IList channels = ObjectFactory.GetCollection(typeof(TvDatabase.Channel), result); + return channels[0] as TvDatabase.Channel; } duplicateChannelsFound = (result.Rows.Count > 0); return null; } + private static bool ChannelListContains(List<Channel> channels, Guid channelId) + { + foreach (Channel channel in channels) + { + if (channel.ChannelId == channelId) + { + return true; + } + } + return false; + } + #endregion } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.cs 2009-05-22 21:00:13 UTC (rev 2868) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.cs 2009-05-26 08:32:13 UTC (rev 2869) @@ -5,7 +5,6 @@ using System.Text; using System.Windows.Forms; -using TvDatabase; using Gentle.Framework; using ForTheRecord.Entities; @@ -20,29 +19,27 @@ InitializeComponent(); } - internal ChannelLinks ChannelLinks { set; get; } + internal Channel Channel { set; get; } - internal TvChannel TvChannel { set; get; } - private void CreateShareForm_Load(object sender, EventArgs e) { - _channelNameLabel.Text = this.TvChannel.DisplayName; + _channelNameLabel.Text = this.Channel.DisplayName; LoadGroups(); - LinkedMediaPortalChannel linkedChannel = this.ChannelLinks.GetLinkedMediaPortalChannel(this.TvChannel); + LinkedMediaPortalChannel linkedChannel = ChannelLinks.GetLinkedMediaPortalChannel(this.Channel); if (linkedChannel != null) { - SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(GroupMap)); + SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(TvDatabase.GroupMap)); sb.AddConstraint(Operator.Equals, "idChannel", linkedChannel.Id); SqlResult result = Broker.Execute(sb.GetStatement()); - List<GroupMap> groupMaps = (List<GroupMap>) - ObjectFactory.GetCollection(typeof(GroupMap), result, new List<GroupMap>()); + List<TvDatabase.GroupMap> groupMaps = (List<TvDatabase.GroupMap>) + ObjectFactory.GetCollection(typeof(TvDatabase.GroupMap), result, new List<TvDatabase.GroupMap>()); if (groupMaps.Count > 0) { foreach (ListViewItem item in _groupsListView.Items) { - ChannelGroup channelGroup = item.Tag as ChannelGroup; - if (channelGroup.IdGroup == groupMaps[0].IdGroup) + if (item.Tag is int + && (int)item.Tag == groupMaps[0].IdGroup) { item.Selected = true; _groupsListView.EnsureVisible(item.Index); @@ -74,21 +71,44 @@ private void LoadGroups() { - SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(ChannelGroup)); - sb.AddOrderByField("groupName"); - SqlResult result = Broker.Execute(sb.GetStatement()); - List<ChannelGroup> channelGroups = (List<ChannelGroup>) - ObjectFactory.GetCollection(typeof(ChannelGroup), result, new List<ChannelGroup>()); - _groupsListView.Items.Clear(); - foreach (ChannelGroup channelGroup in channelGroups) + if (this.Channel.ChannelType == ChannelType.Television) { - ListViewItem item = new ListViewItem(channelGroup.GroupName); - item.Tag = channelGroup; - _groupsListView.Items.Add(item); + List<TvDatabase.ChannelGroup> groups = Utility.GetAllGroups<TvDatabase.ChannelGroup>(); + foreach (TvDatabase.ChannelGroup group in groups) + { + if (group.GroupName.Equals("All Channels", StringComparison.CurrentCultureIgnoreCase)) + { + groups.Remove(group); + break; + } + } + groups.Add(new TvDatabase.ChannelGroup(-1, "All Channels")); + foreach (TvDatabase.ChannelGroup group in groups) + { + ListViewItem item = new ListViewItem(group.GroupName); + item.Tag = group.IdGroup; + _groupsListView.Items.Add(item); + } } - ListViewItem allItem = new ListViewItem("All Channels"); - allItem.Tag = null; - _groupsListView.Items.Add(allItem); + else + { + List<TvDatabase.RadioChannelGroup> groups = Utility.GetAllGroups<TvDatabase.RadioChannelGroup>(); + foreach (TvDatabase.RadioChannelGroup group in groups) + { + if (group.GroupName.Equals("All Channels", StringComparison.CurrentCultureIgnoreCase)) + { + groups.Remove(group); + break; + } + } + groups.Add(new TvDatabase.RadioChannelGroup(-1, "All Channels")); + foreach (TvDatabase.RadioChannelGroup group in groups) + { + ListViewItem item = new ListViewItem(group.GroupName); + item.Tag = group.IdGroup; + _groupsListView.Items.Add(item); + } + } } private void _okButton_Click(object sender, EventArgs e) @@ -96,11 +116,11 @@ if (_channelsListView.SelectedItems.Count > 0) { ChannelItem channelItem = _channelsListView.SelectedItems[0].Tag as ChannelItem; - this.ChannelLinks.SetLinkedMediaPortalChannel(this.TvChannel, channelItem.Channel); + ChannelLinks.SetLinkedMediaPortalChannel(this.Channel, channelItem.Channel); } else { - this.ChannelLinks.ClearLinkedMediaPortalChannel(this.TvChannel); + ChannelLinks.ClearLinkedMediaPortalChannel(this.Channel); } this.DialogResult = DialogResult.OK; this.Close(); @@ -108,7 +128,7 @@ private void _clearLinkButton_Click(object sender, EventArgs e) { - this.ChannelLinks.ClearLinkedMediaPortalChannel(this.TvChannel); + ChannelLinks.ClearLinkedMediaPortalChannel(this.Channel); this.DialogResult = DialogResult.OK; this.Close(); } @@ -125,37 +145,16 @@ { if (_groupsListView.SelectedItems.Count > 0) { - ChannelGroup group = _groupsListView.SelectedItems[0].Tag as ChannelGroup; + int groupId = (int)_groupsListView.SelectedItems[0].Tag; List<ChannelItem> channelItems = new List<ChannelItem>(); - if (group == null) + List<TvDatabase.Channel> channels = + Utility.GetAllChannelsInGroup(this.Channel.ChannelType, groupId); + foreach (TvDatabase.Channel channel in channels) { - SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(Channel)); - sb.AddConstraint(Operator.Equals, "visibleInGuide", true); - sb.AddOrderByField("displayName"); - SqlResult result = Broker.Execute(sb.GetStatement()); - List<Channel> channels = (List<Channel>)ObjectFactory.GetCollection(typeof(Channel), result, new List<Channel>()); - foreach(Channel channel in channels) - { - channelItems.Add(new ChannelItem(channel)); - } + channelItems.Add(new ChannelItem(channel)); } - else - { - SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(GroupMap)); - sb.AddConstraint(Operator.Equals, "idGroup", group.IdGroup); - SqlResult result = Broker.Execute(sb.GetStatement()); - List<GroupMap> groupMaps = (List<GroupMap>) - ObjectFactory.GetCollection(typeof(GroupMap), result, new List<GroupMap>()); - foreach (GroupMap groupMap in groupMaps) - { - channelItems.Add(new ChannelItem(groupMap.ReferencedChannel())); - } - channelItems.Sort( - delegate(ChannelItem c1, ChannelItem c2) { return c1.Channel.DisplayName.CompareTo(c2.Channel.DisplayName); }); - } - _channelsListView.Items.Clear(); foreach (ChannelItem channelItem in channelItems) { @@ -172,14 +171,14 @@ private class ChannelItem { - private Channel _channel; + private TvDatabase.Channel _channel; - public ChannelItem(Channel channel) + public ChannelItem(TvDatabase.Channel channel) { _channel = channel; } - public Channel Channel + public TvDatabase.Channel Channel { get { return _channel; } } Added: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs 2009-05-26 08:32:13 UTC (rev 2869) @@ -0,0 +1,145 @@ +/* + * Copyright (C) 2007-2009 ForTheRecord + * http://www.4therecord.eu + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + * + */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Text; +using System.Threading; + +using TvLibrary.Interfaces; +using TvEngine.Events; +using TvLibrary.Log; +using Gentle.Framework; + +using ForTheRecord.ServiceAgents; +using ForTheRecord.Entities; +using ForTheRecord.RecorderTuners.Common; +using ForTheRecord.RecorderTuners.MediaPortalTvServer.Channels; + +namespace ForTheRecord.RecorderTuners.MediaPortalTvServer +{ + internal class DvbEpgThread : WorkerThread + { + private List<List<GuideProgram>> _guideProgramsToImport = new List<List<GuideProgram>>(); + private AutoResetEvent _newProgramsToImportEvent; + private object _guideProgramsToImportLock = new object(); + + public DvbEpgThread() + : base("ForTheRecordDvbEpg") + { + } + + public void ImportProgramsAsync(List<GuideProgram> guidePrograms) + { + if (guidePrograms != null + && guidePrograms.Count > 0) + { + lock (_guideProgramsToImportLock) + { + _guideProgramsToImport.Add(guidePrograms); + if (_newProgramsToImportEvent != null) + { + _newProgramsToImportEvent.Set(); + } + } + } + } + + private List<GuideProgram> GetProgramsToImport() + { + lock (_guideProgramsToImportLock) + { + List<GuideProgram> result; + if (_guideProgramsToImport.Count > 0) + { + result = _guideProgramsToImport[0]; + _guideProgramsToImport.RemoveAt(0); + } + else + { + result = new List<GuideProgram>(); + } + return result; + } + } + + protected override void Run() + { + Thread.Sleep(5 * 1000); + + lock (_guideProgramsToImportLock) + { + _newProgramsToImportEvent = new AutoResetEvent(false); + } + try + { + int interval = 1 * 60 * 1000; +#if DEBUG + interval = 5000; +#endif + + bool aborted = false; + while (!aborted) + { + try + { + List<GuideProgram> guidePrograms = GetProgramsToImport(); + if (guidePrograms.Count > 0) + { + using (TvGuideServiceAgent tvGuideAgent = new TvGuideServiceAgent()) + { + Log.Debug("ForTheRecord.RecorderTuners.MediaPortalTvServer: ForTheRecordDvbEpg: importing {0} programs into For The Record", guidePrograms.Count); + foreach (GuideProgram guideProgram in guidePrograms) + { + tvGuideAgent.ImportProgram(guideProgram, GuideSource.DvbEpg); + aborted = this.StopThreadEvent.WaitOne(0, false); + if (aborted) + { + break; + } + } + } + } + if (!aborted) + { + aborted = (0 == WaitHandle.WaitAny(new WaitHandle[] { this.StopThreadEvent, _newProgramsToImportEvent }, interval, false)); + } + } + catch (Exception ex) + { + Log.Error("ForTheRecordDvbEpg error: {0}", ex.Message); + // Delay for a short while and then restart. + aborted = this.StopThreadEvent.WaitOne(30 * 1000, false); + } + } + } + finally + { + lock (_guideProgramsToImportLock) + { + _newProgramsToImportEvent.Close(); + _newProgramsToImportEvent = null; + } + } + } + } +} Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj 2009-05-22 21:00:13 UTC (rev 2868) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj 2009-05-26 08:32:13 UTC (rev 2869) @@ -18,7 +18,7 @@ <OldToolsVersion>2.0</OldToolsVersion> <UpgradeBackupLocation> </UpgradeBackupLocation> - <TargetFrameworkVersion>v3.0</TargetFrameworkVersion> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -38,19 +38,19 @@ <WarningLevel>4</WarningLevel> </PropertyGroup> <ItemGroup> - <Reference Include="ForTheRecord.Entities, Version=1.3.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <Reference Include="ForTheRecord.Entities, Version=1.4.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\ReferencedAssemblies\ForTheRecord.Entities.dll</HintPath> </Reference> - <Reference Include="ForTheRecord.RecorderTuners.Common, Version=1.3.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <Reference Include="ForTheRecord.RecorderTuners.Common, Version=1.4.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\ReferencedAssemblies\ForTheRecord.RecorderTuners.Common.dll</HintPath> </Reference> - <Reference Include="ForTheRecord.ServiceAgents, Version=1.3.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <Reference Include="ForTheRecord.ServiceAgents, Version=1.4.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\ReferencedAssemblies\ForTheRecord.ServiceAgents.dll</HintPath> </Reference> - <Reference Include="ForTheRecord.ServiceContracts, Version=1.3.1.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> + <Reference Include="ForTheRecord.ServiceContracts, Version=1.4.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\ReferencedAssemblies\ForTheRecord.ServiceContracts.dll</HintPath> </Reference> @@ -71,6 +71,9 @@ <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\SetupControls.dll</HintPath> </Reference> <Reference Include="System" /> + <Reference Include="System.Core"> + <RequiredTargetFramework>3.5</RequiredTargetFramework> + </Reference> <Reference Include="System.Data" /> <Reference Include="System.Drawing" /> <Reference Include="System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" /> @@ -107,6 +110,11 @@ <DependentUpon>CreateShareForm.cs</DependentUpon> </Compile> <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> <Compile Include="RecordingThread.cs" /> <Compile Include="SettingName.cs" /> <Compile Include="Channels\ChannelLink.cs" /> @@ -119,9 +127,43 @@ <DependentUpon>SetupForm.cs</DependentUpon> </Compile> <Compile Include="MediaPortalRecorderTunerService.cs" /> + <Compile Include="ThreeStateTreeView.cs"> + <SubType>Component</SubType> + </Compile> <Compile Include="TvServerPlugin.cs" /> - <Compile Include="SyncEpgThread.cs" /> + <Compile Include="DvbEpgThread.cs" /> <Compile Include="Utility.cs" /> + <Compile Include="Wizards\ImportChannels\ImportChannelsContext.cs" /> + <Compile Include="Wizards\ImportChannels\ImportChannelsPage.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="Wizards\ImportChannels\ImportChannelsPage.Designer.cs"> + <DependentUpon>ImportChannelsPage.cs</DependentUpon> + </Compile> + <Compile Include="Wizards\ImportChannels\ImportChannelsPageBase.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="Wizards\ImportChannels\ImportChannelsWizard.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="Wizards\ImportChannels\FinishPage.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="Wizards\ImportChannels\FinishPage.Designer.cs"> + <DependentUpon>FinishPage.cs</DependentUpon> + </Compile> + <Compile Include="Wizards\WizardForm.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="Wizards\WizardForm.Designer.cs"> + <DependentUpon>WizardForm.cs</DependentUpon> + </Compile> + <Compile Include="Wizards\WizardPage.cs"> + <SubType>UserControl</SubType> + </Compile> + <Compile Include="Wizards\WizardPage.Designer.cs"> + <DependentUpon>WizardPage.cs</DependentUpon> + </Compile> </ItemGroup> <ItemGroup> <EmbeddedResource Include="CreateChannelLinkForm.resx"> @@ -132,14 +174,33 @@ <DependentUpon>CreateShareForm.cs</DependentUpon> <SubType>Designer</SubType> </EmbeddedResource> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> <EmbeddedResource Include="SetupForm.resx"> <DependentUpon>SetupForm.cs</DependentUpon> <SubType>Designer</SubType> </EmbeddedResource> + <EmbeddedResource Include="Wizards\ImportChannels\ImportChannelsPage.resx"> + <DependentUpon>ImportChannelsPage.cs</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="Wizards\ImportChannels\FinishPage.resx"> + <DependentUpon>FinishPage.cs</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="Wizards\WizardForm.resx"> + <DependentUpon>WizardForm.cs</DependentUpon> + </EmbeddedResource> + <EmbeddedResource Include="Wizards\WizardPage.resx"> + <DependentUpon>WizardPage.cs</DependentUpon> + </EmbeddedResource> </ItemGroup> <ItemGroup> <None Include="PostBuild.cmd" /> </ItemGroup> + <ItemGroup> + <None Include="Resources\WizardHeader.bmp" /> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- 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. Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs ========================... [truncated message content] |
From: <do...@us...> - 2010-01-13 13:18:01
|
Revision: 3350 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3350&view=rev Author: dot-i Date: 2010-01-13 13:17:54 +0000 (Wed, 13 Jan 2010) Log Message: ----------- Updated for latest SVN 24669. Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioGuideSearch.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioRecorded.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TeletextPageRenderer.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideSearch.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvRecorded.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Client.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll Modified: trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln 2010-01-13 13:17:54 UTC (rev 3350) @@ -11,6 +11,27 @@ EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForTheRecord.UI.MediaPortal", "ForTheRecord.UI.MediaPortal\ForTheRecord.UI.MediaPortal.csproj", "{1526A789-1DE2-4A8B-AA4B-5382A617C4F8}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ReferencedAssemblies", "ReferencedAssemblies", "{FD6B1904-69BA-4054-B218-C616D64BF43A}" + ProjectSection(SolutionItems) = preProject + ReferencedAssemblies\Core.dll = ReferencedAssemblies\Core.dll + ReferencedAssemblies\Databases.dll = ReferencedAssemblies\Databases.dll + ReferencedAssemblies\Dialogs.dll = ReferencedAssemblies\Dialogs.dll + ReferencedAssemblies\ForTheRecord.Client.Common.dll = ReferencedAssemblies\ForTheRecord.Client.Common.dll + ReferencedAssemblies\ForTheRecord.Entities.dll = ReferencedAssemblies\ForTheRecord.Entities.dll + ReferencedAssemblies\ForTheRecord.RecorderTuners.Common.dll = ReferencedAssemblies\ForTheRecord.RecorderTuners.Common.dll + ReferencedAssemblies\ForTheRecord.ServiceAgents.dll = ReferencedAssemblies\ForTheRecord.ServiceAgents.dll + ReferencedAssemblies\ForTheRecord.ServiceContracts.dll = ReferencedAssemblies\ForTheRecord.ServiceContracts.dll + ReferencedAssemblies\Gentle.Common.dll = ReferencedAssemblies\Gentle.Common.dll + ReferencedAssemblies\Gentle.Framework.dll = ReferencedAssemblies\Gentle.Framework.dll + ReferencedAssemblies\PluginBase.dll = ReferencedAssemblies\PluginBase.dll + ReferencedAssemblies\SetupControls.dll = ReferencedAssemblies\SetupControls.dll + ReferencedAssemblies\TvBusinessLayer.dll = ReferencedAssemblies\TvBusinessLayer.dll + ReferencedAssemblies\TvControl.dll = ReferencedAssemblies\TvControl.dll + ReferencedAssemblies\TVDatabase.dll = ReferencedAssemblies\TVDatabase.dll + ReferencedAssemblies\TvLibrary.Interfaces.dll = ReferencedAssemblies\TvLibrary.Interfaces.dll + ReferencedAssemblies\Utils.dll = ReferencedAssemblies\Utils.dll + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -68,16 +68,12 @@ { lock (_guideProgramsToImportLock) { - List<GuideProgram> result; + List<GuideProgram> result = null; if (_guideProgramsToImport.Count > 0) { result = _guideProgramsToImport[0]; _guideProgramsToImport.RemoveAt(0); } - else - { - result = new List<GuideProgram>(); - } return result; } } @@ -103,7 +99,7 @@ try { List<GuideProgram> guidePrograms = GetProgramsToImport(); - if (guidePrograms.Count > 0) + while (guidePrograms != null) { using (TvGuideServiceAgent tvGuideAgent = new TvGuideServiceAgent()) { @@ -118,6 +114,12 @@ } } } + aborted = this.StopThreadEvent.WaitOne(0); + if (aborted) + { + break; + } + guidePrograms = GetProgramsToImport(); } if (!aborted) { Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj 2010-01-13 13:17:54 UTC (rev 3350) @@ -54,21 +54,21 @@ <SpecificVersion>False</SpecificVersion> <HintPath>..\ReferencedAssemblies\ForTheRecord.ServiceContracts.dll</HintPath> </Reference> - <Reference Include="Gentle.Common, Version=1.2.9.1285, Culture=neutral, PublicKeyToken=80b5de62e27be49b"> + <Reference Include="Gentle.Common, Version=1.5.0.29053, Culture=neutral, PublicKeyToken=80b5de62e27be49b, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\Gentle.Common.dll</HintPath> + <HintPath>..\ReferencedAssemblies\Gentle.Common.dll</HintPath> </Reference> - <Reference Include="Gentle.Framework, Version=1.2.9.1286, Culture=neutral, PublicKeyToken=80b5de62e27be49b"> + <Reference Include="Gentle.Framework, Version=1.5.0.29053, Culture=neutral, PublicKeyToken=80b5de62e27be49b, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\Gentle.Framework.dll</HintPath> + <HintPath>..\ReferencedAssemblies\Gentle.Framework.dll</HintPath> </Reference> - <Reference Include="PluginBase, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <Reference Include="PluginBase, Version=1.0.3.28717, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\PluginBase.dll</HintPath> + <HintPath>..\ReferencedAssemblies\PluginBase.dll</HintPath> </Reference> - <Reference Include="SetupControls, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <Reference Include="SetupControls, Version=1.0.3.28715, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\SetupControls.dll</HintPath> + <HintPath>..\ReferencedAssemblies\SetupControls.dll</HintPath> </Reference> <Reference Include="System" /> <Reference Include="System.Core"> @@ -79,21 +79,21 @@ <Reference Include="System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL" /> <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> - <Reference Include="TvBusinessLayer, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <Reference Include="TvBusinessLayer, Version=1.0.4.17440, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\TvBusinessLayer.dll</HintPath> + <HintPath>..\ReferencedAssemblies\TvBusinessLayer.dll</HintPath> </Reference> - <Reference Include="TvControl, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <Reference Include="TvControl, Version=1.0.4.17440, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\TvControl.dll</HintPath> + <HintPath>..\ReferencedAssemblies\TvControl.dll</HintPath> </Reference> - <Reference Include="TVDatabase, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <Reference Include="TVDatabase, Version=1.0.4.17440, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\TVDatabase.dll</HintPath> + <HintPath>..\ReferencedAssemblies\TVDatabase.dll</HintPath> </Reference> - <Reference Include="TvLibrary.Interfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <Reference Include="TvLibrary.Interfaces, Version=1.0.4.17439, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\TvLibrary.Interfaces.dll</HintPath> + <HintPath>..\ReferencedAssemblies\TvLibrary.Interfaces.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -234,6 +234,10 @@ if (Utility.CardFreeOrUsingSameTransponder(card.IdCard, mpChannel, tve3User)) { Log("TuneLiveTvStream(): tuning on card {0} {1}", card.IdCard, card.Name); + lock (_liveStreamsLock) + { + _liveStreams[liveStream.RtspUrl].StreamLastAliveTime = DateTime.Now; + } LiveStreamResult result = StartTimeShifting(channel, card, mpChannel, ref tve3User, ref liveStream); if (result != LiveStreamResult.NoFreeCardFound) { @@ -311,6 +315,7 @@ } liveStream.Channel = channel; liveStream.CardId = tve3User.CardId.ToString(CultureInfo.InvariantCulture); + liveStream.StreamLastAliveTime = DateTime.Now; lock (_liveStreamsLock) { _liveStreams[liveStream.RtspUrl] = liveStream; Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -135,7 +135,7 @@ return null; } - if (!TvServerPlugin.TvController_StartRecording(ref _tve3User, ref _tve3RecordingFileName, false, 0)) + if (TvServerPlugin.TvController_StartRecording(ref _tve3User, ref _tve3RecordingFileName, false, 0) != TvResult.Succeeded) { errorMessage = "TV Server failed to start recording on channel " + _channel.DisplayName; return null; Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -149,6 +149,7 @@ #region IPlugin Methods + private static IController _controller; private ServiceHost _recorderTunerHost; private DvbEpgThread _dvbEpgThread; private PowerEventHandler _powerEventHandler; @@ -157,6 +158,7 @@ { Log.Info("ForTheRecord.RecorderTuners.MediaPortalTvServer: Start"); + _controller = controller; LoadSettings(); if (GlobalServiceProvider.Instance.IsRegistered<IPowerEventHandler>()) @@ -253,6 +255,7 @@ case PowerEventType.Suspend: case PowerEventType.StandBy: Log.Debug("ForTheRecord.RecorderTuners.MediaPortalTvServer: System is entering standby"); + _tvServerNeedsRestart = true; return true; case PowerEventType.QuerySuspendFailed: @@ -279,12 +282,16 @@ } } + private bool _tvServerNeedsRestart; + private void Resume() { - if (_restartTvServerOnResume) + if (_tvServerNeedsRestart + && _restartTvServerOnResume) { TvServerPlugin.TvController_Restart(); } + _tvServerNeedsRestart = false; } internal bool InitializeTvSchedulerConnection(IWin32Window settingsPanel) @@ -571,7 +578,7 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.Tune(ref user, channel, idChannel); + return _controller.Tune(ref user, channel, idChannel); } } @@ -579,7 +586,7 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.Type(cardId); + return _controller.Type(cardId); } } @@ -587,7 +594,7 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.CanTune(cardId, channel); + return _controller.CanTune(cardId, channel); } } @@ -595,7 +602,7 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.IsGrabbingEpg(cardId); + return _controller.IsGrabbingEpg(cardId); } } @@ -603,15 +610,15 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.GetUsersForCard(cardId); + return _controller.GetUsersForCard(cardId); } } - public static bool TvController_StartRecording(ref User user, ref string fileName, bool contentRecording, long startTime) + public static TvResult TvController_StartRecording(ref User user, ref string fileName, bool contentRecording, long startTime) { lock (_tvControllerLock) { - return RemoteControl.Instance.StartRecording(ref user, ref fileName, contentRecording, startTime); + return _controller.StartRecording(ref user, ref fileName, contentRecording, startTime); } } @@ -619,7 +626,7 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.IsRecording(ref user); + return _controller.IsRecording(ref user); } } @@ -627,7 +634,7 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.StopRecording(ref user); + return _controller.StopRecording(ref user); } } @@ -635,7 +642,7 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.StartTimeShifting(ref user, ref fileName); + return _controller.StartTimeShifting(ref user, ref fileName); } } @@ -643,7 +650,7 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.IsTimeShifting(ref user); + return _controller.IsTimeShifting(ref user); } } @@ -651,7 +658,7 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.StopTimeShifting(ref user); + return _controller.StopTimeShifting(ref user); } } @@ -659,7 +666,7 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.StopTimeShifting(ref user, reason); + return _controller.StopTimeShifting(ref user, reason); } } @@ -667,7 +674,7 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.TimeShiftFileName(ref user); + return _controller.TimeShiftFileName(ref user); } } @@ -675,7 +682,7 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.GetStreamingUrl(user); + return _controller.GetStreamingUrl(user); } } @@ -683,7 +690,7 @@ { lock (_tvControllerLock) { - RemoteControl.Instance.HeartBeat(user); + _controller.HeartBeat(user); } } @@ -691,7 +698,7 @@ { lock (_tvControllerLock) { - RemoteControl.Instance.Restart(); + _controller.Restart(); } } @@ -699,7 +706,7 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.HasTeletext(user); + return _controller.HasTeletext(user); } } @@ -707,7 +714,7 @@ { lock (_tvControllerLock) { - RemoteControl.Instance.GrabTeletext(user, true); + _controller.GrabTeletext(user, true); } } @@ -715,7 +722,7 @@ { lock (_tvControllerLock) { - RemoteControl.Instance.GrabTeletext(user, false); + _controller.GrabTeletext(user, false); } } @@ -723,7 +730,7 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.IsGrabbingTeletext(user); + return _controller.IsGrabbingTeletext(user); } } @@ -731,7 +738,7 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.GetTeletextPage(user, pageNumber, subPageNumber); + return _controller.GetTeletextPage(user, pageNumber, subPageNumber); } } @@ -739,7 +746,7 @@ { lock (_tvControllerLock) { - return RemoteControl.Instance.SubPageCount(user, pageNumber); + return _controller.SubPageCount(user, pageNumber); } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -67,6 +67,8 @@ return (channelType == 3); case CardType.DvbT: return (channelType == 4); + case CardType.DvbIP: + return (channelType == 7); } return false; } Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -37,7 +37,6 @@ using MediaPortal.Threading; using MediaPortal.Util; using MediaPortal.Configuration; -using Toub.MediaCenter.Dvrms.Metadata; using ForTheRecord.Entities; using ForTheRecord.ServiceAgents; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -440,7 +440,7 @@ public void ZapToChannel(ChannelGroup channelGroup, Channel channel, bool useZapDelay) { Log.Debug("ChannelNavigator.ZapToChannel {0} - zapdelay {1}", channel.DisplayName, useZapDelay); -// TODO + // TODO //TVHome.UserChannelChanged = true; _zapGroup = channelGroup ?? _currentChannelGroup; _zapChannel = channel; @@ -553,6 +553,8 @@ { bool resumeGraph = true; g_Player.PauseGraph(); + g_Player.OnZapping(0x80); + LiveStreamResult firstResult = LiveStreamResult.Succeeded; LiveStreamResult result = LiveStreamResult.UnknownError; try @@ -569,6 +571,8 @@ string fileName; int seekOffset; GetPlayerFileNameAndOffset(liveStream, out fileName, out seekOffset); + + g_Player.OnZapping(-1); g_Player.SeekAbsolute(g_Player.Duration + seekOffset); } else @@ -576,6 +580,7 @@ // Seems a re-tune has failed, so keep track of the channel that // was already being streamed and stop the current stream. Channel resumeChannel = _currentChannel; + g_Player.OnZapping(-1); g_Player.ContinueGraph(); resumeGraph = false; SilentlyStopLiveStream(liveStream); @@ -842,9 +847,9 @@ { if (_liveStream != null) { - using(TvControlServiceAgent tvControlAgent = new TvControlServiceAgent() ) + using (TvControlServiceAgent tvControlAgent = new TvControlServiceAgent()) { - tvControlAgent.StartGrabbingTeletext(_liveStream); + tvControlAgent.StartGrabbingTeletext(_liveStream); } } } @@ -873,7 +878,7 @@ { return this.TvControlAgent.GetTeletextPage(_liveStream, pageNumber, subPageNumber); } - return null; + return null; } #endregion @@ -982,34 +987,44 @@ private void SaveGroupAndChannelSettings(global::MediaPortal.Profile.Settings xmlwriter, ChannelType channelType, string section) { - if (_navigatorChannels[channelType].LastChannelGroup != null) + try { - try + if (_currentChannelGroup != null + && _currentChannelGroup.ChannelType == channelType) { + xmlwriter.SetValue(section, "group", _currentChannelGroup.GroupName); + } + else if (_navigatorChannels[channelType].LastChannelGroup != null) + { xmlwriter.SetValue(section, "group", _navigatorChannels[channelType].LastChannelGroup.GroupName); } - catch (Exception) + else { + xmlwriter.SetValue(section, "group", String.Empty); } } - else + catch (Exception) { - xmlwriter.SetValue(section, "group", String.Empty); } - if (_navigatorChannels[channelType].LastChannel != null) + try { - try + if (_currentChannel != null + && _currentChannel.ChannelType == channelType) { + xmlwriter.SetValue(section, "channel", _currentChannel.DisplayName); + } + else if (_navigatorChannels[channelType].LastChannel != null) + { xmlwriter.SetValue(section, "channel", _navigatorChannels[channelType].LastChannel.DisplayName); } - catch (Exception) + else { + xmlwriter.SetValue(section, "channel", String.Empty); } } - else + catch (Exception) { - xmlwriter.SetValue(section, "channel", String.Empty); } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj 2010-01-13 13:17:54 UTC (rev 3350) @@ -53,17 +53,17 @@ <PlatformTarget>x86</PlatformTarget> </PropertyGroup> <ItemGroup> - <Reference Include="Core, Version=0.2.3.18279, Culture=neutral, processorArchitecture=x86"> + <Reference Include="Core, Version=1.0.3.28694, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\Core.dll</HintPath> + <HintPath>..\ReferencedAssemblies\Core.dll</HintPath> </Reference> - <Reference Include="Databases, Version=0.2.3.18279, Culture=neutral, processorArchitecture=x86"> + <Reference Include="Databases, Version=1.0.3.28696, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\Databases.dll</HintPath> + <HintPath>..\ReferencedAssemblies\Databases.dll</HintPath> </Reference> - <Reference Include="Dialogs, Version=0.2.3.18279, Culture=neutral, processorArchitecture=x86"> + <Reference Include="Dialogs, Version=1.0.3.28698, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\Dialogs.dll</HintPath> + <HintPath>..\ReferencedAssemblies\Dialogs.dll</HintPath> </Reference> <Reference Include="ForTheRecord.Client.Common, Version=1.4.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> @@ -90,13 +90,13 @@ </Reference> <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> - <Reference Include="TvLibrary.Interfaces, Version=1.0.0.26777, Culture=neutral, processorArchitecture=x86"> + <Reference Include="TvLibrary.Interfaces, Version=1.0.3.28723, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\TvLibrary.Interfaces.dll</HintPath> + <HintPath>..\ReferencedAssemblies\TvLibrary.Interfaces.dll</HintPath> </Reference> - <Reference Include="Utils, Version=0.2.3.18279, Culture=neutral, processorArchitecture=x86"> + <Reference Include="Utils, Version=2.2.7.28690, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\ForTheRecord.ReferencedAssemblies\MediaPortalAssemblies\Utils.dll</HintPath> + <HintPath>..\ReferencedAssemblies\Utils.dll</HintPath> </Reference> </ItemGroup> <ItemGroup> Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -1102,7 +1102,8 @@ { label = new GUILabelControl(GetID, (int)Controls.LABEL_TIME1 + iLabel, xpos, ypos, iLabelWidth, cntlHeaderBkgImg.RenderHeight, labelTime.FontName, String.Empty, - labelTime.TextColor, GUIControl.Alignment.ALIGN_CENTER, false); + labelTime.TextColor, GUIControl.Alignment.Center, GUIControl.VAlignment.Middle, false, + labelTime.ShadowAngle, labelTime.ShadowDistance, labelTime.ShadowColor); label.AllocResources(); GUIControl cntl = (GUIControl)label; this.Add(ref cntl); @@ -1525,7 +1526,7 @@ channelLabel = new GUILabelControl(GetID, (int)Controls.SINGLE_CHANNEL_LABEL, channelImage.XPosition + 44, channelImage.YPosition + 10, - 300, 40, "font16", channel.DisplayName, 4294967295, GUIControl.Alignment.Left, true); + 300, 40, "font16", channel.DisplayName, 4294967295, GUIControl.Alignment.Left, GUIControl.VAlignment.Middle, true, 0, 0, 0xFF000000); channelLabel.AllocResources(); GUIControl temp = (GUIControl)channelLabel; Add(ref temp); Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -37,7 +37,6 @@ using MediaPortal.Threading; using MediaPortal.Util; using MediaPortal.Configuration; -using Toub.MediaCenter.Dvrms.Metadata; using ForTheRecord.Entities; using ForTheRecord.ServiceAgents; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -689,7 +689,8 @@ GUIControl.HideControl(GetID, (int)Controls.IMG_REC_RECTANGLE); GUIControl.HideControl(GetID, (int)Controls.IMG_REC_CHANNEL); - if (_tvOnOffButton.Selected != ForTheRecordMain.Navigator.IsLiveStreamOn) + if (_tvOnOffButton != null + && _tvOnOffButton.Selected != ForTheRecordMain.Navigator.IsLiveStreamOn) { _tvOnOffButton.Selected = ForTheRecordMain.Navigator.IsLiveStreamOn; } Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioGuideSearch.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioGuideSearch.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioGuideSearch.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -37,7 +37,6 @@ using MediaPortal.Threading; using MediaPortal.Util; using MediaPortal.Configuration; -using Toub.MediaCenter.Dvrms.Metadata; using ForTheRecord.Entities; using ForTheRecord.ServiceAgents; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioRecorded.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioRecorded.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioRecorded.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -37,7 +37,6 @@ using MediaPortal.Threading; using MediaPortal.Util; using MediaPortal.Configuration; -using Toub.MediaCenter.Dvrms.Metadata; using ForTheRecord.Entities; using ForTheRecord.ServiceAgents; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -37,7 +37,6 @@ using MediaPortal.Threading; using MediaPortal.Util; using MediaPortal.Configuration; -using Toub.MediaCenter.Dvrms.Metadata; using ForTheRecord.Entities; using ForTheRecord.ServiceAgents; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TeletextPageRenderer.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TeletextPageRenderer.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TeletextPageRenderer.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -36,7 +36,7 @@ public TeletextPageRenderer() { - _isRegionalDK = (RegionInfo.CurrentRegion.Equals("DK")); + _isRegionalDK = RegionInfo.CurrentRegion.TwoLetterISORegionName.Equals("DK", StringComparison.InvariantCultureIgnoreCase); } #endregion Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideSearch.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideSearch.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideSearch.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -37,7 +37,6 @@ using MediaPortal.Threading; using MediaPortal.Util; using MediaPortal.Configuration; -using Toub.MediaCenter.Dvrms.Metadata; using ForTheRecord.Entities; using ForTheRecord.ServiceAgents; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -42,7 +42,7 @@ { } - private const int _keepAliveIntervalSeconds = 25; + private const int _keepAliveIntervalSeconds = 20; private const string _settingSection = "fortherecord"; @@ -237,7 +237,7 @@ } } - private void DoKeepAlive() + private int DoKeepAlive(int param1, int param2, object data) { if (g_Player.Playing || (GUIWindowManager.ActiveWindow != (int)GUIWindow.Window.WINDOW_HOME @@ -267,14 +267,14 @@ ForTheRecordMain.Navigator.SendLiveStreamKeepAlive(); } catch { } + return 0; } private void KeepAliveThreadMain() { - MethodInvoker methodInvoker = new MethodInvoker(DoKeepAlive); do { - methodInvoker.Invoke(); + GUIWindowManager.SendThreadCallbackAndWait(DoKeepAlive, 0, 0, null); } while (!_keepAliveThreadStopEvent.WaitOne(_keepAliveIntervalSeconds * 1000, false)); } Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvRecorded.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvRecorded.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvRecorded.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -37,7 +37,6 @@ using MediaPortal.Threading; using MediaPortal.Util; using MediaPortal.Configuration; -using Toub.MediaCenter.Dvrms.Metadata; using ForTheRecord.Entities; using ForTheRecord.ServiceAgents; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs 2010-01-13 10:17:39 UTC (rev 3349) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs 2010-01-13 13:17:54 UTC (rev 3350) @@ -36,7 +36,6 @@ using MediaPortal.Threading; using MediaPortal.Util; using MediaPortal.Configuration; -using Toub.MediaCenter.Dvrms.Metadata; using ForTheRecord.Entities; using ForTheRecord.ServiceAgents; Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Client.Common.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2010-03-20 11:07:06
|
Revision: 3508 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3508&view=rev Author: dot-i Date: 2010-03-20 11:07:00 +0000 (Sat, 20 Mar 2010) Log Message: ----------- Updated to 1.4.0.2 release. Included patch by sPiel to improve player skip-step (relative on/off). Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TextId.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Translator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/WindowId.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Client.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs 2010-03-20 11:02:03 UTC (rev 3507) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs 2010-03-20 11:07:00 UTC (rev 3508) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2010-03-20 11:02:03 UTC (rev 3507) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2010-03-20 11:07:00 UTC (rev 3508) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -326,6 +326,16 @@ case TvResult.AllCardsBusy: return LiveStreamResult.NoFreeCardFound; + case TvResult.ChannelIsScrambled: + return LiveStreamResult.IsScrambled; + + case TvResult.ChannelNotMappedToAnyCard: + case TvResult.NoSignalDetected: + case TvResult.NoTuningDetails: + case TvResult.NoVideoAudioDetected: + case TvResult.UnknownChannel: + return LiveStreamResult.ChannelTuneFailed; + default: return LiveStreamResult.UnknownError; } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2010-03-20 11:02:03 UTC (rev 3507) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2010-03-20 11:07:00 UTC (rev 3508) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs 2010-03-20 11:02:03 UTC (rev 3507) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs 2010-03-20 11:07:00 UTC (rev 3508) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs 2010-03-20 11:02:03 UTC (rev 3507) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs 2010-03-20 11:07:00 UTC (rev 3508) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs 2010-03-20 11:02:03 UTC (rev 3507) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs 2010-03-20 11:07:00 UTC (rev 3508) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs 2010-03-20 11:02:03 UTC (rev 3507) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs 2010-03-20 11:07:00 UTC (rev 3508) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2010-03-20 11:02:03 UTC (rev 3507) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2010-03-20 11:07:00 UTC (rev 3508) @@ -699,8 +699,8 @@ { seekOffset = 10; fileName = liveStream.RtspUrl; - if (ForTheRecordMain.AvoidRtspForLiveTv - && !String.IsNullOrEmpty(liveStream.TimeshiftFile)) + if (!String.IsNullOrEmpty(liveStream.TimeshiftFile) + && (ForTheRecordMain.AvoidRtspForLiveTv || !liveStream.RtspUrl.StartsWith("rtsp://", StringComparison.CurrentCultureIgnoreCase))) { fileName = liveStream.TimeshiftFile; seekOffset = 0; @@ -820,6 +820,10 @@ dlg.SetLine(1, "It was not possible to re-tune the live stream"); break; + case LiveStreamResult.IsScrambled: + dlg.SetLine(1, "The channel is scrambled"); + break; + case LiveStreamResult.UnknownError: dlg.SetLine(1, "Unknown error"); break; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs 2010-03-20 11:02:03 UTC (rev 3507) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs 2010-03-20 11:07:00 UTC (rev 3508) @@ -816,7 +816,7 @@ day = GUILocalizeStrings.Get(663); break; } - day = String.Format("{0} {1}-{2}", day, dtTemp.Day, dtTemp.Month); + day = GetLocalDate(day, dtTemp.Day, dtTemp.Month); cntlDay.AddLabel(day, iDay); } } @@ -1215,7 +1215,7 @@ day = GUILocalizeStrings.Get(663); break; } - day = String.Format("{0} {1}-{2}", day, _viewingTime.Day, _viewingTime.Month); + day = String.Format(day, _viewingTime.Day, _viewingTime.Month); string guiPropertyPrefix = _channelType == ChannelType.Television ? "#TV" : "#Radio"; GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Guide.Day", day); @@ -4096,5 +4096,27 @@ { return (time >= program.StartTime && time <= program.StopTime); } + + private string GetLocalDate(string dayOfWeek, int day, int month) + { + CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture; + string monthDayFormat = currentCulture.DateTimeFormat.MonthDayPattern; + + // Get the starting position of the day and month in the + // MonthDay pattern of the current culture + int dayPosition = monthDayFormat.IndexOf('d'); + int monthPosition = monthDayFormat.IndexOf('M'); + + // See if month is first in the pattern + string format = "{0} {1}{2}{3}"; + if (monthPosition >= 0 + && monthPosition < dayPosition) + { + // Month is first - Display month before day + format = "{0} {3}{2}{1}"; + } + + return String.Format(format, dayOfWeek, day, currentCulture.DateTimeFormat.DateSeparator, month); + } } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.cs 2010-03-20 11:02:03 UTC (rev 3507) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.cs 2010-03-20 11:07:00 UTC (rev 3508) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TextId.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TextId.cs 2010-03-20 11:02:03 UTC (rev 3507) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TextId.cs 2010-03-20 11:07:00 UTC (rev 3508) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Translator.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Translator.cs 2010-03-20 11:02:03 UTC (rev 3507) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Translator.cs 2010-03-20 11:07:00 UTC (rev 3508) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs 2010-03-20 11:02:03 UTC (rev 3507) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs 2010-03-20 11:07:00 UTC (rev 3508) @@ -113,6 +113,8 @@ bool _playNotifyBeep = true; bool _needToClearScreen = false; bool _useVMR9Zap = false; + bool _immediateSeekIsRelative = true; + int _immediateSeekValue = 10; ///@ ///VMR9OSD _vmr9OSD = null; FullScreenState _screenState = new FullScreenState(); @@ -210,6 +212,8 @@ _useVMR9Zap = xmlreader.GetValueAsBool("general", "useVMR9ZapOSD", false); _notifyTVTimeout = xmlreader.GetValueAsInt("movieplayer", "notifyTVTimeout", 10); _playNotifyBeep = xmlreader.GetValueAsBool("movieplayer", "notifybeep", true); + _immediateSeekIsRelative = xmlreader.GetValueAsBool("movieplayer", "immediateskipstepsisrelative", true); + _immediateSeekValue = xmlreader.GetValueAsInt("movieplayer", "immediateskipstepsize", 10); } Load(GUIGraphicsContext.Skin + @"\mytvFullScreen.xml"); GetID = (int)GUIWindow.Window.WINDOW_TVFULLSCREEN; @@ -660,7 +664,14 @@ } _statusVisible = true; _statusTimeOutTimer = DateTime.Now; - g_Player.SeekRelativePercentage(-10); + if (_immediateSeekIsRelative) + { + g_Player.SeekRelativePercentage(-_immediateSeekValue); + } + else + { + g_Player.SeekRelative(-_immediateSeekValue); + } } } break; @@ -678,7 +689,14 @@ } _statusVisible = true; _statusTimeOutTimer = DateTime.Now; - g_Player.SeekRelativePercentage(10); + if (_immediateSeekIsRelative) + { + g_Player.SeekRelativePercentage(_immediateSeekValue); + } + else + { + g_Player.SeekRelative(_immediateSeekValue); + } } } break; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Utility.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Utility.cs 2010-03-20 11:02:03 UTC (rev 3507) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Utility.cs 2010-03-20 11:07:00 UTC (rev 3508) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/WindowId.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/WindowId.cs 2010-03-20 11:02:03 UTC (rev 3507) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/WindowId.cs 2010-03-20 11:07:00 UTC (rev 3508) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Client.Common.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2010-05-01 19:38:24
|
Revision: 3562 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3562&view=rev Author: dot-i Date: 2010-05-01 19:38:16 +0000 (Sat, 01 May 2010) Log Message: ----------- Updated to plugins for the For The Record 1.5.0.0 release. Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordMain.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/MiniGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/PostBuild.cmd trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVZapOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvCropSettings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideDialog.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvProgramInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvTeletext.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvTeletextBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ChannelProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ChannelProgramsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/TitleRuleTypeIndex.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/ChannelPrograms.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideUpcomingProgram.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/KeepUntilControlUtility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/LiveStreamView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/LiveStreamsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ProcessUtility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/RecorderTunersCache.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Recordings/RecordingsController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Recordings/RecordingsModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ScheduleNamesCache.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SearchGuide/SearchGuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SearchGuide/SearchGuideModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SerializableDictionary.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SortableBindingList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingGuideProgramsDictionary.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingOrActiveProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingOrActiveProgramsList.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Client.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Gentle.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Gentle.Framework.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -11,7 +11,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ForTheRecord.RecorderTuners.MediaPortalTvServer")] -[assembly: AssemblyCopyright("Copyright © ForTheRecord 2007-2009")] +[assembly: AssemblyCopyright("Copyright © ForTheRecord 2007-2010")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -37,6 +37,7 @@ using MediaPortal.Threading; using MediaPortal.Util; using MediaPortal.Configuration; +using Action = MediaPortal.GUI.Library.Action; using ForTheRecord.Entities; using ForTheRecord.ServiceAgents; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -73,6 +73,8 @@ private GuideProgramSummary _zapProgram; private long _zapDelayMs; private bool _autoFullScreen; + private ManualResetEvent _waitForBlackScreenEvent; + private int _framesBeforeStopRenderBlackImage; public ChannelNavigator() { @@ -80,8 +82,61 @@ RefreshChannelGroups(ChannelType.Television); _navigatorChannels[ChannelType.Radio] = new NavigatorChannels(); RefreshChannelGroups(ChannelType.Radio); + _waitForBlackScreenEvent = new ManualResetEvent(false); + GUIGraphicsContext.OnBlackImageRendered += GUIGraphicsContext_OnBlackImageRendered; + GUIGraphicsContext.OnVideoReceived += GUIGraphicsContext_OnVideoReceived; } + #region Black Image + + private void RenderBlackImage() + { + if (!GUIGraphicsContext.RenderBlackImage) + { + Log.Debug("ChannelNavigator.RenderBlackImage()"); + _waitForBlackScreenEvent.Reset(); + GUIGraphicsContext.RenderBlackImage = true; + _waitForBlackScreenEvent.WaitOne(1000, false); + } + } + + private void StopRenderBlackImage() + { + if (GUIGraphicsContext.RenderBlackImage) + { + _framesBeforeStopRenderBlackImage = 3; + // Ambass : we need to wait the 3rd frame to avoid persistance of previous channel....Why ????? + // Morpheus: number of frames depends on hardware, from 1..5 or higher might be needed! + // Probably the faster the graphics card is, the more frames required??? + } + } + + private void GUIGraphicsContext_OnBlackImageRendered() + { + if (GUIGraphicsContext.RenderBlackImage) + { + _waitForBlackScreenEvent.Set(); + } + } + + private void GUIGraphicsContext_OnVideoReceived() + { + if (GUIGraphicsContext.RenderBlackImage) + { + Log.Debug("ChannelNavigator.OnVideoReceived() {0}", _framesBeforeStopRenderBlackImage); + if (_framesBeforeStopRenderBlackImage > 0) + { + if (--_framesBeforeStopRenderBlackImage == 0) + { + GUIGraphicsContext.RenderBlackImage = false; + Log.Debug("ChannelNavigator.StopRenderBlackImage()"); + } + } + } + } + + #endregion + private TvControlServiceAgent _tvControlAgent; private TvControlServiceAgent TvControlAgent @@ -551,84 +606,101 @@ if (liveStream != null) { - bool resumeGraph = true; - g_Player.PauseGraph(); - g_Player.OnZapping(0x80); - - LiveStreamResult firstResult = LiveStreamResult.Succeeded; - LiveStreamResult result = LiveStreamResult.UnknownError; try { - // - // First try to re-tune the existing TV stream (staying on the same card). - // - result = this.TvControlAgent.TuneLiveStream(currentAndNext.Channel, ref liveStream); - if (result == LiveStreamResult.Succeeded) - { - SetCurrentAndNext(channel.ChannelType, currentAndNext); - _currentChannel = channel; + RenderBlackImage(); - string fileName; - int seekOffset; - GetPlayerFileNameAndOffset(liveStream, out fileName, out seekOffset); + bool resumeGraph = true; + g_Player.PauseGraph(); + g_Player.OnZapping(0x80); - g_Player.OnZapping(-1); - g_Player.SeekAbsolute(g_Player.Duration + seekOffset); - } - else + LiveStreamResult firstResult = LiveStreamResult.Succeeded; + LiveStreamResult result = LiveStreamResult.UnknownError; + try { - // Seems a re-tune has failed, so keep track of the channel that - // was already being streamed and stop the current stream. - Channel resumeChannel = _currentChannel; - g_Player.OnZapping(-1); - g_Player.ContinueGraph(); - resumeGraph = false; - SilentlyStopLiveStream(liveStream); - - // Now re-try the new channel with a new stream. - liveStream = null; - result = this.TvControlAgent.TuneLiveStream(channel, ref liveStream); + // + // First try to re-tune the existing TV stream (staying on the same card). + // + result = this.TvControlAgent.TuneLiveStream(currentAndNext.Channel, ref liveStream); if (result == LiveStreamResult.Succeeded) { - // Success! Let's show the new stream. - result = PlayLiveStream(liveStream); + SetCurrentAndNext(channel.ChannelType, currentAndNext); _currentChannel = channel; + + string fileName; + int seekOffset; + GetPlayerFileNameAndOffset(liveStream, out fileName, out seekOffset); + + g_Player.OnZapping(-1); + if (g_Player.Duration < 0.0) + { + result = LiveStreamResult.ChannelTuneFailed; + } + else + { + g_Player.SeekAbsolute(g_Player.Duration + seekOffset); + } } - else + + if (result != LiveStreamResult.Succeeded) { - // Still nothing :-( So keep track of the error-code and let's - // try to re-tune to the original channel. - firstResult = result; + // Seems a re-tune has failed, so keep track of the channel that + // was already being streamed and stop the current stream. + Channel resumeChannel = _currentChannel; + g_Player.OnZapping(-1); + g_Player.ContinueGraph(); + resumeGraph = false; + SilentlyStopLiveStream(liveStream); + + // Now re-try the new channel with a new stream. liveStream = null; - result = this.TvControlAgent.TuneLiveStream(resumeChannel, ref liveStream); + result = this.TvControlAgent.TuneLiveStream(channel, ref liveStream); if (result == LiveStreamResult.Succeeded) { + // Success! Let's show the new stream. result = PlayLiveStream(liveStream); - _currentChannel = resumeChannel; + _currentChannel = channel; } + else + { + // Still nothing :-( So keep track of the error-code and let's + // try to re-tune to the original channel. + firstResult = result; + liveStream = null; + result = this.TvControlAgent.TuneLiveStream(resumeChannel, ref liveStream); + if (result == LiveStreamResult.Succeeded) + { + result = PlayLiveStream(liveStream); + _currentChannel = resumeChannel; + } + } } } - } - catch - { - result = LiveStreamResult.UnknownError; - } - finally - { - if (resumeGraph) + catch { - g_Player.ContinueGraph(); + result = LiveStreamResult.UnknownError; } - } + finally + { + if (resumeGraph) + { + g_Player.ContinueGraph(); + } + } - if (result != LiveStreamResult.Succeeded) - { - SilentlyStopLiveStream(liveStream); - ShowLiveStreamError(result); + if (result != LiveStreamResult.Succeeded) + { + SilentlyStopLiveStream(liveStream); + ShowLiveStreamError(result); + } + else if (firstResult != LiveStreamResult.Succeeded) + { + ShowLiveStreamError(firstResult); + } } - else if (firstResult != LiveStreamResult.Succeeded) + finally { - ShowLiveStreamError(firstResult); + StopRenderBlackImage(); } } @@ -669,20 +741,31 @@ GetPlayerFileNameAndOffset(liveStream, out fileName, out seekOffset); RecordedBase.RememberActiveRecordingPosition(); - if (g_Player.Play(fileName, - liveStream.Channel.ChannelType == ChannelType.Television ? g_Player.MediaType.TV : g_Player.MediaType.Radio)) + for (; ; ) { - _liveStream = liveStream; - // TODO: check why this hangs with radio?? - if (liveStream.Channel.ChannelType == ChannelType.Television) + if (g_Player.Play(fileName, + liveStream.Channel.ChannelType == ChannelType.Television ? g_Player.MediaType.TV : g_Player.MediaType.Radio)) { - g_Player.SeekAbsolute(g_Player.Duration + seekOffset); + // TODO: check why this hangs with radio?? + if (liveStream.Channel.ChannelType == ChannelType.Television) + { + double duration = g_Player.Duration; + if (duration < 0.0) + { + g_Player.Stop(); + Thread.Sleep(20); + continue; + } + g_Player.SeekAbsolute(g_Player.Duration + seekOffset); + } + _liveStream = liveStream; } + else + { + result = LiveStreamResult.UnknownError; + } + break; } - else - { - result = LiveStreamResult.UnknownError; - } return result; } @@ -1056,6 +1139,10 @@ if (disposing) { // Managed resources + GUIGraphicsContext.OnVideoReceived -= GUIGraphicsContext_OnVideoReceived; + GUIGraphicsContext.OnBlackImageRendered -= GUIGraphicsContext_OnBlackImageRendered; + _waitForBlackScreenEvent.Close(); + _waitForBlackScreenEvent = null; if (_tvControlAgent != null) { _tvControlAgent.Dispose(); Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordMain.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordMain.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordMain.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -67,18 +67,19 @@ } } - internal static bool IsActiveRecording(GuideProgram guideProgram) + internal static bool IsActiveRecording(Guid channelId, GuideProgram guideProgram) { ActiveRecording activeRecording; - return IsActiveRecording(guideProgram, out activeRecording); + return IsActiveRecording(channelId, guideProgram, out activeRecording); } - internal static bool IsActiveRecording(GuideProgram guideProgram, out ActiveRecording activeRecording) + internal static bool IsActiveRecording(Guid channelId, GuideProgram guideProgram, out ActiveRecording activeRecording) { + Guid upcomingProgramId = guideProgram.GetUniqueUpcomingProgramId(channelId); + foreach (ActiveRecording recording in ActiveRecordings) { - if (recording.Program.GuideProgramId.HasValue - && recording.Program.GuideProgramId.Value == guideProgram.GuideProgramId) + if (recording.Program.UpcomingProgramId == upcomingProgramId) { activeRecording = recording; return true; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -41,6 +41,7 @@ using MediaPortal.Player; using MediaPortal.Configuration; using MediaPortal.Video.Database; +using Action = MediaPortal.GUI.Library.Action; using ForTheRecord.Entities; using ForTheRecord.ServiceAgents; @@ -1446,7 +1447,7 @@ } _currentChannel = channel; - _currentRecOrNotify = _currentProgram != null && ForTheRecordMain.IsActiveRecording(_currentProgram); + _currentRecOrNotify = _currentProgram != null && ForTheRecordMain.IsActiveRecording(_currentChannel.ChannelId, _currentProgram); } private void RenderSingleChannel(TvSchedulerServiceAgent tvSchedulerAgent, TvGuideServiceAgent tvGuideAgent, Channel channel) @@ -2883,7 +2884,7 @@ if (_currentProgram != null && _currentChannel != null) { - if (ForTheRecordMain.IsActiveRecording(_currentProgram)) + if (ForTheRecordMain.IsActiveRecording(_currentChannel.ChannelId, _currentProgram)) { dlg.AddLocalizedString(637); // Edit Recording } @@ -3078,7 +3079,7 @@ try { ActiveRecording activeRecording; - if (ForTheRecordMain.IsActiveRecording(_currentProgram, out activeRecording)) + if (ForTheRecordMain.IsActiveRecording(_currentChannel.ChannelId, _currentProgram, out activeRecording)) { Log.Info("TVGuide: clicked on a currently running recording"); GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU); @@ -4058,24 +4059,26 @@ private string GetChannelProgramIcon(Channel channel, Guid guideProgramId, out bool isRecording) { + Guid upcomingProgramId = UpcomingProgram.GetUniqueUpcomingProgramId(guideProgramId, channel.ChannelId); + isRecording = false; string recordIconImage = null; GuideUpcomingProgram upcoming = null; ScheduleType type = ScheduleType.Recording; - if (_model.UpcomingRecordingsById.ContainsKey(guideProgramId)) + if (_model.UpcomingRecordingsById.ContainsKey(upcomingProgramId)) { type = ScheduleType.Recording; - upcoming = _model.UpcomingRecordingsById[guideProgramId]; + upcoming = _model.UpcomingRecordingsById[upcomingProgramId]; } - else if (_model.UpcomingAlertsById.ContainsKey(guideProgramId)) + else if (_model.UpcomingAlertsById.ContainsKey(upcomingProgramId)) { type = ScheduleType.Alert; - upcoming = _model.UpcomingAlertsById[guideProgramId]; + upcoming = _model.UpcomingAlertsById[upcomingProgramId]; } - else if (_model.UpcomingSuggestionsById.ContainsKey(guideProgramId)) + else if (_model.UpcomingSuggestionsById.ContainsKey(upcomingProgramId)) { type = ScheduleType.Suggestion; - upcoming = _model.UpcomingSuggestionsById[guideProgramId]; + upcoming = _model.UpcomingSuggestionsById[upcomingProgramId]; } if (upcoming != null && upcoming.ChannelId == channel.ChannelId) Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -37,6 +37,7 @@ using MediaPortal.Threading; using MediaPortal.Util; using MediaPortal.Configuration; +using Action = MediaPortal.GUI.Library.Action; using ForTheRecord.Entities; using ForTheRecord.ServiceAgents; @@ -427,16 +428,15 @@ item.Label = String.Format("[{0}] {1}", program.Channel.DisplayName, title); logoImagePath = "defaultVideoBig.png"; } - if (_model.AllUpcomingGuidePrograms.ContainsKey(program.GuideProgramId)) + + item.PinImage = null; + Guid upcomingProgramId = program.GetUniqueUpcomingProgramId(); + if (_model.AllUpcomingGuidePrograms.ContainsKey(upcomingProgramId)) { - GuideUpcomingProgram programInfo = _model.AllUpcomingGuidePrograms[program.GuideProgramId]; + GuideUpcomingProgram programInfo = _model.AllUpcomingGuidePrograms[upcomingProgramId]; item.PinImage = Utility.GetIconImageFileName(programInfo.Type, programInfo.IsPartOfSeries, - programInfo.CancellationReason, programInfo.UpcomingRecording); + programInfo.CancellationReason, programInfo.UpcomingRecording); } - else - { - item.PinImage = null; - } item.ThumbnailImage = logoImagePath; item.IconImageBig = logoImagePath; item.IconImage = logoImagePath; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -30,6 +30,7 @@ using MediaPortal.Player; using TvLibrary.Interfaces; using TvLibrary.Implementations.DVB; +using Action = MediaPortal.GUI.Library.Action; using ForTheRecord.ServiceAgents; using ForTheRecord.ServiceContracts; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/MiniGuide.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/MiniGuide.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/MiniGuide.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -36,6 +36,7 @@ using MediaPortal.GUI.Library; using MediaPortal.Player; using MediaPortal.Util; +using Action = MediaPortal.GUI.Library.Action; using ForTheRecord.Entities; using ForTheRecord.ServiceAgents; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/PostBuild.cmd =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/PostBuild.cmd 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/PostBuild.cmd 2010-05-01 19:38:16 UTC (rev 3562) @@ -1,13 +1,15 @@ if %3 == Release goto reallyEnd set mpDir="C:\Program Files\Team MediaPortal\MediaPortal" + set progDir="C:\ProgramData\Team MediaPortal\MediaPortal" IF NOT EXIST %mpDir% goto end copy %1ForTheRecord.ServiceContracts.dll %mpDir%\plugins\Windows copy %1ForTheRecord.ServiceAgents.dll %mpDir%\plugins\Windows copy %1ForTheRecord.Entities.dll %mpDir%\plugins\Windows copy %1ForTheRecord.UI.Process.dll %mpDir%\plugins\Windows copy %1ForTheRecord.UI.MediaPortal.* %mpDir%\plugins\Windows - xcopy /S /Y /I %1..\..\skin %mpDir%\skin - xcopy /S /Y /I %1..\..\language %mpDir%\language + copy %1ForTheRecord.Client.Common.* %mpDir%\plugins\Windows + xcopy /S /Y /I %1..\..\skin %progDir%\skin + xcopy /S /Y /I %1..\..\language %progDir%\language :end set mpDir="C:\Program Files (x86)\Team MediaPortal\MediaPortal" IF NOT EXIST %mpDir% goto reallyEnd @@ -16,8 +18,9 @@ copy %1ForTheRecord.Entities.dll %mpDir%\plugins\Windows copy %1ForTheRecord.UI.Process.dll %mpDir%\plugins\Windows copy %1ForTheRecord.UI.MediaPortal.* %mpDir%\plugins\Windows - xcopy /S /Y /I %1..\..\skin %mpDir%\skin - xcopy /S /Y /I %1..\..\language %mpDir%\language + copy %1ForTheRecord.Client.Common.* %mpDir%\plugins\Windows + xcopy /S /Y /I %1..\..\skin %progDir%\skin + xcopy /S /Y /I %1..\..\language %progDir%\language :reallyEnd REM IF EXIST "C:\ProgramData\Team MediaPortal\MediaPortal\Cache" DEL /S /Q "C:\ProgramData\Team MediaPortal\MediaPortal\Cache" REM IF EXIST "C:\Documents And Settings\All Users\Application Data\Team Mediaportal\Mediaportal\Cache" DEL /S /Q "C:\Documents And Settings\All Users\Application Data\Team Mediaportal\Mediaportal\Cache" Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/AssemblyInfo.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/AssemblyInfo.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -10,7 +10,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ForTheRecord.UI.MediaPortal")] -[assembly: AssemblyCopyright("Copyright © ForTheRecord 2007-2009")] +[assembly: AssemblyCopyright("Copyright © ForTheRecord 2007-2010")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -37,6 +37,7 @@ using MediaPortal.Threading; using MediaPortal.Util; using MediaPortal.Configuration; +using Action = MediaPortal.GUI.Library.Action; using ForTheRecord.Entities; using ForTheRecord.ServiceAgents; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVZapOSD.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVZapOSD.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVZapOSD.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -32,6 +32,7 @@ using MediaPortal.GUI.Library; using MediaPortal.Player; using MediaPortal.Util; +using Action = MediaPortal.GUI.Library.Action; using ForTheRecord.ServiceAgents; using ForTheRecord.Entities; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvCropSettings.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvCropSettings.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvCropSettings.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -32,6 +32,7 @@ using MediaPortal.GUI.Library; using MediaPortal.Player; using MediaPortal.Util; +using Action = MediaPortal.GUI.Library.Action; #endregion namespace ForTheRecord.UI.MediaPortal Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -40,6 +40,7 @@ using ForTheRecord.Entities; using ForTheRecord.ServiceAgents; using ForTheRecord.UI.Process.Guide; +using Action = MediaPortal.GUI.Library.Action; #endregion namespace ForTheRecord.UI.MediaPortal @@ -819,7 +820,7 @@ { ActiveRecording activeRecording; if (currentProgram == null - || !ForTheRecordMain.IsActiveRecording(currentProgram, out activeRecording)) + || !ForTheRecordMain.IsActiveRecording(currentChannel.ChannelId, currentProgram, out activeRecording)) { ForTheRecordMain.IsChannelRecording(currentChannel, out activeRecording); } Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideDialog.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideDialog.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideDialog.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -38,6 +38,7 @@ using MediaPortal.Util; using MediaPortal.Dialogs; using MediaPortal.Player; +using Action = MediaPortal.GUI.Library.Action; #endregion namespace ForTheRecord.UI.MediaPortal Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -173,18 +173,18 @@ } } - internal static bool IsActiveRecording(GuideProgram guideProgram) + internal static bool IsActiveRecording(Guid channelId, GuideProgram guideProgram) { ActiveRecording activeRecording; - return IsActiveRecording(guideProgram, out activeRecording); + return IsActiveRecording(channelId, guideProgram, out activeRecording); } - internal static bool IsActiveRecording(GuideProgram guideProgram, out ActiveRecording activeRecording) + internal static bool IsActiveRecording(Guid channelId, GuideProgram guideProgram, out ActiveRecording activeRecording) { + Guid upcomingProgramId = guideProgram.GetUniqueUpcomingProgramId(channelId); foreach (ActiveRecording recording in ActiveRecordings) { - if (recording.Program.GuideProgramId.HasValue - && recording.Program.GuideProgramId.Value == guideProgram.GuideProgramId) + if (recording.Program.UpcomingProgramId == upcomingProgramId) { activeRecording = recording; return true; @@ -346,6 +346,7 @@ private void OnPlayRecordingBackStopped(global::MediaPortal.Player.g_Player.MediaType type, int stoptime, string filename) { + GUIGraphicsContext.RenderBlackImage = false; if (type == g_Player.MediaType.TV || type == g_Player.MediaType.Radio) { @@ -355,6 +356,7 @@ private void OnPlayRecordingBackEnded(global::MediaPortal.Player.g_Player.MediaType type, string filename) { + GUIGraphicsContext.RenderBlackImage = false; if ((type == g_Player.MediaType.TV || type == g_Player.MediaType.Radio) && ForTheRecordMain.Navigator.IsLiveStreamOn) { Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvOSD.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvOSD.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvOSD.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -32,6 +32,7 @@ using MediaPortal.GUI.Library; using MediaPortal.Player; using MediaPortal.Util; +using Action = MediaPortal.GUI.Library.Action; using ForTheRecord.Entities; using ForTheRecord.ServiceAgents; @@ -1363,7 +1364,7 @@ { imgRecIcon.Visible = (!g_Player.IsTVRecording && prog != null - && ForTheRecordMain.IsActiveRecording(prog)); + && ForTheRecordMain.IsActiveRecording(_channelId, prog)); } if (prog != null && !g_Player.IsTVRecording) Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvProgramInfo.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvProgramInfo.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvProgramInfo.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -254,7 +254,7 @@ Schedule schedule = null; UpcomingRecording upcomingRecording; - if (GetUpcomingRecordingAndSchedule(_currentProgram, out upcomingRecording, out schedule) + if (GetUpcomingRecordingAndSchedule(_channel.ChannelId, _currentProgram, out upcomingRecording, out schedule) && !upcomingRecording.Program.IsCancelled) { bool isRecordOnce = (schedule.Rules.FindRuleByType(ScheduleRuleType.OnDate) != null); @@ -366,7 +366,7 @@ { UpcomingRecording upcomingRecording; Schedule schedule; - if (GetUpcomingRecordingAndSchedule(_currentProgram, out upcomingRecording, out schedule)) + if (GetUpcomingRecordingAndSchedule(_channel.ChannelId, _currentProgram, out upcomingRecording, out schedule)) { ScheduleRule newEpisodesRule = FindNewEpisodesOnlyRule(schedule); if (newEpisodesRule != null) @@ -388,7 +388,7 @@ UpcomingRecording upcomingRecording; Schedule schedule; - if (GetUpcomingRecordingAndSchedule(_currentProgram, out upcomingRecording, out schedule)) + if (GetUpcomingRecordingAndSchedule(_channel.ChannelId, _currentProgram, out upcomingRecording, out schedule)) { GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); if (dlg != null) @@ -427,7 +427,7 @@ using (TvSchedulerServiceAgent tvSchedulerAgent = new TvSchedulerServiceAgent()) { UpcomingRecording upcomingRecording; - if (HasUpcomingRecording(guideProgram, out upcomingRecording)) + if (HasUpcomingRecording(channel.ChannelId, guideProgram, out upcomingRecording)) { if (upcomingRecording.Program.IsCancelled) { @@ -504,7 +504,7 @@ } else { - if (ForTheRecordMain.IsActiveRecording(guideProgram)) + if (ForTheRecordMain.IsActiveRecording(_channel.ChannelId, guideProgram)) { GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); if (dlgYesNo != null) @@ -602,7 +602,7 @@ { UpcomingRecording upcomingRecording; Schedule schedule; - if (GetUpcomingRecordingAndSchedule(_currentProgram, out upcomingRecording, out schedule)) + if (GetUpcomingRecordingAndSchedule(_channel.ChannelId, _currentProgram, out upcomingRecording, out schedule)) { int? newSeconds; if (GetPrePostRecordValue(Utility.GetLocalizedText(TextId.PreRecord), schedule.PreRecordSeconds, out newSeconds)) @@ -618,7 +618,7 @@ { UpcomingRecording upcomingRecording; Schedule schedule; - if (GetUpcomingRecordingAndSchedule(_currentProgram, out upcomingRecording, out schedule)) + if (GetUpcomingRecordingAndSchedule(_channel.ChannelId, _currentProgram, out upcomingRecording, out schedule)) { int? newSeconds; if (GetPrePostRecordValue(Utility.GetLocalizedText(TextId.PostRecord), schedule.PostRecordSeconds, out newSeconds)) @@ -685,7 +685,7 @@ { UpcomingRecording upcomingRecording; Schedule schedule; - if (GetUpcomingRecordingAndSchedule(_currentProgram, out upcomingRecording, out schedule)) + if (GetUpcomingRecordingAndSchedule(_channel.ChannelId, _currentProgram, out upcomingRecording, out schedule)) { KeepUntilMode newMode; int? newValue; @@ -832,15 +832,17 @@ Log.Warn("TVProgrammInfo.item_OnItemSelected: params where NULL!"); } - internal static bool HasUpcomingRecording(GuideProgram program, out UpcomingRecording upcomingRecording) + internal static bool HasUpcomingRecording(Guid channelId, GuideProgram program, out UpcomingRecording upcomingRecording) { using (TvControlServiceAgent tvControlAgent = new TvControlServiceAgent()) { upcomingRecording = null; + Guid upcomingProgramId = program.GetUniqueUpcomingProgramId(channelId); + UpcomingRecording[] upcomingRecordings = tvControlAgent.GetAllUpcomingRecordings(UpcomingRecordingsFilter.All, true); foreach (UpcomingRecording recording in upcomingRecordings) { - if (recording.Program.GuideProgramId == program.GuideProgramId) + if (recording.Program.UpcomingProgramId == upcomingProgramId) { upcomingRecording = recording; return true; @@ -850,10 +852,10 @@ } } - internal static bool GetUpcomingRecordingAndSchedule(GuideProgram program, out UpcomingRecording upcomingRecording, out Schedule schedule) + internal static bool GetUpcomingRecordingAndSchedule(Guid channelId, GuideProgram program, out UpcomingRecording upcomingRecording, out Schedule schedule) { schedule = null; - if (HasUpcomingRecording(program, out upcomingRecording)) + if (HasUpcomingRecording(channelId, program, out upcomingRecording)) { using (TvSchedulerServiceAgent tvSchedulerAgent = new TvSchedulerServiceAgent()) { Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvTeletext.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvTeletext.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvTeletext.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -25,6 +25,7 @@ using System; using MediaPortal.GUI.Library; +using Action = MediaPortal.GUI.Library.Action; namespace ForTheRecord.UI.MediaPortal { Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvTeletextBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvTeletextBase.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvTeletextBase.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -31,6 +31,7 @@ using MediaPortal.Configuration; using MediaPortal.GUI.Library; using MediaPortal.Profile; +using Action = MediaPortal.GUI.Library.Action; using ForTheRecord.ServiceAgents; using ForTheRecord.ServiceContracts; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -36,6 +36,7 @@ using MediaPortal.Threading; using MediaPortal.Util; using MediaPortal.Configuration; +using Action = MediaPortal.GUI.Library.Action; using ForTheRecord.Entities; using ForTheRecord.ServiceAgents; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ChannelProgramView.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ChannelProgramView.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ChannelProgramView.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -29,10 +29,12 @@ public class ChannelProgramView { private ChannelProgram _program; + private Guid _upcomingProgramId; public ChannelProgramView(ChannelProgram program) { _program = program; + _upcomingProgramId = program.GetUniqueUpcomingProgramId(); } public ChannelProgram Program @@ -40,6 +42,16 @@ get { return _program; } } + public Guid UpcomingProgramId + { + get { return _upcomingProgramId; } + } + + public Guid ChannelId + { + get { return _program.Channel.ChannelId; } + } + public string ChannelName { get { return _program.Channel.DisplayName; } Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ChannelProgramsList.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ChannelProgramsList.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ChannelProgramsList.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramView.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramView.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramView.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramsList.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramsList.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramsList.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleController.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleController.cs 2010-04-30 17:18:30 UTC (rev 3561) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleController.cs 2010-05-01 19:38:16 UTC (rev 3562) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2009 ForTheRecord + * Copyright (C) 2007-2010 ForTheRecord * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -468,19 +468,24 @@ private static Operator GetNextOperator(string expression, int startIndex, out int operatorIndex, out int nextIndex) { - int orOperatorIndex = expression.IndexOf(" OR ", startIndex); - int andOperatorIndex = expression.IndexOf(" AND ", startIndex); - int notOperatorIndex = expression.IndexOf("NOT ", startIndex); - if (notOperatorIndex != startIndex) + string orOperator = " OR "; + string andOperator = " AND "; + string notOperator = "NOT "; + + int orOperatorIndex = expression.IndexOf(orOperator, startIndex); + int andOperatorIndex = expression.IndexOf(andOperator, startIndex); + int notOperatorIndex = expression.IndexOf(notOperator, startIndex); + if (notOperatorIndex > startIndex) { - notOperatorIndex = expression.IndexOf(" NOT ", startIndex); + notOperator = " NOT "; + notOperatorIndex = expression.IndexOf(notOperator, startIndex); } if (orOperatorIndex >= 0 && (andOperatorIndex < 0 || orOperatorIndex < andOperatorIndex) && (notOperatorIndex < 0 || orOperatorIndex < notOperatorIndex)) { ... [truncated message content] |
From: <do...@us...> - 2010-05-31 15:44:34
|
Revision: 3610 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3610&view=rev Author: dot-i Date: 2010-05-31 15:44:28 +0000 (Mon, 31 May 2010) Log Message: ----------- Updated to 1.5.0.1 release. Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Client.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2010-05-27 11:26:35 UTC (rev 3609) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2010-05-31 15:44:28 UTC (rev 3610) @@ -423,7 +423,10 @@ if (_zapGroup != null && _zapGroup != _currentChannelGroup) { // Change current group (and possibly zap to the first channel of the group) - _navigatorChannels[_zapGroup.ChannelType].PreviousChannelGroup = _currentChannelGroup; + if (_currentChannelGroup != null) + { + _navigatorChannels[_currentChannelGroup.ChannelType].PreviousChannelGroup = _currentChannelGroup; + } _currentChannelGroup = _zapGroup; RefreshChannelsInGroup(_zapGroup.ChannelType); if (_zapChannel == null @@ -442,7 +445,10 @@ { Channel prevChannel = _currentChannel; TuneLiveStream(zappingTo); - _navigatorChannels[zappingTo.ChannelType].PreviousChannel = prevChannel; + if (prevChannel != null) + { + _navigatorChannels[prevChannel.ChannelType].PreviousChannel = prevChannel; + } _navigatorChannels[zappingTo.ChannelType].LastChannel = _currentChannel; _navigatorChannels[zappingTo.ChannelType].LastChannelGroup = _currentChannelGroup; } @@ -579,8 +585,14 @@ Channel prevChannel = _currentChannel; ChannelGroup prevGroup = _currentChannelGroup; ZapToChannel(_navigatorChannels[channelType].PreviousChannelGroup, _navigatorChannels[channelType].PreviousChannel, false); - _navigatorChannels[channelType].PreviousChannel = prevChannel; - _navigatorChannels[channelType].PreviousChannelGroup = prevGroup; + if (prevChannel != null) + { + _navigatorChannels[prevChannel.ChannelType].PreviousChannel = prevChannel; + } + if (prevGroup != null) + { + _navigatorChannels[prevGroup.ChannelType].PreviousChannelGroup = prevGroup; + } return true; } return false; @@ -710,17 +722,21 @@ LiveStreamResult result = this.TvControlAgent.TuneLiveStream(currentAndNext.Channel, ref liveStream); if (result == LiveStreamResult.Succeeded) { - SetCurrentAndNext(currentAndNext.Channel.ChannelType, currentAndNext); - _currentChannel = channel; - result = PlayLiveStream(liveStream); if (result == LiveStreamResult.Succeeded) { + SetCurrentAndNext(currentAndNext.Channel.ChannelType, currentAndNext); + _currentChannel = channel; + if (_autoFullScreen) { g_Player.ShowFullScreenWindow(); } } + else + { + AsyncStopLiveStream(); + } } else { @@ -787,6 +803,11 @@ { fileName = liveStream.TimeshiftFile; seekOffset = 0; + DateTime maxWaitTime = DateTime.Now.AddSeconds(5); + while (!System.IO.File.Exists(fileName)) + { + Thread.Sleep(100); + } } } @@ -842,10 +863,12 @@ { lock (_asyncStopLiveStreamLock) { - ChannelType channelType = _liveStream.Channel.ChannelType; _pendingStopLiveStream = _liveStream; _liveStream = null; - _navigatorChannels[channelType].PreviousChannel = _currentChannel; + if (_currentChannel != null) + { + _navigatorChannels[_currentChannel.ChannelType].PreviousChannel = _currentChannel; + } _asyncStopLiveStreamThread = new Thread(new ThreadStart(AsyncStopLiveStreamThreadMain)); _asyncStopLiveStreamThread.Start(); } @@ -860,10 +883,12 @@ StopPendingLiveStream(); if (_liveStream != null) { - ChannelType channelType = _liveStream.Channel.ChannelType; this.TvControlAgent.StopLiveStream(_liveStream); _liveStream = null; - _navigatorChannels[channelType].PreviousChannel = _currentChannel; + if (_currentChannel != null) + { + _navigatorChannels[_currentChannel.ChannelType].PreviousChannel = _currentChannel; + } } SetCurrentAndNext(ChannelType.Television, null); SetCurrentAndNext(ChannelType.Radio, null); @@ -1052,9 +1077,12 @@ break; } } - _navigatorChannels[channelType].PreviousChannelGroup = _currentChannelGroup; + if (_currentChannelGroup != null) + { + _navigatorChannels[_currentChannelGroup.ChannelType].PreviousChannelGroup = _currentChannelGroup; + } - _navigatorChannels[channelType].PreviousChannelGroup = null; + _navigatorChannels[channelType].PreviousChannel = null; foreach (Channel channel in _navigatorChannels[channelType].Channels) { if (channel.DisplayName == channelName) Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs 2010-05-27 11:26:35 UTC (rev 3609) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs 2010-05-31 15:44:28 UTC (rev 3610) @@ -693,7 +693,9 @@ if (_tvOnOffButton != null && _tvOnOffButton.Selected != ForTheRecordMain.Navigator.IsLiveStreamOn) { - _tvOnOffButton.Selected = ForTheRecordMain.Navigator.IsLiveStreamOn; + _tvOnOffButton.Selected = ForTheRecordMain.Navigator.IsLiveStreamOn + && ForTheRecordMain.Navigator.CurrentChannel != null + && ForTheRecordMain.Navigator.CurrentChannel.ChannelType == _channelType; } base.Process(); @@ -718,14 +720,27 @@ } else if (control == _channelButton) { + if (ForTheRecordMain.Navigator.IsLiveStreamOn + && ForTheRecordMain.Navigator.CurrentChannel != null + && ForTheRecordMain.Navigator.CurrentChannel.ChannelType != _channelType) + { + g_Player.Stop(); + ForTheRecordMain.Navigator.StopLiveStream(); + } OnSelectChannel(); } else if (control == _tvOnOffButton) - { + { if (ForTheRecordMain.Navigator.IsLiveStreamOn) { + bool turnOnLiveStream = (ForTheRecordMain.Navigator.CurrentChannel == null + || ForTheRecordMain.Navigator.CurrentChannel.ChannelType != _channelType); g_Player.Stop(); ForTheRecordMain.Navigator.StopLiveStream(); + if (turnOnLiveStream) + { + System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(AsyncTurnOnStream)); + } } else { @@ -747,10 +762,28 @@ base.OnClicked(controlId, control, actionType); } + private void AsyncTurnOnStream(object state) + { + DateTime maxWaitTime = DateTime.Now.AddSeconds(1); + while (g_Player.Playing + && DateTime.Now < maxWaitTime) + { + System.Threading.Thread.Sleep(100); + } + GUIWindowManager.SendThreadCallbackAndWait(DoTurnOnStream, 0, 0, null); + } + + private int DoTurnOnStream(int param1, int param2, object data) + { + TurnOnStream(); + return 0; + } + private void TurnOnStream() { Channel previousChannel = ForTheRecordMain.Navigator.GetPreviousChannel(_channelType); - if (previousChannel != null) + if (previousChannel != null + && previousChannel.ChannelType == _channelType) { ForTheRecordMain.Navigator.ZapToChannel(previousChannel, false); } Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Client.Common.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2010-08-31 07:22:42
|
Revision: 3772 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3772&view=rev Author: dot-i Date: 2010-08-31 07:22:36 +0000 (Tue, 31 Aug 2010) Log Message: ----------- Updated to 1.5.0.2 release. Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2010-08-26 10:04:14 UTC (rev 3771) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2010-08-31 07:22:36 UTC (rev 3772) @@ -78,10 +78,10 @@ public ChannelNavigator() { + _navigatorChannels[ChannelType.Radio] = new NavigatorChannels(); + RefreshChannelGroups(ChannelType.Radio); _navigatorChannels[ChannelType.Television] = new NavigatorChannels(); RefreshChannelGroups(ChannelType.Television); - _navigatorChannels[ChannelType.Radio] = new NavigatorChannels(); - RefreshChannelGroups(ChannelType.Radio); _waitForBlackScreenEvent = new ManualResetEvent(false); GUIGraphicsContext.OnBlackImageRendered += GUIGraphicsContext_OnBlackImageRendered; GUIGraphicsContext.OnVideoReceived += GUIGraphicsContext_OnVideoReceived; @@ -444,10 +444,12 @@ if (zappingTo != null) { Channel prevChannel = _currentChannel; + ChannelGroup prevGroup = _currentChannelGroup; TuneLiveStream(zappingTo); if (prevChannel != null) { _navigatorChannels[prevChannel.ChannelType].PreviousChannel = prevChannel; + _navigatorChannels[prevGroup.ChannelType].PreviousChannelGroup = prevGroup; } _navigatorChannels[zappingTo.ChannelType].LastChannel = _currentChannel; _navigatorChannels[zappingTo.ChannelType].LastChannelGroup = _currentChannelGroup; @@ -803,12 +805,12 @@ { fileName = liveStream.TimeshiftFile; seekOffset = 0; - DateTime maxWaitTime = DateTime.Now.AddSeconds(5); - while (!System.IO.File.Exists(fileName)) - { - Thread.Sleep(100); - } } + else + { + // Small delay to allow RTSP stream to start up. + Thread.Sleep(100); + } } private void SetCurrentAndNext(ChannelType channelType, CurrentAndNextProgram currentAndNext) @@ -1057,30 +1059,28 @@ { Log.Info("ChannelNavigator::LoadSettings()"); _autoFullScreen = xmlreader.GetValueAsBool("mytv", "autofullscreen", true); - string channelName = xmlreader.GetValueAsString("mytv", "channel", String.Empty); _zapDelayMs = 1000 * xmlreader.GetValueAsInt("movieplayer", "zapdelay", 2); - - LoadGroupAndChannelSettings(xmlreader, ChannelType.Radio, "myradio", channelName); - LoadGroupAndChannelSettings(xmlreader, ChannelType.Television, "mytv", channelName); + LoadGroupAndChannelSettings(xmlreader, ChannelType.Radio, "myradio"); + LoadGroupAndChannelSettings(xmlreader, ChannelType.Television, "mytv"); } private void LoadGroupAndChannelSettings(global::MediaPortal.Profile.Settings xmlreader, - ChannelType channelType, string section, string channelName) + ChannelType channelType, string section) { + string channelName = xmlreader.GetValueAsString(section, "channel", String.Empty); + string groupname = xmlreader.GetValueAsString(section, "group", Utility.GetLocalizedText(TextId.AllChannels)); foreach (ChannelGroup group in _navigatorChannels[channelType].Groups) { if (group.GroupName == groupname) { + _navigatorChannels[channelType].PreviousChannelGroup = group; _currentChannelGroup = group; RefreshChannelsInGroup(channelType); break; } } - if (_currentChannelGroup != null) - { - _navigatorChannels[_currentChannelGroup.ChannelType].PreviousChannelGroup = _currentChannelGroup; - } + _navigatorChannels[channelType].LastChannelGroup = _navigatorChannels[channelType].PreviousChannelGroup; _navigatorChannels[channelType].PreviousChannel = null; foreach (Channel channel in _navigatorChannels[channelType].Channels) @@ -1091,6 +1091,7 @@ break; } } + _navigatorChannels[channelType].LastChannel = _navigatorChannels[channelType].PreviousChannel; } public void SaveSettings(global::MediaPortal.Profile.Settings xmlwriter) Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs 2010-08-26 10:04:14 UTC (rev 3771) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs 2010-08-31 07:22:36 UTC (rev 3772) @@ -92,6 +92,7 @@ private bool _sortAscending = true; private int _selectedItemIndex; + private int _selectedParentItemIndex; private object _currentGroupId; private ChannelType _channelType; @@ -423,7 +424,7 @@ { case Action.ActionType.ACTION_DELETE_ITEM: { - int item = GetSelectedItemNo(); + int item = GetSelectedItemIndex(); if (item >= 0) OnDeleteRecording(item); UpdateProperties(); @@ -442,6 +443,7 @@ { _currentGroupId = null; LoadDirectory(false); + SelectItemByIndex(ref _selectedParentItemIndex); return; } } @@ -454,7 +456,7 @@ protected override void OnPageDestroy(int newWindowId) { - _selectedItemIndex = GetSelectedItemNo(); + _selectedItemIndex = GetSelectedItemIndex(); SaveSettings(); if (_tvSchedulerAgent != null) { @@ -497,13 +499,8 @@ LoadSettings(); LoadDirectory(true); + SelectItemByIndex(ref _selectedItemIndex); - while (_selectedItemIndex >= GetItemCount() && _selectedItemIndex > 0) - { - _selectedItemIndex--; - } - GUIControl.SelectItemControl(GetID, _facadeView.GetID, _selectedItemIndex); - _sortByButton.SortChanged += new SortEventHandler(SortChanged); } } @@ -647,7 +644,7 @@ protected override void OnShowContextMenu() { - int itemIndex = GetSelectedItemNo(); + int itemIndex = GetSelectedItemIndex(); GUIListItem item = GetItem(itemIndex); if (item == null || item.IsFolder) @@ -726,6 +723,7 @@ List<GUIListItem> itemlist = new List<GUIListItem>(); + bool isSubDirectory = false; int groupIndex = 0; foreach (RecordingGroup recordingGroup in _model.RecordingGroups) { @@ -751,6 +749,7 @@ Utils.SetDefaultIcons(item); item.ThumbnailImage = item.IconImageBig; + isSubDirectory = true; itemlist.Add(item); } if (recordings != null) @@ -820,7 +819,7 @@ Log.Error("TvRecorded: Error adding recordings to list - {0}", ex2.Message); } - string strObjects = string.Format("{0} {1}", itemlist.Count, Utility.GetLocalizedText(TextId.RecordingsListItemsSuffix)); + string strObjects = string.Format("{0}", itemlist.Count - (isSubDirectory ? 1 : 0)); GUIPropertyManager.SetProperty("#itemcount", strObjects); OnSort(); @@ -971,6 +970,8 @@ if (pItem.Label == _parentDirectoryLabel) { _currentGroupId = null; + LoadDirectory(false); + SelectItemByIndex(ref _selectedParentItemIndex); } else { @@ -990,8 +991,9 @@ _currentGroupId = EnsureCategoryName(recordingGroup.Category); break; } + _selectedParentItemIndex = GetSelectedItemIndex(); + LoadDirectory(false); } - LoadDirectory(false); return false; } @@ -1009,7 +1011,7 @@ private void OnDeleteRecording(int itemIndex) { - _selectedItemIndex = GetSelectedItemNo(); + _selectedItemIndex = GetSelectedItemIndex(); GUIListItem item = GetItem(itemIndex); if (item != null && !item.IsFolder) @@ -1032,11 +1034,7 @@ TvControlAgent.DeleteRecording(rec.RecordingFileName, true); LoadDirectory(true); - while (_selectedItemIndex >= GetItemCount() && _selectedItemIndex > 0) - { - _selectedItemIndex--; - } - GUIControl.SelectItemControl(GetID, _facadeView.GetID, _selectedItemIndex); + SelectItemByIndex(ref _selectedItemIndex); } } } @@ -1047,7 +1045,7 @@ try { RecordingSummary rec; - GUIListItem pItem = GetItem(GetSelectedItemNo()); + GUIListItem pItem = GetItem(GetSelectedItemIndex()); if (pItem == null) { GUIPropertyManager.SetProperty("#selectedthumb", String.Empty); @@ -1078,6 +1076,7 @@ if (rec == null) { + Utility.ClearProperty(guiPropertyPrefix + ".RecordedTV.Channel"); Utility.ClearProperty(guiPropertyPrefix + ".RecordedTV.Title"); Utility.ClearProperty(guiPropertyPrefix + ".RecordedTV.Genre"); Utility.ClearProperty(guiPropertyPrefix + ".RecordedTV.Time"); @@ -1093,6 +1092,7 @@ rec.ProgramStartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), rec.ProgramStopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); + GUIPropertyManager.SetProperty(guiPropertyPrefix + ".RecordedTV.Channel", rec.ChannelDisplayName); GUIPropertyManager.SetProperty(guiPropertyPrefix + ".RecordedTV.Title", rec.Title); GUIPropertyManager.SetProperty(guiPropertyPrefix + ".RecordedTV.Genre", rec.Category); GUIPropertyManager.SetProperty(guiPropertyPrefix + ".RecordedTV.Time", strTime); @@ -1137,7 +1137,7 @@ return _facadeView[iItem]; } - private int GetSelectedItemNo() + private int GetSelectedItemIndex() { if (_facadeView.Count > 0) { @@ -1149,6 +1149,15 @@ } } + private void SelectItemByIndex(ref int index) + { + while (index >= GetItemCount() && index > 0) + { + index--; + } + GUIControl.SelectItemControl(GetID, _facadeView.GetID, index); + } + private int GetItemCount() { return _facadeView.Count; Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2010-11-28 12:47:47
|
Revision: 3984 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3984&view=rev Author: dot-i Date: 2010-11-28 12:47:40 +0000 (Sun, 28 Nov 2010) Log Message: ----------- Updated to 1.5.0.3 release. Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideModel.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Client.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2010-11-27 16:22:51 UTC (rev 3983) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2010-11-28 12:47:40 UTC (rev 3984) @@ -25,6 +25,7 @@ using System.Threading; using System.Diagnostics; using System.Globalization; +using System.Runtime.InteropServices; using TvLibrary.Interfaces; using TvEngine.Events; @@ -54,6 +55,7 @@ _suggestedBaseFileName = suggestedBaseFileName; _recordOnCard = recordOnCard; _channel = channel; + SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS | EXECUTION_STATE.ES_SYSTEM_REQUIRED | EXECUTION_STATE.ES_AWAYMODE_REQUIRED); } #region Overrides @@ -69,6 +71,12 @@ private User _tve3User; private string _tve3RecordingFileName; + protected override void OnThreadEnding() + { + base.OnThreadEnding(); + SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS); + } + protected override bool OnPrepareRecording(RecorderTunerCallbackServiceAgent callbackAgent, ref string errorMessage) { DeleteAllMediaPortalSchedules(); @@ -291,5 +299,21 @@ } #endregion + + #region P/Invoke + + [FlagsAttribute] + private enum EXECUTION_STATE : uint + { + ES_SYSTEM_REQUIRED = 0x00000001, + ES_DISPLAY_REQUIRED = 0x00000002, + ES_AWAYMODE_REQUIRED = 0x00000040, + ES_CONTINUOUS = 0x80000000 + } + + [DllImport("Kernel32.DLL", CharSet = CharSet.Auto, SetLastError = true)] + private extern static EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE state); + + #endregion } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs 2010-11-27 16:22:51 UTC (rev 3983) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs 2010-11-28 12:47:40 UTC (rev 3984) @@ -88,8 +88,7 @@ HORZ_SCROLLBAR = 28, VERT_SCROLLBAR = 29, LABEL_TIME1 = 40, // first and template - IMG_CHAN1 = 50, - IMG_CHAN1_LABEL = 70, + IMG_CHAN1 = 70, IMG_TIME1 = 90, // first and template IMG_REC_PIN = 31, SINGLE_CHANNEL_LABEL = 32, Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideController.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideController.cs 2010-11-27 16:22:51 UTC (rev 3983) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideController.cs 2010-11-28 12:47:40 UTC (rev 3984) @@ -39,7 +39,13 @@ public void Initialize(ITvSchedulerService tvSchedulerAgent, ChannelType channelType, int epgHours, string allChannelsGroupName) { + Initialize(tvSchedulerAgent, channelType, epgHours, 0, allChannelsGroupName); + } + + public void Initialize(ITvSchedulerService tvSchedulerAgent, ChannelType channelType, int epgHours, int epgHoursOffset, string allChannelsGroupName) + { _model.EpgHours = epgHours; + _model.EpgHoursOffset = epgHoursOffset; _model.AllChannelsGroupName = allChannelsGroupName; ChangeChannelType(tvSchedulerAgent, channelType); } @@ -86,6 +92,10 @@ DateTime guideDate = DateTime.Now; int hours = (int)Math.Floor((decimal)guideDate.TimeOfDay.TotalHours); _model.GuideDateTime = guideDate.Date.Add(new TimeSpan(hours - hours % _model.EpgHours, 0, 0)); + if (_model.GuideDateTime.TimeOfDay.TotalHours < _model.EpgHoursOffset) + { + _model.GuideDateTime = _model.GuideDateTime.AddDays(-1).AddHours(_model.EpgHoursOffset); + } } public delegate bool CancellationPendingDelegate(); Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideModel.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideModel.cs 2010-11-27 16:22:51 UTC (rev 3983) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideModel.cs 2010-11-28 12:47:40 UTC (rev 3984) @@ -35,6 +35,8 @@ public int EpgHours { get; internal set; } + public int EpgHoursOffset { get; internal set; } + public string AllChannelsGroupName { get; internal set; } private List<ChannelGroup> _channelGroups = new List<ChannelGroup>(); Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Client.Common.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2010-12-21 11:02:51
|
Revision: 4050 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4050&view=rev Author: dot-i Date: 2010-12-21 11:02:44 +0000 (Tue, 21 Dec 2010) Log Message: ----------- Updated plugins for latest MP1.2 SVN. Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/Resources.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ForTheRecord.UI.Process.csproj trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll Modified: trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln 2010-12-20 10:10:41 UTC (rev 4049) +++ trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln 2010-12-21 11:02:44 UTC (rev 4050) @@ -1,16 +1,10 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "RecorderTuner Server Plugin", "RecorderTuner Server Plugin", "{84E6B02A-0674-4406-911E-88CAB7CE17E6}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "GUI Client Plugin", "GUI Client Plugin", "{2A217BB8-A9FF-4013-ACAC-B1D1EBB39349}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForTheRecord.RecorderTuners.MediaPortalTvServer", "ForTheRecord.RecorderTuners.MediaPortalTvServer\ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj", "{6CF22F4E-FFFD-448D-A1A8-2156CB0133ED}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForTheRecord.UI.Process", "ForTheRecord.UI.Process\ForTheRecord.UI.Process.csproj", "{A35F0ED7-98ED-4EE2-99C6-EA2AF880F8CD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForTheRecord.UI.MediaPortal", "ForTheRecord.UI.MediaPortal\ForTheRecord.UI.MediaPortal.csproj", "{1526A789-1DE2-4A8B-AA4B-5382A617C4F8}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ReferencedAssemblies", "ReferencedAssemblies", "{FD6B1904-69BA-4054-B218-C616D64BF43A}" ProjectSection(SolutionItems) = preProject ReferencedAssemblies\Core.dll = ReferencedAssemblies\Core.dll @@ -32,6 +26,12 @@ ReferencedAssemblies\Utils.dll = ReferencedAssemblies\Utils.dll EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForTheRecord.RecorderTuners.MediaPortalTvServer", "ForTheRecord.RecorderTuners.MediaPortalTvServer\ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj", "{6CF22F4E-FFFD-448D-A1A8-2156CB0133ED}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForTheRecord.UI.Process", "ForTheRecord.UI.Process\ForTheRecord.UI.Process.csproj", "{A35F0ED7-98ED-4EE2-99C6-EA2AF880F8CD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForTheRecord.UI.MediaPortal", "ForTheRecord.UI.MediaPortal\ForTheRecord.UI.MediaPortal.csproj", "{1526A789-1DE2-4A8B-AA4B-5382A617C4F8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj 2010-12-20 10:10:41 UTC (rev 4049) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj 2010-12-21 11:02:44 UTC (rev 4050) @@ -1,4 +1,5 @@ -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> @@ -15,10 +16,25 @@ <SccProvider>SubversionScc</SccProvider> <FileUpgradeFlags> </FileUpgradeFlags> - <OldToolsVersion>2.0</OldToolsVersion> + <OldToolsVersion>3.5</OldToolsVersion> <UpgradeBackupLocation> </UpgradeBackupLocation> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <IsWebBootstrapper>false</IsWebBootstrapper> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -28,6 +44,7 @@ <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> @@ -36,6 +53,7 @@ <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <ItemGroup> <Reference Include="ForTheRecord.Entities, Version=1.4.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> @@ -201,6 +219,23 @@ <ItemGroup> <None Include="Resources\WizardHeader.bmp" /> </ItemGroup> + <ItemGroup> + <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> + <Install>false</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1</ProductName> + <Install>true</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> + <Visible>False</Visible> + <ProductName>Windows Installer 3.1</ProductName> + <Install>true</Install> + </BootstrapperPackage> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- 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. Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2010-12-20 10:10:41 UTC (rev 4049) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2010-12-21 11:02:44 UTC (rev 4050) @@ -53,7 +53,7 @@ private object _liveStreamsLock = new object(); private Dictionary<string, LiveStream> _liveStreams = new Dictionary<string, LiveStream>(); - private Dictionary<string, User> _liveStreamUsers = new Dictionary<string, User>(); + private Dictionary<string, IUser> _liveStreamUsers = new Dictionary<string, IUser>(); protected override string Name { @@ -226,7 +226,7 @@ if (liveStream != null && _liveStreamUsers.ContainsKey(liveStream.RtspUrl)) { - User tve3User = _liveStreamUsers[liveStream.RtspUrl]; + IUser tve3User = _liveStreamUsers[liveStream.RtspUrl]; foreach (TvDatabase.Card card in availableCards) { if (card.IdCard == tve3User.CardId) @@ -266,7 +266,7 @@ { string userName = String.Format(CultureInfo.InvariantCulture, "{0}{1}", _ftrLiveUserName, Guid.NewGuid()); - User tve3User = new User(userName, true, card.IdCard); + IUser tve3User = new User(userName, true, card.IdCard); tve3User.IdChannel = mpChannel.IdChannel; tve3User.SubChannel = -1; @@ -293,7 +293,7 @@ } private LiveStreamResult StartTimeShifting(Channel channel, TvDatabase.Card card, TvDatabase.Channel mpChannel, - ref User tve3User, ref LiveStream liveStream) + ref IUser tve3User, ref LiveStream liveStream) { IChannel tuningChannel = Utility.FindTuningChannelOnCard(mpChannel, card.IdCard); if (tuningChannel != null) @@ -361,7 +361,7 @@ { if (_liveStreams.ContainsKey(liveStream.RtspUrl)) { - User tve3User = _liveStreamUsers[liveStream.RtspUrl]; + IUser tve3User = _liveStreamUsers[liveStream.RtspUrl]; if (TvServerPlugin.TvController_IsTimeShifting(ref tve3User)) { if (!TvServerPlugin.TvController_StopTimeShifting(ref tve3User)) @@ -410,17 +410,17 @@ cards.Sort(delegate(TvDatabase.Card c1, TvDatabase.Card c2) { return c1.Priority.CompareTo(c2.Priority); }); // Get the list of live streams from TV Server - Dictionary<string, User> mpStreamUsers = new Dictionary<string, User>(); + Dictionary<string, IUser> mpStreamUsers = new Dictionary<string, IUser>(); foreach (TvDatabase.Card card in cards) { - User[] cardUsers = TvServerPlugin.TvController_GetUsersForCard(card.IdCard); + IUser[] cardUsers = TvServerPlugin.TvController_GetUsersForCard(card.IdCard); if (cardUsers != null) { - foreach (User user in cardUsers) + foreach (IUser user in cardUsers) { if (user.Name.StartsWith(_ftrLiveUserName)) { - User tve3User = user; + IUser tve3User = user; if (TvServerPlugin.TvController_IsTimeShifting(ref tve3User)) { mpStreamUsers.Add(TvServerPlugin.TvController_GetStreamingUrl(tve3User), tve3User); @@ -458,7 +458,7 @@ { if (!_liveStreams.ContainsKey(rtspUrl)) { - User tve3User = mpStreamUsers[rtspUrl]; + IUser tve3User = mpStreamUsers[rtspUrl]; TvServerPlugin.TvController_StopTimeShifting(ref tve3User, TvStoppedReason.KickedByAdmin); } } @@ -478,7 +478,7 @@ if (_liveStreams.ContainsKey(liveStream.RtspUrl)) { _liveStreams[liveStream.RtspUrl].StreamLastAliveTime = liveStream.StreamLastAliveTime; - User tve3User = _liveStreamUsers[liveStream.RtspUrl]; + IUser tve3User = _liveStreamUsers[liveStream.RtspUrl]; if (TvServerPlugin.TvController_IsTimeShifting(ref tve3User)) { TvServerPlugin.TvController_HeartBeat(tve3User); @@ -498,7 +498,7 @@ { List<ChannelLiveState> liveStates = new List<ChannelLiveState>(); - User tve3User = null; + IUser tve3User = null; if (liveStream != null && _liveStreamUsers.ContainsKey(liveStream.RtspUrl)) { @@ -557,7 +557,7 @@ { if (_liveStreams.ContainsKey(liveStream.RtspUrl)) { - User tve3User = _liveStreamUsers[liveStream.RtspUrl]; + IUser tve3User = _liveStreamUsers[liveStream.RtspUrl]; return TvServerPlugin.TvController_HasTeletext(tve3User); } } @@ -577,7 +577,7 @@ { if (_liveStreams.ContainsKey(liveStream.RtspUrl)) { - User tve3User = _liveStreamUsers[liveStream.RtspUrl]; + IUser tve3User = _liveStreamUsers[liveStream.RtspUrl]; TvServerPlugin.TvController_StartGrabbingTeletext(tve3User); } } @@ -596,7 +596,7 @@ { if (_liveStreams.ContainsKey(liveStream.RtspUrl)) { - User tve3User = _liveStreamUsers[liveStream.RtspUrl]; + IUser tve3User = _liveStreamUsers[liveStream.RtspUrl]; TvServerPlugin.TvController_StopGrabbingTeletext(tve3User); } } @@ -615,7 +615,7 @@ { if (_liveStreams.ContainsKey(liveStream.RtspUrl)) { - User tve3User = _liveStreamUsers[liveStream.RtspUrl]; + IUser tve3User = _liveStreamUsers[liveStream.RtspUrl]; return TvServerPlugin.TvController_IsGrabbingTeletext(tve3User); } } @@ -636,7 +636,7 @@ { if (_liveStreams.ContainsKey(liveStream.RtspUrl)) { - User tve3User = _liveStreamUsers[liveStream.RtspUrl]; + IUser tve3User = _liveStreamUsers[liveStream.RtspUrl]; byte[] result = TvServerPlugin.TvController_GetTeletextPage(tve3User, pageNumber, subPageNumber); if (result != null) { @@ -669,7 +669,7 @@ #region Private Methods - private static string GetTsBufferFile(User tve3User) + private static string GetTsBufferFile(IUser tve3User) { string tsBufferFile = TvServerPlugin.TvController_TimeShiftFileName(ref tve3User); string uncTimeshiftFolder = Common.ShareExplorer.GetUncPathForLocalPath(Path.GetDirectoryName(tsBufferFile)); Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/Resources.Designer.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/Resources.Designer.cs 2010-12-20 10:10:41 UTC (rev 4049) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/Resources.Designer.cs 2010-12-21 11:02:44 UTC (rev 4050) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. -// Runtime Version:2.0.50727.3053 +// Runtime Version:4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -19,7 +19,7 @@ // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2010-12-20 10:10:41 UTC (rev 4049) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2010-12-21 11:02:44 UTC (rev 4050) @@ -68,7 +68,7 @@ } } - private User _tve3User; + private IUser _tve3User; private string _tve3RecordingFileName; protected override void OnThreadEnding() @@ -203,7 +203,7 @@ private bool EnsureCardFree(bool allowOtherFtrUser, ref string errorMessage, out bool ftrIsRecordingOnCard) { ftrIsRecordingOnCard = false; - User[] cardUsers = TvServerPlugin.TvController_GetUsersForCard(_recordOnCard.IdCard); + IUser[] cardUsers = TvServerPlugin.TvController_GetUsersForCard(_recordOnCard.IdCard); if (cardUsers != null) { TvDatabase.TuningDetail tuning = Utility.FindTuningDetailOnCard(_channel, _recordOnCard.IdCard); @@ -226,7 +226,7 @@ } else { - User tmpUser = cardUser; + IUser tmpUser = cardUser; if (TvServerPlugin.TvController_IsRecording(ref tmpUser)) { if (!TvServerPlugin.TvController_StopRecording(ref tmpUser)) @@ -281,7 +281,7 @@ catch { } } - private static bool StopMediaPortalRecording(User tve3User) + private static bool StopMediaPortalRecording(IUser tve3User) { for (int count = 0; count < 60; count++) { Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs 2010-12-20 10:10:41 UTC (rev 4049) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs 2010-12-21 11:02:44 UTC (rev 4050) @@ -574,7 +574,7 @@ private static object _tvControllerLock = new object(); - public static TvResult TvController_Tune(ref User user, IChannel channel, int idChannel) + public static TvResult TvController_Tune(ref IUser user, IChannel channel, int idChannel) { lock (_tvControllerLock) { @@ -606,7 +606,7 @@ } } - public static User[] TvController_GetUsersForCard(int cardId) + public static IUser[] TvController_GetUsersForCard(int cardId) { lock (_tvControllerLock) { @@ -614,7 +614,7 @@ } } - public static TvResult TvController_StartRecording(ref User user, ref string fileName, bool contentRecording, long startTime) + public static TvResult TvController_StartRecording(ref IUser user, ref string fileName, bool contentRecording, long startTime) { lock (_tvControllerLock) { @@ -622,7 +622,7 @@ } } - public static bool TvController_IsRecording(ref User user) + public static bool TvController_IsRecording(ref IUser user) { lock (_tvControllerLock) { @@ -630,7 +630,7 @@ } } - public static bool TvController_StopRecording(ref User user) + public static bool TvController_StopRecording(ref IUser user) { lock (_tvControllerLock) { @@ -638,7 +638,7 @@ } } - public static TvResult TvController_StartTimeShifting(ref User user, ref string fileName) + public static TvResult TvController_StartTimeShifting(ref IUser user, ref string fileName) { lock (_tvControllerLock) { @@ -646,7 +646,7 @@ } } - public static bool TvController_IsTimeShifting(ref User user) + public static bool TvController_IsTimeShifting(ref IUser user) { lock (_tvControllerLock) { @@ -654,7 +654,7 @@ } } - public static bool TvController_StopTimeShifting(ref User user) + public static bool TvController_StopTimeShifting(ref IUser user) { lock (_tvControllerLock) { @@ -662,7 +662,7 @@ } } - public static bool TvController_StopTimeShifting(ref User user, TvStoppedReason reason) + public static bool TvController_StopTimeShifting(ref IUser user, TvStoppedReason reason) { lock (_tvControllerLock) { @@ -670,7 +670,7 @@ } } - public static string TvController_TimeShiftFileName(ref User user) + public static string TvController_TimeShiftFileName(ref IUser user) { lock (_tvControllerLock) { @@ -678,7 +678,7 @@ } } - public static string TvController_GetStreamingUrl(User user) + public static string TvController_GetStreamingUrl(IUser user) { lock (_tvControllerLock) { @@ -686,7 +686,7 @@ } } - public static void TvController_HeartBeat(User user) + public static void TvController_HeartBeat(IUser user) { lock (_tvControllerLock) { @@ -702,7 +702,7 @@ } } - public static bool TvController_HasTeletext(User user) + public static bool TvController_HasTeletext(IUser user) { lock (_tvControllerLock) { @@ -710,7 +710,7 @@ } } - public static void TvController_StartGrabbingTeletext(User user) + public static void TvController_StartGrabbingTeletext(IUser user) { lock (_tvControllerLock) { @@ -718,7 +718,7 @@ } } - public static void TvController_StopGrabbingTeletext(User user) + public static void TvController_StopGrabbingTeletext(IUser user) { lock (_tvControllerLock) { @@ -726,7 +726,7 @@ } } - public static bool TvController_IsGrabbingTeletext(User user) + public static bool TvController_IsGrabbingTeletext(IUser user) { lock (_tvControllerLock) { @@ -734,7 +734,7 @@ } } - public static byte[] TvController_GetTeletextPage(User user, int pageNumber, int subPageNumber) + public static byte[] TvController_GetTeletextPage(IUser user, int pageNumber, int subPageNumber) { lock (_tvControllerLock) { @@ -742,7 +742,7 @@ } } - public static int TvController_SubPageCount(User user, int pageNumber) + public static int TvController_SubPageCount(IUser user, int pageNumber) { lock (_tvControllerLock) { Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs 2010-12-20 10:10:41 UTC (rev 4049) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs 2010-12-21 11:02:44 UTC (rev 4050) @@ -225,13 +225,13 @@ return CardFreeOrUsingSameTransponder(cardId, channel, null); } - public static bool CardFreeOrUsingSameTransponder(int cardId, TvDatabase.Channel channel, User userToIgnore) + public static bool CardFreeOrUsingSameTransponder(int cardId, TvDatabase.Channel channel, IUser userToIgnore) { - User[] cardUsers = TvServerPlugin.TvController_GetUsersForCard(cardId); + IUser[] cardUsers = TvServerPlugin.TvController_GetUsersForCard(cardId); if (cardUsers != null) { TvDatabase.TuningDetail tuning = Utility.FindTuningDetailOnCard(channel, cardId); - foreach (User cardUser in cardUsers) + foreach (IUser cardUser in cardUsers) { if (userToIgnore == null || cardUser.Name != userToIgnore.Name) Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj 2010-12-20 10:10:41 UTC (rev 4049) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj 2010-12-21 11:02:44 UTC (rev 4050) @@ -1,4 +1,5 @@ -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> @@ -15,9 +16,11 @@ <SccProvider>SubversionScc</SccProvider> <FileUpgradeFlags> </FileUpgradeFlags> - <OldToolsVersion>2.0</OldToolsVersion> + <OldToolsVersion>3.5</OldToolsVersion> <UpgradeBackupLocation> </UpgradeBackupLocation> + <IsWebBootstrapper>false</IsWebBootstrapper> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <PublishUrl>publish\</PublishUrl> <Install>true</Install> <InstallFrom>Disk</InstallFrom> @@ -30,9 +33,9 @@ <MapFileExtensions>true</MapFileExtensions> <ApplicationRevision>0</ApplicationRevision> <ApplicationVersion>1.0.0.%2a</ApplicationVersion> - <IsWebBootstrapper>false</IsWebBootstrapper> <UseApplicationTrust>false</UseApplicationTrust> <BootstrapperEnabled>true</BootstrapperEnabled> + <TargetFrameworkProfile /> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -42,6 +45,7 @@ <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> @@ -51,10 +55,10 @@ <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <PlatformTarget>x86</PlatformTarget> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <ItemGroup> - <Reference Include="Core, Version=1.0.3.28694, Culture=neutral, processorArchitecture=x86"> - <SpecificVersion>False</SpecificVersion> + <Reference Include="Core"> <HintPath>..\ReferencedAssemblies\Core.dll</HintPath> </Reference> <Reference Include="Databases, Version=1.0.3.28696, Culture=neutral, processorArchitecture=x86"> @@ -314,6 +318,11 @@ </ProjectReference> </ItemGroup> <ItemGroup> + <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> + <Install>false</Install> + </BootstrapperPackage> <BootstrapperPackage Include="Microsoft.Net.Framework.2.0"> <Visible>False</Visible> <ProductName>.NET Framework 2.0 %28x86%29</ProductName> @@ -329,6 +338,11 @@ <ProductName>.NET Framework 3.5</ProductName> <Install>false</Install> </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1</ProductName> + <Install>false</Install> + </BootstrapperPackage> </ItemGroup> <ItemGroup> <EmbeddedResource Include="SetupForm.resx"> Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs 2010-12-20 10:10:41 UTC (rev 4049) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs 2010-12-21 11:02:44 UTC (rev 4050) @@ -295,10 +295,12 @@ VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD); if (keyboard != null) { + keyboard.IsSearchKeyboard = false; + keyboard.Text = searchText ?? String.Empty; keyboard.Reset(); - keyboard.Text = searchText ?? String.Empty; keyboard.TextChanged += new VirtualKeyboard.TextChangedEventHandler(keyboard_TextChanged); keyboard.DoModal(GetID); + keyboard_TextChanged(0, keyboard.Text); if (_model.Titles.Length == 0 && !String.IsNullOrEmpty(_model.SearchText)) { @@ -311,7 +313,8 @@ } } - void keyboard_TextChanged(int kindOfSearch, string searchText) + + private void keyboard_TextChanged(int kindOfSearch, string searchText) { using (TvSchedulerServiceAgent tvSchedulerAgent = new TvSchedulerServiceAgent()) { Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs 2010-12-20 10:10:41 UTC (rev 4049) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs 2010-12-21 11:02:44 UTC (rev 4050) @@ -86,7 +86,7 @@ private RecordingsModel _model; private RecordingsController _controller; - private GUIFacadeControl.ViewMode _currentViewMethod = GUIFacadeControl.ViewMode.List; + private GUIFacadeControl.Layout _currentViewMethod = GUIFacadeControl.Layout.List; private RecordingGroupMode _currentGroupByMode = RecordingGroupMode.GroupByProgramTitle; private SortMethod _currentSortMethod = SortMethod.Date; private bool _sortAscending = true; @@ -320,26 +320,26 @@ strTmp = xmlreader.GetValueAsString(this.SettingsSection, "view", "list"); if (strTmp == "List") { - _currentViewMethod = GUIFacadeControl.ViewMode.List; + _currentViewMethod = GUIFacadeControl.Layout.List; } else if (strTmp == "AlbumView") { - _currentViewMethod = GUIFacadeControl.ViewMode.AlbumView; + _currentViewMethod = GUIFacadeControl.Layout.AlbumView; } else if (strTmp == "SmallIcons") { - _currentViewMethod = GUIFacadeControl.ViewMode.SmallIcons; + _currentViewMethod = GUIFacadeControl.Layout.SmallIcons; } else if (strTmp == "LargeIcons") { - _currentViewMethod = GUIFacadeControl.ViewMode.LargeIcons; + _currentViewMethod = GUIFacadeControl.Layout.LargeIcons; } else if (strTmp == "Filmstrip") { - _currentViewMethod = GUIFacadeControl.ViewMode.Filmstrip; + _currentViewMethod = GUIFacadeControl.Layout.Filmstrip; } - _facadeView.View = _currentViewMethod; + _facadeView.CurrentLayout = _currentViewMethod; _facadeView.Focus = true; } } @@ -377,22 +377,22 @@ } switch (_currentViewMethod) { - case GUIFacadeControl.ViewMode.AlbumView: + case GUIFacadeControl.Layout.AlbumView: xmlwriter.SetValue(this.SettingsSection, "view", "AlbumView"); break; - case GUIFacadeControl.ViewMode.Filmstrip: + case GUIFacadeControl.Layout.Filmstrip: xmlwriter.SetValue(this.SettingsSection, "view", "Filmstrip"); break; - case GUIFacadeControl.ViewMode.LargeIcons: + case GUIFacadeControl.Layout.LargeIcons: xmlwriter.SetValue(this.SettingsSection, "view", "LargeIcons"); break; - case GUIFacadeControl.ViewMode.List: + case GUIFacadeControl.Layout.List: xmlwriter.SetValue(this.SettingsSection, "view", "List"); break; - case GUIFacadeControl.ViewMode.Playlist: + case GUIFacadeControl.Layout.Playlist: xmlwriter.SetValue(this.SettingsSection, "view", "Playlist"); break; - case GUIFacadeControl.ViewMode.SmallIcons: + case GUIFacadeControl.Layout.SmallIcons: xmlwriter.SetValue(this.SettingsSection, "view", "SmallIcons"); break; default: @@ -517,44 +517,44 @@ shouldContinue = false; switch (_currentViewMethod) { - case GUIFacadeControl.ViewMode.List: - _currentViewMethod = GUIFacadeControl.ViewMode.Playlist; - if (!AllowView(_currentViewMethod) || _facadeView.PlayListView == null) + case GUIFacadeControl.Layout.List: + _currentViewMethod = GUIFacadeControl.Layout.Playlist; + if (!AllowView(_currentViewMethod) || _facadeView.PlayListLayout == null) { shouldContinue = true; } break; - case GUIFacadeControl.ViewMode.Playlist: - _currentViewMethod = GUIFacadeControl.ViewMode.SmallIcons; - if (!AllowView(_currentViewMethod) || _facadeView.ThumbnailView == null) + case GUIFacadeControl.Layout.Playlist: + _currentViewMethod = GUIFacadeControl.Layout.SmallIcons; + if (!AllowView(_currentViewMethod) || _facadeView.ThumbnailLayout == null) { shouldContinue = true; } break; - case GUIFacadeControl.ViewMode.SmallIcons: - _currentViewMethod = GUIFacadeControl.ViewMode.LargeIcons; - if (!AllowView(_currentViewMethod) || _facadeView.ThumbnailView == null) + case GUIFacadeControl.Layout.SmallIcons: + _currentViewMethod = GUIFacadeControl.Layout.LargeIcons; + if (!AllowView(_currentViewMethod) || _facadeView.ThumbnailLayout == null) { shouldContinue = true; } break; - case GUIFacadeControl.ViewMode.LargeIcons: - _currentViewMethod = GUIFacadeControl.ViewMode.AlbumView; - if (!AllowView(_currentViewMethod) || _facadeView.AlbumListView == null) + case GUIFacadeControl.Layout.LargeIcons: + _currentViewMethod = GUIFacadeControl.Layout.AlbumView; + if (!AllowView(_currentViewMethod) || _facadeView.AlbumListLayout == null) { shouldContinue = true; } break; - case GUIFacadeControl.ViewMode.AlbumView: - _currentViewMethod = GUIFacadeControl.ViewMode.Filmstrip; - if (!AllowView(_currentViewMethod) || _facadeView.FilmstripView == null) + case GUIFacadeControl.Layout.AlbumView: + _currentViewMethod = GUIFacadeControl.Layout.Filmstrip; + if (!AllowView(_currentViewMethod) || _facadeView.FilmstripLayout == null) { shouldContinue = true; } break; - case GUIFacadeControl.ViewMode.Filmstrip: - _currentViewMethod = GUIFacadeControl.ViewMode.List; - if (!AllowView(_currentViewMethod) || _facadeView.ListView == null) + case GUIFacadeControl.Layout.Filmstrip: + _currentViewMethod = GUIFacadeControl.Layout.List; + if (!AllowView(_currentViewMethod) || _facadeView.ListLayout == null) { shouldContinue = true; } @@ -562,7 +562,7 @@ } } while (shouldContinue); - _facadeView.View = _currentViewMethod; + _facadeView.CurrentLayout = _currentViewMethod; LoadDirectory(true); } @@ -621,10 +621,10 @@ } } - private bool AllowView(GUIFacadeControl.ViewMode view) + private bool AllowView(GUIFacadeControl.Layout view) { // Disable playlist for now as it makes no sense to move recording entries - if (view == GUIFacadeControl.ViewMode.Playlist) + if (view == GUIFacadeControl.Layout.Playlist) { return false; } @@ -878,21 +878,21 @@ switch (_currentViewMethod) { - case GUIFacadeControl.ViewMode.AlbumView: + case GUIFacadeControl.Layout.AlbumView: text = GUILocalizeStrings.Get(529); break; - case GUIFacadeControl.ViewMode.Filmstrip: + case GUIFacadeControl.Layout.Filmstrip: text = GUILocalizeStrings.Get(733); break; - case GUIFacadeControl.ViewMode.LargeIcons: + case GUIFacadeControl.Layout.LargeIcons: text = GUILocalizeStrings.Get(417); break; - case GUIFacadeControl.ViewMode.List: + case GUIFacadeControl.Layout.List: text = GUILocalizeStrings.Get(101); break; //case GUIFacadeControl.ViewMode.Playlist: // break; - case GUIFacadeControl.ViewMode.SmallIcons: + case GUIFacadeControl.Layout.SmallIcons: text = GUILocalizeStrings.Get(100); break; default: @@ -932,7 +932,7 @@ rec.RecordingStartTime.ToShortTimeString(), ts.TotalSeconds > 0 ? Utils.SecondsToHMString((int)ts.TotalSeconds) : Utility.GetLocalizedText(TextId.RecordingInProgress)); item1.Label2 = strTime; - if (_currentViewMethod == GUIFacadeControl.ViewMode.List) + if (_currentViewMethod == GUIFacadeControl.Layout.List) { if (_currentSortMethod == SortMethod.Channel) { Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ForTheRecord.UI.Process.csproj =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ForTheRecord.UI.Process.csproj 2010-12-20 10:10:41 UTC (rev 4049) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ForTheRecord.UI.Process.csproj 2010-12-21 11:02:44 UTC (rev 4050) @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> @@ -19,6 +19,25 @@ <SignAssembly>false</SignAssembly> <AssemblyOriginatorKeyFile> </AssemblyOriginatorKeyFile> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>3.5</OldToolsVersion> + <UpgradeBackupLocation /> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <IsWebBootstrapper>false</IsWebBootstrapper> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> @@ -28,6 +47,7 @@ <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> @@ -36,6 +56,7 @@ <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <ItemGroup> <Reference Include="ForTheRecord.Entities, Version=1.3.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> @@ -83,6 +104,23 @@ <Compile Include="UpcomingOrActiveProgramsList.cs" /> <Compile Include="UpcomingOrActiveProgramView.cs" /> </ItemGroup> + <ItemGroup> + <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName> + <Install>false</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1</ProductName> + <Install>true</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> + <Visible>False</Visible> + <ProductName>Windows Installer 3.1</ProductName> + <Install>true</Install> + </BootstrapperPackage> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- 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. Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2011-05-27 09:12:14
|
Revision: 4229 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4229&view=rev Author: dot-i Date: 2011-05-27 09:12:05 +0000 (Fri, 27 May 2011) Log Message: ----------- Updated to For The Record 1.6.0.0 code (for MediaPortal 1.2 Beta). Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordMain.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/MiniGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVZapOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TextId.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Translator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideDialog.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvProgramInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvTeletextBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/WindowId.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_da.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_de.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_en.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_nl.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_pl.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_sv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ChannelProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ChannelProgramsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/TitleRuleTypeIndex.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/ChannelPrograms.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideUpcomingProgram.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/KeepUntilControlUtility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/LiveStreamView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/LiveStreamsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ProcessUtility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/RecorderTunersCache.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Recordings/RecordingsController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Recordings/RecordingsModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ScheduleNamesCache.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SearchGuide/SearchGuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SearchGuide/SearchGuideModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SerializableDictionary.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SortableBindingList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingOrActiveProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingOrActiveProgramsList.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Client.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll Added Paths: ----------- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_no.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_Active.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_RadioGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_RadioGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_RadioHome.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_RecordedRadio.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_TvGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_Alert.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_AlertCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_AlertSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_AlertSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_Recording.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingSeriesCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingSeriesInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingSeriesWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_RecordingWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_Suggestion.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_SuggestionCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_SuggestionSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_SuggestionSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/Media/4TR_logo.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_Active.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RadioGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RadioGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RadioHome.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RecordedRadio.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_TvGuide.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_TvGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_Alert.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_AlertCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_AlertSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_AlertSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_Recording.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingSeriesCancelledHistory.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingSeriesInConflict.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingSeriesWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_RecordingWithWarning.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_Suggestion.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_SuggestionCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_SuggestionSeries.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_SuggestionSeriesCancelled.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_hover_logo-noglow.png trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/Media/4TR_logo.png trunk/plugins/ForTheRecord/ReferencedAssemblies/Common.Utils.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/WindowPlugins.dll Removed Paths: ------------- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Aeon wide/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Blue3wide/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Indigo/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Monochrome/ Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -93,7 +93,5 @@ public int MPChannelId { get; set; } public string MPChannelName { get; set; } - - public string MPChannelDisplayName { get; set; } } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -183,13 +183,13 @@ { TvDatabase.Channel mpChannel = GetChannelById(link.ChannelType, link.MPChannelId); if (mpChannel == null - || mpChannel.Name != link.MPChannelName) + || mpChannel.DisplayName != link.MPChannelName) { - mpChannel = GetChannelByName(link.ChannelType, link.MPChannelName); + bool duplicateChannelsFound; + mpChannel = GetChannelByDisplayName(link.ChannelType, link.MPChannelName, out duplicateChannelsFound); } if (mpChannel != null) { - link.MPChannelDisplayName = mpChannel.DisplayName; _linksById.Add(link.ChannelId, link); } } @@ -250,7 +250,7 @@ if (_linksById.ContainsKey(channelId)) { ChannelLink link = _linksById[channelId]; - return new LinkedMediaPortalChannel(link.MPChannelId, link.MPChannelName, link.MPChannelDisplayName); + return new LinkedMediaPortalChannel(link.MPChannelId, link.MPChannelName); } TvDatabase.Channel channel = GetChannelByDisplayName(channelType, displayName, @@ -259,7 +259,7 @@ { isAutoLinked = true; _autoLinkedMPChannels[channel.IdChannel] = true; - return new LinkedMediaPortalChannel(channel.IdChannel, channel.Name, channel.DisplayName); + return new LinkedMediaPortalChannel(channel.IdChannel, channel.DisplayName); } return null; @@ -280,7 +280,7 @@ foreach (ChannelLink link in _linksById.Values) { if (link.MPChannelId == channel.IdChannel - && link.MPChannelName == channel.Name) + && link.MPChannelName == channel.DisplayName) { return link; } @@ -316,8 +316,7 @@ try { ClearLinkedMediaPortalChannel(channel); - ChannelLink link = new ChannelLink(channel.ChannelType, channel.ChannelId, channel.DisplayName, mpChannel.IdChannel, mpChannel.Name); - link.MPChannelDisplayName = mpChannel.DisplayName; + ChannelLink link = new ChannelLink(channel.ChannelType, channel.ChannelId, channel.DisplayName, mpChannel.IdChannel, mpChannel.DisplayName); _linksById.Add(link.ChannelId, link); } finally @@ -382,12 +381,6 @@ return InternalGetChannelBy(channelType, "idChannel", id, out duplicateChannelsFound); } - private TvDatabase.Channel GetChannelByName(ChannelType channelType, string name) - { - bool duplicateChannelsFound; - return InternalGetChannelBy(channelType, "name", name, out duplicateChannelsFound); - } - private TvDatabase.Channel InternalGetChannelBy(ChannelType channelType, string columnName, object value, out bool duplicateChannelsFound) { SqlBuilder sb = new SqlBuilder(StatementType.Select, typeof(TvDatabase.Channel)); Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -26,15 +26,13 @@ { internal class LinkedMediaPortalChannel { - public LinkedMediaPortalChannel(int id, string name, string displayName) + public LinkedMediaPortalChannel(int id, string displayName) { this.Id = id; - this.Name = name; this.DisplayName = displayName; } public int Id { get; set; } - public string Name { get; set; } public string DisplayName { get; set; } } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/CreateChannelLinkForm.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -185,14 +185,7 @@ public string ChannelName { - get - { - if (String.Equals(_channel.DisplayName, _channel.Name)) - { - return _channel.DisplayName; - } - return _channel.DisplayName + " (" + _channel.Name + ")"; - } + get { return _channel.DisplayName; } } } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -18,6 +18,10 @@ * http://www.gnu.org/copyleft/gpl.html * */ + +// Uncomment this to enable RTSP-test code +//#define USE_FTR_RTSP + using System; using System.Collections.Generic; using System.Text; @@ -38,6 +42,9 @@ using ForTheRecord.ServiceAgents; using ForTheRecord.RecorderTuners.Common; using ForTheRecord.RecorderTuners.MediaPortalTvServer.Channels; +#if USE_FTR_RTSP +using ForTheRecord.StreamingServer.ServiceAgents; +#endif namespace ForTheRecord.RecorderTuners.MediaPortalTvServer { @@ -51,6 +58,11 @@ { private const string _ftrLiveUserName = "FTRLive"; +#if USE_FTR_RTSP + private const string _rtspUrlSuffixFormat = @"Live-Card{0}-{1}"; + private const string _rtspApplicationName = "MediaPortal TV Server"; +#endif + private object _liveStreamsLock = new object(); private Dictionary<string, LiveStream> _liveStreams = new Dictionary<string, LiveStream>(); private Dictionary<string, IUser> _liveStreamUsers = new Dictionary<string, IUser>(); @@ -60,6 +72,14 @@ get { return "MediaPortal TV Server"; } } +#if USE_FTR_RTSP + public override void Initialize(Guid recorderTunerId, string serverHostName, int tcpPort) + { + base.Initialize(recorderTunerId, serverHostName, tcpPort); + RegisterApplicationInRtspServer(true); + } +#endif + public override string AllocateCard(Channel channel, CardChannelAllocation[] alreadyAllocated, bool useReversePriority) { try @@ -132,7 +152,7 @@ // // Note: "!ChannelAlreadyAllocatedOn(alreadyAllocated, allocation.CardId, channelId)" was // not added since TV Server can record the same channel several times on the same transponder. - if (mpChannel.FreeToAir + if (card.DecryptLimit == 0 || CountNumTimesAllocated(alreadyAllocated, allocation.CardId) < card.DecryptLimit) { // Get the previously allocated channel and its tuning details and let's check if the @@ -192,15 +212,26 @@ public override string[] GetRecordingShares() { + return GetCardFolders(true); + } + + public override string[] GetTimeshiftShares() + { + return GetCardFolders(false); + } + + private static string[] GetCardFolders(bool getRecordingFolder) + { List<string> shares = new List<string>(); List<TvDatabase.Card> cards = Utility.GetAllCards(); foreach (TvDatabase.Card card in cards) { - if (!String.IsNullOrEmpty(card.RecordingFolder)) + string folder = getRecordingFolder ? card.RecordingFolder : card.TimeShiftFolder; + if (!String.IsNullOrEmpty(folder)) { - string uncRecordingFolder = Common.ShareExplorer.GetUncPathForLocalPath(card.RecordingFolder); - shares.Add(String.IsNullOrEmpty(uncRecordingFolder) ? card.RecordingFolder : uncRecordingFolder); + string uncRecordingFolder = Common.ShareExplorer.GetUncPathForLocalPath(folder); + shares.Add(String.IsNullOrEmpty(uncRecordingFolder) ? folder : uncRecordingFolder); } else { @@ -213,7 +244,7 @@ #region Live TV/Radio - public override LiveStreamResult TuneLiveStream(Channel channel, ref LiveStream liveStream) + public override LiveStreamResult TuneLiveStream(Channel channel, CardChannelAllocation upcomingRecordingAllocation, ref LiveStream liveStream) { try { @@ -231,7 +262,7 @@ { if (card.IdCard == tve3User.CardId) { - if (Utility.CardFreeOrUsingSameTransponder(card.IdCard, mpChannel, tve3User)) + if (Utility.CardFreeOrUsingSameTransponder(card, mpChannel, tve3User)) { Log("TuneLiveTvStream(): tuning on card {0} {1}", card.IdCard, card.Name); lock (_liveStreamsLock) @@ -262,7 +293,7 @@ foreach (TvDatabase.Card card in availableCards) { if (!Utility.IsInSameHybridGroup(card, inUseHybridGroups) - && Utility.CardFreeOrUsingSameTransponder(card.IdCard, mpChannel)) + && Utility.CardFreeOrUsingSameTransponder(card, mpChannel)) { string userName = String.Format(CultureInfo.InvariantCulture, "{0}{1}", _ftrLiveUserName, Guid.NewGuid()); @@ -312,6 +343,10 @@ string tsBufferFile = GetTsBufferFile(tve3User); liveStream = new LiveStream(channel, rtspUrl); liveStream.TimeshiftFile = tsBufferFile; +#if USE_FTR_RTSP + string rtspUrlSuffix = String.Format(_rtspUrlSuffixFormat, tve3User.CardId, tve3User.SubChannel); + liveStream.RtspUrl = StartRtspStream(tsBufferFile, rtspUrlSuffix); +#endif } liveStream.Channel = channel; liveStream.CardId = tve3User.CardId.ToString(CultureInfo.InvariantCulture); @@ -348,7 +383,7 @@ } else { - Log(TraceEventType.Error, "StartTimeShifting(): no tuning channel found for {0}", mpChannel.Name); + Log(TraceEventType.Error, "StartTimeShifting(): no tuning channel found for {0}", mpChannel.DisplayName); return LiveStreamResult.ChannelTuneFailed; } } @@ -362,6 +397,11 @@ if (_liveStreams.ContainsKey(liveStream.RtspUrl)) { IUser tve3User = _liveStreamUsers[liveStream.RtspUrl]; + +#if USE_FTR_RTSP + StopRtspStream(liveStream); +#endif + if (TvServerPlugin.TvController_IsTimeShifting(ref tve3User)) { if (!TvServerPlugin.TvController_StopTimeShifting(ref tve3User)) @@ -519,7 +559,7 @@ foreach (TvDatabase.Card card in availableCards) { if (!Utility.IsInSameHybridGroup(card, inUseHybridGroups) - && Utility.CardFreeOrUsingSameTransponder(card.IdCard, mpChannel, tve3User)) + && Utility.CardFreeOrUsingSameTransponder(card, mpChannel, tve3User)) { IChannel tuningChannel = Utility.FindTuningChannelOnCard(mpChannel, card.IdCard); if (tuningChannel != null) @@ -748,5 +788,65 @@ } #endregion + + #region RTSP + +#if USE_FTR_RTSP + private bool RegisterApplicationInRtspServer(bool logError) + { + bool succeeded = StreamingServerHost.Instance.RegisterApplication(_rtspApplicationName); + if (!succeeded && logError) + { + TvLibrary.Log.Log.Error("Couldn't reach RTSP-server to register {0}.", _rtspApplicationName); + } + return succeeded; + } + + private string StartRtspStream(string filePath, string rtspUrlSuffix) + { + string streamUri = null; + // Ensure RTSP-Server is up and running, and we are registered + if (RegisterApplicationInRtspServer(false)) + { + try + { + using (StreamingServiceAgent streamingServiceAgent = new StreamingServiceAgent()) + { + streamUri = streamingServiceAgent.AddStream(filePath, rtspUrlSuffix); + } + } + catch (Exception ex) + { + TvLibrary.Log.Log.Error(ex.Message); + } + } + return streamUri; + } + + private void StopRtspStream(LiveStream stream) + { + // Ensure RTSP-Server is up and running, and we are registered + if (RegisterApplicationInRtspServer(false)) + { + try + { + using (StreamingServiceAgent streamingServiceAgent = new StreamingServiceAgent()) + { + // "rtsp://MEDIASERVER:554/ForTheRecord-Argus-Card2-2" + int index = stream.RtspUrl.LastIndexOf('/') + 1; + string rtspUrlSuffix = stream.RtspUrl.Substring(index); + streamingServiceAgent.RemoveStream(rtspUrlSuffix); + //Logger.Info("Stopped RTSP-Stream " + rtspUrlSuffix); + } + } + catch (Exception ex) + { + TvLibrary.Log.Log.Error(ex.Message); + } + } + } +#endif + + #endregion } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -2,6 +2,7 @@ using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using MediaPortal.Common.Utils; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information @@ -9,9 +10,9 @@ [assembly: AssemblyTitle("ForTheRecord.RecorderTuners.MediaPortalTvServer")] [assembly: AssemblyDescription("For The Record MediaPortal TV Server plugin")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("For The Record")] [assembly: AssemblyProduct("ForTheRecord.RecorderTuners.MediaPortalTvServer")] -[assembly: AssemblyCopyright("Copyright © ForTheRecord 2007-2010")] +[assembly: AssemblyCopyright("Copyright © For The Record 2007-2011")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -34,3 +35,6 @@ // by using the '*' as shown below: [assembly: AssemblyVersion(ForTheRecord.Entities.Constants.AssemblyVersion)] [assembly: AssemblyFileVersion(ForTheRecord.Entities.Constants.AssemblyVersion)] + +// MediaPortal version +[assembly: CompatibleVersion("1.1.7.0")] Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -25,7 +25,6 @@ using System.Threading; using System.Diagnostics; using System.Globalization; -using System.Runtime.InteropServices; using TvLibrary.Interfaces; using TvEngine.Events; @@ -55,7 +54,6 @@ _suggestedBaseFileName = suggestedBaseFileName; _recordOnCard = recordOnCard; _channel = channel; - SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS | EXECUTION_STATE.ES_SYSTEM_REQUIRED | EXECUTION_STATE.ES_AWAYMODE_REQUIRED); } #region Overrides @@ -64,19 +62,13 @@ { get { - return new TimeSpan(0, 3, 0); + return new TimeSpan(0, 2, 0); } } private IUser _tve3User; private string _tve3RecordingFileName; - protected override void OnThreadEnding() - { - base.OnThreadEnding(); - SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS); - } - protected override bool OnPrepareRecording(RecorderTunerCallbackServiceAgent callbackAgent, ref string errorMessage) { DeleteAllMediaPortalSchedules(); @@ -104,7 +96,7 @@ string fileName = Path.Combine(_recordOnCard.RecordingFolder, baseFileName); string extension = (_recordOnCard.RecordingFormat == 0) ? ".ts" : ".mpg"; - _tve3RecordingFileName = Common.Utility.GetFreeFileName(fileName, extension); + _tve3RecordingFileName = Common.Utility.GetFreeFileName(fileName, extension, 0); string tve3RecordingDirectory = Path.GetDirectoryName(_tve3RecordingFileName); if (!Directory.Exists(tve3RecordingDirectory)) { @@ -207,7 +199,7 @@ if (cardUsers != null) { TvDatabase.TuningDetail tuning = Utility.FindTuningDetailOnCard(_channel, _recordOnCard.IdCard); - foreach (User cardUser in cardUsers) + foreach (IUser cardUser in cardUsers) { if (!cardUser.Name.Equals("epg", StringComparison.InvariantCultureIgnoreCase)) { @@ -299,21 +291,5 @@ } #endregion - - #region P/Invoke - - [FlagsAttribute] - private enum EXECUTION_STATE : uint - { - ES_SYSTEM_REQUIRED = 0x00000001, - ES_DISPLAY_REQUIRED = 0x00000002, - ES_AWAYMODE_REQUIRED = 0x00000040, - ES_CONTINUOUS = 0x80000000 - } - - [DllImport("Kernel32.DLL", CharSet = CharSet.Auto, SetLastError = true)] - private extern static EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE state); - - #endregion } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -469,10 +469,6 @@ else { message = "Linked to " + linkedChannel.DisplayName; - if (!String.Equals(linkedChannel.DisplayName, linkedChannel.Name)) - { - message += " (" + linkedChannel.Name + ")"; - } rowColor = Color.DarkGreen; } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -407,7 +407,7 @@ TvDatabase.Channel mpChannel = layer.GetChannelByTuningDetail(dvbChannel.NetworkId, dvbChannel.TransportId, dvbChannel.ServiceId); if (mpChannel != null) { - Log.Debug("ForTheRecord.RecorderTuners.MediaPortalTvServer: ImportEpgPrograms(): received {0} programs on {1}", epgChannel.Programs.Count, mpChannel.Name); + Log.Debug("ForTheRecord.RecorderTuners.MediaPortalTvServer: ImportEpgPrograms(): received {0} programs on {1}", epgChannel.Programs.Count, mpChannel.DisplayName); using (ForTheRecordServiceAgent forTheRecordAgent = new ForTheRecordServiceAgent()) using (TvSchedulerServiceAgent tvSchedulerAgent = new TvSchedulerServiceAgent()) @@ -474,7 +474,7 @@ string externalId = mpChannel.ExternalId; if (String.IsNullOrEmpty(externalId)) { - externalId = mpChannel.Name; + externalId = mpChannel.DisplayName; } channel.GuideChannelId = tvGuideAgent.EnsureChannel(externalId, mpChannel.DisplayName, channel.ChannelType); tvSchedulerAgent.AttachChannelToGuide(channel.ChannelId, channel.GuideChannelId.Value); Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -78,7 +78,7 @@ IChannel tuningChannel = null; try { - List<IChannel> tunings = new TvDatabase.TvBusinessLayer().GetTuningChannelByName(channel); + List<IChannel> tunings = new TvDatabase.TvBusinessLayer().GetTuningChannelsByDbChannel(channel); foreach (IChannel tuning in tunings) { if (TvServerPlugin.TvController_CanTune(cardId, tuning)) @@ -220,29 +220,39 @@ return groupIds; } - public static bool CardFreeOrUsingSameTransponder(int cardId, TvDatabase.Channel channel) + public static bool CardFreeOrUsingSameTransponder(TvDatabase.Card card, TvDatabase.Channel channel) { - return CardFreeOrUsingSameTransponder(cardId, channel, null); + return CardFreeOrUsingSameTransponder(card, channel, null); } - public static bool CardFreeOrUsingSameTransponder(int cardId, TvDatabase.Channel channel, IUser userToIgnore) + public static bool CardFreeOrUsingSameTransponder(TvDatabase.Card card, TvDatabase.Channel channel, IUser userToIgnore) { - IUser[] cardUsers = TvServerPlugin.TvController_GetUsersForCard(cardId); + IUser[] cardUsers = TvServerPlugin.TvController_GetUsersForCard(card.IdCard); if (cardUsers != null) { - TvDatabase.TuningDetail tuning = Utility.FindTuningDetailOnCard(channel, cardId); + TvDatabase.TuningDetail tuning = Utility.FindTuningDetailOnCard(channel, card.IdCard); + + HashSet<int> activeChannels = new HashSet<int>(); + foreach (IUser cardUser in cardUsers) { if (userToIgnore == null || cardUser.Name != userToIgnore.Name) { - if (!cardUser.Name.Equals("epg", StringComparison.InvariantCultureIgnoreCase) - && !Utility.IsSameTransponder(cardId, tuning, cardUser.IdChannel)) + if (!cardUser.Name.Equals("epg", StringComparison.InvariantCultureIgnoreCase)) { - return false; + activeChannels.Add(cardUser.IdChannel); + if (!Utility.IsSameTransponder(card.IdCard, tuning, cardUser.IdChannel)) + { + return false; + } } } } + + return activeChannels.Contains(channel.IdChannel) + || card.DecryptLimit == 0 + || activeChannels.Count < card.DecryptLimit; } return true; } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2010 ForTheRecord + * Copyright (C) 2007-2011 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -432,6 +432,7 @@ { if (recording == null) { + GUIPropertyManager.SetProperty("#TV.Active.Channel", String.Empty); GUIPropertyManager.SetProperty("#TV.Active.Title", String.Empty); GUIPropertyManager.SetProperty("#TV.Active.Genre", String.Empty); GUIPropertyManager.SetProperty("#TV.Active.Time", String.Empty); @@ -448,6 +449,7 @@ recording.Program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), recording.Program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); + GUIPropertyManager.SetProperty("#TV.Active.Channel", recording.Program.Channel.DisplayName); GUIPropertyManager.SetProperty("#TV.Active.Title", recording.Program.Title); GUIPropertyManager.SetProperty("#TV.Active.Genre", recording.Program.Category); GUIPropertyManager.SetProperty("#TV.Active.Time", strTime); Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2011-05-26 16:34:21 UTC (rev 4228) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2011-05-27 09:12:05 UTC (rev 4229) @@ -75,6 +75,9 @@ private bool _autoFullScreen; private ManualResetEvent _waitForBlackScreenEvent; private int _framesBeforeStopRenderBlackImage; + private int _zapChannelNr = -1; + private static LiveStreamResult result = LiveStreamResult.UnknownError; + private int backupvolume = -1; public ChannelNavigator() { @@ -95,6 +98,7 @@ { Log.Debug("ChannelNavigator.RenderBlackImage()"); _waitForBlackScreenEvent.Reset(); + _framesBeforeStopRenderBlackImage = 0; GUIGraphicsContext.RenderBlackImage = true; _waitForBlackScreenEvent.WaitOne(1000, false); } @@ -104,7 +108,8 @@ { if (GUIGraphicsContext.RenderBlackImage) { - _framesBeforeStopRenderBlackImage = 3; + GUIGraphicsContext.RenderBlackImage = false; + // _framesBeforeStopRenderBlackImage = 3; // Ambass : we need to wait the 3rd frame to avoid persistance of previous channel....Why ????? // Morpheus: number of frames depends on hardware, from 1..5 or higher might be needed! // Probably the faster the graphics card is, the more frames required??? @@ -123,9 +128,9 @@ { if (GUIGraphicsContext.RenderBlackImage) { - Log.Debug("ChannelNavigator.OnVideoReceived() {0}", _framesBeforeStopRenderBlackImage); if (_framesBeforeStopRenderBlackImage > 0) { + Log.Debug("ChannelNavigator.OnVideoReceived() {0}", _framesBeforeStopRenderBlackImage); if (--_framesBeforeStopRenderBlackImage == 0) { GUIGraphicsContext.RenderBlackImage = false; @@ -184,6 +189,29 @@ } /// <summary> + /// Gets the channel number that we will zap to. If not zapping by number or not zapping to anything, returns -1. + /// </summary> + public int ZapChannelNr + { + get + { + return _zapChannelNr; + } + set + { + _zapChannelNr = value; + } + } + + public bool DoingChannelChange { get; set; } + public string TuningResult { get; set; } + + /// <summary> + /// returns true if we press a channel number + /// </summary> + public bool RefreshZapChannelNr { get; set; } + + /// <summary> /// Gets and sets the last viewed channel, null if there is none. /// </summary> public Channel GetPreviousChannel(ChannelType channelType) @@ -404,21 +432,21 @@ return false; } try - { + { _reentrant = true; - //UpdateCurrentChannel(); // Make sure current and next is up to date. KeepCurrentNextUpToDate(ChannelType.Television); KeepCurrentNextUpToDate(ChannelType.Radio); - // Zapping to another group or channel? + // Zapping to another group or channel? if (_zapGroup != null || _zapChannel != null) { // Time to zap? if (DateTime.Now >= _zapTime) { + Log.Debug("ChannelNavigator: CheckChannelChange()_DateTime.Now >= _zapTime,_zapgroup = {0} , _zapchannel = {1}", _zapGroup.GroupName, _zapChannel.DisplayName); // Zapping to another group? if (_zapGroup != null && _zapGroup != _currentChannelGroup) { @@ -439,6 +467,14 @@ // Zap to desired channel Channel zappingTo = _zapChannel; + + if (ForTheRecordMain.Navigator.CurrentChannel != null + && ForTheRecordMain.Navigator.CurrentChannel.ChannelId == zappingTo.ChannelId) + { + Log.Debug("ChannelNavigator: CheckChannelChange()_CurrentChannel.ChannelId = zappingTo.ChannelId --> break off zapping"); + zappingTo = null; + } + _zapChannel = null; if (zappingTo != null) @@ -454,10 +490,16 @@ _navigatorChannels[zappingTo.ChannelType].LastChannel = _currentChannel; _navigatorChannels[zappingTo.ChannelType].LastChannelGroup = _currentChannelGroup; } + _zapChannelNr = -1; + _reentrant = false; return true; } } } + catch (Exception ex) + { + Log.Error("ChannelNavigator: error CheckChannelChange() = {0}", ex.Message); + } finally { _reentrant = false; @@ -476,6 +518,10 @@ RefreshCurrentAndNext(channelType); } } + else + { + RefreshCurrentAndNext(channelType); + } } public bool ZapToChannelNumber(ChannelType channelType, int channelNr, bool useZapDelay) @@ -537,6 +583,7 @@ /// <param name="useZapDelay">If true, the configured zap delay is used. Otherwise it zaps immediately.</param> public void ZapToNextChannel(bool useZapDelay) { + _zapChannelNr = -1; if (_currentChannel != null) { ChannelType channelType = _currentChannel.ChannelType; @@ -560,6 +607,7 @@ /// <param name="useZapDelay">If true, the configured zap delay is used. Otherwise it zaps immediately.</param> public void ZapToPreviousChannel(bool useZapDelay) { + _zapChannelNr = -1; if (_currentChannel != null) { ChannelType channelType = _currentChannel.ChannelType; @@ -606,177 +654,311 @@ private LiveStream _liveStream; private LiveStream _pendingStopLiveStream; + private bool _liveStreamIsRtsp; private void TuneLiveStream(Channel channel) { + Log.Debug("ChannelNavigator: TuneLiveStream(), channel = {0}", channel.DisplayName); if (channel != null) { using (TvSchedulerServiceAgent tvSchedulerAgent = new TvSchedulerServiceAgent()) { - CurrentAndNextProgram currentAndNext = tvSchedulerAgent.GetCurrentAndNextForChannel(channel.ChannelId, false, null); + LiveStream liveStream = _liveStream; + CurrentAndNextProgram currentAndNext = tvSchedulerAgent.GetCurrentAndNextForChannel(channel.ChannelId, true, _liveStream);//null); + if (currentAndNext != null) { - LiveStream liveStream = _liveStream; + TuningResult = string.Empty; - if (liveStream != null) + if (currentAndNext.LiveState != ChannelLiveState.Tunable) { - try + //don't stop the previous channel, so the next tuning will be faster. + Log.Debug("ChannelNavigator: currentAndNext.LiveState != ChannelLiveState.Tunable"); + SetCurrentAndNext(currentAndNext.Channel.ChannelType, currentAndNext); + _currentChannel = channel; + this.DoingChannelChange = true; + RenderBlackImage(); + + //I don't know anything better + if (backupvolume == -1) { - RenderBlackImage(); + backupvolume = g_Player.Volume; + } + g_Player.Volume = 0; - bool resumeGraph = true; - g_Player.PauseGraph(); - g_Player.OnZapping(0x80); - - LiveStreamResult firstResult = LiveStreamResult.Succeeded; - LiveStreamResult result = LiveStreamResult.UnknownError; + if (currentAndNext.LiveState == ChannelLiveState.NoFreeCard || currentAndNext.LiveState == ChannelLiveState.NotTunable) + { + result = LiveStreamResult.NoFreeCardFound; + ... [truncated message content] |
From: <do...@us...> - 2011-05-30 07:45:56
|
Revision: 4236 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4236&view=rev Author: dot-i Date: 2011-05-30 07:45:45 +0000 (Mon, 30 May 2011) Log Message: ----------- Fixed references in project files. Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj 2011-05-29 11:20:18 UTC (rev 4235) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj 2011-05-30 07:45:45 UTC (rev 4236) @@ -56,6 +56,9 @@ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <ItemGroup> + <Reference Include="Common.Utils"> + <HintPath>..\ReferencedAssemblies\Common.Utils.dll</HintPath> + </Reference> <Reference Include="ForTheRecord.Entities, Version=1.4.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\ReferencedAssemblies\ForTheRecord.Entities.dll</HintPath> Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj 2011-05-29 11:20:18 UTC (rev 4235) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj 2011-05-30 07:45:45 UTC (rev 4236) @@ -58,6 +58,9 @@ <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <ItemGroup> + <Reference Include="Common.Utils"> + <HintPath>..\ReferencedAssemblies\Common.Utils.dll</HintPath> + </Reference> <Reference Include="Core"> <HintPath>..\ReferencedAssemblies\Core.dll</HintPath> </Reference> @@ -102,6 +105,9 @@ <SpecificVersion>False</SpecificVersion> <HintPath>..\ReferencedAssemblies\Utils.dll</HintPath> </Reference> + <Reference Include="WindowPlugins"> + <HintPath>..\ReferencedAssemblies\WindowPlugins.dll</HintPath> + </Reference> </ItemGroup> <ItemGroup> <Compile Include="ActiveRecordings.cs" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2011-10-18 08:18:59
|
Revision: 4311 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4311&view=rev Author: dot-i Date: 2011-10-18 08:18:48 +0000 (Tue, 18 Oct 2011) Log Message: ----------- Updated to For The Record 1.6.0.1 release. Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordMain.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioHome.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TextId.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvProgramInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_da.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_de.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_en.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_nl.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_no.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_pl.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_sv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_RecordedRadio.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_TvGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_Active.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_ProgramInfo.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RadioGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RadioHome.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RecordedRadio.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RecordedTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_TvGuideSearch.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_Upcoming.xml trunk/plugins/ForTheRecord/ReferencedAssemblies/Common.Utils.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Client.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/WindowPlugins.dll Added Paths: ----------- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/EventListener.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_common.window.xml Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2011-10-09 09:23:41 UTC (rev 4310) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2011-10-18 08:18:48 UTC (rev 4311) @@ -371,8 +371,8 @@ _viewsList.Add(item); } - string strObjects = string.Format("{0} {1}", _viewsList.Count, Utility.GetLocalizedText(TextId.RecordingsListItemsSuffix)); - GUIPropertyManager.SetProperty("#itemcount", strObjects); + GUIPropertyManager.SetProperty("#itemcount", _viewsList.Count.ToString()); + GUIPropertyManager.SetProperty("#currentmodule", Utility.GetLocalizedText(TextId.ActiveRecordings)); UpdateButtonStates(); // OnSort(); UpdateProperties(); Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2011-10-09 09:23:41 UTC (rev 4310) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2011-10-18 08:18:48 UTC (rev 4311) @@ -78,6 +78,7 @@ private int _zapChannelNr = -1; private static LiveStreamResult result = LiveStreamResult.UnknownError; private int backupvolume = -1; + private static DateTime _updateTimer = DateTime.MinValue; public ChannelNavigator() { @@ -437,8 +438,13 @@ //UpdateCurrentChannel(); // Make sure current and next is up to date. - KeepCurrentNextUpToDate(ChannelType.Television); - KeepCurrentNextUpToDate(ChannelType.Radio); + TimeSpan ts = DateTime.Now - _updateTimer; + if (ts.TotalMilliseconds > 2000) + { + _updateTimer = DateTime.Now; + KeepCurrentNextUpToDate(ChannelType.Television); + KeepCurrentNextUpToDate(ChannelType.Radio); + } // Zapping to another group or channel? if (_zapGroup != null || _zapChannel != null) @@ -469,7 +475,8 @@ Channel zappingTo = _zapChannel; if (ForTheRecordMain.Navigator.CurrentChannel != null - && ForTheRecordMain.Navigator.CurrentChannel.ChannelId == zappingTo.ChannelId) + && ForTheRecordMain.Navigator.CurrentChannel.ChannelId == zappingTo.ChannelId + && _liveStream != null) { Log.Debug("ChannelNavigator: CheckChannelChange()_CurrentChannel.ChannelId = zappingTo.ChannelId --> break off zapping"); zappingTo = null; @@ -489,6 +496,20 @@ } _navigatorChannels[zappingTo.ChannelType].LastChannel = _currentChannel; _navigatorChannels[zappingTo.ChannelType].LastChannelGroup = _currentChannelGroup; + + try + { + if (zappingTo.ChannelType == ChannelType.Television) + { + TvHome.UpdateProgressPercentageBar(); + } + else + { + RadioHome.UpdateProgressPercentageBar(); + RadioHome.UpdateMusicProperties(); + } + } + catch { } } _zapChannelNr = -1; _reentrant = false; @@ -750,13 +771,14 @@ GetPlayerFileNameAndOffset(liveStream, out fileName, out seekOffset);*/ g_Player.OnZapping(-1); + double duration = g_Player.Duration; if (g_Player.Duration < 0.0) { result = LiveStreamResult.UnknownError; } else { - g_Player.SeekAbsolute(g_Player.Duration + 0); + g_Player.SeekAbsolute(duration); } } @@ -912,16 +934,44 @@ null); msg.TargetWindowId = (int)(int)GUIWindow.Window.WINDOW_TVFULLSCREEN; GUIGraphicsContext.SendMessage(msg); - return; } else { // if not fulscreen, show notify dialog with the error message + string caption = string.Empty; + string tvlogo = string.Empty; + + if (channel != null) + { + using (TvSchedulerServiceAgent TvSchedulerAgent = new TvSchedulerServiceAgent()) + { + tvlogo = Utility.GetLogoImage(channel, TvSchedulerAgent); + } + + if (channel.ChannelType == ChannelType.Television) + { + caption = GUILocalizeStrings.Get(605) + " - " + channel.DisplayName; + } + else + { + caption = GUILocalizeStrings.Get(665) + " - " + channel.DisplayName; + } + } + GUIDialogNotify pDlgNotify = (GUIDialogNotify)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_NOTIFY); - string caption = GUILocalizeStrings.Get(605) + " - " + channel.DisplayName; - pDlgNotify.SetHeading(caption); //my tv - pDlgNotify.SetText(TuningResult); - pDlgNotify.DoModal((int)GUIWindowManager.ActiveWindowEx); + if (pDlgNotify != null) + { + pDlgNotify.Reset(); + pDlgNotify.ClearAll(); + pDlgNotify.SetHeading(caption); + if (!string.IsNullOrEmpty(TuningResult)) + { + pDlgNotify.SetText(TuningResult); + } + pDlgNotify.SetImage(tvlogo); + pDlgNotify.TimeOut = 5; + pDlgNotify.DoModal(GUIWindowManager.ActiveWindow); + } } } @@ -934,6 +984,30 @@ GetPlayerFileNameAndOffset(liveStream, out fileName, out seekOffset); RecordedBase.RememberActiveRecordingPosition(); int timeout = 0; + + if (!ForTheRecordMain.PreferRtspForLiveTv && seekOffset == 0) + { + bool tsFileExists = false; + while (!tsFileExists && timeout < 100) + { + tsFileExists = System.IO.File.Exists(fileName); + if (!tsFileExists) + { + Log.Info("Channelnavigator: startplay: waiting for TS file {0}", fileName); + timeout++; + Thread.Sleep(10); + } + } + if (timeout >= 100) + { + result = LiveStreamResult.UnknownError; + g_Player.Stop(); + Log.Debug("ChannelNavigator: PlayLiveStream_Result = {0}", result); + return result; + } + timeout = 0; + } + for (; ; ) { if (g_Player.Play(fileName, @@ -945,10 +1019,10 @@ if (duration < 0.0) { g_Player.Stop(); - timeout = timeout + 10; + timeout++; Log.Debug("ChannelNavigator: PlayLiveStream_timeout = {0}", timeout); Thread.Sleep(20); - if (timeout > 5000) + if (timeout > 100) { result = LiveStreamResult.UnknownError; Log.Debug("ChannelNavigator: PlayLiveStream_timeout from 5000ms reached"); @@ -956,9 +1030,9 @@ } continue; } - g_Player.SeekAbsolute(g_Player.Duration + seekOffset); - _liveStream = liveStream; - _liveStreamIsRtsp = fileName.StartsWith("rtsp:", StringComparison.InvariantCultureIgnoreCase); + g_Player.SeekAbsolute(duration); + _liveStream = liveStream; + _liveStreamIsRtsp = fileName.StartsWith("rtsp:", StringComparison.InvariantCultureIgnoreCase); } else { @@ -1016,20 +1090,6 @@ } } } - if (g_Player.Playing - && (g_Player.IsTV || g_Player.IsRadio)) - { - if (_navigatorChannels[channelType].CurrentProgram != null) - { - g_Player.currentTitle = _navigatorChannels[channelType].CurrentProgram.CreateProgramTitle(); - g_Player.currentDescription = _navigatorChannels[channelType].CurrentProgram.CreateCombinedDescription(true); - } - else - { - g_Player.currentTitle = String.Empty; - g_Player.currentDescription = String.Empty; - } - } } private void RefreshCurrentAndNext(ChannelType channelType) Added: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/EventListener.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/EventListener.cs (rev 0) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/EventListener.cs 2011-10-18 08:18:48 UTC (rev 4311) @@ -0,0 +1,268 @@ +#region Copyright (C) 2007-2011 For The Record +/* + * Copyright (C) 2007-2011 For The Record + * http://www.4therecord.eu + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GNU Make; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * http://www.gnu.org/copyleft/gpl.html + */ + +#endregion + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Net; +using System.ServiceModel; + +using MediaPortal.GUI.Library; +using MediaPortal.Player; + +using ForTheRecord.ServiceContracts.Events; +using ForTheRecord.ServiceAgents; +using ForTheRecord.Entities; +using ForTheRecord.Client.Common; + +namespace ForTheRecord.UI.MediaPortal +{ + [ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single, + InstanceContextMode = InstanceContextMode.Single)] + + public class EventListener : EventsListenerServiceBase + { + private string _serviceUrl = string.Empty; + private ServiceHost _serviceHost = null; + private bool stopping = false; + + # region EventListener Members + + public override void LiveStreamEnded(LiveStream liveStream) + { + Log.Debug("EventListener: LiveStreamEnded()"); + OnLiveStreamEnded(liveStream); + } + + public override void UpcomingRecordingsChanged() + { + Log.Debug("EventListener: UpcomingRecordingsChanged()"); + //ForTheRecordMain.UpcomingRecordingsChanged = true; + } + + public override void RecordingStarted(Recording recording) + { + Log.Debug("EventListener: recording started: {0}", recording.Title); + OnrecordingStarted(recording); + } + + public override void RecordingEnded(Recording recording) + { + Log.Debug("EventListener: recording ended: {0}", recording.Title); + //OnRecordingEnded(recording); + } + + public override void ActiveRecordingsChanged() + { + Log.Debug("EventListener: ActiveRecordingsChanged()"); + } + + public override void UpcomingAlertsChanged() + { + Log.Debug("EventListener: UpcomingAlertsChanged()"); + //ForTheRecordMain.UpcomingAlertsChanged = true; + } + + # endregion + + # region Start/Stop + + private object StartListenerLock = new object(); + public void StartListener() + { + lock (StartListenerLock) + { + int _port = GetFreeTcpPort(49800); + if (_port == -1) + { + Log.Error("EventListener: No free port found!"); + return; + } + + _serviceUrl = "net.tcp://" + Dns.GetHostName() + ":" + _port + "/MpClient/"; + StopListener(); + + Log.Debug("EventListener: start()"); + _serviceHost = CreateServiceHost(_serviceUrl); + _serviceHost.Open(); + + bool failed = true; + while (failed && !stopping) + { + failed = false; + try + { + using (ForTheRecordServiceAgent agent = new ForTheRecordServiceAgent()) + { + agent.EnsureEventListener(ForTheRecordEventGroup.RecordingEvents | ForTheRecordEventGroup.ScheduleEvents, _serviceUrl, Constants.EventListenerApiVersion); + } + } + catch (Exception ex) + { + Log.Error("EventListener: StartListener() error = {0}", ex.Message); + System.Threading.Thread.Sleep(2000); + failed = true; + } + } + } + } + + private object StopListenerLock = new object(); + public void StopListener() + { + lock (StopListenerLock) + { + Log.Debug("EventListener: stop()"); + stopping = true; + bool failed = true; + while (failed) + { + failed = false; + try + { + using (ForTheRecordServiceAgent agent = new ForTheRecordServiceAgent()) + { + agent.RemoveEventListener(_serviceUrl); + } + } + catch (Exception ex) + { + Log.Error("EventListener: StopListener() error = {0}", ex.Message); + System.Threading.Thread.Sleep(2000); + failed = true; + } + } + + if (_serviceHost != null) + { + _serviceHost.Close(); + } + stopping = false; + } + } + + #endregion + + #region Private Methods + + + private void OnLiveStreamEnded(LiveStream liveStream) + { + lock (this) + { + GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_STOP_SERVER_TIMESHIFTING, 0, 0, 0, 0, 0, null); + msg.Object = liveStream; + msg.Param1 = 4321; + GUIGraphicsContext.SendMessage(msg); + msg = null; + } + } + + private void OnRecordingEnded(Recording recording) + { + lock (this) + { + GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_NOTIFY_REC, 0, 0, 0, 0, 0, null); + msg.Param1 = 0;//ended + msg.Object = recording; + GUIGraphicsContext.SendMessage(msg); + msg = null; + } + } + + private void OnrecordingStarted(Recording recording) + { + lock (this) + { + if (ForTheRecordMain.Navigator.IsLiveStreamOn) + { + LiveStream livestream = ForTheRecordMain.Navigator.LiveStream; + if (livestream != null) + { + bool _streamStopped = false; + int timeout = 0; + + using (TvControlServiceAgent tvControlAgent = new TvControlServiceAgent()) + { + while (timeout < 20 && _streamStopped == false) + { + LiveStream[] livestreams = tvControlAgent.GetLiveStreams(); + _streamStopped = true; + foreach (LiveStream stream in livestreams) + { + if (stream.TimeshiftFile == livestream.TimeshiftFile) + { + _streamStopped = false; + } + } + timeout++; + System.Threading.Thread.Sleep(100); + } + + if (_streamStopped) + { + OnLiveStreamEnded(livestream); + } + } + } + } + + /*GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_NOTIFY_REC, 0, 0, 0, 0, 0, null); + msg.Param1 = 1;//started + msg.Object = recording; + GUIGraphicsContext.SendMessage(msg); + msg = null;*/ + } + } + + private static int GetFreeTcpPort(int port) + { + int _port = -1; + for (int i = 0; i < 100; i++) + { + try + { + System.Net.Sockets.TcpListener tcpListener = new System.Net.Sockets.TcpListener(IPAddress.Any, port); + tcpListener.Start(); + tcpListener.Stop(); + _port = port; + break; + } + catch (System.Net.Sockets.SocketException) + { + port--; + } + } + Log.Debug("EventListener: listener port = {0}", port); + return _port; + } + + private static ServiceHost CreateServiceHost(string eventsServiceBaseUrl) + { + return CreateServiceHost(typeof(EventListener), eventsServiceBaseUrl, typeof(IRecordingEventsListener), typeof(IScheduleEventsListener)); + } + + #endregion + } +} Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj 2011-10-09 09:23:41 UTC (rev 4310) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj 2011-10-18 08:18:48 UTC (rev 4311) @@ -95,6 +95,7 @@ <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\..\Program Files\Reference Assemblies\Microsoft\WinFX\v3.0\System.Runtime.Remoting.dll</HintPath> </Reference> + <Reference Include="System.ServiceModel" /> <Reference Include="System.Windows.Forms" /> <Reference Include="System.Xml" /> <Reference Include="TvLibrary.Interfaces, Version=1.0.3.28723, Culture=neutral, processorArchitecture=x86"> @@ -112,6 +113,7 @@ <ItemGroup> <Compile Include="ActiveRecordings.cs" /> <Compile Include="ChannelNavigator.cs" /> + <Compile Include="EventListener.cs" /> <Compile Include="Hamming.cs" /> <Compile Include="TeletextPageRenderer.cs" /> <Compile Include="TvFullscreenTeletext.cs" /> @@ -163,156 +165,68 @@ <Content Include="language\fortherecord_nl.xml" /> <Content Include="language\fortherecord_pl.xml" /> <Content Include="language\fortherecord_sv.xml" /> - <Content Include="skin\Aeon wide\4TR_Active.xml" /> - <Content Include="skin\Aeon wide\4TR_Home.xml" /> - <Content Include="skin\Aeon wide\4TR_ProgramInfo.xml" /> - <Content Include="skin\Aeon wide\4TR_RadioGuide.xml" /> - <Content Include="skin\Aeon wide\4TR_RadioGuideSearch.xml" /> - <Content Include="skin\Aeon wide\4TR_RadioHome.xml" /> - <Content Include="skin\Aeon wide\4TR_RecordedRadio.xml" /> - <Content Include="skin\Aeon wide\4TR_RecordedTv.xml" /> - <Content Include="skin\Aeon wide\4TR_TvGuide.xml" /> - <Content Include="skin\Aeon wide\4TR_TvGuideSearch.xml" /> - <Content Include="skin\Aeon wide\4TR_Upcoming.xml" /> - <Content Include="skin\Aeon wide\common.window.short.xml" /> - <Content Include="skin\Aeon wide\Media\4TR_Alert.png" /> - <Content Include="skin\Aeon wide\Media\4TR_AlertCancelled.png" /> - <Content Include="skin\Aeon wide\Media\4TR_AlertSeries.png" /> - <Content Include="skin\Aeon wide\Media\4TR_AlertSeriesCancelled.png" /> - <Content Include="skin\Aeon wide\Media\4TR_Recording.png" /> - <Content Include="skin\Aeon wide\Media\4TR_RecordingCancelled.png" /> - <Content Include="skin\Aeon wide\Media\4TR_RecordingCancelledHistory.png" /> - <Content Include="skin\Aeon wide\Media\4TR_RecordingInConflict.png" /> - <Content Include="skin\Aeon wide\Media\4TR_RecordingSeries.png" /> - <Content Include="skin\Aeon wide\Media\4TR_RecordingSeriesCancelled.png" /> - <Content Include="skin\Aeon wide\Media\4TR_RecordingSeriesCancelledHistory.png" /> - <Content Include="skin\Aeon wide\Media\4TR_RecordingSeriesInConflict.png" /> - <Content Include="skin\Aeon wide\Media\4TR_RecordingSeriesWithWarning.png" /> - <Content Include="skin\Aeon wide\Media\4TR_RecordingWithWarning.png" /> - <Content Include="skin\Aeon wide\Media\4TR_Suggestion.png" /> - <Content Include="skin\Aeon wide\Media\4TR_SuggestionCancelled.png" /> - <Content Include="skin\Aeon wide\Media\4TR_SuggestionSeries.png" /> - <Content Include="skin\Aeon wide\Media\4TR_SuggestionSeriesCancelled.png" /> - <Content Include="skin\Aeon wide\Media\togglebutton-off-focus.png" /> - <Content Include="skin\Aeon wide\Media\togglebutton-off-nofocus.png" /> - <Content Include="skin\Aeon wide\Media\togglebutton-on-focus.png" /> - <Content Include="skin\Aeon wide\Media\togglebutton-on-nofocus.png" /> - <Content Include="skin\Blue3wide\4TR_Active.xml" /> - <Content Include="skin\Blue3wide\4TR_Home.xml" /> - <Content Include="skin\Blue3wide\4TR_ProgramInfo.xml" /> - <Content Include="skin\Blue3wide\4TR_RadioGuide.xml" /> - <Content Include="skin\Blue3wide\4TR_RadioGuideSearch.xml" /> - <Content Include="skin\Blue3wide\4TR_RadioHome.xml" /> - <Content Include="skin\Blue3wide\4TR_RecordedRadio.xml" /> - <Content Include="skin\Blue3wide\4TR_RecordedTv.xml" /> - <Content Include="skin\Blue3wide\4TR_TvGuide.xml" /> - <Content Include="skin\Blue3wide\4TR_TvGuideSearch.xml" /> - <Content Include="skin\Blue3wide\4TR_Upcoming.xml" /> - <Content Include="skin\Blue3wide\Media\4TR_Alert.png" /> - <Content Include="skin\Blue3wide\Media\4TR_AlertCancelled.png" /> - <Content Include="skin\Blue3wide\Media\4TR_AlertSeries.png" /> - <Content Include="skin\Blue3wide\Media\4TR_AlertSeriesCancelled.png" /> - <Content Include="skin\Blue3wide\Media\4TR_Recording.png" /> - <Content Include="skin\Blue3wide\Media\4TR_RecordingCancelled.png" /> - <Content Include="skin\Blue3wide\Media\4TR_RecordingCancelledHistory.png" /> - <Content Include="skin\Blue3wide\Media\4TR_RecordingInConflict.png" /> - <Content Include="skin\Blue3wide\Media\4TR_RecordingSeries.png" /> - <Content Include="skin\Blue3wide\Media\4TR_RecordingSeriesCancelled.png" /> - <Content Include="skin\Blue3wide\Media\4TR_RecordingSeriesCancelledHistory.png" /> - <Content Include="skin\Blue3wide\Media\4TR_RecordingSeriesInConflict.png" /> - <Content Include="skin\Blue3wide\Media\4TR_RecordingSeriesWithWarning.png" /> - <Content Include="skin\Blue3wide\Media\4TR_RecordingWithWarning.png" /> - <Content Include="skin\Blue3wide\Media\4TR_Suggestion.png" /> - <Content Include="skin\Blue3wide\Media\4TR_SuggestionCancelled.png" /> - <Content Include="skin\Blue3wide\Media\4TR_SuggestionSeries.png" /> - <Content Include="skin\Blue3wide\Media\4TR_SuggestionSeriesCancelled.png" /> - <Content Include="skin\Blue3\4TR_Active.xml" /> - <Content Include="skin\Blue3\4TR_Home.xml" /> - <Content Include="skin\Blue3\4TR_ProgramInfo.xml" /> - <Content Include="skin\Blue3\4TR_RadioGuide.xml" /> - <Content Include="skin\Blue3\4TR_RadioGuideSearch.xml" /> - <Content Include="skin\Blue3\4TR_RadioHome.xml" /> - <Content Include="skin\Blue3\4TR_RecordedRadio.xml" /> - <Content Include="skin\Blue3\4TR_RecordedTv.xml" /> - <Content Include="skin\Blue3\4TR_TvGuide.xml" /> - <Content Include="skin\Blue3\4TR_TvGuideSearch.xml" /> - <Content Include="skin\Blue3\4TR_Upcoming.xml" /> - <Content Include="skin\Blue3\Media\4TR_Alert.png" /> - <Content Include="skin\Blue3\Media\4TR_AlertCancelled.png" /> - <Content Include="skin\Blue3\Media\4TR_AlertSeries.png" /> - <Content Include="skin\Blue3\Media\4TR_AlertSeriesCancelled.png" /> - <Content Include="skin\Blue3\Media\4TR_Recording.png" /> - <Content Include="skin\Blue3\Media\4TR_RecordingCancelled.png" /> - <Content Include="skin\Blue3\Media\4TR_RecordingCancelledHistory.png" /> - <Content Include="skin\Blue3\Media\4TR_RecordingInConflict.png" /> - <Content Include="skin\Blue3\Media\4TR_RecordingSeries.png" /> - <Content Include="skin\Blue3\Media\4TR_RecordingSeriesCancelled.png" /> - <Content Include="skin\Blue3\Media\4TR_RecordingSeriesCancelledHistory.png" /> - <Content Include="skin\Blue3\Media\4TR_RecordingSeriesInConflict.png" /> - <Content Include="skin\Blue3\Media\4TR_RecordingSeriesWithWarning.png" /> - <Content Include="skin\Blue3\Media\4TR_RecordingWithWarning.png" /> - <Content Include="skin\Blue3\Media\4TR_Suggestion.png" /> - <Content Include="skin\Blue3\Media\4TR_SuggestionCancelled.png" /> - <Content Include="skin\Blue3\Media\4TR_SuggestionSeries.png" /> - <Content Include="skin\Blue3\Media\4TR_SuggestionSeriesCancelled.png" /> - <Content Include="skin\Indigo\4TR_Active.xml" /> - <Content Include="skin\Indigo\4TR_Home.xml" /> - <Content Include="skin\Indigo\4TR_ProgramInfo.xml" /> - <Content Include="skin\Indigo\4TR_RadioGuide.xml" /> - <Content Include="skin\Indigo\4TR_RadioGuideSearch.xml" /> - <Content Include="skin\Indigo\4TR_RadioHome.xml" /> - <Content Include="skin\Indigo\4TR_RecordedRadio.xml" /> - <Content Include="skin\Indigo\4TR_RecordedTv.xml" /> - <Content Include="skin\Indigo\4TR_TvGuide.xml" /> - <Content Include="skin\Indigo\4TR_TvGuideSearch.xml" /> - <Content Include="skin\Indigo\4TR_Upcoming.xml" /> - <Content Include="skin\Indigo\Media\4TR_Alert.png" /> - <Content Include="skin\Indigo\Media\4TR_AlertCancelled.png" /> - <Content Include="skin\Indigo\Media\4TR_AlertSeries.png" /> - <Content Include="skin\Indigo\Media\4TR_AlertSeriesCancelled.png" /> - <Content Include="skin\Indigo\Media\4TR_Recording.png" /> - <Content Include="skin\Indigo\Media\4TR_RecordingCancelled.png" /> - <Content Include="skin\Indigo\Media\4TR_RecordingInConflict.png" /> - <Content Include="skin\Indigo\Media\4TR_RecordingSeries.png" /> - <Content Include="skin\Indigo\Media\4TR_RecordingSeriesCancelled.png" /> - <Content Include="skin\Indigo\Media\4TR_RecordingSeriesInConflict.png" /> - <Content Include="skin\Indigo\Media\4TR_RecordingSeriesWithWarning.png" /> - <Content Include="skin\Indigo\Media\4TR_RecordingWithWarning.png" /> - <Content Include="skin\Indigo\Media\4TR_Suggestion.png" /> - <Content Include="skin\Indigo\Media\4TR_SuggestionCancelled.png" /> - <Content Include="skin\Indigo\Media\4TR_SuggestionSeries.png" /> - <Content Include="skin\Indigo\Media\4TR_SuggestionSeriesCancelled.png" /> - <Content Include="skin\Indigo\Media\4TR_RecordingSeriesCancelledHistory.png" /> - <Content Include="skin\Indigo\Media\4TR_RecordingCancelledHistory.png" /> - <Content Include="skin\Monochrome\4TR_Active.xml" /> - <Content Include="skin\Monochrome\4TR_Home.xml" /> - <Content Include="skin\Monochrome\4TR_ProgramInfo.xml" /> - <Content Include="skin\Monochrome\4TR_RadioGuide.xml" /> - <Content Include="skin\Monochrome\4TR_RadioGuideSearch.xml" /> - <Content Include="skin\Monochrome\4TR_RadioHome.xml" /> - <Content Include="skin\Monochrome\4TR_RecordedRadio.xml" /> - <Content Include="skin\Monochrome\4TR_RecordedTv.xml" /> - <Content Include="skin\Monochrome\4TR_TvGuide.xml" /> - <Content Include="skin\Monochrome\4TR_TvGuideSearch.xml" /> - <Content Include="skin\Monochrome\4TR_Upcoming.xml" /> - <Content Include="skin\Monochrome\Media\4TR_Alert.png" /> - <Content Include="skin\Monochrome\Media\4TR_AlertCancelled.png" /> - <Content Include="skin\Monochrome\Media\4TR_AlertSeries.png" /> - <Content Include="skin\Monochrome\Media\4TR_AlertSeriesCancelled.png" /> - <Content Include="skin\Monochrome\Media\4TR_Recording.png" /> - <Content Include="skin\Monochrome\Media\4TR_RecordingCancelled.png" /> - <Content Include="skin\Monochrome\Media\4TR_RecordingCancelledHistory.png" /> - <Content Include="skin\Monochrome\Media\4TR_RecordingInConflict.png" /> - <Content Include="skin\Monochrome\Media\4TR_RecordingSeries.png" /> - <Content Include="skin\Monochrome\Media\4TR_RecordingSeriesCancelled.png" /> - <Content Include="skin\Monochrome\Media\4TR_RecordingSeriesCancelledHistory.png" /> - <Content Include="skin\Monochrome\Media\4TR_RecordingSeriesInConflict.png" /> - <Content Include="skin\Monochrome\Media\4TR_RecordingSeriesWithWarning.png" /> - <Content Include="skin\Monochrome\Media\4TR_RecordingWithWarning.png" /> - <Content Include="skin\Monochrome\Media\4TR_Suggestion.png" /> - <Content Include="skin\Monochrome\Media\4TR_SuggestionCancelled.png" /> - <Content Include="skin\Monochrome\Media\4TR_SuggestionSeries.png" /> - <Content Include="skin\Monochrome\Media\4TR_SuggestionSeriesCancelled.png" /> + <Content Include="skin\DefaultWide\4TR_Active.xml" /> + <Content Include="skin\DefaultWide\4TR_common.window.xml" /> + <Content Include="skin\DefaultWide\4TR_Home.xml" /> + <Content Include="skin\DefaultWide\4TR_ProgramInfo.xml" /> + <Content Include="skin\DefaultWide\4TR_RadioGuide.xml" /> + <Content Include="skin\DefaultWide\4TR_RadioGuideSearch.xml" /> + <Content Include="skin\DefaultWide\4TR_RadioHome.xml" /> + <Content Include="skin\DefaultWide\4TR_RecordedRadio.xml" /> + <Content Include="skin\DefaultWide\4TR_RecordedTv.xml" /> + <Content Include="skin\DefaultWide\4TR_TvGuide.xml" /> + <Content Include="skin\DefaultWide\4TR_TvGuideSearch.xml" /> + <Content Include="skin\DefaultWide\4TR_Upcoming.xml" /> + <Content Include="skin\DefaultWide\Media\4TR_Alert.png" /> + <Content Include="skin\DefaultWide\Media\4TR_AlertCancelled.png" /> + <Content Include="skin\DefaultWide\Media\4TR_AlertSeries.png" /> + <Content Include="skin\DefaultWide\Media\4TR_AlertSeriesCancelled.png" /> + <Content Include="skin\DefaultWide\Media\4TR_hover_logo-noglow.png" /> + <Content Include="skin\DefaultWide\Media\4TR_logo.png" /> + <Content Include="skin\DefaultWide\Media\4TR_Recording.png" /> + <Content Include="skin\DefaultWide\Media\4TR_RecordingCancelled.png" /> + <Content Include="skin\DefaultWide\Media\4TR_RecordingCancelledHistory.png" /> + <Content Include="skin\DefaultWide\Media\4TR_RecordingInConflict.png" /> + <Content Include="skin\DefaultWide\Media\4TR_RecordingSeries.png" /> + <Content Include="skin\DefaultWide\Media\4TR_RecordingSeriesCancelled.png" /> + <Content Include="skin\DefaultWide\Media\4TR_RecordingSeriesCancelledHistory.png" /> + <Content Include="skin\DefaultWide\Media\4TR_RecordingSeriesInConflict.png" /> + <Content Include="skin\DefaultWide\Media\4TR_RecordingSeriesWithWarning.png" /> + <Content Include="skin\DefaultWide\Media\4TR_RecordingWithWarning.png" /> + <Content Include="skin\DefaultWide\Media\4TR_Suggestion.png" /> + <Content Include="skin\DefaultWide\Media\4TR_SuggestionCancelled.png" /> + <Content Include="skin\DefaultWide\Media\4TR_SuggestionSeries.png" /> + <Content Include="skin\DefaultWide\Media\4TR_SuggestionSeriesCancelled.png" /> + <Content Include="skin\Default\4TR_Active.xml" /> + <Content Include="skin\Default\4TR_Home.xml" /> + <Content Include="skin\Default\4TR_ProgramInfo.xml" /> + <Content Include="skin\Default\4TR_RadioGuide.xml" /> + <Content Include="skin\Default\4TR_RadioGuideSearch.xml" /> + <Content Include="skin\Default\4TR_RadioHome.xml" /> + <Content Include="skin\Default\4TR_RecordedRadio.xml" /> + <Content Include="skin\Default\4TR_RecordedTv.xml" /> + <Content Include="skin\Default\4TR_TvGuide.xml" /> + <Content Include="skin\Default\4TR_TvGuideSearch.xml" /> + <Content Include="skin\Default\4TR_Upcoming.xml" /> + <Content Include="skin\Default\Media\4TR_Alert.png" /> + <Content Include="skin\Default\Media\4TR_AlertCancelled.png" /> + <Content Include="skin\Default\Media\4TR_AlertSeries.png" /> + <Content Include="skin\Default\Media\4TR_AlertSeriesCancelled.png" /> + <Content Include="skin\Default\Media\4TR_logo.png" /> + <Content Include="skin\Default\Media\4TR_Recording.png" /> + <Content Include="skin\Default\Media\4TR_RecordingCancelled.png" /> + <Content Include="skin\Default\Media\4TR_RecordingCancelledHistory.png" /> + <Content Include="skin\Default\Media\4TR_RecordingInConflict.png" /> + <Content Include="skin\Default\Media\4TR_RecordingSeries.png" /> + <Content Include="skin\Default\Media\4TR_RecordingSeriesCancelled.png" /> + <Content Include="skin\Default\Media\4TR_RecordingSeriesCancelledHistory.png" /> + <Content Include="skin\Default\Media\4TR_RecordingSeriesInConflict.png" /> + <Content Include="skin\Default\Media\4TR_RecordingSeriesWithWarning.png" /> + <Content Include="skin\Default\Media\4TR_RecordingWithWarning.png" /> + <Content Include="skin\Default\Media\4TR_Suggestion.png" /> + <Content Include="skin\Default\Media\4TR_SuggestionCancelled.png" /> + <Content Include="skin\Default\Media\4TR_SuggestionSeries.png" /> + <Content Include="skin\Default\Media\4TR_SuggestionSeriesCancelled.png" /> </ItemGroup> <ItemGroup> <None Include="PostBuild.cmd" /> Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordMain.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordMain.cs 2011-10-09 09:23:41 UTC (rev 4310) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordMain.cs 2011-10-18 08:18:48 UTC (rev 4311) @@ -103,6 +103,18 @@ return false; } + internal static bool IsRecordingStillActive(Guid recordingID) + { + foreach (ActiveRecording rec in ActiveRecordings) + { + if (rec.RecordingId == recordingID) + { + return true; + } + } + return false; + } + #endregion #region Settings @@ -147,10 +159,10 @@ internal static bool EnsureConnection() { - return EnsureConnection(true); + return EnsureConnection(true, true); } - internal static bool EnsureConnection(bool showPreviousOnError) + internal static bool EnsureConnection(bool showPreviousOnError, bool schowError) { if (!ServiceChannelFactories.IsInitialized) { @@ -166,8 +178,8 @@ } catch (ForTheRecordNotFoundException ex) { - if ((showPreviousOnError || !_connectionErrorShown) - && GUIWindowManager.ActiveWindow != 0) + if (((showPreviousOnError || !_connectionErrorShown) + && GUIWindowManager.ActiveWindow != 0) && schowError) { GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); dlg.SetHeading("Failed to connect to For The Record"); @@ -180,8 +192,8 @@ } catch (Exception ex) { - if ((showPreviousOnError || !_connectionErrorShown) - && GUIWindowManager.ActiveWindow != 0) + if (((showPreviousOnError || !_connectionErrorShown) + && GUIWindowManager.ActiveWindow != 0) && schowError) { GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); dlg.SetHeading("Failed to connect to For The Record"); @@ -195,7 +207,8 @@ } if (!ServiceChannelFactories.IsInitialized) { - if (showPreviousOnError) + if (showPreviousOnError + && GUIWindowManager.ActiveWindow != 0) { GUIWindowManager.ShowPreviousWindow(); } @@ -214,6 +227,15 @@ { if (_navigator == null) { + if (!ServiceChannelFactories.IsInitialized) + { + Log.Error("waiting for a connection to the core service, before starting the navigator"); + while (!EnsureConnection(false, false)) + { + System.Threading.Thread.Sleep(1000); + } + Log.Error("waiting for a connection to the core service, before starting the navigator, succeed!!"); + } _navigator = new ChannelNavigator(); } return _navigator; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs 2011-10-09 09:23:41 UTC (rev 4310) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs 2011-10-18 08:18:48 UTC (rev 4311) @@ -289,6 +289,11 @@ { currentChannelName = _currentChannel.DisplayName; } + + if (_channelOffset < 0) + { + _channelOffset = 0; + } } _useNewRecordingButtonColor = Utils.FileExistsInCache(Path.Combine(GUIGraphicsContext.Skin, @"media\tvguide_recButton_Focus_middle.png")); @@ -804,14 +809,18 @@ int iItemHeight = cntlChannelTemplate.Height; _channelCount = (int)(((float)iHeight) / ((float)iItemHeight)); - if (message.Param1 != (int)WindowId.ProgramInfo) + bool isPreviousWindowTvGuideRelated = (message.Param1 == (int)Window.WINDOW_TV_PROGRAM_INFO || + message.Param1 == (int)Window.WINDOW_VIDEO_INFO); + + if (!isPreviousWindowTvGuideRelated) { UnFocus(); } + GetChannels(true); LoadSchedules(true); _currentProgram = null; - if (message.Param1 != (int)WindowId.ProgramInfo) + if (!isPreviousWindowTvGuideRelated) { _viewingTime = DateTime.Now; _cursorY = 0; @@ -834,19 +843,20 @@ } } - // Last page adjust (To get a full page channel listing) - if ((_channelList.Count > _channelCount) && (_cursorX > _channelList.Count - Math.Min(_channelList.Count, _channelCount) + 1)) - { - _channelOffset = _channelList.Count - _channelCount; - _cursorX = _cursorX - _channelOffset; - } - while (_cursorX >= _channelCount) { _cursorX -= _channelCount; _channelOffset += _channelCount; } + // Mantis 3579: the above lines can lead to too large channeloffset. + // Now we check if the offset is too large, and if it is, we reduce it and increase the cursor position accordingly + if (!_guideContinuousScroll && (_channelOffset > _channelList.Count - _channelCount) && (_channelList.Count - _channelCount > 0)) + { + _cursorX += _channelOffset - (_channelList.Count - _channelCount); + _channelOffset = _channelList.Count - _channelCount; + } + GUISpinControl cntlDay = GetControl((int)Controls.SPINCONTROL_DAY) as GUISpinControl; if (cntlDay != null) { @@ -905,7 +915,7 @@ Log.Debug("TvGuideBase: SpinControl cntlTimeInterval is null!"); } - if (message.Param1 != (int)WindowId.ProgramInfo) + if (!isPreviousWindowTvGuideRelated) { Update(true); } @@ -1528,8 +1538,12 @@ && chan.LogicalChannelNumber.HasValue) { channelNumber = chan.LogicalChannelNumber.Value.ToString(); + GUIPropertyManager.SetProperty(SkinPropertyPrefix + ".Guide.ChannelNumber", channelNumber); } - GUIPropertyManager.SetProperty(SkinPropertyPrefix + ".Guide.ChannelNumber", channelNumber); + else + { + GUIPropertyManager.SetProperty(SkinPropertyPrefix + ".Guide.ChannelNumber", String.Empty); + } } if (_cursorY == 0 || _currentProgram == null) @@ -3686,10 +3700,13 @@ if (channel != null && _currentProgram != null) { - if (TvProgramInfo.RecordProgram(channel, _currentProgram)) + if (TvProgramInfo.RecordProgram(channel, _currentProgram, true)) { LoadSchedules(true); UpdateCurrentProgram(true); + UnFocus(); + Update(false); + SetFocus(); } } } @@ -3739,7 +3756,7 @@ UnFocus(); for (int i = 0; i < Steps; ++i) { - OnUp(true, true); + OnUp(false, true); } Correct(); Update(false); @@ -3775,7 +3792,7 @@ UnFocus(); for (int i = 0; i < Steps; ++i) { - OnDown(true); + OnDown(false); } Correct(); Update(false); Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs 2011-10-09 09:23:41 UTC (rev 4310) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs 2011-10-18 08:18:48 UTC (rev 4311) @@ -363,8 +363,16 @@ } } - string strObjects = string.Format("{0} {1}", _viewsList.Count, Utility.GetLocalizedText(TextId.RecordingsListItemsSuffix)); - GUIPropertyManager.SetProperty("#itemcount", strObjects); + GUIPropertyManager.SetProperty("#itemcount", _viewsList.Count.ToString()); + if (this._channelType == ChannelType.Television) + { + GUIPropertyManager.SetProperty("#currentmodule", GUILocalizeStrings.Get(100604)); + } + else + { + //TODO: new string for radio search + GUIPropertyManager.SetProperty("#currentmodule", GUILocalizeStrings.Get(100604)); + } _sortByButton.IsEnabled = !showTitles; Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs 2011-10-09 09:23:41 UTC (rev 4310) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs 2011-10-18 08:18:48 UTC (rev 4311) @@ -179,6 +179,15 @@ GUIPropertyManager.SetProperty("#itemcount", String.Empty); GUIPropertyManager.SetProperty("#selecteditem", String.Empty); + if (this._channelType == ChannelType.Television) + { + GUIPropertyManager.SetProperty("#currentmodule", GUILocalizeStrings.Get(100001)); + } + else + { + GUIPropertyManager.SetProperty("#currentmodule", GUILocalizeStrings.Get(100030)); + } + if (!ForTheRecordMain.Navigator.IsLiveStreamOn && this.AutoTurnOnStream && !PreviousWindowWasPluginWindow()) @@ -674,8 +683,8 @@ GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Record.percent1", percentage); GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Record.percent2", "0"); GUIPropertyManager.SetProperty(guiPropertyPrefix + ".Record.percent3", "0"); - GUIPropertyManager.SetProperty(guiPropertyPrefix + ".View.title", g_Player.currentTitle); - GUIPropertyManager.SetProperty(guiPropertyPrefix + ".View.description", g_Player.currentDescription); + GUIPropertyManager.SetProperty(guiPropertyPrefix + ".View.title", playingRecording.Title/*g_Player.currentTitle*/); + GUIPropertyManager.SetProperty(guiPropertyPrefix + ".View.description", playingRecording.CreateCombinedDescription(true)/*g_Player.currentDescription*/); GUIPropertyManager.SetProperty(guiPropertyPrefix + ".View.start", global::MediaPortal.Util.Utils.SecondsToHMSString((int)currentPosition)); GUIPropertyManager.SetProperty(guiPropertyPrefix + ".View.stop", global::MediaPortal.Util.Utils.SecondsToHMSString((int)duration)); // GUIPropertyManager.SetProperty(guiPropertyPrefix + ".View.remaining", String.Empty); --> not needed? to be checked! @@ -728,7 +737,6 @@ IMG_REC_CHANNEL = 21, LABEL_REC_INFO = 22, IMG_REC_RECTANGLE = 23, - }; private bool _turnOnStreamNow; @@ -757,6 +765,11 @@ && ForTheRecordMain.Navigator.CurrentChannel.ChannelType == _channelType; } + /*if (_teletextButton != null && _teletextButton.IsEnabled != (ForTheRecordMain.Navigator.HasTeletext() && !g_Player.IsTVRecording && ForTheRecordMain.Navigator.IsLiveStreamOn)) + { + _teletextButton.IsEnabled = (ForTheRecordMain.Navigator.HasTeletext() && !g_Player.IsTVRecording && ForTheRecordMain.Navigator.IsLiveStreamOn); + }*/ + base.Process(); } @@ -897,6 +910,14 @@ { xmlSettings.SetValueAsBool("general", "wait for tvserver", false); } + + //hack for minidisplay plugin, minidislay don't work with 4TR as it wants to connect to mp tv server. + //by clearing the hostname, minidisplay don't search for a tv server and minidisplay is working. + string mpTvserviceHostname = xmlSettings.GetValueAsString("tvservice", "hostname", ""); + if (mpTvserviceHostname != string.Empty) + { + xmlSettings.SetValue("tvservice", "hostname", string.Empty); + } } } @@ -922,6 +943,8 @@ || prevId == (int)GUIWindow.Window.WINDOW_SCHEDULER || prevId == (int)GUIWindow.Window.WINDOW_SEARCHTV || prevId == (int)GUIWindow.Window.WINDOW_TV_TUNING_DETAILS + || prevId == (int)GUIWindow.Window.WINDOW_TV + || prevId == (int)GUIWindow.Window.WINDOW_TVGUIDE || prevId == (int)GUIWindow.Window.WINDOW_RADIO || prevId == (int)GUIWindow.Window.WINDOW_RADIO_GUIDE || prevId == WindowId.TvGuide Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/AssemblyInfo.cs 2011-10-09 09:23:41 UTC (rev 4310) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/AssemblyInfo.cs 2011-10-18 08:18:48 UTC (rev 4311) @@ -36,4 +36,4 @@ [assembly: AssemblyFileVersion(ForTheRecord.Entities.Constants.AssemblyVersion)] // MediaPortal version -[assembly: CompatibleVersion("1.1.7.0")] +[assembly: CompatibleVersion("1.2.0.0")] Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioHome.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioHome.cs 2011-10-09 09:23:41 UTC (rev 4310) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioHome.cs 2011-10-18 08:18:48 UTC (rev 4311) @@ -26,8 +26,10 @@ using MediaPortal.GUI.Library; using MediaPortal.Configuration; +using MediaPortal.Player; using ForTheRecord.Entities; +using ForTheRecord.ServiceAgents; namespace ForTheRecord.UI.MediaPortal { @@ -73,6 +75,7 @@ strButtonImage = String.Empty; strButtonImageFocus = String.Empty; strPictureImage = @"hover_my radio.png"; + //_teletextButton = null; return true; } @@ -102,7 +105,7 @@ bool result = Load(GUIGraphicsContext.Skin + @"\4TR_RadioHome.xml"); if (result) { - ForTheRecordMain.EnsureConnection(false); + ForTheRecordMain.EnsureConnection(false,true); LoadSettings(); base.Init(); } @@ -145,6 +148,54 @@ DoUpdateProgressPercentageBar(ChannelType.Radio); } + public static void UpdateMusicProperties() + { + if (g_Player.Playing && g_Player.IsRadio) + { + Recording playingRecording = RecordedBase.GetPlayingRecording(); + string chanName = string.Empty; + Channel chan = ForTheRecordMain.Navigator.CurrentChannel; + Guid channelId = Guid.Empty; + + if (playingRecording != null + && playingRecording.ChannelType == ChannelType.Radio + && ForTheRecordMain.Navigator.IsLiveStreamOn == false) + { + chanName = playingRecording.ChannelDisplayName; + channelId = playingRecording.ChannelId; + } + else if (chan != null && chan.ChannelType == ChannelType.Radio + && ForTheRecordMain.Navigator.IsLiveStreamOn) + { + chanName = chan.DisplayName; + channelId = chan.ChannelId; + } + + if (chanName != string.Empty) + { + string logo = String.Empty; + if (channelId != Guid.Empty) + { + using (TvSchedulerServiceAgent tvSchedulerAgent = new TvSchedulerServiceAgent()) + { + logo = Utility.GetLogoImage(channelId, chanName, tvSchedulerAgent); + } + if (String.IsNullOrEmpty(logo)) + { + logo = "defaultMyRadioBig.png"; + } + } + + GUIPropertyManager.RemovePlayerProperties(); + GUIPropertyManager.SetProperty("#Play.Current.ArtistThumb", logo); + GUIPropertyManager.SetProperty("#Play.Current.Thumb", logo); + GUIPropertyManager.SetProperty("#Play.Current.Album", chanName); + GUIPropertyManager.SetProperty("#Play.Current.Title", chanName); + GUIPropertyManager.SetProperty("#Play.Current.Artist", chanName); + } + } + } + private void LoadSettings() { if (!_settingsLoaded) Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs 2011-10-09 09:23:41 UTC (rev 4310) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs 2011-10-18 08:18:48 UTC (rev 4311) @@ -29,6 +29,7 @@ using System.Globalization; using System.IO; using System.Thre... [truncated message content] |
From: <do...@us...> - 2012-04-02 12:04:43
|
Revision: 4469 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4469&view=rev Author: dot-i Date: 2012-04-02 12:04:32 +0000 (Mon, 02 Apr 2012) Log Message: ----------- Updated source to 1.6.0.2 version. Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvCropManager.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Client.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2012-03-29 20:37:48 UTC (rev 4468) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs 2012-04-02 12:04:32 UTC (rev 4469) @@ -486,6 +486,17 @@ if (zappingTo != null) { + if ((this.IsLiveStreamOn + && _currentChannel != null + && zappingTo.ChannelType != _currentChannel.ChannelType) + || (g_Player.Playing && !this.IsLiveStreamOn)) + { + //g_Player needs a comlete stop when the ChannelType changes + g_Player.Stop(true); + this.StopLiveStream(); + Thread.Sleep(250); + } + Channel prevChannel = _currentChannel; ChannelGroup prevGroup = _currentChannelGroup; TuneLiveStream(zappingTo); Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs 2012-03-29 20:37:48 UTC (rev 4468) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs 2012-04-02 12:04:32 UTC (rev 4469) @@ -92,6 +92,7 @@ private RecordingGroupMode _currentGroupByMode = RecordingGroupMode.GroupByProgramTitle; private SortMethod _currentSortMethod = SortMethod.Date; private bool _sortAscending = true; + private bool _enableThumbs = true; private int _selectedItemIndex; private int _selectedParentItemIndex; @@ -234,6 +235,10 @@ { jumpToTime = rec.LastWatchedPosition.Value; } + else + { + return false; + } } } if (jumpToTime == 0) @@ -272,7 +277,7 @@ } if (g_Player.Play(fileName, - rec.ChannelType == ChannelType.Television ? g_Player.MediaType.Recording : g_Player.MediaType.Radio)) + rec.ChannelType == ChannelType.Television ? g_Player.MediaType.TV : g_Player.MediaType.Radio)) { if (Utils.IsVideo(fileName)) { @@ -325,6 +330,7 @@ else if (strTmp == "name") _currentSortMethod = SortMethod.Name; _sortAscending = xmlreader.GetValueAsBool(this.SettingsSection, "sortascending", true); + _enableThumbs = xmlreader.GetValueAsBool(this.SettingsSection, "userecordingthumbs", true); strTmp = xmlreader.GetValueAsString(this.SettingsSection, "group", "title"); if (strTmp == "channel") _currentGroupByMode = RecordingGroupMode.GroupByChannel; @@ -776,9 +782,6 @@ item.Label = rec.CreateProgramTitle(); item.TVTag = rec; - // Set a default logo indicating the watched status - string previewThumb = rec.ThumbnailFileName; - // Get the channel logo for the small icons string logo = Utility.GetLogoImage(rec.ChannelId, rec.ChannelDisplayName, TvSchedulerAgent); if (!System.IO.File.Exists(logo)) @@ -786,11 +789,18 @@ logo = rec.LastWatchedTime.HasValue ? strDefaultSeenIcon : strDefaultUnseenIcon; } - if (!File.Exists(previewThumb) - || new FileInfo(previewThumb).Length == 0) + string previewThumb = logo; + if (_enableThumbs) { - // Fallback to Logo/Default icon - previewThumb = logo; + // Set a default logo indicating the watched status + previewThumb = rec.ThumbnailFileName; + + if (!File.Exists(previewThumb) + || new FileInfo(previewThumb).Length == 0) + { + // Fallback to Logo/Default icon + previewThumb = logo; + } } if (ForTheRecordMain.IsRecordingStillActive(rec.RecordingId)) @@ -1535,22 +1545,24 @@ private void OnPlayRecordingBackStarted(global::MediaPortal.Player.g_Player.MediaType type, string filename) { - if (type == g_Player.MediaType.Recording - && _playingRecording != null) + if (filename == _playingRecordingFileName) { - // set audio track based on user prefs. - int prefLangIdx = HomeBase.GetPreferedAudioStreamIndex(); - g_Player.CurrentAudioStream = prefLangIdx; + if (g_Player.IsTVRecording || g_Player.IsVideo) + { + // set audio track based on user prefs. + int prefLangIdx = HomeBase.GetPreferedAudioStreamIndex(); + g_Player.CurrentAudioStream = prefLangIdx; + } + else if (g_Player.IsRadio && _playingRecording != null) + { + RadioHome.UpdateMusicProperties(); + } } - else if (type != g_Player.MediaType.Recording && _playingRecording != null) + else { _playingRecordingFileName = null; _playingRecording = null; } - if (type == g_Player.MediaType.Radio) - { - RadioHome.UpdateMusicProperties(); - } } private static void StopCurrentPlayback(TvControlServiceAgent tvControlAgent) Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvCropManager.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvCropManager.cs 2012-03-29 20:37:48 UTC (rev 4468) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvCropManager.cs 2012-04-02 12:04:32 UTC (rev 4469) @@ -92,7 +92,7 @@ /// <param name="filename"></param> void g_Player_PlayBackStarted(g_Player.MediaType type, string filename) { - if (type == g_Player.MediaType.TV || type == g_Player.MediaType.Recording) + if (g_Player.IsTV || g_Player.IsTVRecording) { try { Modified: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs 2012-03-29 20:37:48 UTC (rev 4468) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs 2012-04-02 12:04:32 UTC (rev 4469) @@ -509,7 +509,7 @@ { Log.Debug("TvHome: GUI_MSG_STOP_SERVER_TIMESHIFTING, stopped livestream = navigator livestream"); - if (g_Player.Playing && (g_Player.IsTV || g_Player.IsRadio)) + if (g_Player.Playing && g_Player.IsTimeShifting) { if (GUIWindowManager.ActiveWindow == (int)(int)GUIWindow.Window.WINDOW_TVFULLSCREEN) { @@ -733,6 +733,24 @@ } } break;*/ + + + //this (GUI_MSG_RECORDER_VIEW_CHANNEL) event is used to let other plugins play a recording, + //lastMediaHandler does this (with param1 = 5577 for indentification). + case GUIMessage.MessageType.GUI_MSG_RECORDER_VIEW_CHANNEL: + if (message.Param1 == 5577) + { + try + { + Recording rec = message.Object as Recording; + RecordedBase.PlayRecording(rec, message.Param2); + } + catch + { + Log.Error("TVHome: error on GUI_MSG_RECORDER_VIEW_CHANNEL event"); + } + } + break; } } @@ -763,8 +781,7 @@ { if (ForTheRecordMain.Navigator.IsLiveStreamOn) { - if (type == g_Player.MediaType.TV - || type == g_Player.MediaType.Radio) + if (g_Player.IsTV || g_Player.IsRadio) { // set audio track based on user prefs. int prefLangIdx = HomeBase.GetPreferedAudioStreamIndex(); Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Client.Common.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll =================================================================== (Binary files differ) Modified: trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <do...@us...> - 2012-07-16 07:23:45
|
Revision: 4500 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4500&view=rev Author: dot-i Date: 2012-07-16 07:23:33 +0000 (Mon, 16 Jul 2012) Log Message: ----------- Updated to 1.7.0.0 source code, in combination with MP 1.3 alpha. Modified Paths: -------------- trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ChannelNavigator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/EventListener.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecord.UI.MediaPortal.csproj trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ForTheRecordMain.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/GuideSearchBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/HomeBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/MiniGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioGuideSearch.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioHome.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RadioRecorded.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/RecordedBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.Designer.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/SetupForm.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVZapOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TextId.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Translator.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvCropManager.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvCropSettings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullScreen.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuide.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideSearch.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvHome.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvOSD.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvProgramInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvRecorded.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvRecordingOverlay.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Utility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/WindowId.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_da.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_de.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_en.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_nl.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_no.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_pl.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/language/fortherecord_sv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_Home.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_RadioHome.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ChannelProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ChannelProgramsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/CurrentAndNextProgramsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/EditScheduleModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/EditSchedule/TitleRuleTypeIndex.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/ChannelPrograms.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Guide/GuideUpcomingProgram.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/KeepUntilControlUtility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/LiveStreamView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/LiveStreamsList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ProcessUtility.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Properties/AssemblyInfo.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/RecorderTunersCache.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Recordings/RecordingsController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/Recordings/RecordingsModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/ScheduleNamesCache.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SearchGuide/SearchGuideController.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SearchGuide/SearchGuideModel.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SerializableDictionary.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/SortableBindingList.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingOrActiveProgramView.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.Process/UpcomingOrActiveProgramsList.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/Common.Utils.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Core.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Databases.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Dialogs.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Client.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.Entities.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.RecorderTuners.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceAgents.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/ForTheRecord.ServiceContracts.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Gentle.Common.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Gentle.Framework.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/PluginBase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/SetupControls.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TVDatabase.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvBusinessLayer.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvControl.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/TvLibrary.Interfaces.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/Utils.dll trunk/plugins/ForTheRecord/ReferencedAssemblies/WindowPlugins.dll Added Paths: ----------- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TVNotifyYesNoDialog.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TuningDetails.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingRadio.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingTv.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/settings/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/settings/ChannelManagment.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/settings/ClientSettingsBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/settings/ServerSettingsBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_ManualSchedule.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_ProgramInfo2.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_RadioGuideSearch2.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_RecordedRadio2.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_RecordedTv2.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_TvGuideSearch2.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_UpcomingRadio.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/Default/4TR_UpcomingTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_ChannelManagment.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_ClientSettings.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_ManualSchedule.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_ProgramInfo2.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RadioGuideSearch2.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RecordedRadio2.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_RecordedTv2.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_ServerSettings.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_TuningDetails.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_TvGuideSearch2.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_UpcomingRadio.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/4TR_UpcomingTv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/skin/DefaultWide/settings_tv.xml trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/teletext/ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/teletext/Hamming.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/teletext/TeletextPageRenderer.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/teletext/TvFullscreenTeletext.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/teletext/TvTeletext.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/teletext/TvTeletextBase.cs trunk/plugins/ForTheRecord/ReferencedAssemblies/DirectShowLib.dll Removed Paths: ------------- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/Hamming.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TeletextPageRenderer.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvFullscreenTeletext.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvGuideDialog.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvTeletext.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/TvTeletextBase.cs trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/UpcomingPrograms.cs Modified: trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.MPPlugins.sln 2012-07-16 07:23:33 UTC (rev 4500) @@ -10,6 +10,7 @@ ReferencedAssemblies\Core.dll = ReferencedAssemblies\Core.dll ReferencedAssemblies\Databases.dll = ReferencedAssemblies\Databases.dll ReferencedAssemblies\Dialogs.dll = ReferencedAssemblies\Dialogs.dll + ReferencedAssemblies\DirectShowLib.dll = ReferencedAssemblies\DirectShowLib.dll ReferencedAssemblies\ForTheRecord.Client.Common.dll = ReferencedAssemblies\ForTheRecord.Client.Common.dll ReferencedAssemblies\ForTheRecord.Entities.dll = ReferencedAssemblies\ForTheRecord.Entities.dll ReferencedAssemblies\ForTheRecord.RecorderTuners.Common.dll = ReferencedAssemblies\ForTheRecord.RecorderTuners.Common.dll Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLink.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/ChannelLinks.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -36,7 +36,7 @@ { internal class ChannelLinks { - private ReaderWriterLock _readerWriterLock = new ReaderWriterLock(); + private ReaderWriterLockSlim _readerWriterLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); private Dictionary<Guid, ChannelLink> _linksById = new Dictionary<Guid, ChannelLink>(); private Dictionary<int, bool> _autoLinkedMPChannels = new Dictionary<int, bool>(); @@ -148,7 +148,7 @@ string settingsFileName = this.SettingsFileName; if (!File.Exists(settingsFileName)) { - _readerWriterLock.AcquireWriterLock(Timeout.Infinite); + _readerWriterLock.EnterWriteLock(); try { _linksById.Clear(); @@ -157,7 +157,7 @@ } finally { - _readerWriterLock.ReleaseWriterLock(); + _readerWriterLock.ExitWriteLock(); } } @@ -165,7 +165,7 @@ if (forceLoad || lastWriteTimeUtc != _lastFileWriteTimeUtc) { - _readerWriterLock.AcquireWriterLock(Timeout.Infinite); + _readerWriterLock.EnterWriteLock(); try { _lastFileWriteTimeUtc = lastWriteTimeUtc; @@ -198,14 +198,14 @@ } finally { - _readerWriterLock.ReleaseWriterLock(); + _readerWriterLock.ExitWriteLock(); } } } private void SaveChannelLinks() { - _readerWriterLock.AcquireReaderLock(Timeout.Infinite); + _readerWriterLock.EnterReadLock(); try { string settingsFileName = this.SettingsFileName; @@ -229,7 +229,7 @@ } finally { - _readerWriterLock.ReleaseReaderLock(); + _readerWriterLock.ExitReadLock(); } } @@ -241,7 +241,7 @@ { EnsureLoaded(); - _readerWriterLock.AcquireReaderLock(Timeout.Infinite); + _readerWriterLock.EnterReadLock(); try { isAutoLinked = false; @@ -266,7 +266,7 @@ } finally { - _readerWriterLock.ReleaseReaderLock(); + _readerWriterLock.ExitReadLock(); } } @@ -274,7 +274,7 @@ { EnsureLoaded(); - _readerWriterLock.AcquireReaderLock(Timeout.Infinite); + _readerWriterLock.EnterReadLock(); try { foreach (ChannelLink link in _linksById.Values) @@ -289,7 +289,7 @@ } finally { - _readerWriterLock.ReleaseReaderLock(); + _readerWriterLock.ExitReadLock(); } } @@ -297,14 +297,14 @@ { EnsureLoaded(); - _readerWriterLock.AcquireReaderLock(Timeout.Infinite); + _readerWriterLock.EnterReadLock(); try { return _autoLinkedMPChannels.ContainsKey(mpChannel.IdChannel); } finally { - _readerWriterLock.ReleaseReaderLock(); + _readerWriterLock.ExitReadLock(); } } @@ -312,7 +312,7 @@ { EnsureLoaded(); - _readerWriterLock.AcquireWriterLock(Timeout.Infinite); + _readerWriterLock.EnterWriteLock(); try { ClearLinkedMediaPortalChannel(channel); @@ -321,7 +321,7 @@ } finally { - _readerWriterLock.ReleaseWriterLock(); + _readerWriterLock.ExitWriteLock(); } } @@ -329,7 +329,7 @@ { EnsureLoaded(); - _readerWriterLock.AcquireWriterLock(Timeout.Infinite); + _readerWriterLock.EnterWriteLock(); try { if (_linksById.ContainsKey(channel.ChannelId)) @@ -339,7 +339,7 @@ } finally { - _readerWriterLock.ReleaseWriterLock(); + _readerWriterLock.ExitWriteLock(); } } @@ -347,7 +347,7 @@ { EnsureLoaded(); - _readerWriterLock.AcquireWriterLock(Timeout.Infinite); + _readerWriterLock.EnterWriteLock(); try { List<Guid> obsoleteLinks = new List<Guid>(); @@ -366,7 +366,7 @@ } finally { - _readerWriterLock.ReleaseWriterLock(); + _readerWriterLock.ExitWriteLock(); } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Channels/LinkedMediaPortalChannel.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/DvbEpgThread.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/ForTheRecord.RecorderTuners.MediaPortalTvServer.csproj 2012-07-16 07:23:33 UTC (rev 4500) @@ -59,12 +59,14 @@ <Reference Include="Common.Utils"> <HintPath>..\ReferencedAssemblies\Common.Utils.dll</HintPath> </Reference> + <Reference Include="DirectShowLib"> + <HintPath>..\ReferencedAssemblies\DirectShowLib.dll</HintPath> + </Reference> <Reference Include="ForTheRecord.Entities, Version=1.4.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> <HintPath>..\ReferencedAssemblies\ForTheRecord.Entities.dll</HintPath> </Reference> - <Reference Include="ForTheRecord.RecorderTuners.Common, Version=1.4.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> + <Reference Include="ForTheRecord.RecorderTuners.Common"> <HintPath>..\ReferencedAssemblies\ForTheRecord.RecorderTuners.Common.dll</HintPath> </Reference> <Reference Include="ForTheRecord.ServiceAgents, Version=1.4.0.0, Culture=neutral, PublicKeyToken=a9a5dfc20b8d6175, processorArchitecture=MSIL"> Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/MediaPortalRecorderTunerService.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -38,6 +38,7 @@ using TvLibrary.Log; using ForTheRecord.Entities; +using ForTheRecord.Entities.Tuning; using ForTheRecord.ServiceContracts; using ForTheRecord.ServiceAgents; using ForTheRecord.RecorderTuners.Common; @@ -585,6 +586,141 @@ return liveStates.ToArray(); } + public override ServiceTuning GetLiveStreamTuningDetails(LiveStream liveStream) + { + ServiceTuning result = null; + + lock (_liveStreamsLock) + { + if (_liveStreams.ContainsKey(liveStream.RtspUrl)) + { + IUser tve3User = _liveStreamUsers[liveStream.RtspUrl]; + + IChannel channel = TvServerPlugin.TvController_CurrentChannel(tve3User); + + var dvbSChannel = channel as TvLibrary.Channels.DVBSChannel; + if (dvbSChannel != null) + { + result = new ServiceTuning() + { + CardType = Entities.Tuning.CardType.DvbS, + Frequency = (int)dvbSChannel.Frequency, + InnerFecRate = (ForTheRecord.Entities.Tuning.FecCodeRate)dvbSChannel.InnerFecRate, + Modulation = (ForTheRecord.Entities.Tuning.Modulation)dvbSChannel.ModulationType, + Name = dvbSChannel.Name, + ONID = dvbSChannel.NetworkId, + OrbitalPosition = dvbSChannel.SatelliteIndex, // TODO: check if this is the right number + Pilot = (ForTheRecord.Entities.Tuning.Pilot)dvbSChannel.Pilot, + ProviderName = dvbSChannel.Provider, + IsFreeToAir = dvbSChannel.FreeToAir, + RollOff = (ForTheRecord.Entities.Tuning.RollOff)dvbSChannel.Rolloff, + SID = dvbSChannel.ServiceId, + SignalPolarisation = (ForTheRecord.Entities.Tuning.SignalPolarisation)dvbSChannel.Polarisation, + SymbolRate = dvbSChannel.SymbolRate, + TSID = dvbSChannel.TransportId + }; + } + else + { + var dvbCChannel = channel as TvLibrary.Channels.DVBCChannel; + if (dvbCChannel != null) + { + result = new ServiceTuning() + { + CardType = Entities.Tuning.CardType.DvbC, + Frequency = (int)dvbCChannel.Frequency, + Modulation = (ForTheRecord.Entities.Tuning.Modulation)dvbCChannel.ModulationType, + Name = dvbCChannel.Name, + ONID = dvbCChannel.NetworkId, + ProviderName = dvbCChannel.Provider, + IsFreeToAir = dvbCChannel.FreeToAir, + SID = dvbCChannel.ServiceId, + SymbolRate = dvbCChannel.SymbolRate, + TSID = dvbCChannel.TransportId + }; + } + else + { + var dvbTChannel = channel as TvLibrary.Channels.DVBTChannel; + if (dvbTChannel != null) + { + result = new ServiceTuning() + { + CardType = Entities.Tuning.CardType.DvbT, + Frequency = (int)dvbTChannel.Frequency, + Bandwidth = dvbTChannel.BandWidth, + Name = dvbTChannel.Name, + ONID = dvbTChannel.NetworkId, + ProviderName = dvbTChannel.Provider, + IsFreeToAir = dvbTChannel.FreeToAir, + SID = dvbTChannel.ServiceId, + TSID = dvbTChannel.TransportId + }; + } + else + { + var atscChannel = channel as TvLibrary.Channels.ATSCChannel; + if (atscChannel != null) + { + result = new ServiceTuning() + { + CardType = Entities.Tuning.CardType.Atsc, + Frequency = (int)atscChannel.Frequency, + MajorChannel = atscChannel.MajorChannel, + MinorChannel = atscChannel.MinorChannel, + Name = atscChannel.Name, + PhysicalChannel = atscChannel.PhysicalChannel, + ProviderName = atscChannel.Provider, + IsFreeToAir = atscChannel.FreeToAir, + SID = atscChannel.ServiceId, + TSID = atscChannel.TransportId + }; + } + else + { + var analogChannel = channel as TvLibrary.Implementations.AnalogChannel; + if (analogChannel != null) + { + result = new ServiceTuning() + { + CardType = Entities.Tuning.CardType.Analog, + Frequency = (int)analogChannel.Frequency, + Name = analogChannel.Name, + IsFreeToAir = analogChannel.FreeToAir, + PhysicalChannel = analogChannel.ChannelNumber + }; + } + else + { + var dvbIPChannel = channel as TvLibrary.Channels.DVBIPChannel; + if (dvbIPChannel != null) + { + result = new ServiceTuning() + { + CardType = Entities.Tuning.CardType.DvbIP, + Url = dvbIPChannel.Url, + Name = dvbIPChannel.Name, + ProviderName = dvbIPChannel.Provider, + IsFreeToAir = dvbIPChannel.FreeToAir + }; + } + } + } + } + } + } + + if (result != null) + { + result.SignalQuality = TvServerPlugin.TvController_SignalQuality(tve3User.CardId); + result.SignalStrength = TvServerPlugin.TvController_SignalLevel(tve3User.CardId); + } + } + } + + return result; + } + #endregion #region TeleText Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Properties/AssemblyInfo.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -12,7 +12,7 @@ [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("For The Record")] [assembly: AssemblyProduct("ForTheRecord.RecorderTuners.MediaPortalTvServer")] -[assembly: AssemblyCopyright("Copyright © For The Record 2007-2011")] +[assembly: AssemblyCopyright("Copyright © For The Record 2007-2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -37,4 +37,4 @@ [assembly: AssemblyFileVersion(ForTheRecord.Entities.Constants.AssemblyVersion)] // MediaPortal version -[assembly: CompatibleVersion("1.1.7.0")] +[assembly: CompatibleVersion("1.2.0.0")] Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/RecordingThread.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -135,7 +135,7 @@ return null; } - if (TvServerPlugin.TvController_StartRecording(ref _tve3User, ref _tve3RecordingFileName, false, 0) != TvResult.Succeeded) + if (TvServerPlugin.TvController_StartRecording(ref _tve3User, ref _tve3RecordingFileName) != TvResult.Succeeded) { errorMessage = "TV Server failed to start recording on channel " + _channel.DisplayName; return null; Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SettingName.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/SetupForm.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/TvServerPlugin.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -614,11 +614,11 @@ } } - public static TvResult TvController_StartRecording(ref IUser user, ref string fileName, bool contentRecording, long startTime) + public static TvResult TvController_StartRecording(ref IUser user, ref string fileName) { lock (_tvControllerLock) { - return _controller.StartRecording(ref user, ref fileName, contentRecording, startTime); + return _controller.StartRecording(ref user, ref fileName); } } @@ -686,6 +686,14 @@ } } + public static IChannel TvController_CurrentChannel(IUser user) + { + lock (_tvControllerLock) + { + return _controller.CurrentChannel(ref user); + } + } + public static void TvController_HeartBeat(IUser user) { lock (_tvControllerLock) @@ -750,6 +758,22 @@ } } + public static int TvController_SignalLevel(int cardId) + { + lock (_tvControllerLock) + { + return _controller.SignalLevel(cardId); + } + } + + public static int TvController_SignalQuality(int cardId) + { + lock (_tvControllerLock) + { + return _controller.SignalQuality(cardId); + } + } + #endregion } } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Utility.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify @@ -283,6 +283,12 @@ { return true; } + if (tuning.ChannelType == 0 // Analog + && tuning.ChannelType == otherTuning.ChannelType + && tuning.IdChannel == otherTuning.IdChannel) + { + return true; + } } return false; } Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/FinishPage.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsContext.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPage.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsPageBase.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/ImportChannels/ImportChannelsWizard.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardForm.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Modified: trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.RecorderTuners.MediaPortalTvServer/Wizards/WizardPage.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2011 For The Record + * Copyright (C) 2007-2012 For The Record * http://www.4therecord.eu * * This Program is free software; you can redistribute it and/or modify Deleted: trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs =================================================================== --- trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2012-07-11 10:05:47 UTC (rev 4499) +++ trunk/plugins/ForTheRecord/ForTheRecord.UI.MediaPortal/ActiveRecordings.cs 2012-07-16 07:23:33 UTC (rev 4500) @@ -1,637 +0,0 @@ -#region Copyright (C) 2005-2008 Team MediaPortal - -/* - * Copyright (C) 2005-2008 Team MediaPortal - * http://www.team-mediaportal.com - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU Make; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#endregion - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Threading; - -using MediaPortal.Dialogs; -using MediaPortal.GUI.Library; -using MediaPortal.Player; -using MediaPortal.Services; -using MediaPortal.Threading; -using MediaPortal.Util; -using MediaPortal.Configuration; -using Action = MediaPortal.GUI.Library.Action; - -using ForTheRecord.Entities; -using ForTheRecord.ServiceAgents; -using ForTheRecord.ServiceContracts; -using ForTheRecord.UI.Process.Recordings; - -namespace ForTheRecord.UI.MediaPortal -{ - public class ActiveRecordings : GUIWindow, IComparer<GUIListItem> - { - #region variables - - private enum SortMethod - { - Channel = 0, - Date = 1, - Name = 2, - Genre = 3, - Played = 4, - Duration = 5 - } - - private SortMethod _currentSortMethod = SortMethod.Date; - - private bool _sortAscending = true; - private int _selectedItemIndex; - - [SkinControl(10)] - protected GUIListControl _viewsList; - - #endregion - - public ActiveRecordings() - { - GetID = (int)WindowId.ActiveRecordings; - } - - #region Service Agents - - private TvSchedulerServiceAgent _tvSchedulerAgent; - - public ITvSchedulerService TvSchedulerAgent - { - get - { - if (_tvSchedulerAgent == null) - { - _tvSchedulerAgent = new TvSchedulerServiceAgent(); - } - return _tvSchedulerAgent; - } - } - - private TvGuideServiceAgent _tvGuideAgent; - - public ITvGuideService TvGuideAgent - { - get - { - if (_tvGuideAgent == null) - { - _tvGuideAgent = new TvGuideServiceAgent(); - } - return _tvGuideAgent; - } - } - - private TvControlServiceAgent _tvControlAgent; - - public ITvControlService TvControlAgent - { - get - { - if (_tvControlAgent == null) - { - _tvControlAgent = new TvControlServiceAgent(); - } - return _tvControlAgent; - } - } - - private ConfigurationServiceAgent _configurationAgent; - - public IConfigurationService ConfigurationAgent - { - get - { - if (_configurationAgent == null) - { - _configurationAgent = new ConfigurationServiceAgent(); - } - return _configurationAgent; - } - } - - #endregion - - public override void OnAdded() - { - Log.Info("ActiveRecordings:OnAdded"); - Restore(); - PreInit(); - ResetAllControls(); - } - - public override bool IsTv - { - get { return true; } - } - - #region Serialisation - - private void LoadSettings() - { - } - - private void SaveSettings() - { - } - - #endregion - - #region overrides - - public override bool Init() - { - bool bResult = Load(GUIGraphicsContext.Skin + @"\4TR_Active.xml"); - LoadSettings(); - Restore(); - PreInit(); - ResetAllControls(); - return bResult; - } - - public override void OnAction(Action action) - { - switch (action.wID) - { - case Action.ActionType.ACTION_DELETE_ITEM: - { - int itemIndex = GetSelectedItemNo(); - if (itemIndex >= 0) - { - OnAbortRecording(GetItem(itemIndex)); - } - } - break; - } - base.OnAction(action); - } - - protected override void OnPageDestroy(int newWindowId) - { - _selectedItemIndex = GetSelectedItemNo(); - SaveSettings(); - if (_tvSchedulerAgent != null) - { - _tvSchedulerAgent.Dispose(); - } - if (_tvGuideAgent != null) - { - _tvGuideAgent.Dispose(); - } - if (_tvControlAgent != null) - { - _tvControlAgent.Dispose(); - } - if (_configurationAgent != null) - { - _configurationAgent.Dispose(); - } - base.OnPageDestroy(newWindowId); - } - - protected override void OnPageLoad() - { - base.OnPageLoad(); - - LoadSettings(); - LoadActiveRecordings(); - - GUIControl.FocusControl(GetID, 10); - - //_sortByButton.SortChanged += new SortEventHandler(SortChanged); - } - - protected override void OnClicked(int controlId, GUIControl control, global::MediaPortal.GUI.Library.Action.ActionType actionType) - { - base.OnClicked(controlId, control, actionType); - - if (control == _viewsList) - { - GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_ITEM_SELECTED, GetID, 0, control.GetID, 0, 0, null); - OnMessage(msg); - int iItem = (int)msg.Param1; - if (actionType == Action.ActionType.ACTION_SELECT_ITEM) - { - OnPlayRecording(iItem); - } - if (actionType == Action.ActionType.ACTION_SHOW_INFO) - { - OnShowContextMenu(); - } - } - } - - public override bool OnMessage(GUIMessage message) - { - switch (message.Message) - { - case GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS_CHANGED: - UpdateProperties(); - break; - } - return base.OnMessage(message); - } - - protected override void OnShowContextMenu() - { - int iItem = GetSelectedItemNo(); - GUIListItem pItem = GetItem(iItem); - if (pItem == null) return; - if (pItem.IsFolder) return; - ActiveRecording activeRecording = pItem.TVTag as ActiveRecording; - if (activeRecording != null) - { - GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU); - if (dlg == null) return; - dlg.Reset(); - dlg.SetHeading(activeRecording.Program.Title); - dlg.AddLocalizedString(655); //Play recorded tv - dlg.AddLocalizedString(1449); //Stop recording - dlg.DoModal(GetID); - switch (dlg.SelectedId) - { - case 655: // Play - PlayRecording(activeRecording, false); - break; - - case 1449: // Abort - OnAbortRecording(pItem); - break; - } - } - } - - private void OnAbortRecording(GUIListItem item) - { - if (item == null) return; - ActiveRecording activeRecording = item.TVTag as ActiveRecording; - if (activeRecording != null) - { - GUIDialogYesNo dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO); - if (dlgYesNo != null) - { - UpcomingProgram program = activeRecording.Program; - - dlgYesNo.SetHeading(Utility.GetLocalizedText(TextId.StopRecording)); - dlgYesNo.SetLine(1, program.Channel.DisplayName); - dlgYesNo.SetLine(2, program.Title); - dlgYesNo.SetLine(3, string.Empty); - dlgYesNo.SetDefaultToYes(false); - dlgYesNo.DoModal(GetID); - - if (dlgYesNo.IsConfirmed) - { - this.TvSchedulerAgent.CancelUpcomingProgram(program.ScheduleId, program.GuideProgramId, - program.Channel.ChannelId, program.StartTime); - _viewsList.ListItems.Remove(item); - GUIControl.RefreshControl(GetID, _viewsList.GetID); - UpdateProperties(); - _selectedItemIndex = GetSelectedItemNo(); - } - } - } - } - - private bool OnPlayRecording(int itemIndex) - { - GUIListItem item = GetItem(itemIndex); - if (item == null) return false; - - ActiveRecording activeRecording = item.TVTag as ActiveRecording; - if (activeRecording != null) - { - return PlayRecording(activeRecording, false); - } - return false; - } - - internal static bool PlayRecording(ActiveRecording activeRecording, bool jumpToLivePoint) - { - using (TvControlServiceAgent tvControlAgent = new TvControlServiceAgent()) - { - Recording recording = tvControlAgent.GetRecordingById(activeRecording.RecordingId); - if (recording != null) - { - int? jumpTo = null; - if (jumpToLivePoint) - { - TimeSpan duration = DateTime.Now - activeRecording.RecordingStartTime; - jumpTo = (int)duration.TotalSeconds - 3; - } - RecordedBase.PlayRecording(recording, jumpTo); - return true; - } - return false; - } - } - - public override void Process() - { - base.Process(); - } - - #endregion - - #region recording methods - - private void LoadActiveRecordings() - { - string strDefaultUnseenIcon = GUIGraphicsContext.Skin + @"\Media\defaultVideoBig.png"; - string strDefaultSeenIcon = GUIGraphicsContext.Skin + @"\Media\defaultVideoSeenBig.png"; - GUIControl.ClearControl(GetID, _viewsList.GetID); - - List<ActiveRecording> activeRecordings = new List<ActiveRecording>( - this.TvControlAgent.GetActiveRecordings()); - foreach (ActiveRecording recording in activeRecordings) - { - GUIListItem item = CreateListItem(recording); - _viewsList.Add(item); - } - - GUIPropertyManager.SetProperty("#itemcount", _viewsList.Count.ToString()); - GUIPropertyManager.SetProperty("#currentmodule", Utility.GetLocalizedText(TextId.ActiveRecordings)); - - UpdateButtonStates(); // OnSort(); - UpdateProperties(); - - if (GetItemCount() > 0) - { - while (_selectedItemIndex >= GetItemCount() && _selectedItemIndex > 0) - { - _selectedItemIndex--; - } - GUIControl.SelectItemControl(GetID, _viewsList.GetID, _selectedItemIndex); - } - } - - private GUIListItem CreateListItem(ActiveRecording activeRecording) - { - GUIListItem item = new GUIListItem(); - string title = activeRecording.Program.CreateProgramTitle(); - item.Label = title; - //item.OnItemSelected += new global::MediaPortal.GUI.Library.GUIListItem.ItemSelectedHandler(item_OnItemSelected); - string logoImagePath = Utility.GetLogoImage(activeRecording.Program.Channel, TvSchedulerAgent); - if (logoImagePath == null - || !System.IO.File.Exists(logoImagePath)) - { - item.Label = String.Format("[{0}] {1}", activeRecording.Program.Channel.DisplayName, title); - logoImagePath = "defaultVideoBig.png"; - } - item.PinImage = Utility.GetIconImageFileName(activeRecording); - item.TVTag = activeRecording; - item.ThumbnailImage = logoImagePath; - item.IconImageBig = logoImagePath; - item.IconImage = logoImagePath; - item.Label2 = String.Format("{0} {1} - {2}", Utility.GetShortDayDateString(activeRecording.Program.StartTime), - activeRecording.Program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), - activeRecording.Program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); - return item; - } - - private void UpdateButtonStates() - { - //_sortByButton.IsAscending = _sortAscending; - _viewsList.IsVisible = true; - } - - private void UpdateProperties() - { - ActiveRecording recording = null; - GUIListItem item = GetItem(GetSelectedItemNo()); - if (item != null) - { - recording = item.TVTag as ActiveRecording; - } - SetProperties(recording); - } - - private void SetProperties(ActiveRecording recording) - { - if (recording == null) - { - GUIPropertyManager.SetProperty("#TV.Active.Channel", String.Empty); - GUIPropertyManager.SetProperty("#TV.Active.Title", String.Empty); - GUIPropertyManager.SetProperty("#TV.Active.Genre", String.Empty); - GUIPropertyManager.SetProperty("#TV.Active.Time", String.Empty); - GUIPropertyManager.SetProperty("#TV.Active.Description", " "); - GUIPropertyManager.SetProperty("#TV.Active.thumb", String.Empty); - } - else - { - GuideProgram guideProgram = recording.Program.GuideProgramId.HasValue ? - this.TvGuideAgent.GetProgramById(recording.Program.GuideProgramId.Value) : null; - - string strTime = string.Format("{0} {1} - {2}", - Utility.GetShortDayDateString(recording.Program.StartTime), - recording.Program.StartTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat), - recording.Program.StopTime.ToString("t", CultureInfo.CurrentCulture.DateTimeFormat)); - - GUIPropertyManager.SetProperty("#TV.Active.Channel", recording.Program.Channel.DisplayName); - GUIPropertyManager.SetProperty("#TV.Active.Title", recording.Program.Title); - GUIPropertyManager.SetProperty("#TV.Active.Genre", recording.Program.Category); - GUIPropertyManager.SetProperty("#TV.Active.Time", strTime); - string description; - if (guideProgram == null) - { - description = String.Empty; - } - else - { - description = guideProgram.CreateCombinedDescription(true); - } - GUIPropertyManager.SetProperty("#TV.Active.Description", description); - - string logo = Utility.GetLogoImage(recording.Program.Channel.ChannelId, - recording.Program.Channel.DisplayName, TvSchedulerAgent); - if (System.IO.File.Exists(... [truncated message content] |