Skip to content

Commit

Permalink
Initial implementation for tv guide genre and coloring Configuration …
Browse files Browse the repository at this point in the history
…tool page.
  • Loading branch information
ajp8164 committed Jan 11, 2012
1 parent 68c42fe commit 4454356
Show file tree
Hide file tree
Showing 35 changed files with 4,352 additions and 142 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="TvLibrary.Utils">
<HintPath>..\..\TvLibrary.Utils\bin\Release\TvLibrary.Utils.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\..\Common-MP-TVE3\SolutionInfo.cs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="TvLibrary.Utils">
<HintPath>..\..\TvLibrary.Utils\bin\Release\TvLibrary.Utils.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Common-MP-TVE3\Common.Utils\Common.Utils.csproj">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@
<Name>System.Windows.Forms</Name>
</Reference>
<Reference Include="System.Xml" />
<Reference Include="TvLibrary.Utils">
<HintPath>..\..\..\TvLibrary.Utils\bin\Release\TvLibrary.Utils.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\..\..\Common-MP-TVE3\SolutionInfo.cs">
Expand Down
3 changes: 3 additions & 0 deletions TvEngine3/TVLibrary/Plugins/TvMovie/TvMovie.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
<Reference Include="System.Xml">
<Private>False</Private>
</Reference>
<Reference Include="TvLibrary.Utils">
<HintPath>..\..\TvLibrary.Utils\bin\Release\TvLibrary.Utils.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\..\Common-MP-TVE3\SolutionInfo.cs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public bool Load(PlayList playlist, string fileName)
string infoLine = ReadInfoLine(node, file);
int duration = ReadLength(node);

Utils.GetQualifiedFilename(basePath, ref file);
SetupTv.Utils.GetQualifiedFilename(basePath, ref file);
PlayListItem newItem = new PlayListItem(infoLine, file, duration);
playlist.Add(newItem);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ private bool AddItem(string songName, int duration, string fileName)
}
else
{
Utils.GetQualifiedFilename(basePath, ref fileName);
SetupTv.Utils.GetQualifiedFilename(basePath, ref fileName);
newItem.FileName = fileName;
newItem.Type = PlayListItem.PlayListItemType.Audio;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public bool Load(PlayList playlist, string fileName)
PlayListItem newItem = new PlayListItem(infoLine, fileName, duration);
if (tmp.IndexOf("http:") < 0 && tmp.IndexOf("mms:") < 0 && tmp.IndexOf("rtp:") < 0)
{
Utils.GetQualifiedFilename(basePath, ref fileName);
SetupTv.Utils.GetQualifiedFilename(basePath, ref fileName);
newItem.Type = PlayListItem.PlayListItemType.AudioStream;
}
playlist.Add(newItem);
Expand Down
3 changes: 3 additions & 0 deletions TvEngine3/TVLibrary/SetupTv/SetupTv.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@
<Reference Include="System.Web.Services" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="TvLibrary.Utils">
<HintPath>..\TvLibrary.Utils\bin\Release\TvLibrary.Utils.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\Common-MP-TVE3\SolutionInfo.cs">
Expand Down
6 changes: 6 additions & 0 deletions TvEngine3/TVLibrary/TvControl/Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,12 @@ void GetAllRecordingChannels(out List<int> currentRecChannels, out List<int> cur
/// <value>The server ip adresses.</value>
List<string> ServerIpAdresses { get; }

/// <summary>
/// Returns an ordered, distict list of all program genres.
/// </summary>
/// <returns></returns>
IList<string> GetGenres();

#endregion

#region streaming
Expand Down
6 changes: 0 additions & 6 deletions TvEngine3/TVLibrary/TvControl/TvControl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\Common-MP-TVE3\OsInfo\OSInfo.cs">
<Link>OSInfo.cs</Link>
</Compile>
<Compile Include="..\..\..\Common-MP-TVE3\OsInfo\OSPrerequisites.cs">
<Link>OSPrerequisites.cs</Link>
</Compile>
<Compile Include="..\..\..\Common-MP-TVE3\SolutionInfo.cs">
<Link>SolutionInfo.cs</Link>
</Compile>
Expand Down
17 changes: 17 additions & 0 deletions TvEngine3/TVLibrary/TvControl/TvServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,23 @@ public void GetAllRecordingChannels(out List<int> currentRecChannels, out List<i
}
}

/// <summary>
/// Returns an ordered, distict list of all program genres.
/// </summary>
/// <returns></returns>
public IList<string> GetGenres()
{
try
{
return RemoteControl.Instance.GetGenres();
}
catch (Exception)
{
HandleFailure();
}
return new List<string>();
}

#endregion
}
}
7 changes: 7 additions & 0 deletions TvEngine3/TVLibrary/TvLibrary.Utils/TvLibrary.Utils.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,18 @@
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\Common-MP-TVE3\OsInfo\OSInfo.cs">
<Link>OSInfo.cs</Link>
</Compile>
<Compile Include="..\..\..\Common-MP-TVE3\OsInfo\OSPrerequisites.cs">
<Link>OSPrerequisites.cs</Link>
</Compile>
<Compile Include="..\..\..\Common-MP-TVE3\SolutionInfo.cs">
<Link>SolutionInfo.cs</Link>
</Compile>
Expand Down
30 changes: 30 additions & 0 deletions TvEngine3/TVLibrary/TvPlugin/TvPlugin.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,36 +19,66 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Utils", "..\..\..\Co
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{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}.Debug|x86.ActiveCfg = Debug|x86
{1526A789-1DE2-4A8B-AA4B-5382A617C4F8}.Debug|x86.Build.0 = Debug|x86
{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
{1526A789-1DE2-4A8B-AA4B-5382A617C4F8}.Release|x86.ActiveCfg = Release|x86
{1526A789-1DE2-4A8B-AA4B-5382A617C4F8}.Release|x86.Build.0 = Release|x86
{0DB878C6-1B68-4DC5-B6EF-564B7C08486F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0DB878C6-1B68-4DC5-B6EF-564B7C08486F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0DB878C6-1B68-4DC5-B6EF-564B7C08486F}.Debug|x86.ActiveCfg = Debug|x86
{0DB878C6-1B68-4DC5-B6EF-564B7C08486F}.Debug|x86.Build.0 = Debug|x86
{0DB878C6-1B68-4DC5-B6EF-564B7C08486F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0DB878C6-1B68-4DC5-B6EF-564B7C08486F}.Release|Any CPU.Build.0 = Release|Any CPU
{0DB878C6-1B68-4DC5-B6EF-564B7C08486F}.Release|x86.ActiveCfg = Release|x86
{0DB878C6-1B68-4DC5-B6EF-564B7C08486F}.Release|x86.Build.0 = Release|x86
{AE752FB4-7450-4150-9BAD-19EFA9D2AC37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AE752FB4-7450-4150-9BAD-19EFA9D2AC37}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AE752FB4-7450-4150-9BAD-19EFA9D2AC37}.Debug|x86.ActiveCfg = Debug|x86
{AE752FB4-7450-4150-9BAD-19EFA9D2AC37}.Debug|x86.Build.0 = Debug|x86
{AE752FB4-7450-4150-9BAD-19EFA9D2AC37}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AE752FB4-7450-4150-9BAD-19EFA9D2AC37}.Release|Any CPU.Build.0 = Release|Any CPU
{AE752FB4-7450-4150-9BAD-19EFA9D2AC37}.Release|x86.ActiveCfg = Release|x86
{AE752FB4-7450-4150-9BAD-19EFA9D2AC37}.Release|x86.Build.0 = Release|x86
{0FD8DEAE-37A4-49CC-A7BE-E86E0E0D85BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0FD8DEAE-37A4-49CC-A7BE-E86E0E0D85BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0FD8DEAE-37A4-49CC-A7BE-E86E0E0D85BD}.Debug|x86.ActiveCfg = Debug|x86
{0FD8DEAE-37A4-49CC-A7BE-E86E0E0D85BD}.Debug|x86.Build.0 = Debug|x86
{0FD8DEAE-37A4-49CC-A7BE-E86E0E0D85BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0FD8DEAE-37A4-49CC-A7BE-E86E0E0D85BD}.Release|Any CPU.Build.0 = Release|Any CPU
{0FD8DEAE-37A4-49CC-A7BE-E86E0E0D85BD}.Release|x86.ActiveCfg = Release|x86
{0FD8DEAE-37A4-49CC-A7BE-E86E0E0D85BD}.Release|x86.Build.0 = Release|x86
{58C35C9D-F18D-40F2-8024-24E50D01E9C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{58C35C9D-F18D-40F2-8024-24E50D01E9C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{58C35C9D-F18D-40F2-8024-24E50D01E9C5}.Debug|x86.ActiveCfg = Debug|x86
{58C35C9D-F18D-40F2-8024-24E50D01E9C5}.Debug|x86.Build.0 = Debug|x86
{58C35C9D-F18D-40F2-8024-24E50D01E9C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{58C35C9D-F18D-40F2-8024-24E50D01E9C5}.Release|Any CPU.Build.0 = Release|Any CPU
{58C35C9D-F18D-40F2-8024-24E50D01E9C5}.Release|x86.ActiveCfg = Release|x86
{58C35C9D-F18D-40F2-8024-24E50D01E9C5}.Release|x86.Build.0 = Release|x86
{CE009BFA-5EF6-4153-B2A1-2FA79698A9AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CE009BFA-5EF6-4153-B2A1-2FA79698A9AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CE009BFA-5EF6-4153-B2A1-2FA79698A9AE}.Debug|x86.ActiveCfg = Debug|x86
{CE009BFA-5EF6-4153-B2A1-2FA79698A9AE}.Debug|x86.Build.0 = Debug|x86
{CE009BFA-5EF6-4153-B2A1-2FA79698A9AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CE009BFA-5EF6-4153-B2A1-2FA79698A9AE}.Release|Any CPU.Build.0 = Release|Any CPU
{CE009BFA-5EF6-4153-B2A1-2FA79698A9AE}.Release|x86.ActiveCfg = Release|x86
{CE009BFA-5EF6-4153-B2A1-2FA79698A9AE}.Release|x86.Build.0 = Release|x86
{F6EDA1F3-3DCD-43F4-8A90-E32DA70C8227}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F6EDA1F3-3DCD-43F4-8A90-E32DA70C8227}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F6EDA1F3-3DCD-43F4-8A90-E32DA70C8227}.Debug|x86.ActiveCfg = Debug|x86
{F6EDA1F3-3DCD-43F4-8A90-E32DA70C8227}.Debug|x86.Build.0 = Debug|x86
{F6EDA1F3-3DCD-43F4-8A90-E32DA70C8227}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F6EDA1F3-3DCD-43F4-8A90-E32DA70C8227}.Release|Any CPU.Build.0 = Release|Any CPU
{F6EDA1F3-3DCD-43F4-8A90-E32DA70C8227}.Release|x86.ActiveCfg = Release|x86
{F6EDA1F3-3DCD-43F4-8A90-E32DA70C8227}.Release|x86.Build.0 = Release|x86
EndGlobalSection
Expand Down
54 changes: 30 additions & 24 deletions TvEngine3/TVLibrary/TvPlugin/TvPlugin/TvGuideBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,22 +152,26 @@ private void LoadSettings()
_guideContinuousScroll = xmlreader.GetValueAsBool("mytv", "continuousScrollGuide", false);
_loopDelay = xmlreader.GetValueAsInt("gui", "listLoopDelay", 0);

// Load the genre map. All of the genre names to load are in a csv list.
String genreNames = xmlreader.GetValueAsString("genremap", "genrenames", String.Empty);
_genreList = new List<string>(genreNames.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
// Load the genre map.
if (_genreMap.Count == 0)
{
LoadGenreMap(xmlreader);
}

// Special genre rules.
_specifyMpaaRatedAsMovie = xmlreader.GetValueAsBool("genremap", "specifympaaratedasmovie", false);
_specifyMpaaRatedAsMovie = xmlreader.GetValueAsBool("genreoptions", "specifympaaratedasmovie", false);
}

// Load settings defined by the skin.
LoadSkinSettings();

// If guide colors were not loaded from skin settings then attempt to load guide colors from the MP settings.
// Load genre colors.
// If guide colors are not loaded from skin settings then attempt to load guide colors from the MP settings.
using (Settings xmlreader = new SKSettings())
{
_guideColorsLoaded = LoadGuideColors(xmlreader);
}

if (!_guideColorsLoaded)
{
using (Settings xmlreader = new MPSettings())
Expand Down Expand Up @@ -211,34 +215,35 @@ protected override void LoadSkinSettings()
{
_useColorsForGenres = bool.Parse(temp);
}

if (!_guideColorsLoaded)
{
using (Settings xmlreader = new SKSettings())
{
_guideColorsLoaded = LoadGuideColors(xmlreader);
}
}
}

