From: <wie...@us...> - 2008-03-25 21:21:45
|
Revision: 1526 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=1526&view=rev Author: wiesener Date: 2008-03-25 14:21:38 -0700 (Tue, 25 Mar 2008) Log Message: ----------- Initial commit. Added an option to use the g_player instead of PlayListPlayer in order to get OSD, but this doesn't work too well. Added Paths: ----------- trunk/plugins/NRK Browser/ trunk/plugins/NRK Browser/Nrk.cs trunk/plugins/NRK Browser/NrkBrowser.csproj trunk/plugins/NRK Browser/NrkBrowser.sln trunk/plugins/NRK Browser/NrkBrowser.xml trunk/plugins/NRK Browser/NrkPlugin.cs trunk/plugins/NRK Browser/Properties/ trunk/plugins/NRK Browser/Properties/AssemblyInfo.cs trunk/plugins/NRK Browser/SettingsForm.Designer.cs trunk/plugins/NRK Browser/SettingsForm.cs trunk/plugins/NRK Browser/SettingsForm.resx trunk/plugins/NRK Browser/readme.txt Added: trunk/plugins/NRK Browser/Nrk.cs =================================================================== --- trunk/plugins/NRK Browser/Nrk.cs (rev 0) +++ trunk/plugins/NRK Browser/Nrk.cs 2008-03-25 21:21:38 UTC (rev 1526) @@ -0,0 +1,299 @@ +/* + * Copyright (c) 2008 Terje Wiesener <wie...@sa...> + * + * Loosely based on an anonymous (and slightly outdated) NRK parser in python for Myth-tv, + * please email me if you are the author :) + * + * */ + +using System.Collections.Generic; +using System.Text.RegularExpressions; +using System.Net; +using System.IO; +using System.Text; + +namespace Nrk +{ + #region Helper Classes + + public abstract class Item + { + private string _id; + private string _title; + + public string Title + { + get { return _title; } + } + + public string ID + { + get { return _id; } + } + + public virtual bool Playable + { + get { return false; } + } + + public override string ToString() + { + return "(" + this.GetType().Name + ") " + this.Title; + } + + public Item(string id, string title) + { + _id = id; + _title = title; + } + } + + public class Category : Item + { + public Category(string id, string title) : base(id, title) { } + } + + public class Program : Item + { + public Program(string id, string title) : base(id, title) { } + } + + public class Folder : Item + { + public Folder(string id, string title) : base(id, title) { } + } + + public class Clip : Item + { + public Clip(string id, string title) : base(id, title) { } + + public override bool Playable + { + get { return true; } + } + } + + #endregion + + public class NrkParser + { + static string BASE_URL = "http://www1.nrk.no/"; + static string MAIN_URL = BASE_URL + "nett-tv/"; + static string CATEGORY_URL = MAIN_URL + "tema/"; + static string PROGRAM_URL = MAIN_URL + "prosjekt/"; + static string SETTINGS_URL = MAIN_URL + "innstillinger/"; + static string CLIP_URL = MAIN_URL + "klipp/"; + static string FOLDER_URL = MAIN_URL + "kategori/"; + + CookieContainer _jar; + int _speed; + + public NrkParser(int speed) + { + _jar = new CookieContainer(); + this.Speed = speed; + } + + public int Speed + { + get { return _speed; } + set + { + _speed = value; + FetchUrl(NrkParser.MAIN_URL + "hastighet.aspx?hastighet=" + _speed + "&retururl=http://www1.nrk.no/nett-tv/"); + } + } + + public List<Item> GetCategories() + { + List<Item> categories = new List<Item>(); + string data = FetchUrl(NrkParser.MAIN_URL); + Regex query = new Regex("<a href=\"/nett-tv/tema/(\\w*).*?>(.*?)</a>"); + MatchCollection result = query.Matches(data); + foreach (Match x in result) + { + if (x.Groups[2].Value != "Plusspakken") + { + categories.Add(new Category(x.Groups[1].Value, x.Groups[2].Value)); + } + } + return categories; + } + + public List<Item> GetPrograms(Category category) + { + string data = FetchUrl(NrkParser.CATEGORY_URL + category.ID); + Regex query = new Regex("<a href=\"/nett-tv/prosjekt/(.*?)\" id=\".*?\" title=\"(.*?)\".*?>\\s+<img src=\"(.*?)\" id="); + MatchCollection matches = query.Matches(data); + List<Item> programs = new List<Item>(); + foreach (Match x in matches) + { + programs.Add(new Program(x.Groups[1].Value, x.Groups[2].Value)); + } + return programs; + } + + public List<Item> GetAllPrograms()//all programs + { + string data = FetchUrl(NrkParser.MAIN_URL + "bokstav/@"); + Regex query = new Regex("<a href=\"/nett-tv/prosjekt/(.*?)\" id=\".*?\" title=\"(.*?)\".*?>\\s+<img src=\"(.*?)\" id="); + MatchCollection matches = query.Matches(data); + List<Item> programs = new List<Item>(); + foreach (Match x in matches) + { + programs.Add(new Program(x.Groups[1].Value, x.Groups[2].Value)); + } + return programs; + } + + public List<Item> GetFolders(Program program) + { + string data = FetchUrl(NrkParser.PROGRAM_URL + program.ID); + Regex query = new Regex("<a id=\".*?\" href=\"/nett-tv/kategori/(.*?)\".*?title=\"(.*?)\".*?class=\"icon-(.*?)-black\".*?>(.*?)</a>"); + MatchCollection matches = query.Matches(data); + List<Item> folders = new List<Item>(); + foreach (Match x in matches) + { + folders.Add(new Folder(x.Groups[1].Value, x.Groups[2].Value)); + } + return folders; + } + + public List<Item> GetFolders(Folder folder) + { + string data = FetchUrl(NrkParser.FOLDER_URL + folder.ID); + Regex query = new Regex("<a id=\".*?\" href=\"/nett-tv/kategori/(.*?)\".*?title=\"(.*?)\".*?class=\"icon-(.*?)-black\".*?>(.*?)</a>"); + MatchCollection matches = query.Matches(data); + List<Item> folders = new List<Item>(); + foreach (Match x in matches) + { + folders.Add(new Folder(x.Groups[1].Value, x.Groups[2].Value)); + } + return folders; + } + + public List<Item> GetClips(Program program) + { + string data = FetchUrl(NrkParser.PROGRAM_URL + program.ID); + List<Item> clips = new List<Item>(); + Regex query = new Regex("<a href=\"/nett-tv/klipp/(.*?)\"\\s+title=\"(.*?)\"\\s+class=\"(.*?)\".*?>(.*?)</a>"); + MatchCollection matches = query.Matches(data); + foreach (Match x in matches) + { + clips.Add(new Clip(x.Groups[1].Value, x.Groups[4].Value)); + } + + return clips; + } + + public List<Item> GetClips(Folder folder) + { + string data = FetchUrl(NrkParser.FOLDER_URL + folder.ID); + + List<Item> clips = new List<Item>(); + + Regex query = new Regex("<a href=\"/nett-tv/klipp/(.*?)\"\\s+title=\"(.*?)\"\\s+class=\"(.*?)\".*?>(.*?)</a>"); + MatchCollection matches = query.Matches(data); + foreach (Match x in matches) + { + clips.Add(new Clip(x.Groups[1].Value, x.Groups[4].Value)); + } + + return clips; + } + + public string GetClipUrl(Clip clip) + { + string data = FetchUrl(NrkParser.CLIP_URL + clip.ID); + Regex query = new Regex("<param name=\"FileName\" value=\"(.*?)\" />", RegexOptions.IgnoreCase); + MatchCollection result = query.Matches(data); + string urldata = FetchUrl(result[0].Groups[1].Value); + query = new Regex("<ref href=\"(.*?)\" />"); + MatchCollection movie_url = query.Matches(urldata); + //skip any advertisement + try { return movie_url[1].Groups[0].Value; } + catch { return movie_url[0].Groups[1].Value; } + } + + string FetchUrl(string url) + { + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + request.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"; + request.CookieContainer = _jar; + // Set some reasonable limits on resources used by this request + request.MaximumAutomaticRedirections = 4; + request.MaximumResponseHeadersLength = 4; + // Set credentials to use for this request. + request.Credentials = CredentialCache.DefaultCredentials; + HttpWebResponse response = (HttpWebResponse)request.GetResponse(); + + // Get the stream associated with the response. + Stream receiveStream = response.GetResponseStream(); + + // Pipes the stream to a higher level stream reader with the required encoding format. + StreamReader readStream = new StreamReader(receiveStream, Encoding.UTF8); + + string ret = readStream.ReadToEnd(); + response.Close(); + readStream.Close(); + return ret; + } + + /* Test function. + * Will simply call the different functions and print out the result + */ + public static void Main() + { + NrkParser nrk = new NrkParser(900); + + List<Item> categories = nrk.GetCategories(); + foreach (Item category in categories) + { + System.Console.WriteLine(category.ID + " " + category.Title); + } + System.Console.WriteLine(); + + List<Item> programs = nrk.GetPrograms((Category)categories[1]); + foreach (Program program in programs) + { + System.Console.WriteLine(program.ID + " " + program.Title); + } + System.Console.WriteLine(); + + List<Item> clips = nrk.GetClips((Program)programs[0]);//list episodes + foreach (Clip clip in clips) + { + System.Console.WriteLine(clip.ID + " " + clip.Title); + } + System.Console.WriteLine(); + + List<Item> folders = nrk.GetFolders((Program)programs[0]);//list folders (ie. 2006, january etc) + foreach (Folder folder in folders) + { + System.Console.WriteLine(folder.ID + " " + folder.Title); + } + System.Console.WriteLine(); + + clips = nrk.GetClips((Folder)folders[1]);//list episodes + foreach (Clip clip in clips) + { + System.Console.WriteLine(clip.ID + " " + clip.Title); + } + System.Console.WriteLine(); + + string url = nrk.GetClipUrl((Clip)clips[0]); + System.Console.WriteLine(url); + + programs = nrk.GetAllPrograms();//alphabetical list + foreach (Program program in programs) + { + System.Console.WriteLine(program.ID + " " + program.Title); + } + System.Console.WriteLine(); + + System.Console.WriteLine("Press enter to quit"); + System.Console.Read(); + } + } + +} \ No newline at end of file Added: trunk/plugins/NRK Browser/NrkBrowser.csproj =================================================================== --- trunk/plugins/NRK Browser/NrkBrowser.csproj (rev 0) +++ trunk/plugins/NRK Browser/NrkBrowser.csproj 2008-03-25 21:21:38 UTC (rev 1526) @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.21022</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{DEE2E577-EF83-4FD3-9C3C-360CD3ACB125}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>NrkBrowser</RootNamespace> + <AssemblyName>NrkBrowser</AssemblyName> + <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </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\debug\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="Core, Version=0.2.3.0, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Core.dll</HintPath> + </Reference> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Drawing" /> + <Reference Include="System.Windows.Forms" /> + <Reference Include="System.Xml" /> + <Reference Include="Utils, Version=2.2.2.0, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Utils.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="Nrk.cs" /> + <Compile Include="NrkPlugin.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="SettingsForm.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="SettingsForm.Designer.cs"> + <DependentUpon>SettingsForm.cs</DependentUpon> + </Compile> + </ItemGroup> + <ItemGroup> + <Content Include="NrkBrowser.xml" /> + <Content Include="readme.txt" /> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="SettingsForm.resx"> + <DependentUpon>SettingsForm.cs</DependentUpon> + <SubType>Designer</SubType> + </EmbeddedResource> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\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>copy "$(TargetPath)" "C:\Program Files\Team MediaPortal\MediaPortal\plugins\Windows"</PostBuildEvent> + </PropertyGroup> +</Project> \ No newline at end of file Added: trunk/plugins/NRK Browser/NrkBrowser.sln =================================================================== --- trunk/plugins/NRK Browser/NrkBrowser.sln (rev 0) +++ trunk/plugins/NRK Browser/NrkBrowser.sln 2008-03-25 21:21:38 UTC (rev 1526) @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual C# Express 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NrkBrowser", "NrkBrowser.csproj", "{DEE2E577-EF83-4FD3-9C3C-360CD3ACB125}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DEE2E577-EF83-4FD3-9C3C-360CD3ACB125}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DEE2E577-EF83-4FD3-9C3C-360CD3ACB125}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DEE2E577-EF83-4FD3-9C3C-360CD3ACB125}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DEE2E577-EF83-4FD3-9C3C-360CD3ACB125}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal Added: trunk/plugins/NRK Browser/NrkBrowser.xml =================================================================== --- trunk/plugins/NRK Browser/NrkBrowser.xml (rev 0) +++ trunk/plugins/NRK Browser/NrkBrowser.xml 2008-03-25 21:21:38 UTC (rev 1526) @@ -0,0 +1,15 @@ +<window> + + <define>#header.label:NRK Nett-TV</define> + + <id>40918376</id> + <defaultcontrol>50</defaultcontrol> + <allowoverlay>yes</allowoverlay> + <controls> + <import>common.window.xml</import> + + <!-- importing the default video facade view, with id 50 --> + <import>common.facade.video.xml</import> + + </controls> +</window> \ No newline at end of file Added: trunk/plugins/NRK Browser/NrkPlugin.cs =================================================================== --- trunk/plugins/NRK Browser/NrkPlugin.cs (rev 0) +++ trunk/plugins/NRK Browser/NrkPlugin.cs 2008-03-25 21:21:38 UTC (rev 1526) @@ -0,0 +1,270 @@ +/* + * Copyright (c) 2008 Terje Wiesener <wie...@sa...> + * + * */ +using System; +using System.Collections.Generic; +using System.Text; +using MediaPortal.GUI.Library; +using MediaPortal.Player; +using MediaPortal.Playlists; +using MediaPortal.Profile; + +using Nrk; +using System.Windows.Forms; + + +namespace NrkBrowser +{ + public class NrkPlugin : GUIWindow, ISetupForm + { + + [SkinControlAttribute(50)] + protected GUIFacadeControl facadeView = null; + + protected NrkParser _nrk = null; + protected Stack<Item> _active = null; + protected bool _osdPlayer = true; + + static string configfile = "NrkBrowserSettings.xml"; + + public NrkPlugin() + { + GetID = 40918376; + } + + #region ISetupForm Members + + public string PluginName() + { + return "NRK browser"; + } + + public string Description() + { + return "Plugin for watching NRK nett-tv"; + } + + public string Author() + { + return "Terje Wiesener <wie...@sa...>"; + } + + public void ShowPlugin() + { + SettingsForm form = new SettingsForm(); + Settings settings = new Settings(NrkPlugin.configfile); + int speed = settings.GetValueAsInt("NrkBrowser", "speed", 2048); + if (speed < form.speedUpDown.Minimum) + { + speed = (int)form.speedUpDown.Minimum; + settings.SetValue("NrkBrowser", "speed", speed); + } + if (speed > form.speedUpDown.Maximum) + { + speed = (int)form.speedUpDown.Maximum; + settings.SetValue("NrkBrowser", "speed", speed); + } + form.speedUpDown.Value = speed; + + bool osd = settings.GetValueAsBool("NrkBrowser", "osdPlayer", false); + form.osdPlayerCheckbox.Checked = osd; + + DialogResult res = form.ShowDialog(); + if (res == DialogResult.OK) + { + speed = (int)form.speedUpDown.Value; + settings.SetValue("NrkBrowser", "speed", speed); + osd = form.osdPlayerCheckbox.Checked; + settings.SetValueAsBool("NrkBrowser", "osdPlayer", osd); + } + } + + public bool CanEnable() + { + return true; + } + + public int GetWindowId() + { + return GetID; + //return 40918376; + } + + public bool DefaultEnabled() + { + return true; + } + + public bool HasSetup() + { + return true; + } + + /// <summary> + /// If the plugin should have it's own button on the main menu of Mediaportal then it + /// should return true to this method, otherwise if it should not be on home + /// it should return false + /// </summary> + /// <param name="strButtonText">text the button should have</param> + /// <param name="strButtonImage">image for the button, or empty for default</param> + /// <param name="strButtonImageFocus">image for the button, or empty for default</param> + /// <param name="strPictureImage">subpicture for the button or empty for none</param> + /// <returns>true : plugin needs it's own button on home + /// false : plugin does not need it's own button on home</returns> + + public bool GetHome(out string strButtonText, out string strButtonImage, + out string strButtonImageFocus, out string strPictureImage) + { + strButtonText = PluginName(); + strButtonImage = String.Empty; + strButtonImageFocus = String.Empty; + strPictureImage = GUIGraphicsContext.Skin + @"\media\hover_webbrowser.png"; + return true; + } + + #endregion + + + public override bool Init() + { + bool result = Load(GUIGraphicsContext.Skin + @"\NrkBrowser.xml"); + Settings settings = new Settings(NrkPlugin.configfile); + int speed = settings.GetValueAsInt("NrkBrowser", "speed", 2048); + _nrk = new NrkParser(speed); + _active = new Stack<Item>(); + _osdPlayer = settings.GetValueAsBool("NrkBrowser", "osdPlayer", false); + return result; + } + + protected override void OnPageLoad() + { + if (_active.Count == 0) + { + Activate(null); + } + else + { + Activate(_active.Pop()); + } + } + + protected override void OnPreviousWindow() + { + if (_active.Count <= 0) + { + base.OnPreviousWindow(); + return; + } + _active.Pop();//we do not want to show the active item again + if (_active.Count > 0) Activate(_active.Pop()); + else Activate(null); + } + + protected override void OnClicked(int controlId, GUIControl control, + MediaPortal.GUI.Library.Action.ActionType actionType) + { + if (control == facadeView) ItemSelected(); + base.OnClicked(controlId, control, actionType); + } + + protected void UpdateList(List<Item> newitems) + { + this.facadeView.Clear(); + foreach (Item item in newitems) + { + GUIListItem listitem = new GUIListItem(item.Title); + listitem.TVTag = item; + if (item.Playable) + { + listitem.IconImage = GUIGraphicsContext.Skin + @"\media\defaultVideo.png"; + listitem.IconImageBig = GUIGraphicsContext.Skin + @"\media\defaultVideo.png"; + } + else + { + listitem.IconImage = GUIGraphicsContext.Skin + @"\media\defaultFolder.png"; + listitem.IconImageBig = GUIGraphicsContext.Skin + @"\media\DefaultFolderBig.png"; + } + this.facadeView.Add(listitem); + } + + } + + protected void ItemSelected() + { + Item selecteditem = (Item)facadeView.SelectedListItem.TVTag; + Activate(selecteditem); + } + + protected void Activate(Item item) + { + if (item == null) + { + List<Item> items = _nrk.GetCategories(); + UpdateList(items); + return; + } + + if (item is Clip) + { + PlayClip((Clip)item); + return; + } + + _active.Push(item); + + if (item is Category) + { + UpdateList(_nrk.GetPrograms((Category)item)); + } + if (item is Program) + { + List<Item> items = _nrk.GetClips((Program)item); + items.AddRange(_nrk.GetFolders((Program)item)); + UpdateList(items); + } + if (item is Folder) + { + List<Item> items = _nrk.GetClips((Folder)item); + items.AddRange(_nrk.GetFolders((Folder)item)); + UpdateList(items); + } + } + + protected void PlayClip(Clip item) + { + string url = _nrk.GetClipUrl(item); + PlayListType type; + if (url.EndsWith(".wmv")) type = PlayListType.PLAYLIST_VIDEO_TEMP; + else if (url.EndsWith(".wma")) type = PlayListType.PLAYLIST_RADIO_STREAMS; + //FIXME: Hangs on some audio streams... + else + { + MessageBox.Show("Unknown clip type, please contact author"); + return; + } + + if (_osdPlayer) + { + //FIXME: the g_player doesn't seem to play any of the streams. + //Could it be that it doesn't like the mms:// url? + g_Player.Init(); + if (type == PlayListType.PLAYLIST_VIDEO_TEMP) + g_Player.PlayVideoStream(url, item.Title); + else + g_Player.PlayAudioStream(url, false); + } + else + { + PlayListPlayer playlistPlayer = PlayListPlayer.SingletonPlayer; + playlistPlayer.RepeatPlaylist = false; + PlayList playlist = playlistPlayer.GetPlaylist(type); + playlist.Clear(); + PlayListItem toPlay = new PlayListItem(item.Title, url); + playlist.Add(toPlay); + playlistPlayer.CurrentPlaylistType = type; + playlistPlayer.Play(0); + } + } + } +} Added: trunk/plugins/NRK Browser/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/NRK Browser/Properties/AssemblyInfo.cs (rev 0) +++ trunk/plugins/NRK Browser/Properties/AssemblyInfo.cs 2008-03-25 21:21:38 UTC (rev 1526) @@ -0,0 +1,36 @@ +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("NRK Browser")] +[assembly: AssemblyDescription("Plugin for Media Portal")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("NRK Browser")] +[assembly: AssemblyCopyright("Copyright © Terje Wiesener <wie...@sa...> 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("7c80e1cd-6294-451f-88f1-1622403db953")] + +// 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 Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.1.0")] +[assembly: AssemblyFileVersion("1.0.1.0")] Added: trunk/plugins/NRK Browser/SettingsForm.Designer.cs =================================================================== --- trunk/plugins/NRK Browser/SettingsForm.Designer.cs (rev 0) +++ trunk/plugins/NRK Browser/SettingsForm.Designer.cs 2008-03-25 21:21:38 UTC (rev 1526) @@ -0,0 +1,152 @@ +namespace NrkBrowser +{ + partial class SettingsForm + { + /// <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.saveButton = new System.Windows.Forms.Button(); + this.speedLabel = new System.Windows.Forms.Label(); + this.speedUpDown = new System.Windows.Forms.NumericUpDown(); + this.unitLabel = new System.Windows.Forms.Label(); + this.cancelButton = new System.Windows.Forms.Button(); + this.osdPlayerCheckbox = new System.Windows.Forms.CheckBox(); + this.osdLabel = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.speedUpDown)).BeginInit(); + this.SuspendLayout(); + // + // saveButton + // + this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.saveButton.DialogResult = System.Windows.Forms.DialogResult.OK; + this.saveButton.Location = new System.Drawing.Point(201, 95); + this.saveButton.Name = "saveButton"; + this.saveButton.Size = new System.Drawing.Size(75, 23); + this.saveButton.TabIndex = 0; + this.saveButton.Text = "Save"; + this.saveButton.UseVisualStyleBackColor = true; + // + // speedLabel + // + this.speedLabel.AutoSize = true; + this.speedLabel.Location = new System.Drawing.Point(12, 14); + this.speedLabel.Name = "speedLabel"; + this.speedLabel.Size = new System.Drawing.Size(122, 17); + this.speedLabel.TabIndex = 1; + this.speedLabel.Text = "Connection speed"; + // + // speedUpDown + // + this.speedUpDown.Location = new System.Drawing.Point(157, 12); + this.speedUpDown.Maximum = new decimal(new int[] { + 16384, + 0, + 0, + 0}); + this.speedUpDown.Minimum = new decimal(new int[] { + 300, + 0, + 0, + 0}); + this.speedUpDown.Name = "speedUpDown"; + this.speedUpDown.Size = new System.Drawing.Size(72, 22); + this.speedUpDown.TabIndex = 2; + this.speedUpDown.Value = new decimal(new int[] { + 2048, + 0, + 0, + 0}); + // + // unitLabel + // + this.unitLabel.AutoSize = true; + this.unitLabel.Location = new System.Drawing.Point(235, 17); + this.unitLabel.Name = "unitLabel"; + this.unitLabel.Size = new System.Drawing.Size(34, 17); + this.unitLabel.TabIndex = 3; + this.unitLabel.Text = "kb/s"; + // + // 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(120, 95); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(75, 23); + this.cancelButton.TabIndex = 4; + this.cancelButton.Text = "Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + // + // osdPlayerCheckbox + // + this.osdPlayerCheckbox.AutoSize = true; + this.osdPlayerCheckbox.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.osdPlayerCheckbox.Location = new System.Drawing.Point(156, 43); + this.osdPlayerCheckbox.Name = "osdPlayerCheckbox"; + this.osdPlayerCheckbox.Size = new System.Drawing.Size(18, 17); + this.osdPlayerCheckbox.TabIndex = 5; + this.osdPlayerCheckbox.UseVisualStyleBackColor = true; + // + // osdLabel + // + this.osdLabel.AutoSize = true; + this.osdLabel.Location = new System.Drawing.Point(12, 43); + this.osdLabel.Name = "osdLabel"; + this.osdLabel.Size = new System.Drawing.Size(138, 17); + this.osdLabel.TabIndex = 6; + this.osdLabel.Text = "Use player with OSD"; + // + // SettingsForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(290, 130); + this.Controls.Add(this.cancelButton); + this.Controls.Add(this.osdPlayerCheckbox); + this.Controls.Add(this.saveButton); + this.Controls.Add(this.speedLabel); + this.Controls.Add(this.osdLabel); + this.Controls.Add(this.unitLabel); + this.Controls.Add(this.speedUpDown); + this.Name = "SettingsForm"; + this.Text = "NrkBrowser settings"; + ((System.ComponentModel.ISupportInitialize)(this.speedUpDown)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button saveButton; + private System.Windows.Forms.Label speedLabel; + private System.Windows.Forms.Label unitLabel; + public System.Windows.Forms.NumericUpDown speedUpDown; + private System.Windows.Forms.Button cancelButton; + public System.Windows.Forms.CheckBox osdPlayerCheckbox; + private System.Windows.Forms.Label osdLabel; + } +} \ No newline at end of file Added: trunk/plugins/NRK Browser/SettingsForm.cs =================================================================== --- trunk/plugins/NRK Browser/SettingsForm.cs (rev 0) +++ trunk/plugins/NRK Browser/SettingsForm.cs 2008-03-25 21:21:38 UTC (rev 1526) @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Text; +using System.Windows.Forms; + +namespace NrkBrowser +{ + public partial class SettingsForm : Form + { + public SettingsForm() + { + InitializeComponent(); + } + } +} Added: trunk/plugins/NRK Browser/SettingsForm.resx =================================================================== --- trunk/plugins/NRK Browser/SettingsForm.resx (rev 0) +++ trunk/plugins/NRK Browser/SettingsForm.resx 2008-03-25 21:21:38 UTC (rev 1526) @@ -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/NRK Browser/readme.txt =================================================================== --- trunk/plugins/NRK Browser/readme.txt (rev 0) +++ trunk/plugins/NRK Browser/readme.txt 2008-03-25 21:21:38 UTC (rev 1526) @@ -0,0 +1,21 @@ +To install the plugin, copy the contents of the INSTALL folder to your +Media Portal installation path (usually something like +C:\Program Files\Team Media Portal\Media Portal). + +If you are using a custom skin, you probably need to copy the skin file, +NrkBrowser.xml, to the folder containing your skin as well. + +If you experience any problems, please contact me and I will look into it +when I have time. + +Best regards, +Terje Wiesener <wie...@sa...> + +Changelog: + +Version 1.0.1.0 +- Fixed naming of skin folders +- Added configuration for connection speed + +Version 1.0.0.1 +- First release \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |