From: <che...@us...> - 2010-02-04 02:43:06
|
Revision: 3432 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=3432&view=rev Author: chef_koch Date: 2010-02-04 01:37:18 +0000 (Thu, 04 Feb 2010) Log Message: ----------- added MusicBrainzRating plugin Added Paths: ----------- trunk/plugins/MusicBrainzRating/ trunk/plugins/MusicBrainzRating/Build/ trunk/plugins/MusicBrainzRating/Build/build.bat trunk/plugins/MusicBrainzRating/Build/filever.exe trunk/plugins/MusicBrainzRating/MpeRelease/ trunk/plugins/MusicBrainzRating/MpeRelease/MusicBrainzRating.mpe1 trunk/plugins/MusicBrainzRating/MpeRelease/MusicBrainzRating.xmp2 trunk/plugins/MusicBrainzRating/MpeRelease/update.xml trunk/plugins/MusicBrainzRating/MusicBrainzRating/ trunk/plugins/MusicBrainzRating/MusicBrainzRating/HelperClasses/ trunk/plugins/MusicBrainzRating/MusicBrainzRating/HelperClasses/MusicBrainzService.cs trunk/plugins/MusicBrainzRating/MusicBrainzRating/HelperClasses/Rating.cs trunk/plugins/MusicBrainzRating/MusicBrainzRating/Language/ trunk/plugins/MusicBrainzRating/MusicBrainzRating/Language/de.xml trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRating.cs trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRating.csproj trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRating.csproj.user trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRatingConfig.Designer.cs trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRatingConfig.cs trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRatingConfig.resx trunk/plugins/MusicBrainzRating/MusicBrainzRating/Properties/ trunk/plugins/MusicBrainzRating/MusicBrainzRating/Properties/AssemblyInfo.cs trunk/plugins/MusicBrainzRating/MusicBrainzRating/Properties/Resources.Designer.cs trunk/plugins/MusicBrainzRating/MusicBrainzRating/Properties/Resources.resx trunk/plugins/MusicBrainzRating/MusicBrainzRating/Settings.cs trunk/plugins/MusicBrainzRating/MusicBrainzRating/Translation.cs trunk/plugins/MusicBrainzRating/MusicBrainzRating/img/ trunk/plugins/MusicBrainzRating/MusicBrainzRating/img/MusicBrainzLogo.png trunk/plugins/MusicBrainzRating/MusicBrainzRating/img/MusicBrainzRating_disabled.png trunk/plugins/MusicBrainzRating/MusicBrainzRating/img/MusicBrainzRating_enabled.png trunk/plugins/MusicBrainzRating/MusicBrainzRating/img/powered_by_musicbrainz.png trunk/plugins/MusicBrainzRating/MusicBrainzRating.5.0.resharper trunk/plugins/MusicBrainzRating/MusicBrainzRating.sln Added: trunk/plugins/MusicBrainzRating/Build/build.bat =================================================================== --- trunk/plugins/MusicBrainzRating/Build/build.bat (rev 0) +++ trunk/plugins/MusicBrainzRating/Build/build.bat 2010-02-04 01:37:18 UTC (rev 3432) @@ -0,0 +1,28 @@ +@ECHO OFF + + +REM Select program path based on current machine environment +set ProgramDir=%ProgramFiles% +if not "%ProgramFiles(x86)%".=="". set ProgramDir=%ProgramFiles(x86)% + + +REM set logfile where the infos are written to, and clear that file +set LOG=build.log +echo. > %LOG% + + +echo. +echo -= MusicBrainzRating =- +echo -=====================- +echo. + + +echo. +echo Building MusicBrainzRating... +"%WINDIR%\Microsoft.NET\Framework\v3.5\MSBUILD.exe" /target:Rebuild /property:Configuration=Release;AllowUnsafeBlocks=true "..\MusicBrainzRating.sln" >> %LOG% + + +echo. +echo Building MpeExtension package... +"%ProgramDir%\Team MediaPortal\MediaPortal\MpeMaker.exe" "..\MpeRelease\MySleepTimer.xmp2" /B /UpdateXML >> %LOG% + Added: trunk/plugins/MusicBrainzRating/Build/filever.exe =================================================================== (Binary files differ) Property changes on: trunk/plugins/MusicBrainzRating/Build/filever.exe ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/MusicBrainzRating/MpeRelease/MusicBrainzRating.mpe1 =================================================================== (Binary files differ) Property changes on: trunk/plugins/MusicBrainzRating/MpeRelease/MusicBrainzRating.mpe1 ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/plugins/MusicBrainzRating/MpeRelease/MusicBrainzRating.xmp2 =================================================================== --- trunk/plugins/MusicBrainzRating/MpeRelease/MusicBrainzRating.xmp2 (rev 0) +++ trunk/plugins/MusicBrainzRating/MpeRelease/MusicBrainzRating.xmp2 2010-02-04 01:37:18 UTC (rev 3432) @@ -0,0 +1,198 @@ +<?xml version="1.0" encoding="utf-8"?> +<PackageClass xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <Version>2.0</Version> + <Groups> + <Items> + <GroupItem Name="PluginDLL"> + <ParentGroup /> + <DisplayName>PluginDLL</DisplayName> + <DefaulChecked>true</DefaulChecked> + <Description>PluginDLL</Description> + <Files> + <Items> + <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> + <Param1 /> + <UpdateOption>AlwaysOverwrite</UpdateOption> + <LocalFileName>..\MusicBrainzRating\bin\Release\MusicBrainzRating.dll</LocalFileName> + <ZipFileName>Installer{CopyFile}\{bffaac66-8490-4025-a237-15ba59acda9a}-MusicBrainzRating.dll</ZipFileName> + <DestinationFilename>%Plugins%\process\MusicBrainzRating.dll</DestinationFilename> + </FileItem> + </Items> + </Files> + </GroupItem> + </Items> + </Groups> + <Sections> + <Items> + <SectionItem Guid="30c97031-2dc6-46ff-bfba-2976b8017ba3" Name="Welcome Screen" ConditionGroup=""> + <Params> + <Items> + <SectionParam Name="Header text"> + <Value>Welcome to the Extension Installer for [Name]</Value> + <ValueType>String</ValueType> + <Description /> + </SectionParam> + <SectionParam Name="Description"> + <Value>This will install [Name] version [Version] on your computer. +It is recommended that you close all other applications before continuing. +Click Next to continue or Cancel to exit Setup.</Value> + <ValueType>String</ValueType> + <Description /> + </SectionParam> + <SectionParam Name="Left part image"> + <Value /> + <ValueType>File</ValueType> + <Description /> + </SectionParam> + <SectionParam Name="Header image"> + <Value /> + <ValueType>File</ValueType> + <Description>Image in upper right part</Description> + </SectionParam> + </Items> + </Params> + <Actions> + <Items /> + </Actions> + <IncludedGroups /> + <PanelName>Welcome Screen</PanelName> + <WizardButtonsEnum>NextCancel</WizardButtonsEnum> + </SectionItem> + <SectionItem Guid="6099679d-937f-4dc6-b767-f6d6e065aa0d" Name="Install Section" ConditionGroup=""> + <Params> + <Items> + <SectionParam Name="Header Title"> + <Value /> + <ValueType>String</ValueType> + <Description>Header title</Description> + </SectionParam> + <SectionParam Name="Header description"> + <Value /> + <ValueType>String</ValueType> + <Description>Description of section, shown in under section title</Description> + </SectionParam> + <SectionParam Name="Header image"> + <Value /> + <ValueType>File</ValueType> + <Description>Image in upper right part</Description> + </SectionParam> + </Items> + </Params> + <Actions> + <Items> + <ActionItem Name="InstallFiles" ActionType="InstallFiles" ConditionGroup=""> + <Params> + <Items /> + </Params> + <ExecuteLocation>AfterPanelShow</ExecuteLocation> + </ActionItem> + </Items> + </Actions> + <IncludedGroups /> + <PanelName>Install Section</PanelName> + <WizardButtonsEnum>Next</WizardButtonsEnum> + </SectionItem> + <SectionItem Guid="6f06eb11-6575-4bcb-8075-c2d22f2be908" Name="Setup Complete" ConditionGroup=""> + <Params> + <Items> + <SectionParam Name="Header text"> + <Value>The Extension Installer Wizard has successfully installed [Name].</Value> + <ValueType>String</ValueType> + <Description /> + </SectionParam> + <SectionParam Name="Left part image"> + <Value /> + <ValueType>File</ValueType> + <Description /> + </SectionParam> + <SectionParam Name="Header image"> + <Value /> + <ValueType>File</ValueType> + <Description>Image in upper right part</Description> + </SectionParam> + </Items> + </Params> + <Actions> + <Items /> + </Actions> + <IncludedGroups /> + <PanelName>Setup Complete</PanelName> + <WizardButtonsEnum>Finish</WizardButtonsEnum> + </SectionItem> + </Items> + </Sections> + <Dependencies> + <Items /> + </Dependencies> + <GeneralInfo> + <Name>MusicBrainzRating</Name> + <Id>ea2aee37-34d8-41d9-a006-8a47930b5f55</Id> + <Author>chefkoch @ Team MediaPortal</Author> + <HomePage>http://forum.team-mediaportal.com/MusicBrainzRating-t77284.html</HomePage> + <ForumPage>http://forum.team-mediaportal.com/MusicBrainzRating-t77284.html</ForumPage> + <UpdateUrl>http://mp-plugins.svn.sourceforge.net/viewvc/mp-plugins/trunk/plugins/MusicBrainzRating/MpeRelease/update.xml</UpdateUrl> + <Version> + <Major>1</Major> + <Minor>0</Minor> + <Build>0</Build> + <Revision>0</Revision> + </Version> + <ExtensionDescription>Using this plugin you are able to submit you ratings for music tracks to musicbrainz.org + +Enter you username and password in the plugin's config, start MediaPortal, play any music file and rate it by pressing 0-5 on your keyboard or remote. + +The plugin requires to find the MusicBrainz track id withing the file's id3v2 or APE tag.</ExtensionDescription> + <VersionDescription> * initial release of the plugin</VersionDescription> + <DevelopmentStatus>Stable</DevelopmentStatus> + <OnlineLocation>http://mp-plugins.svn.sourceforge.net/viewvc/mp-plugins/trunk/plugins/MusicBrainzRating/MpeRelease/MusicBrainzRating.mpe1</OnlineLocation> + <ReleaseDate>2010-02-04T02:05:55.7643322+01:00</ReleaseDate> + <Tags>music, ratings, now playing, musicbrainz</Tags> + <Location>D:\MediaPortal\mp-plugins\trunk\plugins\MusicBrainzRating\MpeRelease\MusicBrainzRating.mpe1</Location> + <Params> + <Items> + <SectionParam Name="Icon"> + <Value>..\MusicBrainzRating\img\MusicBrainzRating_enabled.png</Value> + <ValueType>File</ValueType> + <Description>The icon file of the package (jpg,png,bmp)</Description> + </SectionParam> + <SectionParam Name="Online Icon"> + <Value>http://mp-plugins.svn.sourceforge.net/viewvc/mp-plugins/trunk/plugins/MusicBrainzRating/MusicBrainzRating/img/MusicBrainzRating_enabled.png</Value> + <ValueType>String</ValueType> + <Description>The icon file of the package stored online (jpg,png,bmp)</Description> + </SectionParam> + <SectionParam Name="Configuration file"> + <Value>%Plugins%\process\MusicBrainzRating.dll</Value> + <ValueType>Template</ValueType> + <Description>The file used to configure the extension. + If have .exe extension the will be executed + If have .dll extension used like MP plugin configuration</Description> + </SectionParam> + </Items> + </Params> + </GeneralInfo> + <UniqueFileList> + <Items> + <FileItem InstallType="CopyFile" SystemFile="false" Modified="true"> + <Param1 /> + <UpdateOption>AlwaysOverwrite</UpdateOption> + <LocalFileName>..\MusicBrainzRating\bin\Release\MusicBrainzRating.dll</LocalFileName> + <ZipFileName>Installer{CopyFile}\{bffaac66-8490-4025-a237-15ba59acda9a}-MusicBrainzRating.dll</ZipFileName> + <DestinationFilename>%Plugins%\process\MusicBrainzRating.dll</DestinationFilename> + </FileItem> + <FileItem InstallType="CopyFile" SystemFile="true" Modified="true"> + <Param1 /> + <UpdateOption>OverwriteIfOlder</UpdateOption> + <LocalFileName>..\MusicBrainzRating\img\MusicBrainzRating_enabled.png</LocalFileName> + <ZipFileName>Installer{CopyFile}\{8d50cf58-614f-4fc4-8ba6-e9e4a60afad6}-MusicBrainzRating_enabled.png</ZipFileName> + <DestinationFilename /> + </FileItem> + </Items> + </UniqueFileList> + <ProjectSettings> + <FolderGroups /> + <ProjectFilename>D:\MediaPortal\mp-plugins\trunk\plugins\MusicBrainzRating\MpeRelease\MusicBrainzRating.xmp2</ProjectFilename> + <UpdatePath1>D:\MediaPortal\mp-plugins\trunk\plugins\MusicBrainzRating\MpeRelease\update.xml</UpdatePath1> + <UpdatePath2 /> + <UpdatePath3 /> + </ProjectSettings> +</PackageClass> \ No newline at end of file Added: trunk/plugins/MusicBrainzRating/MpeRelease/update.xml =================================================================== --- trunk/plugins/MusicBrainzRating/MpeRelease/update.xml (rev 0) +++ trunk/plugins/MusicBrainzRating/MpeRelease/update.xml 2010-02-04 01:37:18 UTC (rev 3432) @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="utf-8"?> +<ExtensionCollection xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + <Items> + <PackageClass> + <Version>2.0</Version> + <Groups> + <Items> + <GroupItem Name="PluginDLL"> + <DisplayName>PluginDLL</DisplayName> + <DefaulChecked>true</DefaulChecked> + <Description>PluginDLL</Description> + <Files> + <Items /> + </Files> + </GroupItem> + </Items> + </Groups> + <Sections> + <Items /> + </Sections> + <Dependencies> + <Items /> + </Dependencies> + <GeneralInfo> + <Name>MusicBrainzRating</Name> + <Id>ea2aee37-34d8-41d9-a006-8a47930b5f55</Id> + <Author>chefkoch @ Team MediaPortal</Author> + <HomePage>http://forum.team-mediaportal.com/MusicBrainzRating-t77284.html</HomePage> + <ForumPage>http://forum.team-mediaportal.com/MusicBrainzRating-t77284.html</ForumPage> + <UpdateUrl>http://mp-plugins.svn.sourceforge.net/viewvc/mp-plugins/trunk/plugins/MusicBrainzRating/MpeRelease/update.xml</UpdateUrl> + <Version> + <Major>1</Major> + <Minor>0</Minor> + <Build>0</Build> + <Revision>0</Revision> + </Version> + <ExtensionDescription>Using this plugin you are able to submit you ratings for music tracks to musicbrainz.org + +Enter you username and password in the plugin's config, start MediaPortal, play any music file and rate it by pressing 0-5 on your keyboard or remote. + +The plugin requires to find the MusicBrainz track id withing the file's id3v2 or APE tag.</ExtensionDescription> + <VersionDescription> * initial release of the plugin</VersionDescription> + <DevelopmentStatus>Stable</DevelopmentStatus> + <OnlineLocation>http://mp-plugins.svn.sourceforge.net/viewvc/mp-plugins/trunk/plugins/MusicBrainzRating/MpeRelease/MusicBrainzRating.mpe1</OnlineLocation> + <ReleaseDate>2010-02-04T02:05:55.7643322+01:00</ReleaseDate> + <Tags>music, ratings, now playing, musicbrainz</Tags> + <Location>D:\MediaPortal\mp-plugins\trunk\plugins\MusicBrainzRating\MpeRelease\MusicBrainzRating.mpe1</Location> + <Params> + <Items> + <SectionParam Name="Icon"> + <Value>D:\MediaPortal\mp-plugins\trunk\plugins\MusicBrainzRating\MusicBrainzRating\img\MusicBrainzRating_enabled.png</Value> + <ValueType>File</ValueType> + <Description>The icon file of the package (jpg,png,bmp)</Description> + </SectionParam> + <SectionParam Name="Online Icon"> + <Value>http://mp-plugins.svn.sourceforge.net/viewvc/mp-plugins/trunk/plugins/MusicBrainzRating/MusicBrainzRating/img/MusicBrainzRating_enabled.png</Value> + <ValueType>String</ValueType> + <Description>The icon file of the package stored online (jpg,png,bmp)</Description> + </SectionParam> + <SectionParam Name="Configuration file"> + <Value>%Plugins%\process\MusicBrainzRating.dll</Value> + <ValueType>Template</ValueType> + <Description>The file used to configure the extension. + If have .exe extension the will be executed + If have .dll extension used like MP plugin configuration</Description> + </SectionParam> + </Items> + </Params> + </GeneralInfo> + <UniqueFileList> + <Items /> + </UniqueFileList> + <ProjectSettings> + <FolderGroups /> + </ProjectSettings> + </PackageClass> + </Items> +</ExtensionCollection> \ No newline at end of file Added: trunk/plugins/MusicBrainzRating/MusicBrainzRating/HelperClasses/MusicBrainzService.cs =================================================================== --- trunk/plugins/MusicBrainzRating/MusicBrainzRating/HelperClasses/MusicBrainzService.cs (rev 0) +++ trunk/plugins/MusicBrainzRating/MusicBrainzRating/HelperClasses/MusicBrainzService.cs 2010-02-04 01:37:18 UTC (rev 3432) @@ -0,0 +1,92 @@ +// MusicBrainzService.cs +// +// Copyright (c) 2008 Scott Peterson <lun...@gm...> +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +using System; +using System.Net; +using System.Net.Cache; +using System.Web; +using System; +using System.IO; +using System.Text; + +namespace MusicBrainz +{ + public class MusicBrainzService + { + string host = "musicbrainz.org"; + int port = 80; + string pathPrefix = "/ws"; + string realm = "musicbrainz.org"; + + NetworkCredential _networkCredential; + + public MusicBrainzService(string user, string password) + { + _networkCredential = new NetworkCredential(user, password); + } + + public void Post(Rating rating) + { + Uri address = new Uri("http://musicbrainz.org/ws/1/rating/"); + + // Create the web request + HttpWebRequest request = WebRequest.Create(address) as HttpWebRequest; + + // Add authentication to request + request.Credentials = _networkCredential; + + // Set type to POST + request.Method = "POST"; + request.ContentType = "application/x-www-form-urlencoded"; + + StringBuilder data = new StringBuilder(); + data.Append("entity="); + data.Append(rating._entity); + data.Append("&id="); + data.Append(rating._id); + data.Append("&rating="); + data.Append(rating._rating); + + // Create a byte array of the data we want to send + byte[] byteData = UTF8Encoding.UTF8.GetBytes(data.ToString()); + + // Set the content length in the request headers + request.ContentLength = byteData.Length; + + // Write data + using (Stream postStream = request.GetRequestStream()) + { + postStream.Write(byteData, 0, byteData.Length); + } + + // Get response + using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) + { + // Get the response stream + StreamReader reader = new StreamReader(response.GetResponseStream()); + + // Console application output + Console.WriteLine(reader.ReadToEnd()); + } + } + } +} Added: trunk/plugins/MusicBrainzRating/MusicBrainzRating/HelperClasses/Rating.cs =================================================================== --- trunk/plugins/MusicBrainzRating/MusicBrainzRating/HelperClasses/Rating.cs (rev 0) +++ trunk/plugins/MusicBrainzRating/MusicBrainzRating/HelperClasses/Rating.cs 2010-02-04 01:37:18 UTC (rev 3432) @@ -0,0 +1,19 @@ +using System; +using System.Text; + +namespace MusicBrainz +{ + public class Rating + { + public string _entity = "track"; + public string _id = "26f1ffc7-491b-46e4-b682-21e7bcafebfe"; + public string _rating = "4"; + + public Rating(string entity, string id, string rating) + { + _entity = entity; + _id = id; + _rating = rating; + } + } +} Added: trunk/plugins/MusicBrainzRating/MusicBrainzRating/Language/de.xml =================================================================== --- trunk/plugins/MusicBrainzRating/MusicBrainzRating/Language/de.xml (rev 0) +++ trunk/plugins/MusicBrainzRating/MusicBrainzRating/Language/de.xml 2010-02-04 01:37:18 UTC (rev 3432) @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- MyAlarm translation file --> +<!-- German (de) --> +<!-- Note: English is the fallback for any strings not found in other languages --> +<strings> + <!-- P --> + <string Field="PluginDescription">Schl\xE4fst auch du beim Fernsehen st\xE4ndig ein? Dann brauchst du dieses Plugin, welches MediaPortal automatisch nach einer bestimmten Zeit ausschaltet.</string> + <!-- S --> + <string Field="SleepingInXMin">Autom. Ausschalten in {0} min.</string> + <string Field="SleepingInXMinPlaytime">Autom. Ausschalten in {0} min. (restl. Wiedergabezeit)</string> + <string Field="SleepTimer">Automatisches Ausschalten</string> + <!-- T --> + <string Field="TimeIsUp">Es ist Schlafenszeit! Gute Nacht.</string> + <string Field="TimerStopped">Sleeptimer ausgeschaltet!</string> +</strings> \ No newline at end of file Added: trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRating.cs =================================================================== --- trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRating.cs (rev 0) +++ trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRating.cs 2010-02-04 01:37:18 UTC (rev 3432) @@ -0,0 +1,326 @@ +#region Copyright (C) 2005-2010 Team MediaPortal + +// Copyright (C) 2005-2010 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal 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 of the License, or +// (at your option) any later version. +// +// MediaPortal 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 MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +using System; +using System.ComponentModel; +using System.Threading; +using System.Timers; +using System.Windows.Forms; +using MediaPortal.Configuration; +using MediaPortal.Dialogs; +using MediaPortal.GUI.Library; +using MediaPortal.Music.Database; +using MediaPortal.Player; +using MediaPortal.Util; +using MusicBrainz; +using Roger.ID3; +using TagLib; +using Timer = System.Timers.Timer; + +namespace MusicBrainzRating +{ + [PluginIcons("MusicBrainzRating.img.MusicBrainzRating_enabled.png", "MusicBrainzRating.img.MusicBrainzRating_disabled.png")] + public class MusicBrainzRating : IPlugin, ISetupForm + { + #region Nested struct: RatingStruct + + private struct RatingStruct + { + public string trackID; + public int rating; + } + + #endregion + + private void GUIWindowManager_OnNewAction(Action action) + { + if (!g_Player.Playing) return; + if (!g_Player.IsMusic) return; + if (GUIWindowManager.ActiveWindow != (int)GUIWindow.Window.WINDOW_MUSIC_PLAYING_NOW) return; + + try + { + switch (action.wID) + { + case Action.ActionType.REMOTE_0: + Log.Debug("REMOTE_0"); + SubmitRating(0); + break; + case Action.ActionType.REMOTE_1: + SubmitRating(1); + break; + case Action.ActionType.REMOTE_2: + SubmitRating(2); + break; + case Action.ActionType.REMOTE_3: + SubmitRating(3); + break; + case Action.ActionType.REMOTE_4: + SubmitRating(4); + break; + case Action.ActionType.REMOTE_5: + SubmitRating(5); + break; + + case Action.ActionType.ACTION_KEY_PRESSED: + switch (action.m_key.KeyChar) + { + case (int)Keys.D0: + Log.Debug("KeyChar0"); + SubmitRating(0); + break; + case (int)Keys.D1: + SubmitRating(1); + break; + case (int)Keys.D2: + SubmitRating(2); + break; + case (int)Keys.D3: + SubmitRating(3); + break; + case (int)Keys.D4: + SubmitRating(4); + break; + case (int)Keys.D5: + SubmitRating(5); + break; + } + break; + } + } + catch (Exception ex) + { + Log.Error(ex); + } + } + + private void SubmitRating(int rating) + { + string file = g_Player.CurrentFile; + if (String.IsNullOrEmpty(file)) return; + + string trackID = GetMusicBrainzTrackID(file); + if (String.IsNullOrEmpty(trackID)) return; + + + RatingStruct rs = new RatingStruct(); + rs.trackID = trackID; + rs.rating = rating; + + ParameterizedThreadStart pts = new ParameterizedThreadStart(SubmitRating); + Thread thread = new Thread(pts); + thread.Start(rs); + } + + private void SubmitRating(object arg) + { + if (!(arg is RatingStruct)) return; + RatingStruct rs = (RatingStruct)arg; + + MusicBrainzService service = new MusicBrainzService(Settings.Username, Settings.Password); + Rating _rating = new Rating("track", rs.trackID, rs.rating.ToString()); + try + { + service.Post(_rating); + } + catch (Exception ex) + { + Log.Error(ex); + } + } + + private static string GetMusicBrainzTrackID(string file) + { + if (String.IsNullOrEmpty(file)) return null; + Settings.VerboseLog("GetMusicBrainzTrackID for {0}", file); + + try + { + // Set the flag to use the standard System Encoding set by the user + // Otherwise Latin1 is used as default, which causes characters in various languages being displayed wrong + TagLib.ByteVector.UseBrokenLatin1Behavior = true; + TagLib.File tag = TagLib.File.Create(file); + if (tag == null) + { + Log.Warn("GetMusicBrainzTrackID: No tag in file - {0}", file); + return null; + } + + string trackID = null; + switch (tag.MimeType) + { + case "taglib/mp3": + { + TagLib.Id3v2.Tag id32_tag = tag.GetTag(TagTypes.Id3v2) as TagLib.Id3v2.Tag; + if (id32_tag != null) + trackID = id32_tag.MusicBrainzTrackId; + } + break; + + case "taglib/ape": + { + TagLib.Ape.Tag apetag = tag.GetTag(TagTypes.Ape, false) as TagLib.Ape.Tag; + if (apetag != null) + trackID = apetag.MusicBrainzTrackId; + } + break; + } + + if (String.IsNullOrEmpty(trackID)) + { + Log.Warn("GetMusicBrainzTrackID: No MusicBrainzTrackId found in file - {0}", file); + return null; + } + + Settings.VerboseLog("GetMusicBrainzTrackID: TrackID {0} found", trackID); + return trackID; + } + catch (Exception ex) + { + Log.Error(ex); + return null; + } + } + + #region ISetupForm Members + + /// <summary> + /// Gets the plugin name. + /// </summary> + /// <returns>The plugin name.</returns> + public string PluginName() + { + return "MusicBrainzRating"; + } + + /// <summary> + /// Gets the description of the plugin. + /// </summary> + /// <returns>The plugin description.</returns> + public string Description() + { + return "Rate a track on MusicPlayingNow screen and submit rating to MusicBrainz.org."; + } + + /// <summary> + /// Gets the plugin author. + /// </summary> + /// <returns>The plugin author.</returns> + public string Author() + { + return "chefkoch"; + } + + /// <summary> + /// Shows the plugin configuration. + /// </summary> + public void ShowPlugin() + { + new MusicBrainzRatingConfig().ShowDialog(); + } + + /// <summary> + /// Determines whether this plugin can be enabled. + /// </summary> + /// <returns> + /// <c>true</c> if this plugin can be enabled; otherwise, <c>false</c>. + /// </returns> + public bool CanEnable() + { + return true; + } + + /// <summary> + /// Gets the window id. + /// </summary> + /// <returns>The window id.</returns> + public int GetWindowId() + { + // WindowID of windowplugin belonging to this setup + // enter your own unique code + return -1; + } + + /// <summary> + /// Defaults enabled. + /// </summary> + /// <returns>true if this plugin is enabled by default, otherwise false.</returns> + public bool DefaultEnabled() + { + return true; + } + + /// <summary> + /// Determines whether this plugin has setup. + /// </summary> + /// <returns> + /// <c>true</c> if this plugin has setup; otherwise, <c>false</c>. + /// </returns> + 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 = String.Empty; + return false; + } + + #endregion + + #region IPlugin Member + + /// <summary> + /// This method will be called by mediaportal to start your process plugin + /// </summary> + public void Start() + { + Settings.Load(); + + GUIWindowManager.OnNewAction += new OnActionHandler(GUIWindowManager_OnNewAction); + } + + /// <summary> + /// This method will be called by mediaportal to stop your process plugin + /// </summary> + public void Stop() + { + GUIWindowManager.OnNewAction -= new OnActionHandler(GUIWindowManager_OnNewAction); + } + + #endregion + } +} \ No newline at end of file Added: trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRating.csproj =================================================================== --- trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRating.csproj (rev 0) +++ trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRating.csproj 2010-02-04 01:37:18 UTC (rev 3432) @@ -0,0 +1,148 @@ +<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.21022</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{03856C9E-0926-41DB-A13A-AE3D08285428}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>MusicBrainzRating</RootNamespace> + <AssemblyName>MusicBrainzRating</AssemblyName> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + <IsWebBootstrapper>false</IsWebBootstrapper> + <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> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>false</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <UseVSHostingProcess>false</UseVSHostingProcess> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>none</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <UseVSHostingProcess>false</UseVSHostingProcess> + </PropertyGroup> + <ItemGroup> + <Reference Include="Core, Version=1.0.2.0, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\..\MediaPortal\trunk\mediaportal\Core\bin\Release\Core.dll</HintPath> + </Reference> + <Reference Include="Databases, Version=1.0.4.166, Culture=neutral, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\..\MediaPortal\trunk\mediaportal\Databases\bin\Release\Databases.dll</HintPath> + </Reference> + <Reference Include="Dialogs, Version=1.0.2.0, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\..\MediaPortal\trunk\mediaportal\Dialogs\bin\Release\Dialogs.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="taglib-sharp, Version=2.0.2.17, Culture=neutral, PublicKeyToken=db62eba44689b5b0, processorArchitecture=MSIL"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\..\MediaPortal\trunk\mediaportal\MediaPortal.Base\taglib-sharp.dll</HintPath> + </Reference> + <Reference Include="Utils, Version=2.2.7.0, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\..\MediaPortal\trunk\mediaportal\Utils\bin\Release\Utils.dll</HintPath> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="HelperClasses\MusicBrainzService.cs" /> + <Compile Include="HelperClasses\Rating.cs" /> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Translation.cs" /> + <Compile Include="Settings.cs" /> + <Compile Include="MusicBrainzRating.cs"> + </Compile> + <Compile Include="MusicBrainzRatingConfig.cs"> + <SubType>Form</SubType> + </Compile> + <Compile Include="MusicBrainzRatingConfig.Designer.cs"> + <DependentUpon>MusicBrainzRatingConfig.cs</DependentUpon> + </Compile> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="MusicBrainzRatingConfig.resx"> + <SubType>Designer</SubType> + <DependentUpon>MusicBrainzRatingConfig.cs</DependentUpon> + </EmbeddedResource> + </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="img\MusicBrainzRating_disabled.png" /> + <EmbeddedResource Include="img\MusicBrainzRating_enabled.png" /> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + <SubType>Designer</SubType> + </EmbeddedResource> + </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> + <Content Include="img\MusicBrainzLogo.png" /> + <Content Include="img\powered_by_musicbrainz.png" /> + <Content Include="Language\de.xml" /> + </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> + </PostBuildEvent> + </PropertyGroup> +</Project> \ No newline at end of file Added: trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRating.csproj.user =================================================================== --- trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRating.csproj.user (rev 0) +++ trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRating.csproj.user 2010-02-04 01:37:18 UTC (rev 3432) @@ -0,0 +1,16 @@ +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <PublishUrlHistory> + </PublishUrlHistory> + <InstallUrlHistory> + </InstallUrlHistory> + <SupportUrlHistory> + </SupportUrlHistory> + <UpdateUrlHistory> + </UpdateUrlHistory> + <BootstrapperUrlHistory> + </BootstrapperUrlHistory> + <FallbackCulture>de-DE</FallbackCulture> + <VerifyUploadedFiles>false</VerifyUploadedFiles> + </PropertyGroup> +</Project> \ No newline at end of file Added: trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRatingConfig.Designer.cs =================================================================== --- trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRatingConfig.Designer.cs (rev 0) +++ trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRatingConfig.Designer.cs 2010-02-04 01:37:18 UTC (rev 3432) @@ -0,0 +1,150 @@ +namespace MusicBrainzRating +{ + partial class MusicBrainzRatingConfig + { + /// <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.cancelButton = new System.Windows.Forms.Button(); + this.okButton = new System.Windows.Forms.Button(); + this.passwordTextBox = new System.Windows.Forms.TextBox(); + this.usernameTextBox = new System.Windows.Forms.TextBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.pictureBox = new System.Windows.Forms.PictureBox(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit(); + this.SuspendLayout(); + // + // 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(261, 94); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(75, 23); + this.cancelButton.TabIndex = 58; + this.cancelButton.Text = "Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); + // + // 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(180, 94); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(75, 23); + this.okButton.TabIndex = 59; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // + // passwordTextBox + // + this.passwordTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.passwordTextBox.Location = new System.Drawing.Point(76, 38); + this.passwordTextBox.Name = "passwordTextBox"; + this.passwordTextBox.PasswordChar = '*'; + this.passwordTextBox.Size = new System.Drawing.Size(260, 20); + this.passwordTextBox.TabIndex = 60; + // + // usernameTextBox + // + this.usernameTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.usernameTextBox.Location = new System.Drawing.Point(76, 12); + this.usernameTextBox.Name = "usernameTextBox"; + this.usernameTextBox.Size = new System.Drawing.Size(260, 20); + this.usernameTextBox.TabIndex = 61; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 15); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(58, 13); + this.label1.TabIndex = 62; + this.label1.Text = "Username:"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 41); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(56, 13); + this.label2.TabIndex = 63; + this.label2.Text = "Password:"; + // + // pictureBox + // + this.pictureBox.Cursor = System.Windows.Forms.Cursors.Hand; + this.pictureBox.Image = global::MusicBrainzRating.Properties.Resources.powered_by_musicbrainz; + this.pictureBox.Location = new System.Drawing.Point(12, 86); + this.pictureBox.Name = "pictureBox"; + this.pictureBox.Size = new System.Drawing.Size(88, 31); + this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.pictureBox.TabIndex = 64; + this.pictureBox.TabStop = false; + this.pictureBox.Click += new System.EventHandler(this.pictureBox_Click); + // + // MusicBrainzRatingConfig + // + 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(348, 125); + this.Controls.Add(this.pictureBox); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.usernameTextBox); + this.Controls.Add(this.passwordTextBox); + this.Controls.Add(this.okButton); + this.Controls.Add(this.cancelButton); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "MusicBrainzRatingConfig"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "MusicBrainz configuration"; + ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button cancelButton; + private System.Windows.Forms.Button okButton; + private System.Windows.Forms.TextBox passwordTextBox; + private System.Windows.Forms.TextBox usernameTextBox; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.PictureBox pictureBox; + } +} \ No newline at end of file Added: trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRatingConfig.cs =================================================================== --- trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRatingConfig.cs (rev 0) +++ trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRatingConfig.cs 2010-02-04 01:37:18 UTC (rev 3432) @@ -0,0 +1,88 @@ +#region Copyright (C) 2005-2010 Team MediaPortal + +// Copyright (C) 2005-2010 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal 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 of the License, or +// (at your option) any later version. +// +// MediaPortal 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 MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Windows.Forms; +using MediaPortal.GUI.Library; +using MediaPortal.Util; + +namespace MusicBrainzRating +{ + public partial class MusicBrainzRatingConfig : Form + { + public MusicBrainzRatingConfig() + { + InitializeComponent(); + LoadSettings(); + } + + #region Settings + + private void LoadSettings() + { + try + { + Settings.Load(); + + usernameTextBox.Text = Settings.Username; + passwordTextBox.Text = Settings.Password; + } + catch (Exception ex) + { + Log.Error(ex); + } + } + + private void SaveSettings() + { + Settings.Username = usernameTextBox.Text; + Settings.Password = passwordTextBox.Text; + Settings.Save(); + } + + #endregion + + #region Windows Forms events + + private void okButton_Click(object sender, EventArgs e) + { + SaveSettings(); + Close(); + } + + private void cancelButton_Click(object sender, EventArgs e) + { + Close(); + } + + #endregion + + private void pictureBox_Click(object sender, EventArgs e) + { + try + { + Process.Start("http://musicbrainz.org/"); + } + catch { } + } + } +} \ No newline at end of file Added: trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRatingConfig.resx =================================================================== --- trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRatingConfig.resx (rev 0) +++ trunk/plugins/MusicBrainzRating/MusicBrainzRating/MusicBrainzRatingConfig.resx 2010-02-04 01:37:18 UTC (rev 3432) @@ -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/MusicBrainzRating/MusicBrainzRating/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MusicBrainzRating/MusicBrainzRating/Properties/AssemblyInfo.cs (rev 0) +++ trunk/plugins/MusicBrainzRating/MusicBrainzRating/Properties/AssemblyInfo.cs 2010-02-04 01:37:18 UTC (rev 3432) @@ -0,0 +1,58 @@ +#region Copyright (C) 2005-2010 Team MediaPortal + +// Copyright (C) 2005-2010 Team MediaPortal +// http://www.team-mediaportal.com +// +// MediaPortal 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 of the License, or +// (at your option) any later version. +// +// MediaPortal 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 MediaPortal. If not, see <http://www.gnu.org/licenses/>. + +#endregion + +using System.Reflection; +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("MusicBrainzRating")] +[assembly: AssemblyDescription("Submit track ratings to MusicBrainz.org")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("chefkoch")] +[assembly: AssemblyProduct("MusicBrainzRating")] +[assembly: AssemblyCopyright("Copyright \xA9 2010 chefkoch @ Team MediaPortal")] +[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("216cf21b-9128-47a1-bd0f-33baa87b887f")] + +// 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("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file Added: trunk/plugins/MusicBrainzRating/MusicBrainzRating/Properties/Resources.Designer.cs =================================================================== --- trunk/plugins/MusicBrainzRating/MusicBrainzRating/Properties/Resources.Designer.cs (rev 0) +++ trunk/plugins/MusicBrainzRating/MusicBrainzRating/Properties/Resources.Designer.cs 2010-02-04 01:37:18 UTC (rev 3432) @@ -0,0 +1,70 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:2.0.50727.4927 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace MusicBrainzRating.Properties { + using System; + + + /// <summary> + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// </summary> + // Die... [truncated message content] |