private bool LoadGenreMap(Settings xmlreader)
{
string genre;
List<string> programGenres;
IDictionary<string, string> allGenres = xmlreader.GetSection<string>("genrenames");

// Each genre map entry is a csv list of "program" genre names (those that may be compared with the genre from the program listings).
// It is an error if a single "program" genre is mapped to more than one genre color category; behavior is undefined for this condition.
List<string> programGenres;
foreach (string genre in _genreList)
var enumerator = allGenres.GetEnumerator();
if (enumerator != null)
{
programGenres = new List<string>((xmlreader.GetValueAsString("genremap", genre, String.Empty)).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));

foreach (string programGenre in programGenres)
while (enumerator.MoveNext())
{
try
{
_genreMap.Add(programGenre, genre);
}
catch (ArgumentException)
genre = enumerator.Current.Key;
_genreList.Add(genre);
programGenres = new List<string>(enumerator.Current.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));

foreach (string programGenre in programGenres)
{
Log.Warn("TvGuideBase.cs: The following genre name appears more than once in the genre map: {0}", programGenre);
try
{
_genreMap.Add(programGenre, genre);
}
catch (ArgumentException)
{
Log.Warn("TvGuideBase.cs: The following genre name appears more than once in the genre map: {0}", programGenre);
}
}
}
}
Expand Down Expand Up @@ -280,6 +285,7 @@ private bool LoadGuideColors(Settings xmlreader)
// Each genre color entry is a csv list. The first value is the color for program "on now", the second value is for program "on later".
// If only one value is provided then that value is used for both.
long color0;

foreach (string genre in _genreList)
{
temp = new List<string>((xmlreader.GetValueAsString("tvguidecolors", genre, String.Empty)).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
Expand Down
10 changes: 10 additions & 0 deletions TvEngine3/TVLibrary/TvService/TVController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2161,6 +2161,16 @@ public List<EpgChannel> Epg(int cardId)
return _cards[cardId].Epg.Epg;
}

/// <summary>
/// Returns an ordered, distict list of all program genres.
/// </summary>
/// <returns></returns>
public IList<string> GetGenres()
{
TvBusinessLayer layer = new TvBusinessLayer();
return layer.GetGenres();
}

/// <summary>
/// Deletes the recording from database and disk
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions TvEngine3/TVLibrary/TvService/TvService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="TvLibrary.Utils">
<HintPath>..\TvLibrary.Utils\bin\Release\TvLibrary.Utils.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\Common-MP-TVE3\SolutionInfo.cs">
Expand Down
18 changes: 18 additions & 0 deletions mediaportal/Configuration/MediaPortal.Configuration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="WinCustomControls\WinCustomControls.csproj">
<Project>{49DFF256-09FD-4598-A3E8-855753E2A1FC}</Project>
<Name>WinCustomControls</Name>
</ProjectReference>
<Reference Include="Bass.Net, Version=2.3.1.1, Culture=neutral, PublicKeyToken=b7566c273e6ef480, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\MediaPortal.Base\Bass.Net.dll</HintPath>
Expand Down Expand Up @@ -243,6 +247,10 @@
<Project>{6DA0E4DF-6230-4642-98B5-E690BB6942BB}</Project>
<Name>Utils</Name>
</ProjectReference>
<Reference Include="TvControl, Version=1.2.0.0, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\TvEngine3\TVLibrary\TvControl\bin\Release\TvControl.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\Common-MP-TVE3\SolutionInfo.cs">
Expand Down Expand Up @@ -362,6 +370,9 @@
<Compile Include="SettingsForm.Designer.cs">
<DependentUpon>SettingsForm.cs</DependentUpon>
</Compile>
<Compile Include="Subdialogs\DlgAddGenre.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Subdialogs\DlgMpcSubs.cs">
<SubType>Form</SubType>
</Compile>
Expand Down Expand Up @@ -658,6 +669,9 @@
<DependentUpon>DVDZoom.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Sections\MusicShares.resx">
<DependentUpon>MusicShares.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Sections\TVDebugOptions.resx">
<DependentUpon>TVDebugOptions.cs</DependentUpon>
<SubType>Designer</SubType>
Expand Down Expand Up @@ -710,6 +724,10 @@
<SubType>Designer</SubType>
<DependentUpon>SettingsForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Subdialogs\DlgAddGenre.resx">
<DependentUpon>DlgAddGenre.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Subdialogs\DlgMpcSubs.resx">
<DependentUpon>DlgMpcSubs.cs</DependentUpon>
<SubType>Designer</SubType>
Expand Down
Loading

0 comments on commit 4454356

Please sign in to comment.