From: <kro...@us...> - 2011-04-30 19:21:42
|
Revision: 4189 http://mp-plugins.svn.sourceforge.net/mp-plugins/?rev=4189&view=rev Author: kroko_koenig Date: 2011-04-30 19:21:35 +0000 (Sat, 30 Apr 2011) Log Message: ----------- change for the beta Modified Paths: -------------- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GUIRadio.cs trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GuiRecordings.cs trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/MyStreamRadio.csproj trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Parser.cs trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/AssemblyInfo.cs trunk/plugins/MyStreamradioV2/Source/MyStreamRadio.suo Modified: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GUIRadio.cs =================================================================== --- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GUIRadio.cs 2011-04-30 18:51:53 UTC (rev 4188) +++ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GUIRadio.cs 2011-04-30 19:21:35 UTC (rev 4189) @@ -98,7 +98,7 @@ private string[] favorites; private string lastChannel; - private static OnActionHandler ah; + private static OnActionHandler ah = null; private string actualStation; private Parser parser; @@ -151,16 +151,8 @@ LoadSettings(); } - public override bool Init() - { - currentFolder = string.Empty; - bool bResult = Load(GUIGraphicsContext.Skin + @"\mystreamradio.xml"); - - ServicePointManager.DefaultConnectionLimit = 10; - return bResult; - } - #region Serialisation + void LoadSettings() { using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) @@ -229,6 +221,7 @@ displayTime = xmlreader.GetValueAsInt("mystreamradio", "displayTime", 1); displayMode = xmlreader.GetValueAsInt("mystreamradio", "displayMode", 1); + #region icecast / shoutcast useIcecast = xmlreader.GetValueAsBool("mystreamradio", "icecast", true); useShoutcast = xmlreader.GetValueAsBool("mystreamradio", "shoutcast", true); @@ -262,6 +255,7 @@ filter = 320; break; } + #endregion } } void SaveSettings() @@ -306,6 +300,7 @@ xmlwriter.SetValueAsBool("mystreamradio", "sortascending", sortAscending); #endregion + #region favorites if (favorites[0] != "n.a.") xmlwriter.SetValue("mystreamradio", "Fav01", favorites[0]); if (favorites[1] != "n.a.") xmlwriter.SetValue("mystreamradio", "Fav02", favorites[1]); if (favorites[2] != "n.a.") xmlwriter.SetValue("mystreamradio", "Fav03", favorites[2]); @@ -316,117 +311,31 @@ if (favorites[7] != "n.a.") xmlwriter.SetValue("mystreamradio", "Fav08", favorites[7]); if (favorites[8] != "n.a.") xmlwriter.SetValue("mystreamradio", "Fav09", favorites[8]); if (favorites[9] != "n.a.") xmlwriter.SetValue("mystreamradio", "Fav10", favorites[9]); + #endregion } } + #endregion #region BaseWindow Members - public override void OnAction(Action action) - { - //Debug.WriteLine(action.wID); - // previous menu - if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) - { - if (facadeView.Focus) - { - GUIListItem item = facadeView[0]; - if (item != null) - { - if (item.IsFolder && item.Label == "..") - { - currentFolder = item.Path; - LoadDirectory(); - return; - } - } - } - } - // show context if not fullscreen - if (action.wID == Action.ActionType.ACTION_CONTEXT_MENU) - { - if (!g_Player.FullScreen) - { - OnContextMenu(); - } - } - // go to parent in sub dirs - if (action.wID == Action.ActionType.ACTION_PARENT_DIR) - { - GUIListItem item = facadeView[0]; - if (item != null) - { - if (item.IsFolder && item.Label == "..") - { - currentFolder = item.Path; - LoadDirectory(); - } - } - return; - } - - base.OnAction(action); - } - public void OnAction2(Action action) + public override bool Init() { - //System.Diagnostics.Debug.WriteLine("2 " + action.wID.ToString()); + ServicePointManager.DefaultConnectionLimit = 10; + currentFolder = string.Empty; - // global actions will handeled here e.g. record - //Debug.WriteLine("Action2:" + action.wID.ToString()); - if (action.wID == Action.ActionType.ACTION_RECORD) - { - OnRecord(); - } - - if (action.wID == Action.ActionType.ACTION_STOP) - { - if (EncodeActive()) - btnRecord.Selected = false; - } - - if (g_Player.FullScreen) - { - if ((action.wID == Action.ActionType.REMOTE_1) || - ((action.wID == Action.ActionType.ACTION_KEY_PRESSED) && (action.m_key.KeyChar == 49))) - { - string[] s = favorites[0].Split('|'); - if (s.Length == 3) PlayDirect(favorites[0]); - } - if ((action.wID == Action.ActionType.REMOTE_2) || - ((action.wID == Action.ActionType.ACTION_KEY_PRESSED) && (action.m_key.KeyChar == 50))) - { - string[] s = favorites[1].Split('|'); - if (s.Length == 3) PlayDirect(favorites[1]); - } - if ((action.wID == Action.ActionType.REMOTE_3) || - ((action.wID == Action.ActionType.ACTION_KEY_PRESSED) && (action.m_key.KeyChar == 51))) - { - string[] s = favorites[2].Split('|'); - if (s.Length == 3) PlayDirect(favorites[2]); - } - if ((action.wID == Action.ActionType.REMOTE_4) || - ((action.wID == Action.ActionType.ACTION_KEY_PRESSED) && (action.m_key.KeyChar == 52))) - { - string[] s = favorites[3].Split('|'); - if (s.Length == 3) PlayDirect(favorites[3]); - } - if ((action.wID == Action.ActionType.REMOTE_5) || - ((action.wID == Action.ActionType.ACTION_KEY_PRESSED) && (action.m_key.KeyChar == 53))) - { - string[] s = favorites[4].Split('|'); - if (s.Length == 3) PlayDirect(favorites[4]); - } - } + return (Load(GUIGraphicsContext.Skin + @"\mystreamradio.xml")); } - protected override void OnPageLoad() { if (ah == null) { ah = new OnActionHandler(OnAction2); - GUIGraphicsContext.OnNewAction += ah; } + GUIGraphicsContext.OnNewAction -= ah; + GUIGraphicsContext.OnNewAction += ah; + g_Player.PlayBackStopped += new g_Player.StoppedHandler(g_Player_PlayBackStopped); LoadSettings(); @@ -518,8 +427,6 @@ } protected override void OnPageDestroy(int newWindowId) { - GUIGraphicsContext.OnNewAction -= ah; - selectedItemIndex = facadeView.SelectedListItemIndex; SaveSettings(); @@ -536,22 +443,6 @@ GUIPropertyManager.SetProperty("#currentmodule", "StreamRadio"); return true; } - case GUIMessage.MessageType.GUI_MSG_ITEM_FOCUS_CHANGED: - { - int iControl = message.SenderControlId; - - if (iControl == GUIFacadeID) - { - GUIListItem item = GUIControl.GetSelectedListItem(GetID, GUIFacadeID); - if (item != null) - { - // GetSelectedListItem sets these two so not needed - //GUIPropertyManager.SetProperty("#selecteditem", item.Label); - //GUIPropertyManager.SetProperty("#selecteditem2", item.Label2); - } - } - break; - } } return base.OnMessage(message); @@ -571,26 +462,26 @@ { case View.List: currentView = View.Icons; - if (facadeView.ThumbnailView == null) - shouldContinue = true; - else - facadeView.View = GUIFacadeControl.ViewMode.SmallIcons; + //if (facadeView.ThumbnailView == null) + // shouldContinue = true; + //else + facadeView.CurrentLayout = GUIFacadeControl.Layout.SmallIcons; break; case View.Icons: currentView = View.LargeIcons; - if (facadeView.ThumbnailView == null) - shouldContinue = true; - else - facadeView.View = GUIFacadeControl.ViewMode.LargeIcons; + //if (facadeView.ThumbnailView == null) + // shouldContinue = true; + //else + facadeView.CurrentLayout = GUIFacadeControl.Layout.LargeIcons; break; case View.LargeIcons: currentView = View.List; - if (facadeView.ListView == null) - shouldContinue = true; - else - facadeView.View = GUIFacadeControl.ViewMode.List; + //if (facadeView.ListView == null) + // shouldContinue = true; + //else + facadeView.CurrentLayout = GUIFacadeControl.Layout.List; break; } } while (shouldContinue); @@ -700,13 +591,13 @@ switch (currentView) { case View.List: - facadeView.View = GUIFacadeControl.ViewMode.List; + facadeView.CurrentLayout = GUIFacadeControl.Layout.List; break; case View.Icons: - facadeView.View = GUIFacadeControl.ViewMode.SmallIcons; + facadeView.CurrentLayout = GUIFacadeControl.Layout.SmallIcons; break; case View.LargeIcons: - facadeView.View = GUIFacadeControl.ViewMode.LargeIcons; + facadeView.CurrentLayout = GUIFacadeControl.Layout.LargeIcons; break; } @@ -715,6 +606,103 @@ #endregion + #region OnActions + + public override void OnAction(Action action) + { + #region prev/contex/parent + if (action.wID == Action.ActionType.ACTION_PREVIOUS_MENU) + { + if (facadeView.Focus) + { + GUIListItem item = facadeView[0]; + if (item != null) + { + if (item.IsFolder && item.Label == "..") + { + currentFolder = item.Path; + LoadDirectory(); + return; + } + } + } + } + if (action.wID == Action.ActionType.ACTION_CONTEXT_MENU) + { + if (!g_Player.FullScreen) + { + OnContextMenu(); + } + } + if (action.wID == Action.ActionType.ACTION_PARENT_DIR) + { + GUIListItem item = facadeView[0]; + if (item != null) + { + if (item.IsFolder && item.Label == "..") + { + currentFolder = item.Path; + LoadDirectory(); + } + } + return; + } + #endregion + + base.OnAction(action); + } + public void OnAction2(Action action) + { + if (action.wID == Action.ActionType.ACTION_RECORD) + { + OnRecord(); + } + + if (action.wID == Action.ActionType.ACTION_STOP) + { + if (EncodeActive()) + btnRecord.Selected = false; + } + + #region favorites is fullscreen + if ((g_Player.FullScreen) && (StreamradioIsPlaying())) + { + if ((action.wID == Action.ActionType.REMOTE_1) || + ((action.wID == Action.ActionType.ACTION_KEY_PRESSED) && (action.m_key.KeyChar == 49))) + { + string[] s = favorites[0].Split('|'); + if (s.Length == 3) PlayDirect(favorites[0]); + } + if ((action.wID == Action.ActionType.REMOTE_2) || + ((action.wID == Action.ActionType.ACTION_KEY_PRESSED) && (action.m_key.KeyChar == 50))) + { + string[] s = favorites[1].Split('|'); + if (s.Length == 3) PlayDirect(favorites[1]); + } + if ((action.wID == Action.ActionType.REMOTE_3) || + ((action.wID == Action.ActionType.ACTION_KEY_PRESSED) && (action.m_key.KeyChar == 51))) + { + string[] s = favorites[2].Split('|'); + if (s.Length == 3) PlayDirect(favorites[2]); + } + if ((action.wID == Action.ActionType.REMOTE_4) || + ((action.wID == Action.ActionType.ACTION_KEY_PRESSED) && (action.m_key.KeyChar == 52))) + { + string[] s = favorites[3].Split('|'); + if (s.Length == 3) PlayDirect(favorites[3]); + } + if ((action.wID == Action.ActionType.REMOTE_5) || + ((action.wID == Action.ActionType.ACTION_KEY_PRESSED) && (action.m_key.KeyChar == 53))) + { + string[] s = favorites[4].Split('|'); + if (s.Length == 3) PlayDirect(favorites[4]); + } + } + #endregion + } + + #endregion + #region Events & timers private void g_Player_PlayBackStopped(g_Player.MediaType type, int stoptime, string filename) { @@ -800,7 +788,7 @@ if (parser != null) { - if ((parser.Title != "") && (parser.Title != "...")) + if ((parser.Title != "") && (parser.Title != "...") && (parser.Title != null)) { GUIPropertyManager.SetProperty("#Play.Current.Title", parser.Title.Trim()); GUIPropertyManager.SetProperty("#Play.Current.Artist", parser.Artist.Trim()); @@ -1517,136 +1505,105 @@ #endregion } - private bool EncodeActive() + private void OnRecord() { - - try + if (StreamradioIsPlaying()) { - if (MediaPortal.Visualization.VisualizationBase.Bass.Initialized) + if (!engine.Contains("BASS")) { - int _stream = (int)MediaPortal.Visualization.VisualizationBase.Bass.CurrentAudioStream; - if (_stream != 0) - { - if (lame == null) return false; - if (lame.IsActive) return true; - } + GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); + dlg.SetHeading("BASS engine is not active !"); + dlg.SetLine(1, "Recording is not possible !"); + dlg.SetLine(2, "Activate BASS engine under Music /"); + dlg.SetLine(3, "Player Settings."); + dlg.DoModal(GUIWindowManager.ActiveWindow); } - } - catch (Exception e) - { - Log.Error("Error getting current BASS Audio Stream." + "\n" + e.Message); - } - - return false; - } - - private void OnRecord() - { - if (!engine.Contains("BASS")) - { - GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); - dlg.SetHeading("BASS engine is not active !"); - dlg.SetLine(1, "Recording is not possible !"); - dlg.SetLine(2, "Activate BASS engine under Music /"); - dlg.SetLine(3, "Player Settings."); - dlg.DoModal(GUIWindowManager.ActiveWindow); - } - else - { - if ((g_Player.Playing) && (!g_Player.CurrentFile.StartsWith(Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config)))) + else { - int _stream = (int)MediaPortal.Visualization.VisualizationBase.Bass.CurrentAudioStream; - - if (_stream != 0) + if ((g_Player.Playing) && (!g_Player.CurrentFile.StartsWith(Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config)))) { - if (!EncodeActive()) + int _stream = (int)MediaPortal.Visualization.VisualizationBase.Bass.CurrentAudioStream; + + if (_stream != 0) { - Log.Debug("MyStreamRadio | start recording"); + if (!EncodeActive()) + { + Log.Debug("MyStreamRadio | start recording"); - #region build file name - string[] now = actualStation.Split('|'); - if (now.Length != 3) return; + #region build file name + string[] now = actualStation.Split('|'); + if (now.Length != 3) return; - string fName = now[0]; - string url = now[1]; - string file = now[2]; + string fName = now[0]; + string url = now[1]; + string file = now[2]; - Regex regex = new Regex(@"[\\/:*?<>|\b]"); - fName = regex.Replace(fName, "_"); - fName = fName.Replace(' ', '_'); - fName = fName.Replace('.', '_'); - fName = fName.Replace('!', '_'); - fName = fName.Replace('"', '_'); - fName = fName.Replace('\'', '_'); - fName = fName.Replace('*', '_'); + Regex regex = new Regex(@"[\\/:*?<>|\b]"); + fName = regex.Replace(fName, "_"); + fName = fName.Replace(' ', '_'); + fName = fName.Replace('.', '_'); + fName = fName.Replace('!', '_'); + fName = fName.Replace('"', '_'); + fName = fName.Replace('\'', '_'); + fName = fName.Replace('*', '_'); - if (!recordFolder.EndsWith("\\")) - recordFolder = recordFolder + "\\"; + if (!recordFolder.EndsWith("\\")) + recordFolder = recordFolder + "\\"; - string name = fName + "_"; + string name = fName + "_"; - name += DateTime.Now.Year.ToString() + "_"; - name += string.Format("{0:00}", DateTime.Now.Month) + "_"; - name += string.Format("{0:00}", DateTime.Now.Day) + "_"; + name += DateTime.Now.Year.ToString() + "_"; + name += string.Format("{0:00}", DateTime.Now.Month) + "_"; + name += string.Format("{0:00}", DateTime.Now.Day) + "_"; - name += string.Format("{0:00}", DateTime.Now.Hour); - name += string.Format("{0:00}", DateTime.Now.Minute); + name += string.Format("{0:00}", DateTime.Now.Hour); + name += string.Format("{0:00}", DateTime.Now.Minute); - name = name.Replace('.', '_'); - name = name.Replace(':', '_'); + name = name.Replace('.', '_'); + name = name.Replace(':', '_'); - #endregion + #endregion - string recordFile = recordFolder + name + ".mp3"; - Log.Debug("MyStreamRadio | record file : " + recordFile); + string recordFile = recordFolder + name + ".mp3"; + Log.Debug("MyStreamRadio | record file : " + recordFile); - lame = new EncoderLAME(_stream); - lame.InputFile = null; - lame.OutputFile = recordFile; - lame.LAME_Bitrate = (int)EncoderLAME.BITRATE.kbps_192; - lame.LAME_Mode = EncoderLAME.LAMEMode.Default; - lame.LAME_TargetSampleRate = (int)EncoderLAME.SAMPLERATE.Hz_44100; - lame.LAME_Quality = EncoderLAME.LAMEQuality.Quality; + lame = new EncoderLAME(_stream); + lame.InputFile = null; + lame.OutputFile = recordFile; + lame.LAME_Bitrate = (int)EncoderLAME.BITRATE.kbps_192; + lame.LAME_Mode = EncoderLAME.LAMEMode.Default; + lame.LAME_TargetSampleRate = (int)EncoderLAME.SAMPLERATE.Hz_44100; + lame.LAME_Quality = EncoderLAME.LAMEQuality.Quality; - bool result = lame.Start(null, IntPtr.Zero, false); + bool result = lame.Start(null, IntPtr.Zero, false); - if (result == true) - { - Log.Debug("MyStreamRadio | recording works"); + if (result == true) + { + Log.Debug("MyStreamRadio | recording works"); + } + else + { + Log.Debug("MyStreamRadio | recording did NOT work"); + lame.Stop(); + } } else { - Log.Debug("MyStreamRadio | recording did NOT work"); + Log.Debug("MyStreamRadio | stop recording"); lame.Stop(); } } else { - Log.Debug("MyStreamRadio | stop recording"); - lame.Stop(); + Log.Debug("MyStreamRadio | no stream found !"); + // no stream } } - else - { - Log.Debug("MyStreamRadio | no stream found !"); - // no stream - } } } - btnRecord.Selected = EncodeActive(); } - private bool IsUrl(string fileName) - { - if (fileName.ToLower().StartsWith("http:") || fileName.ToLower().StartsWith("https:") || - fileName.ToLower().StartsWith("mms:") || fileName.ToLower().StartsWith("rtsp:")) - { - return true; - } - return false; - } - private void Play(GUIListItem item) { RadioStation station = item.MusicTag as RadioStation; @@ -1890,5 +1847,45 @@ #endregion + #region some helper methods + + private bool IsUrl(string fileName) + { + if (fileName.ToLower().StartsWith("http:") || fileName.ToLower().StartsWith("https:") || + fileName.ToLower().StartsWith("mms:") || fileName.ToLower().StartsWith("rtsp:")) + { + return true; + } + return false; + } + private bool EncodeActive() + { + try + { + if (MediaPortal.Visualization.VisualizationBase.Bass.Initialized) + { + int _stream = (int)MediaPortal.Visualization.VisualizationBase.Bass.CurrentAudioStream; + if (_stream != 0) + { + if (lame == null) return false; + if (lame.IsActive) return true; + } + } + } + catch (Exception e) + { + Log.Error("Error getting current BASS Audio Stream." + "\n" + e.Message); + } + + return false; + } + private bool StreamradioIsPlaying() + { + if (currentFile == g_Player.CurrentFile) return true; + return false; + } + + #endregion + } } \ No newline at end of file Modified: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GuiRecordings.cs =================================================================== --- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GuiRecordings.cs 2011-04-30 18:51:53 UTC (rev 4188) +++ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GuiRecordings.cs 2011-04-30 19:21:35 UTC (rev 4189) @@ -416,23 +416,23 @@ int itemIndex = GetSelectedItemNo(); if (mapSettings.ViewAs == (int)View.BigIcons) { - facadeView.View = GUIFacadeControl.ViewMode.LargeIcons; + facadeView.CurrentLayout = GUIFacadeControl.Layout.LargeIcons; } else if (mapSettings.ViewAs == (int)View.Albums) { - facadeView.View = GUIFacadeControl.ViewMode.LargeIcons; + facadeView.CurrentLayout = GUIFacadeControl.Layout.LargeIcons; } else if (mapSettings.ViewAs == (int)View.Icons) { - facadeView.View = GUIFacadeControl.ViewMode.SmallIcons; + facadeView.CurrentLayout = GUIFacadeControl.Layout.SmallIcons; } else if (mapSettings.ViewAs == (int)View.List) { - facadeView.View = GUIFacadeControl.ViewMode.List; + facadeView.CurrentLayout = GUIFacadeControl.Layout.List; } else if (mapSettings.ViewAs == (int)View.Filmstrip) { - facadeView.View = GUIFacadeControl.ViewMode.Filmstrip; + facadeView.CurrentLayout = GUIFacadeControl.Layout.Filmstrip; } if (itemIndex > -1) { Modified: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/MyStreamRadio.csproj =================================================================== --- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/MyStreamRadio.csproj 2011-04-30 18:51:53 UTC (rev 4188) +++ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/MyStreamRadio.csproj 2011-04-30 19:21:35 UTC (rev 4189) @@ -39,6 +39,11 @@ <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Bass.Net.dll</HintPath> <Private>False</Private> </Reference> + <Reference Include="Common.Utils, Version=1.1.7.0, Culture=neutral, processorArchitecture=x86"> + <SpecificVersion>False</SpecificVersion> + <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Common.Utils.dll</HintPath> + <Private>False</Private> + </Reference> <Reference Include="Core, Version=1.0.5.32056, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Core.dll</HintPath> Modified: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Parser.cs =================================================================== --- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Parser.cs 2011-04-30 18:51:53 UTC (rev 4188) +++ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Parser.cs 2011-04-30 19:21:35 UTC (rev 4189) @@ -163,10 +163,10 @@ string[] lines = HTML.Split('\n'); string line; - string data = ""; + string data = string.Empty; - string a = ""; - string t = ""; + string a = string.Empty; + string t = string.Empty; int x = 0; int y = 0; @@ -209,9 +209,12 @@ x = data.IndexOf(actStation.Devider); if (x > 0) { + if (t == string.Empty) + { t = ConvStr(data.Substring(x + actStation.Devider.Length)); a = ConvStr(data.Substring(0, x)); ParserLog("Method 1: found title= " + t + " artist= " + a); + } } if (actStation.Image != "") @@ -721,8 +724,8 @@ string[] each = artistTitle.Split('-'); if (each.Length == 2) { - actStation.Artist = each[0]; - actStation.Title = each[1]; + actStation.Artist = ConvStr(each[0]); + actStation.Title = ConvStr(each[1]); } } } Modified: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/AssemblyInfo.cs 2011-04-30 18:51:53 UTC (rev 4188) +++ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/AssemblyInfo.cs 2011-04-30 19:21:35 UTC (rev 4189) @@ -2,6 +2,11 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using MediaPortal.Common.Utils; +[assembly: CompatibleVersion("1.1.7.0")] +[assembly: UsesSubsystem("MP.SkinEngine")] +[assembly: UsesSubsystem("MP.Config")] + // Allgemeine Informationen über eine Assembly werden über die folgenden // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, // die mit einer Assembly verknüpft sind. Modified: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio.suo =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eda...@us...> - 2013-07-16 18:39:33
|
Revision: 4608 http://sourceforge.net/p/mp-plugins/code/4608 Author: edalex86 Date: 2013-07-16 18:39:31 +0000 (Tue, 16 Jul 2013) Log Message: ----------- Added MP 1.4.0 compatibility Fixed loading and saving configuration Modified Paths: -------------- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GUIRadio.cs trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GuiRecordings.cs trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/MyStreamRadio.csproj trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/AssemblyInfo.cs trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/frmSetup.cs trunk/plugins/MyStreamradioV2/Source/MyStreamRadio.sln Modified: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GUIRadio.cs =================================================================== --- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GUIRadio.cs 2013-07-16 09:53:43 UTC (rev 4607) +++ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GUIRadio.cs 2013-07-16 18:39:31 UTC (rev 4608) @@ -50,7 +50,9 @@ //using for token processing using System.IO; using System.Text; +using Action = MediaPortal.GUI.Library.Action; + namespace MediaPortal.GUI.MyStreamRadio { [PluginIcons("MyStreamRadio.StreamRadio.png", "MyStreamRadio.StreamRadioDisabled.png")] @@ -139,7 +141,7 @@ [SkinControlAttribute(7)] protected GUIButtonControl btnNext = null; [SkinControlAttribute(9)] - protected GUIToggleButtonControl btnRecord = null; + protected GUICheckButton btnRecord = null; [SkinControlAttribute(11)] protected GUIButtonControl btnRecordings = null; Modified: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GuiRecordings.cs =================================================================== --- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GuiRecordings.cs 2013-07-16 09:53:43 UTC (rev 4607) +++ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GuiRecordings.cs 2013-07-16 18:39:31 UTC (rev 4608) @@ -39,6 +39,7 @@ using System.Xml.Serialization; using System.IO; using System.Data; +using Action = MediaPortal.GUI.Library.Action; namespace MediaPortal.GUI.MyStreamRadio { Modified: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/MyStreamRadio.csproj =================================================================== --- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/MyStreamRadio.csproj 2013-07-16 09:53:43 UTC (rev 4607) +++ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/MyStreamRadio.csproj 2013-07-16 18:39:31 UTC (rev 4608) @@ -1,4 +1,5 @@ -<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> @@ -13,16 +14,34 @@ </FileUpgradeFlags> <UpgradeBackupLocation> </UpgradeBackupLocation> - <OldToolsVersion>2.0</OldToolsVersion> + <OldToolsVersion>3.5</OldToolsVersion> + <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <TargetFrameworkProfile /> + <PublishUrl>publish\</PublishUrl> + <Install>true</Install> + <InstallFrom>Disk</InstallFrom> + <UpdateEnabled>false</UpdateEnabled> + <UpdateMode>Foreground</UpdateMode> + <UpdateInterval>7</UpdateInterval> + <UpdateIntervalUnits>Days</UpdateIntervalUnits> + <UpdatePeriodically>false</UpdatePeriodically> + <UpdateRequired>false</UpdateRequired> + <MapFileExtensions>true</MapFileExtensions> + <ApplicationRevision>0</ApplicationRevision> + <ApplicationVersion>1.0.0.%2a</ApplicationVersion> + <IsWebBootstrapper>false</IsWebBootstrapper> + <UseApplicationTrust>false</UseApplicationTrust> + <BootstrapperEnabled>true</BootstrapperEnabled> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> - <OutputPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\</OutputPath> + <OutputPath>..\..\..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\</OutputPath> <DefineConstants>DEBUG;TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>pdbonly</DebugType> @@ -32,31 +51,32 @@ <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <AllowUnsafeBlocks>false</AllowUnsafeBlocks> + <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet> </PropertyGroup> <ItemGroup> <Reference Include="Bass.Net, Version=2.4.4.3, Culture=neutral, PublicKeyToken=b7566c273e6ef480, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Bass.Net.dll</HintPath> + <HintPath>..\..\..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Bass.Net.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="Common.Utils, Version=1.1.7.0, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Common.Utils.dll</HintPath> + <HintPath>..\..\..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Common.Utils.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="Core, Version=1.0.5.32056, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Core.dll</HintPath> + <HintPath>..\..\..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Core.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="Databases, Version=1.0.5.32058, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Databases.dll</HintPath> + <HintPath>..\..\..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Databases.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="Dialogs, Version=1.0.5.32061, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\Dialogs.dll</HintPath> + <HintPath>..\..\..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\Dialogs.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="System" /> @@ -67,7 +87,7 @@ <Reference Include="System.Xml" /> <Reference Include="Utils, Version=2.2.7.32052, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Utils.dll</HintPath> + <HintPath>..\..\..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Utils.dll</HintPath> <Private>False</Private> </Reference> </ItemGroup> @@ -117,6 +137,23 @@ <ItemGroup> <EmbeddedResource Include="Template.xml" /> </ItemGroup> + <ItemGroup> + <BootstrapperPackage Include="Microsoft.Net.Client.3.5"> + <Visible>False</Visible> + <ProductName>Клиентский профиль .NET Framework 3.5 SP1</ProductName> + <Install>false</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1"> + <Visible>False</Visible> + <ProductName>.NET Framework 3.5 SP1</ProductName> + <Install>true</Install> + </BootstrapperPackage> + <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1"> + <Visible>False</Visible> + <ProductName>Установщик Windows 3.1</ProductName> + <Install>true</Install> + </BootstrapperPackage> + </ItemGroup> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets. Modified: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/AssemblyInfo.cs 2013-07-16 09:53:43 UTC (rev 4607) +++ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/AssemblyInfo.cs 2013-07-16 18:39:31 UTC (rev 4608) @@ -3,10 +3,7 @@ using System.Runtime.InteropServices; using MediaPortal.Common.Utils; -[assembly: CompatibleVersion("1.1.7.0")] -[assembly: UsesSubsystem("MP.SkinEngine")] -[assembly: UsesSubsystem("MP.Config")] - +[assembly: CompatibleVersion("1.1.6.27644")] // Allgemeine Informationen über eine Assembly werden über die folgenden // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, // die mit einer Assembly verknüpft sind. Modified: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/frmSetup.cs =================================================================== --- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/frmSetup.cs 2013-07-16 09:53:43 UTC (rev 4607) +++ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/frmSetup.cs 2013-07-16 18:39:31 UTC (rev 4608) @@ -29,6 +29,7 @@ using System.Text; using System.Windows.Forms; using System.Xml; +using MediaPortal.Configuration; namespace MediaPortal.GUI.MyStreamRadio { @@ -103,7 +104,7 @@ void LoadSettings() { - using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings("MediaPortal.xml")) + using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { edtRadio.Text = xmlreader.GetValueAsString("mystreamradio", "Radiopath", Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + "\\Radio"); edtRecord.Text = xmlreader.GetValueAsString("mystreamradio", "Record", xmlreader.GetValueAsString("mystreamradio", "Record", Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + "\\Record")); @@ -144,7 +145,7 @@ if (edtRecord.Text.Length == 0) return; - using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings("MediaPortal.xml")) + using (MediaPortal.Profile.Settings xmlwriter = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { xmlwriter.SetValue("mystreamradio", "Radiopath", edtRadio.Text); xmlwriter.SetValue("mystreamradio", "Record", edtRecord.Text); Modified: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio.sln =================================================================== --- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio.sln 2013-07-16 09:53:43 UTC (rev 4607) +++ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio.sln 2013-07-16 18:39:31 UTC (rev 4608) @@ -1,6 +1,6 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MyStreamRadio", "MyStreamRadio\MyStreamRadio.csproj", "{C24ED28B-D6D1-4D0D-AF06-F10BAC35528F}" EndProject Global This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <seb...@us...> - 2014-05-01 10:43:48
|
Revision: 4792 http://sourceforge.net/p/mp-plugins/code/4792 Author: sebastiii Date: 2014-05-01 10:43:45 +0000 (Thu, 01 May 2014) Log Message: ----------- Add external bin (based on 1.7.1) and fix AssemblyInfo for proper SubsystemVersions. Modified Paths: -------------- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/MyStreamRadio.csproj trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/AssemblyInfo.cs trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/Resources.Designer.cs Added Paths: ----------- trunk/plugins/MyStreamradioV2/Source/External/ trunk/plugins/MyStreamradioV2/Source/External/Bass.Net.dll trunk/plugins/MyStreamradioV2/Source/External/Common.Utils.dll trunk/plugins/MyStreamradioV2/Source/External/Core.dll trunk/plugins/MyStreamradioV2/Source/External/Databases.dll trunk/plugins/MyStreamradioV2/Source/External/Dialogs.dll trunk/plugins/MyStreamradioV2/Source/External/Utils.dll Added: trunk/plugins/MyStreamradioV2/Source/External/Bass.Net.dll =================================================================== (Binary files differ) Index: trunk/plugins/MyStreamradioV2/Source/External/Bass.Net.dll =================================================================== --- trunk/plugins/MyStreamradioV2/Source/External/Bass.Net.dll 2014-04-30 20:28:38 UTC (rev 4791) +++ trunk/plugins/MyStreamradioV2/Source/External/Bass.Net.dll 2014-05-01 10:43:45 UTC (rev 4792) Property changes on: trunk/plugins/MyStreamradioV2/Source/External/Bass.Net.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: trunk/plugins/MyStreamradioV2/Source/External/Common.Utils.dll =================================================================== (Binary files differ) Index: trunk/plugins/MyStreamradioV2/Source/External/Common.Utils.dll =================================================================== --- trunk/plugins/MyStreamradioV2/Source/External/Common.Utils.dll 2014-04-30 20:28:38 UTC (rev 4791) +++ trunk/plugins/MyStreamradioV2/Source/External/Common.Utils.dll 2014-05-01 10:43:45 UTC (rev 4792) Property changes on: trunk/plugins/MyStreamradioV2/Source/External/Common.Utils.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: trunk/plugins/MyStreamradioV2/Source/External/Core.dll =================================================================== (Binary files differ) Index: trunk/plugins/MyStreamradioV2/Source/External/Core.dll =================================================================== --- trunk/plugins/MyStreamradioV2/Source/External/Core.dll 2014-04-30 20:28:38 UTC (rev 4791) +++ trunk/plugins/MyStreamradioV2/Source/External/Core.dll 2014-05-01 10:43:45 UTC (rev 4792) Property changes on: trunk/plugins/MyStreamradioV2/Source/External/Core.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: trunk/plugins/MyStreamradioV2/Source/External/Databases.dll =================================================================== (Binary files differ) Index: trunk/plugins/MyStreamradioV2/Source/External/Databases.dll =================================================================== --- trunk/plugins/MyStreamradioV2/Source/External/Databases.dll 2014-04-30 20:28:38 UTC (rev 4791) +++ trunk/plugins/MyStreamradioV2/Source/External/Databases.dll 2014-05-01 10:43:45 UTC (rev 4792) Property changes on: trunk/plugins/MyStreamradioV2/Source/External/Databases.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: trunk/plugins/MyStreamradioV2/Source/External/Dialogs.dll =================================================================== (Binary files differ) Index: trunk/plugins/MyStreamradioV2/Source/External/Dialogs.dll =================================================================== --- trunk/plugins/MyStreamradioV2/Source/External/Dialogs.dll 2014-04-30 20:28:38 UTC (rev 4791) +++ trunk/plugins/MyStreamradioV2/Source/External/Dialogs.dll 2014-05-01 10:43:45 UTC (rev 4792) Property changes on: trunk/plugins/MyStreamradioV2/Source/External/Dialogs.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Added: trunk/plugins/MyStreamradioV2/Source/External/Utils.dll =================================================================== (Binary files differ) Index: trunk/plugins/MyStreamradioV2/Source/External/Utils.dll =================================================================== --- trunk/plugins/MyStreamradioV2/Source/External/Utils.dll 2014-04-30 20:28:38 UTC (rev 4791) +++ trunk/plugins/MyStreamradioV2/Source/External/Utils.dll 2014-05-01 10:43:45 UTC (rev 4792) Property changes on: trunk/plugins/MyStreamradioV2/Source/External/Utils.dll ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property Modified: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/MyStreamRadio.csproj =================================================================== --- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/MyStreamRadio.csproj 2014-04-30 20:28:38 UTC (rev 4791) +++ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/MyStreamRadio.csproj 2014-05-01 10:43:45 UTC (rev 4792) @@ -15,7 +15,7 @@ <UpgradeBackupLocation> </UpgradeBackupLocation> <OldToolsVersion>3.5</OldToolsVersion> - <TargetFrameworkVersion>v3.5</TargetFrameworkVersion> + <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkProfile /> <PublishUrl>publish\</PublishUrl> <Install>true</Install> @@ -56,27 +56,27 @@ <ItemGroup> <Reference Include="Bass.Net, Version=2.4.4.3, Culture=neutral, PublicKeyToken=b7566c273e6ef480, processorArchitecture=MSIL"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Bass.Net.dll</HintPath> + <HintPath>..\External\Bass.Net.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="Common.Utils, Version=1.1.7.0, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Common.Utils.dll</HintPath> + <HintPath>..\External\Common.Utils.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="Core, Version=1.0.5.32056, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Core.dll</HintPath> + <HintPath>..\External\Core.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="Databases, Version=1.0.5.32058, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Databases.dll</HintPath> + <HintPath>..\External\Databases.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="Dialogs, Version=1.0.5.32061, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\plugins\Windows\Dialogs.dll</HintPath> + <HintPath>..\External\Dialogs.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="System" /> @@ -87,7 +87,7 @@ <Reference Include="System.Xml" /> <Reference Include="Utils, Version=2.2.7.32052, Culture=neutral, processorArchitecture=x86"> <SpecificVersion>False</SpecificVersion> - <HintPath>..\..\..\..\..\..\..\..\Program Files\Team MediaPortal\MediaPortal\Utils.dll</HintPath> + <HintPath>..\External\Utils.dll</HintPath> <Private>False</Private> </Reference> </ItemGroup> Modified: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/AssemblyInfo.cs =================================================================== --- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/AssemblyInfo.cs 2014-04-30 20:28:38 UTC (rev 4791) +++ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/AssemblyInfo.cs 2014-05-01 10:43:45 UTC (rev 4792) @@ -3,7 +3,8 @@ using System.Runtime.InteropServices; using MediaPortal.Common.Utils; -[assembly: CompatibleVersion("1.1.6.27644")] +// Define that our plugin is designed for MediaPortal 1.7 - the MP dlls have been slightly restructured and it's using .net 4 now, so not backward compatible +[assembly: CompatibleVersion("1.7.000.0", "1.7.000.0")] // Allgemeine Informationen über eine Assembly werden über die folgenden // Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, // die mit einer Assembly verknüpft sind. @@ -35,3 +36,9 @@ // übernehmen, indem Sie "*" eingeben: [assembly: AssemblyVersion("0.6.5.1")] [assembly: AssemblyFileVersion("0.6.5.1")] + +// Tell MediaPortal which subsystems this plugin will use, so it can check for compatiblity +[assembly: UsesSubsystem("MP.SkinEngine")] +[assembly: UsesSubsystem("MP.Plugins.Music")] +[assembly: UsesSubsystem("MP.Config")] +[assembly: UsesSubsystem("MP.Externals.BASS")] Modified: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/Resources.Designer.cs =================================================================== --- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/Resources.Designer.cs 2014-04-30 20:28:38 UTC (rev 4791) +++ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/Resources.Designer.cs 2014-05-01 10:43:45 UTC (rev 4792) @@ -1,10 +1,10 @@ //------------------------------------------------------------------------------ // <auto-generated> -// Dieser Code wurde von einem Tool generiert. -// Laufzeitversion:2.0.50727.3082 +// This code was generated by a tool. +// Runtime Version:4.0.30319.34014 // -// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn -// der Code erneut generiert wird. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------ @@ -13,13 +13,13 @@ /// <summary> - /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// A strongly-typed resource class, for looking up localized strings, etc. /// </summary> - // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert - // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. - // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen - // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -33,7 +33,7 @@ } /// <summary> - /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// Returns the cached ResourceManager instance used by this class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { @@ -47,8 +47,8 @@ } /// <summary> - /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle - /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. /// </summary> [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Globalization.CultureInfo Culture { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eda...@us...> - 2015-05-25 21:21:35
|
Revision: 4956 http://sourceforge.net/p/mp-plugins/code/4956 Author: edalex86 Date: 2015-05-25 21:21:32 +0000 (Mon, 25 May 2015) Log Message: ----------- New features: - AudioAddict API added (di.fm, jazz radio etc) - Async directory loading Fixes: - Project reverted to .Net 3.5 to restore compatibility with MP below 1.7.0 - Recording temporally disabled to eliminate Bass dependency - Visualizations disabled (not present in MediaPortal anymore) Modified Paths: -------------- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GUIRadio.cs trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/MyStreamRadio.csproj trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Parser.cs trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/Properties/Resources.Designer.cs Added Paths: ----------- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/AudioAddict/ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/AudioAddict/AudioAddictAPI.cs Removed Paths: ------------- trunk/plugins/MyStreamradioV2/Source/External/ Added: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/AudioAddict/AudioAddictAPI.cs =================================================================== --- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/AudioAddict/AudioAddictAPI.cs (rev 0) +++ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/AudioAddict/AudioAddictAPI.cs 2015-05-25 21:21:32 UTC (rev 4956) @@ -0,0 +1,352 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using MediaPortal.Configuration; +using MediaPortal.Util; +using MediaPortal.GUI.Library; +using System.Web.Script.Serialization; +using System.Net; +using System.IO; +using System.ComponentModel; + +namespace MediaPortal.GUI.MyStreamRadio +{ + public class AudioAddictAPI + { + // some info taken from http://difm.eu/dox/ , the rest - personal experimenting + private const string NetworksURL = @"http://api.audioaddict.com/v1/networks"; + public static string APIBaseUrl = @"http://api.audioaddict.com/"; + public static JavaScriptSerializer js = new JavaScriptSerializer(); + const string PluginSubfolder = "MyStreamRadio\\"; + //public static string StreamBaseUrl = "http://listen.di.fm/"; + //string Config.GetSubFolder(Config.Dir.Thumbs, PluginSubfolder + @"sources\tv\"); + + public static void LoadInternalStations() + { + BackgroundWorker AADownloader = new BackgroundWorker(); + AADownloader.DoWork += new DoWorkEventHandler(ad_DoWork); + AADownloader.RunWorkerAsync(); + AADownloader.Dispose(); + + } + private static void ad_DoWork(object sender, DoWorkEventArgs e) + { + var networkList = new List<AANetwork>(); + networkList.AddRange(js.Deserialize<AANetwork[]>(GetResponse(NetworksURL))); + Log.Debug("Server response contains {0} networks.", networkList.Count); + + foreach (var network in networkList) + { + var nw = new RadioNetwork { ListenURL = network.listen_url, Key = network.key, Name = network.name }; + ProcessNetwork(nw); + } + } + + + public static List<AANetwork> GetNetworks() + { + return js.Deserialize<AANetwork[]>(GetResponse(NetworksURL)).ToList(); + } + + public static List<AAChannel> GetChannels(string networkName) + { + var wc = new WebClient(); + var channelList = new List<AAChannel>(); + AANetwork selNet = GetNetworks().First(n => n.name == networkName); + var nw = new RadioNetwork { ListenURL = selNet.listen_url, Key = selNet.key, Name = selNet.name }; + channelList.AddRange(js.Deserialize<AAChannel[]>(GetResponse(nw.ChannelListURL))); + channelList.Sort(AAChannel.Compare); + return channelList; + } + public static AAChannelInfo GetChannelInfo(AAChannel ch, RadioNetwork network) + { + var response = GetResponse(network.ChannelURL + ch.id); + if (string.IsNullOrEmpty(response)) + { + Log.Debug(" Channel info not found for channel ID {0}", ch.id); + return null; + } + AAChannelInfo info = js.Deserialize<AAChannelInfo>(response); + info.ParentNetwork = network; + return info; + } + + public static void ProcessNetwork(RadioNetwork network) + { + var wc = new WebClient(); + var channelList = new List<AAChannel>(); + + Log.Debug("MyStreamRadio: Getting info for network {0}", network.Name); + + if (!Directory.Exists(network.MainFolder)) + Directory.CreateDirectory(Path.GetDirectoryName(network.MainFolder)); + if (!Directory.Exists(network.ImageFolder)) + Directory.CreateDirectory(Path.GetDirectoryName(network.ImageFolder)); + if (!Directory.Exists(network.BannerFolder)) + Directory.CreateDirectory(Path.GetDirectoryName(network.BannerFolder)); + + channelList.AddRange(js.Deserialize<AAChannel[]>(GetResponse(network.ChannelListURL))); + channelList.Sort(AAChannel.Compare); + foreach (var channel in channelList) + { + Log.Debug("\n Name: "); + Log.Debug(channel.name); + Log.Debug(", ID: {0}", channel.id); + AAChannelInfo info = GetChannelInfo(channel, network); + var localAssetFileName = network.ImageFolder + network.Prefix + channel.name + Path.GetExtension(info.asset_url); + if (!File.Exists(localAssetFileName) || (File.GetLastWriteTime(localAssetFileName) < info.updated_at)) + { + try + { + wc.DownloadFile(@"http:" + info.asset_url, localAssetFileName); + Log.Debug(" logo updated"); + } + catch (Exception e) + { + Log.Debug(" couldn't download image with id {0}: {1}", channel.id, e.Message); + } + } + else + { + Log.Debug(" skipped old existing logo"); + } + var localBannerFileName =network.BannerFolder + network.Prefix + channel.name + Path.GetExtension(info.banner_url); + if (!File.Exists(localBannerFileName) || (File.GetLastWriteTime(localBannerFileName) < info.updated_at)) + { + if (info.banner_url == null) + { + Log.Debug(" banner not defined"); + } + else try + { + wc.DownloadFile(@"http:" + info.banner_url, localBannerFileName); + Log.Debug(" banner updated"); + } + catch (Exception e) + { + Log.Debug(" couldn't download banner with id {0}: {1}", channel.id, e.Message); + } + } + } + Log.Debug("\nCompleted list with {0} channels.", channelList.Count); + } + + + static string GetResponse(string request) + { + var wc = new WebClient(); + wc.Headers.Add("Content-type: application/json"); + wc.Headers.Add("Accept: application/json"); + string response = string.Empty; + try + { + response = wc.DownloadString(request); + } + catch (Exception e) + { + Log.Debug("Error retrieving data from server: {0}", e.Message); + } + wc.Dispose(); + return response; + } + + + + + + public class AANetwork + { + public DateTime created_at; + public string description; + public int id; + public string key; + public string name; + public DateTime updated_at; + public string url; + public string listen_url; + public string service_key; + /*{"created_at":"2010-03-16T18:02:42-04:00" + "description":null + "id":1 + "key":"di" + "name":"Digitally Imported" + "updated_at":"2014-03-13T19:36:19-04:00" + "url":"http:\/\/www.di.fm" + "listen_url":"http:\/\/listen.di.fm" + "service_key":"di-premium" + }*/ + } + + public class RadioNetwork + { + public string Name; + public string Key; + public string ListenURL; + public string ChannelListURL { get { return ListenURL + @"/public3"; } } + public string ChannelURL { get { return string.Format(@"http://api.audioaddict.com/v1/{0}/channels/", Key); } } + public string MainFolder { get { return Config.GetSubFolder(Config.Dir.Thumbs, PluginSubfolder) + Name + @"\"; } } + public string ImageFolder { get { return Path.Combine(MainFolder, @"Images\"); } } + public string BannerFolder { get { return Path.Combine(MainFolder, @"Banners\"); } } + public string Prefix + { // abbreviation for network name as prefix for images + get + { + string result; + switch (Key) + { + case "radiotunes": + result = "rt"; + break; + case "jazzradio": + result = "jr"; + break; + case "rockradio": + result = "rr"; + break; + case "frescaradio": + result = "fr"; + break; + default: + result = Key; + break; + } + return result + " "; + } + } + } + + public enum StreamType + { + android_low, //40kbps aac + android, //64kbps aac + android_high, //96kbps mp3 + android_premium_low, //40kbps aac + android_premium_medium, //64kbps aac + android_premium, //128kbps aac + android_premium_high, //256kbps mp3 + public1, //64kbps aac + public2, //40kbps aac + public3, //96kbps mp3 + premium_low, //40kbps aac + premium_medium, //64kbps aac + premium, //128kbps aac + premium_high //256kbps mp3 + } + public class Stream + { + public int id { get; set; } + public string key { get; set; } + public string name { get; set; } + public string playlist { get; set; } + + } + public class PLaylist + { + } + public class AAChannel + { + public int id { get; set; } + public string key { get; set; } + public string name { get; set; } + public string playlist { get; set; } + //} + /* + {"id":348, + "key":"dub", + "name":"Dub", + "playlist":"http:\/\/listen.di.fm\/[streamlist]\/dub.pls" + } + */ + + public static int Compare(AAChannel ch1, AAChannel ch2) + { + return ch1.id - ch2.id; + } + } + + public class AAChannelInfo + { + public string ad_channels { get; set; } + public string channel_director { get; set; } + public DateTime created_at { get; set; } + public string description_long { get; set; } + public string description_short { get; set; } + public int? forum_id { get; set; } + public int id { get; set; } + public string key { get; set; } + public string name { get; set; } + public int? network_id { get; set; } + public int? old_id { get; set; } + public int? premium_id { get; set; } + public int? tracklist_server_id { get; set; } + public DateTime updated_at { get; set; } + public int? asset_id { get; set; } + public string asset_url { get; set; } + public string banner_url { get; set; } + public string description { get; set; } + public AASimilarChannels[] similar_channels { get; set; } + public AAImages images { get; set; } + public string LocalImage + { + get { return (string.IsNullOrEmpty(asset_url) ? "" : ParentNetwork.ImageFolder + ParentNetwork.Prefix + name + Path.GetExtension(asset_url)); } + + } + public RadioNetwork ParentNetwork { get; set; } + } + + public class AASimilarChannels + { + public int id { get; set; } + public int similar_channel_id { get; set; } + } + + public class AAImages + { + private string def; + + public string Default + { + get { return def; } + set { def = (value == null) ? null : value.Replace("{?size,height,width,quality}", ""); } + } + + private string hor_b; + + public string horizontal_banner + { + get { return hor_b; } + set { hor_b = (value == null) ? null : value.Replace("{?size,height,width,quality}", ""); } + } + + /* + {"ad_channels":"8554477917, electronic_music, 8614582190", + "channel_director":"Entranced", + "created_at":"2010-03-16T18:02:42-04:00", + "description_long":"", + "description_short":"Emotive high energy dance music which embraces melodies, vocals and a true journey of dance music songwriting.", + "forum_id":5, + "id":1, + "key":"trance", + "name":"Trance", + "network_id":1, + "old_id":1, + "premium_id":0, + "tracklist_server_id":25623, + "updated_at":"2015-02-17T14:56:41-05:00", + "asset_id":1, + "asset_url":"\/\/static.audioaddict.com\/befc1043f0a216128f8570d3664856f7.png", + "banner_url":"\/\/static.audioaddict.com\/7\/7\/9\/6\/8\/6\/7796862185adb0e0447d31d01c02c2c1.jpg", + "description":"Emotive high energy dance music which embraces melodies, vocals and a true journey of dance music songwriting.", + "similar_channels":[{"id":159,"similar_channel_id":2}, + {"id":160,"similar_channel_id":90}, + {"id":186,"similar_channel_id":175}], + "images":{ "default":"\/\/api.audioaddict.com\/v1\/assets\/image\/befc1043f0a216128f8570d3664856f7.png{?size,height,width,quality}", + "horizontal_banner":"\/\/api.audioaddict.com\/v1\/assets\/image\/7796862185adb0e0447d31d01c02c2c1.jpg{?size,height,width,quality}"} + } + } + */ + } + + } +} \ No newline at end of file Modified: trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GUIRadio.cs =================================================================== --- trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GUIRadio.cs 2015-02-21 11:13:37 UTC (rev 4955) +++ trunk/plugins/MyStreamradioV2/Source/MyStreamRadio/GUIRadio.cs 2015-05-25 21:21:32 UTC (rev 4956) @@ -41,18 +41,21 @@ //using MediaPortal.Radio.Database; using MediaPortal.Music.Database; -using MediaPortal.Visualization; +//using MediaPortal.Visualization; //Bass classes -using Un4seen.Bass; -using Un4seen.Bass.Misc; +//using Un4seen.Bass; +//using Un4seen.Bass.Misc; //using for token processing using System.IO; using System.Text; +using System.Linq; using Action = MediaPortal.GUI.Library.Action; +using System.ComponentModel; + namespace MediaPortal.GUI.MyStreamRadio { [PluginIcons("MyStreamRadio.StreamRadio.png", "MyStreamRadio.StreamRadioDisabled.png")] @@ -89,7 +92,7 @@ string currentFolder = string.Empty; - string currentRadioFolder = string.Empty; + string RootRadioFolder = string.Empty; string recordFolder = string.Empty; string currentFile = string.Empty; @@ -118,7 +121,7 @@ private int displayTime = 1; private int actDisplayTime = 0; - private EncoderLAME lame; + //private EncoderLAME lame; private bool useIcecast = false; private bool useShoutcast = false; @@ -126,6 +129,8 @@ private string engine = string.Empty; private int filter = 0; + public List<AudioAddictAPI.AANetwork> networks = new List<AudioAddictAPI.AANetwork>(); + #endregion #region SkinControls @@ -160,13 +165,13 @@ using (MediaPortal.Profile.Settings xmlreader = new MediaPortal.Profile.Settings(Config.GetFile(Config.Dir.Config, "MediaPortal.xml"))) { #region path settings - currentRadioFolder = xmlreader.GetValueAsString("mystreamradio", "Radiopath", Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + "\\Radio"); + RootRadioFolder = xmlreader.GetValueAsString("mystreamradio", "Radiopath", Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + "\\Radio"); recordFolder = xmlreader.GetValueAsString("mystreamradio", "Record", Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config) + "\\Record"); - Log.Debug("MyStreamRadio: radio folder = " + currentRadioFolder); + Log.Debug("MyStreamRadio: radio folder = " + RootRadioFolder); Log.Debug("MyStreamRadio: record folder = " + recordFolder); - if (!Directory.Exists(currentRadioFolder)) + if (!Directory.Exists(RootRadioFolder)) { Log.Error("MyStreamRadio: radio path is not existing"); } @@ -325,6 +330,8 @@ { ServicePointManager.DefaultConnectionLimit = 10; currentFolder = string.Empty; + networks = AudioAddictAPI.GetNetworks(); + AudioAddictAPI.LoadInternalStations(); return (Load(GUIGraphicsContext.Skin + @"\mystreamradio.xml")); } @@ -368,7 +375,7 @@ #endregion virtualDirectory = new VirtualDirectory(); - Share share = new Share("default", currentRadioFolder); + Share share = new Share("default", RootRadioFolder); share.Default = true; virtualDirectory.Add(share); virtualDirectory.AddExtension(".xml"); @@ -400,24 +407,24 @@ else _Autostart.Start(); #endregion - if (MediaPortal.Visualization.VisualizationBase.VisualizationWindow != null) - { - if (MediaPortal.Visualization.VisualizationBase.VisualizationWindow.Controls["Display"] == null) - { - Log.Debug("Streamradio: Creating new label on Visualization screen"); - crtDisplay lb = new crtDisplay(); - lb.Name = "Display"; - lb.Visible = false; - MediaPortal.Visualization.VisualizationBase.VisualizationWindow.Controls.Add(lb); - } + //if (MediaPortal.Visualization.VisualizationBase.VisualizationWindow != null) + //{ + // if (MediaPortal.Visualization.VisualizationBase.VisualizationWindow.Controls["Display"] == null) + // { + // Log.Debug("Streamradio: Creating new label on Visualization screen"); + // crtDisplay lb = new crtDisplay(); + // lb.Name = "Display"; + // lb.Visible = false; + // MediaPortal.Visualization.VisualizationBase.VisualizationWindow.Controls.Add(lb); + // } - if (!isInit) - { - isInit = true; - MediaPortal.Visualization.VisualizationBase.VisualizationWindow.SizeChanged += new EventHandler(VisualizationWindow_SizeChanged); - } + // if (!isInit) + // { + // isInit = true; + // MediaPortal.Visualization.VisualizationBase.VisualizationWindow.SizeChanged += new EventHandler(VisualizationWindow_SizeChanged); + // } - } + //} Log.Info("Streamradio: Player engine is " + engine); if (!engine.Contains("BASS")) @@ -500,7 +507,7 @@ if (control == btnRecord) { - OnRecord(); + //OnRecord(); } if (control == btnRecordings) @@ -657,7 +664,7 @@ { if (action.wID == Action.ActionType.ACTION_RECORD) { - OnRecord(); + //OnRecord(); } if (action.wID == Action.ActionType.ACTION_STOP) @@ -714,11 +721,11 @@ _Update.Enabled = false; _Update.Stop(); - if (MediaPortal.Visualization.VisualizationBase.VisualizationWindow != null) - { - crtDisplay mLabel = (crtDisplay)MediaPortal.Visualization.VisualizationBase.VisualizationWindow.Controls["Display"]; - if (mLabel != null) mLabel.Visible = false; - } + //if (MediaPortal.Visualization.VisualizationBase.VisualizationWindow != null) + //{ + // crtDisplay mLabel = (crtDisplay)MediaPortal.Visualization.VisualizationBase.VisualizationWindow.Controls["Display"]; + // if (mLabel != null) mLabel.Visible = false; + //} GUIPropertyManager.SetProperty("#Play.Current.Title", ""); GUIPropertyManager.SetProperty("#Play.Current.Artist", ""); @@ -726,42 +733,42 @@ } } - private void VisualizationWindow_SizeChanged(object sender, EventArgs e) - { - if (_Update.Enabled) - { - if (MediaPortal.Visualization.VisualizationBase.VisualizationWindow == null) return; + //private void VisualizationWindow_SizeChanged(object sender, EventArgs e) + //{ + // if (_Update.Enabled) + // { + // if (MediaPortal.Visualization.VisualizationBase.VisualizationWindow == null) return; - crtDisplay mLabel = (crtDisplay)MediaPortal.Visualization.VisualizationBase.VisualizationWindow.Controls["Display"]; - if (mLabel == null) return; + // crtDisplay mLabel = (crtDisplay)MediaPortal.Visualization.VisualizationBase.VisualizationWindow.Controls["Display"]; + // if (mLabel == null) return; - if (currentFile == g_Player.CurrentFile) - { - if (g_Player.FullScreen) - { - int x = MediaPortal.Visualization.VisualizationBase.VisualizationWindow.Width; - int y = MediaPortal.Visualization.VisualizationBase.VisualizationWindow.Height; + // if (currentFile == g_Player.CurrentFile) + // { + // if (g_Player.FullScreen) + // { + // int x = MediaPortal.Visualization.VisualizationBase.VisualizationWindow.Width; + // int y = MediaPortal.Visualization.VisualizationBase.VisualizationWindow.Height; - mLabel.Size = new Size(x, y / 8); - mLabel.Location = new Point(0, y / 10 * 8); + // mLabel.Size = new Size(x, y / 8); + // mLabel.Location = new Point(0, y / 10 * 8); - // set visible depending on mode - if ((displayMode == 1) || ((displayMode == 2) && (actDisplayTime > 0))) - mLabel.Visible = true; - } - else - { - mLabel.Visible = false; - } - } - else - mLabel.Visible = false; - } - else - { - // not enabled - } - } + // // set visible depending on mode + // if ((displayMode == 1) || ((displayMode == 2) && (actDisplayTime > 0))) + // mLabel.Visible = true; + // } + // else + // { + // mLabel.Visible = false; + // } + // } + // else + // mLabel.Visible = false; + // } + // else + // { + // // not enabled + // } + //} private void _Update_Tick(Object obj, EventArgs e) { @@ -774,19 +781,19 @@ { crtDisplay mLabel = null; - if (MediaPortal.Visualization.VisualizationBase.VisualizationWindow != null) - { - mLabel = (crtDisplay)MediaPortal.Visualization.VisualizationBase.VisualizationWindow.Controls["Display"]; + //if (MediaPortal.Visualization.VisualizationBase.VisualizationWindow != null) + //{ + // mLabel = (crtDisplay)MediaPortal.Visualization.VisualizationBase.VisualizationWindow.Controls["Display"]; - // set visible depending on mode - if (mLabel != null) - { - if ((displayMode == 1) || ((displayMode == 2) && (actDisplayTime > 0))) - mLabel.Visible = true; - else - mLabel.Visible = false; - } - } + // // set visible depending on mode + // if (mLabel != null) + // { + // if ((displayMode == 1) || ((displayMode == 2) && (actDisplayTime > 0))) + // mLabel.Visible = true; + // else + // mLabel.Visible = false; + // } + //} if (parser != null) { @@ -815,39 +822,39 @@ Log.Info("StreamRadio: Current track: {0} [{1}] - {2}", parser.Artist.Trim(), actualStation, parser.Title.Trim()); } } - if (MediaPortal.Visualization.VisualizationBase.VisualizationWindow != null && mLabel != null) - { - if (actualStation != null) - { - string[] now = actualStation.Split('|'); - if (now.Length != 3) return; + //if (MediaPortal.Visualization.VisualizationBase.VisualizationWindow != null && mLabel != null) + //{ + // if (actualStation != null) + // { + // string[] now = actualStation.Split('|'); + // if (now.Length != 3) return; - string name = now[0]; - string url = now[1]; - string file = now[2]; + // string name = now[0]; + // string url = now[1]; + // string file = now[2]; - if (file.ToLower().Contains("xml")) - { - Station station = new Station(file); + // if (file.ToLower().Contains("xml")) + // { + // Station station = new Station(file); - int _stream = (int)MediaPortal.Visualization.VisualizationBase.Bass.CurrentAudioStream; + // int _stream = (int)MediaPortal.Visualization.VisualizationBase.Bass.CurrentAudioStream; - if (_stream != 0) - { - mLabel.Artist = parser.Artist; - mLabel.Title = parser.Title; + // if (_stream != 0) + // { + // mLabel.Artist = parser.Artist; + // mLabel.Title = parser.Title; - mLabel.Station = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Thumbs) + "\\Radio\\" + station.Logo; - mLabel.Country = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Thumbs) + "\\Radio\\" + station.Country + ".png"; - mLabel.Desciption = station.Description; - if (EncodeActive()) mLabel.Desciption = "RECORD"; + // mLabel.Station = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Thumbs) + "\\Radio\\" + station.Logo; + // mLabel.Country = MediaPortal.Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Thumbs) + "\\Radio\\" + station.Country + ".png"; + // mLabel.Desciption = station.Description; + // if (EncodeActive()) mLabel.Desciption = "RECORD"; - mLabel.BringToFront(); - } - } - } - } + // mLabel.BringToFront(); + // } + // } + // } + //} } } } @@ -1047,6 +1054,19 @@ private void LoadDirectory() { + + BackgroundWorker ListAdder = new BackgroundWorker(); + ListAdder.DoWork += new DoWorkEventHandler(ListAdder_DoWork); + ListAdder.RunWorkerAsync(); + } + + private void ListAdder_DoWork(object sender, DoWorkEventArgs e) + { + LoadDirectoryAsync(); + } + + private void LoadDirectoryAsync() + { GUIWaitCursor.Show(); GUIControl.ClearControl(GetID, facadeView.GetID); @@ -1055,318 +1075,369 @@ GUIListItem aItem = null; - if (currentRadioFolder.Length != 0) + if (RootRadioFolder.Length != 0) { - #region special folder - string folderName = currentFolder; + #region special folder + string folderName = currentFolder; - if (folderName.Length == 0) folderName = currentRadioFolder; + if (folderName.Length == 0) folderName = RootRadioFolder; - // icecast folder - if (folderName == currentRadioFolder) - { - if (useIcecast) + // icecast folder + if (folderName == RootRadioFolder) { - aItem = new GUIListItem(); - aItem.Label = "Icecast"; - aItem.Path = "Icecast"; - aItem.IsFolder = true; - aItem.MusicTag = null; - aItem.IconImageBig = "icecastBig.png"; - aItem.IconImage = "icecast.png"; + #region add AudioAddict networks + foreach (AudioAddictAPI.AANetwork net in networks) + { + GUIListItem aaItem = new GUIListItem(); + aaItem.Label = net.name; + aaItem.Path = net.name; + aaItem.IsFolder = true; + aaItem.MusicTag = net; + Util.Utils.SetDefaultIcons(aaItem); + facadeView.Add(aaItem); + totalItems++; + aaItem.Dispose(); + } + #endregion - facadeView.Add(aItem); - totalItems++; + if (useIcecast) + { + aItem = new GUIListItem(); + aItem.Label = "Icecast"; + aItem.Path = "Icecast"; + aItem.IsFolder = true; + aItem.MusicTag = null; + aItem.IconImageBig = "icecastBig.png"; + aItem.IconImage = "icecast.png"; + + facadeView.Add(aItem); + totalItems++; + } + if (useShoutcast) + { + aItem = new GUIListItem(); + aItem.Label = "Shoutcast"; + aItem.Path = "Shoutcast"; + aItem.IsFolder = true; + aItem.MusicTag = null; + aItem.IconImageBig = "shoutBig.png"; + aItem.IconImage = "shout.png"; + + facadeView.Add(aItem); + totalItems++; + } } - if (useShoutcast) + #endregion + + if (folderName.Contains(RootRadioFolder)) { - aItem = new GUIListItem(); - aItem.Label = "Shoutcast"; - aItem.Path = "Shoutcast"; - aItem.IsFolder = true; - aItem.MusicTag = null; - aItem.IconImageBig = "shoutBig.png"; - aItem.IconImage = "shout.png"; - facadeView.Add(aItem); - totalItems++; - } - } - #endregion + #region fill normal folder + List<GUIListItem> items = new List<GUIListItem>(); + items = virtualDirectory.GetDirectoryExt(folderName); - if (!folderName.Contains("Shoutcast") && (!folderName.Contains("Icecast"))) - { - #region fill normal folder - List<GUIListItem> items = new List<GUIListItem>(); - items = virtualDirectory.GetDirectoryExt(folderName); + Log.Debug("Streamradio: loading directory with " + items.Count + " items"); - Log.Debug("Streamradio: loading directory with " + items.Count + " items"); + foreach (GUIListItem item in items) + { + int i = 0; + if (!item.IsFolder) + { + item.MusicTag = null; - foreach (GUIListItem item in items) - { - int i = 0; - if (!item.IsFolder) - { - item.MusicTag = null; + item.IconImageBig = "DefaultMyradioStreamBig.png"; + item.IconImage = "DefaultMyradioStream.png"; - item.IconImageBig = "DefaultMyradioStreamBig.png"; - item.IconImage = "DefaultMyradioStream.png"; + if (item.Path.Contains("xml")) + { + RadioStation radio = new RadioStation(); - if (item.Path.Contains("xml")) - { - RadioStation radio = new RadioStation(); + try + { + XmlDocument doc = new XmlDocument(); + doc.Load(item.Path); - try - { - XmlDocument doc = new XmlDocument(); - doc.Load(item.Path); + string path = Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config); + path += "\\Thumbs\\Radio\\"; - string path = Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config); - path += "\\Thumbs\\Radio\\"; + string img = path + doc.SelectSingleNode("/profile/station/logo").InnerText; - string img = path + doc.SelectSingleNode("/profile/station/logo").InnerText; + item.IconImageBig = img; + item.IconImage = img; + item.ThumbnailImage = img; - item.IconImageBig = img; - item.IconImage = img; - item.ThumbnailImage = img; + radio.URL = doc.SelectSingleNode("/profile/stream/url").InnerText; + radio.Name = doc.SelectSingleNode("/profile/station/name").InnerText.ToLower(); + radio.Sort = i; - radio.URL = doc.SelectSingleNode("/profile/stream/url").InnerText; - radio.Name = doc.SelectSingleNode("/profile/station/name").InnerText.ToLower(); - radio.Sort = i; + radio.Genre = doc.SelectSingleNode("/profile/station/category").InnerText.ToLower(); + radio.Language = doc.SelectSingleNode("/profile/station/language").InnerText.ToLower(); - radio.Genre = doc.SelectSingleNode("/profile/station/category").InnerText.ToLower(); - radio.Language = doc.SelectSingleNode("/profile/station/language").InnerText.ToLower(); + item.MusicTag = radio; - item.MusicTag = radio; + // make sure to use the name from the xml + item.Label = doc.SelectSingleNode("/profile/station/name").InnerText; - // make sure to use the name from the xml - item.Label = doc.SelectSingleNode("/profile/station/name").InnerText; + facadeView.Add(item); + totalItems++; + i++; + } + catch (Exception ex) + { + Log.Error("Streamradio: Error reading xml " + item.Path); + Log.Error("Streamradio: Reason : " + ex.Message); + } + } - facadeView.Add(item); - totalItems++; - i++; - } - catch (Exception ex) - { - Log.Error("Streamradio: Error reading xml " + item.Path); - Log.Error("Streamradio: Reason : " + ex.Message); - } - } + } + else + { + // add folder + if (item.Label.Equals("..")) + { // not on top folder + if (folderName == RootRadioFolder) continue; + } + facadeView.Add(item); + totalItems++; + } - } - else - { - // add folder - if (item.Label.Equals("..")) - { // not on top folder - if (folderName == currentRadioFolder) continue; } - facadeView.Add(item); - totalItems++; - } - + #endregion } - #endregion - } - else - { - if (folderName == "Shoutcast") + else { - #region shoutcast genre - aItem = new GUIListItem(); - aItem.Label = ".."; - aItem.Path = currentRadioFolder; - aItem.IsFolder = true; - aItem.MusicTag = null; - aItem.IconImageBig = "defaultFolderBackBig.png"; - aItem.IconImage = "defaultFolderBack.png"; + if (networks.Select(n => n.name).Contains(folderName)) + { + aItem = new GUIListItem(); + aItem.Label = ".."; + aItem.Path = RootRadioFolder; - facadeView.Add(aItem); - totalItems++; + aItem.IsFolder = true; + aItem.MusicTag = null; + aItem.IconImageBig = "defaultFolderBackBig.png"; + aItem.IconImage = "defaultFolderBack.png"; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load("http://yp.shoutcast.com/sbin/newxml.phtml"); - XmlNodeList list = doc.GetElementsByTagName("genre"); + facadeView.Add(aItem); + totalItems++; - for (int i = 0; i < list.Count; i++) - { - string s = list[i].Attributes[0].Value; + List<AudioAddictAPI.AAChannel> aaChannels = AudioAddictAPI.GetChannels(folderName); + foreach (AudioAddictAPI.AAChannel aaCh in aaChannels) + { + AudioAddictAPI.AANetwork network = networks.First(n => n.name == folderName); + AudioAddictAPI.RadioNetwork nw = new AudioAddictAPI.RadioNetwork { ListenURL = network.listen_url, Key = network.key, Name = network.name }; + AudioAddictAPI.AAChannelInfo ai = AudioAddictAPI.GetChannelInfo(aaCh, nw); + GUIListItem aaItem = new GUIListItem(); + aaItem.Label = aaCh.name; + aaItem.MusicTag = aaCh; + aaItem.IconImageBig = ai.LocalImage; + aaItem.IconImage = ai.LocalImage; + facadeView.Add(aaItem); + totalItems++; + //aaItem.Dispose(); - aItem = new GUIListItem(); - aItem.Label = s; - aItem.Path = "Shoutcast/" + s; - aItem.IsFolder = true; + } - aItem.MusicTag = null; - aItem.IconImageBig = "defaultFolderBig.png"; - aItem.IconImage = "defaultFolder.png"; - facadeView.Add(aItem); - totalItems++; - } - } - catch - { - } - #endregion - } - if ((folderName != "Shoutcast") && folderName.Contains("Shoutcast")) - { - #region shoutcast channels - if (folderName.Length > 10) - { - aItem = new GUIListItem(); - aItem.Label = ".."; - aItem.Path = "Shoutcast"; + if (folderName == "Shoutcast") + { + #region shoutcast genre + aItem = new GUIListItem(); + aItem.Label = ".."; + aItem.Path = RootRadioFolder; - aItem.IsFolder = true; - aItem.MusicTag = null; - aItem.IconImageBig = "defaultFolderBackBig.png"; - aItem.IconImage = "defaultFolderBack.png"; + aItem.IsFolder = true; + aItem.MusicTag = null; + aItem.IconImageBig = "defaultFolderBackBig.png"; + aItem.IconImage = "defaultFolderBack.png"; - facadeView.Add(aItem); - totalItems++; + facadeView.Add(aItem); + totalItems++; - string section = folderName.Substring(10, folderName.Length - 10); + try + { + XmlDocument doc = new XmlDocument(); + doc.Load("http://yp.shoutcast.com/sbin/newxml.phtml"); + XmlNodeList list = doc.GetElementsByTagName("genre"); - try - { - XmlDocument doc = new XmlDocument(); - doc.Load("http://yp.shoutcast.com/sbin/newxml.phtml?genre=" + section); - XmlNodeList list = doc.GetElementsByTagName("station"); + for (int i = 0; i < list.Count; i++) + { + string s = list[i].Attributes[0].Value; - for (int i = 0; i < list.Count; i++) - { - string name = list[i].Attributes["name"].Value.ToString(); - string mt = list[i].Attributes["mt"].Value.ToString(); - string id = list[i].Attributes["id"].Value.ToString(); - string br = list[i].Attributes["br"].Value.ToString(); - string genre = list[i].Attributes["genre"].Value.ToString(); + aItem = new GUIListItem(); + aItem.Label = s; + aItem.Path = "Shoutcast/" + s; + aItem.IsFolder = true; - // get bitrate - int bitrate = 0; - try + aItem.MusicTag = null; + aItem.IconImageBig = "defaultFolderBig.png"; + aItem.IconImage = "defaultFolder.png"; + + facadeView.Add(aItem); + totalItems++; + + } + } + catch { - bitrate = Convert.ToInt32(br); + } - catch { } - - if (bitrate >= filter) + #endregion + } + if ((folderName != "Shoutcast") && folderName.Contains("Shoutcast")) + { + #region shoutcast channels + if (folderName.Length > 10) { - aItem = new GUIListItem(); + aItem = new GUIListItem(); + aItem.Label = ".."; + aItem.Path = "Shoutcast"; - aItem.Label = name; - aItem.Path = "http://yp.shoutcast.com/sbin/tunein-station.pls?id=" + id; - aItem.IsFolder = false; + aItem.IsFolder = true; + aItem.MusicTag = null; + aItem.IconImageBig = "defaultFolderBackBig.png"; + aItem.IconImage = "defaultFolderBack.png"; - RadioStation radio = new RadioStation(); - radio.BitRate = bitrate; - radio.Genre = genre; - radio.ID = Convert.ToInt32(id); - radio.Name = name; - radio.URL = aItem.Path; - radio.Sort = i; + facadeView.Add(aItem); + totalItems++; - aItem.MusicTag = radio; - aItem.IconImageBig = "DefaultMyradioStreamBig.png"; - aItem.IconImage = "DefaultMyradioStream.png"; + string section = folderName.Substring(10, folderName.Length - 10); - facadeView.Add(aItem); - totalItems++; + try + { + XmlDocument doc = new XmlDocument(); + doc.Load("http://yp.shoutcast.com/sbin/newxml.phtml?genre=" + section); + XmlNodeList list = doc.GetElementsByTagName("station"); + + for (int i = 0; i < list.Count; i++) + { + string name = list[i].Attributes["name"].Value.ToString(); + string mt = list[i].Attributes["mt"].Value.ToString(); + string id = list[i].Attributes["id"].Value.ToString(); + string br = list[i].Attributes["br"].Value.ToString(); + string genre = list[i].Attributes["genre"].Value.ToString(); + + // get bitrate + int bitrate = 0; + try + { + bitrate = Convert.ToInt32(br); + } + catch { } + + if (bitrate >= filter) + { + aItem = new GUIListItem(); + + aItem.Label = name; + aItem.Path = "http://yp.shoutcast.com/sbin/tunein-station.pls?id=" + id; + aItem.IsFolder = false; + + RadioStation radio = new RadioStation(); + radio.BitRate = bitrate; + radio.Genre = genre; + radio.ID = Convert.ToInt32(id); + radio.Name = name; + radio.URL = aItem.Path; + radio.Sort = i; + + aItem.MusicTag = radio; + aItem.IconImageBig = "DefaultMyradioStreamBig.png"; + aItem.IconImage = "DefaultMyradioStream.png"; + + facadeView.Add(aItem); + totalItems++; + } + } + } + catch + { + // doc not loaded ? + } } - } + #endregion } - catch + if (folderName.Contains("Icecast")) { - // doc not loaded ? - } - } - #endregion - } - if (folderName.Contains("Icecast")) - { - #region icecast channels + #region icecast channels - aItem = new GUIListItem(); - aItem.Label = ".."; - aItem.Path = currentRadioFolder; + aItem = new GUIListItem(); + aItem.Label = ".."; + aItem.Path = RootRadioFolder; - aItem.IsFolder = true; - aItem.MusicTag = null; - aItem.IconImageBig = "defaultFolderBackBig.png"; - aItem.IconImage = "defaultFolderBack.png"; + aItem.IsFolder = true; + aItem.MusicTag = null; + aItem.IconImageBig = "defaultFolderBackBig.png"; + aItem.IconImage = "defaultFolderBack.png"; - facadeView.Add(aItem); - totalItems++; + facadeView.Add(aItem); + totalItems++; - try - { - XmlDocument doc = new XmlDocument(); - doc.Load("http://dir.xiph.org/yp.xml"); - XmlNodeList list = doc.GetElementsByTagName("entry"); + try + { + XmlDocument doc = new XmlDocument(); + doc.Load("http://dir.xiph.org/yp.xml"); + XmlNodeList list = doc.GetElementsByTagName("entry"); - for (int i = 0; i < list.Count; i++) - { - string name = string.Empty; - string br = string.Empty; - string url = string.Empty; - string genre = string.Empty; + for (int i = 0; i < list.Count; i++) + { + string name = string.Empty; + string br = string.Empty; + string url = string.Empty; + string genre = string.Empty; - XmlNode node = list[i]; - foreach (XmlNode child in node) - { - if (child.Name == "server_name") name = child.InnerText; - if (child.Name == "bitrate") br = child.InnerText; - if (child.Name == "genre") genre = child.InnerText; - if (child.Name == "listen_url") url = child.InnerText; - } + XmlNode node = list[i]; + foreach (XmlNode child in node) + { + if (child.Name == "server_name") name = child.InnerText; + if (child.Name == "bitrate") br = child.InnerText; + if (child.Name == "genre") genre = child.InnerText; + if (child.Name == "listen_url") url = child.InnerText; + } - // get bitrate - int bitrate = 0; - try - { - bitrate = Convert.ToInt32(br); - } - catch { } + // get bitrate + int bitrate = 0; + try + { + bitrate = Convert.ToInt32(br); + } + catch { } - if (bitrate >= filter) - { - aItem = new GUIListItem(); + if (bitrate >= filter) + { + aItem = new GUIListItem(); - aItem.Label = name; - aItem.Path = url; - aItem.IsFolder = false; + aItem.Label = name; + aItem.Path = url; + aItem.IsFolder = false; - RadioStation radio = new RadioStation(); + RadioStation radio = new RadioStation(); - radio.BitRate = bitrate; - radio.Genre = genre; - radio.ID = i; - radio.Name = name; - radio.URL = aItem.Path; - radio.Sort = i; + radio.BitRate = bitrate; + radio.Genre = genre; + radio.ID = i; + radio.Name = name; + radio.URL = aItem.Path; + radio.Sort = i; - aItem.MusicTag = radio; - aItem.IconImageBig = "DefaultMyradioStreamBig.png"; - aItem.IconImage = "DefaultMyradioStream.png"; + aItem.MusicTag = radio; + aItem.IconImageBig = "DefaultMyradioStreamBig.png"; + aItem.IconImage = "DefaultMyradioStream.png"; - facadeView.Add(aItem); - totalItems++; - } + facadeView.Add(aItem); + totalItems++; + } + } + } + catch + { + // doc not loaded ? + } } - } - catch - { - // doc not loaded ? - } + #endregion } - #endregion - } } SwitchView(); @@ -1507,104 +1578,104 @@ #endregion } - private void OnRecord() - { - if (StreamradioIsPlaying()) - { - if (!engine.Contains("BASS")) - { - GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); - dlg.SetHeading("BASS engine is not active !"); - dlg.SetLine(1, "Recording is not possible !"); - dlg.SetLine(2, "Activate BASS engine under Music /"); - dlg.SetLine(3, "Player Settings."); - dlg.DoModal(GUIWindowManager.ActiveWindow); - } - else - { - if ((g_Player.Playing) && (!g_Player.CurrentFile.StartsWith(Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config)))) - { - int _stream = (int)MediaPortal.Visualization.VisualizationBase.Bass.CurrentAudioStream; + //private void OnRecord() + //{ + // if (StreamradioIsPlaying()) + // { + // if (!engine.Contains("BASS")) + // { + // GUIDialogOK dlg = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK); + // dlg.SetHeading("BASS engine is not active !"); + // dlg.SetLine(1, "Recording is not possible !"); + // dlg.SetLine(2, "Activate BASS engine under Music /"); + // dlg.SetLine(3, "Player Settings."); + // dlg.DoModal(GUIWindowManager.ActiveWindow); + // } + // else + // { + // if ((g_Player.Playing) && (!g_Player.CurrentFile.StartsWith(Configuration.Config.GetFolder(MediaPortal.Configuration.Config.Dir.Config)))) + // { + // int _stream = (int)MediaPortal.Visualization.VisualizationBase.Bass.CurrentAudioStream; - if (_stream != 0) - { - if (!EncodeActive()) - { - Log.Debug("MyStreamRadio | start recording"); + // if (_stream != 0) + // { + // if (!EncodeActive()) + // { + // Log.Debug("MyStreamRadio | start recording"); - #region build file name - string[] now = actualStation.Split('|'); - if (now.Length != 3) return; + // #region build file name + // string[] now = actualStation.Split('|'); + // if (now.Length != 3) return; - string fName = now[0]; - string url = now[1]; - string file = now[2]; + // string fName = now[0]; + // string url = now[1]; + // string file = now[2]; - Regex regex = new Regex(@"[\\/:*?<>|\b]"); - fName = regex.Replace(fName, "_"); - fName = fName.Replace(' ', '_'); - fName = fName.Replace('.', '_'); - fName = fName.Replace('!', '_'); - fName = fName.Replace('"', '_'); - fName = fName.Replace('\'', '_'); - fName = fName.Replace('*', '_'); + // Regex regex = new Regex(@"[\\/:*?<>|\b]"); + // fName = regex.Replace(fName, "_"); + // fName = fName.Replace(' ', '_'); + // fName = fName.Replace('.', '_'); + // fName = fName.Replace('!', '_'); + // fName = fName.Replace('"', '_'); + // fName = fName.Replace('\'', '_'); + // fName = fName.Replace('*', '_'); - if (!recordFolder.EndsWith("\\")) - recordFolder = recordFolder + "\\"; + // if (!recordFolder.EndsWith("\\")) + // recordFolder = recordFolder + "\\"; - string name = fName + "_"; + // string name = fName + "_"; - name += DateTime.Now.Year.ToString() + "_"; - name += string.Format("{0:00}", DateTime.Now.Month) + "_"; - name += string.Format("{0:00}", DateTime.Now.Day) + "_"; + // name += DateTime.Now.Year.ToString() + "_"; + // name += string.Format("{0:00}", DateTime.Now.Month) + "_"; + // name += string.Format("{0:00}", DateTime.Now.Day) + "_"; - name += string.Format("{0:00}", DateTime.Now.Hour); - name += string.Format("{0:00}", DateTime.Now.Minute); + // name += string.Format("{0:00}", DateTime.Now.Hour); + // name += string.Format("{0:00}", DateTime.Now.Minute); - name = name.Replace('.', '_'); - name = name.Replace(':', '_'); + // name = name.Replace('.', '_'); + // name = name.Replace(':', '_'); - #endregion + // #endregion - string recordFile = recordFolder + name + ".mp3"; - Log.Debug("MyStreamRadio | record file : " + recordFile); + // string recordFile = recordFolder + name + ".mp3"; + // Log.Debug("MyStreamRadio | record file : " + recordFile); - lame = new EncoderLAME(_stream); - lame.InputFile = null; - lame.OutputFile = recordFile; - lame.LAME_Bitrate = (int)EncoderLAME.BITRATE.kbps_192; - lame.LAME_Mode = EncoderLAME.LAMEMode.Default; - lame.LAME_TargetSampleRate = (int)EncoderLAME.SAMPLERATE.Hz_44100; - lame.LAME_Quality = EncoderLAME.LAMEQuality.Quality; + // lame = new EncoderLAME(_stream); + // lame.InputFile = null; + // lame.OutputFile = recordFile; + // lame.LAME_Bitrate = (int)EncoderLAME.BITRATE.kbps_192; + // lame.LAME_Mode = EncoderLAME.LAMEMode.Default; + // lame.LAME_TargetSampleRate = (int)EncoderLAME.SAMPLERATE.Hz_44100; + // lame.LAME_Quality = EncoderLAME.LAMEQuality.Quality; - bool result = lame.Start(null, IntPtr.Zero, false); + // bool result = lame.Start(null, IntPtr.Zero, false); - if (result == true) - { - Log.Debug("MyStreamRadio | recording works"); - } - else - { - Log.Debug("MyStreamRadio | recording did NOT work"); - lame.Stop(); - } - } - else - { - Log.Debug("MyStreamRadio | stop recording"); - lame.Stop(); - } - } - else - { - Log.Debug("MyStreamRadio | no stream found !"); - // no stream - } - } - } - } - btnRecord.Selected = EncodeActive(); - } + // if (result == true) + // { + // Log.Debug("MyStreamRadio | recording works"); + ... [truncated message content] |