forked from ARGUS-TV/ARGUS-TV
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRadioHome.cs
209 lines (168 loc) · 5.28 KB
/
RadioHome.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#region Copyright (C) 2005-2013 Team MediaPortal
/*
* Copyright (C) 2005-2013 Team MediaPortal
* http://www.team-mediaportal.com
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#endregion
using System;
using MediaPortal.GUI.Library;
using MediaPortal.Configuration;
using MediaPortal.Player;
using ArgusTV.DataContracts;
using ArgusTV.ServiceProxy;
namespace ArgusTV.UI.MediaPortal
{
public class RadioHome : HomeBase, ISetupForm, IShowPlugin
{
public RadioHome()
: base(ChannelType.Radio){}
#region ISetupForm Members
public string Author()
{
return "http://www.argus-tv.com/ (dot-i)";
}
public bool CanEnable()
{
//TODO
//disabling radio can also disable TV,so prevent it for now until we find a real solution.
return false;
}
public bool DefaultEnabled()
{
return true;
}
public string Description()
{
return "ARGUS Radio plugin";
}
public bool GetHome(out string strButtonText, out string strButtonImage, out string strButtonImageFocus, out string strPictureImage)
{
strButtonText = GUILocalizeStrings.Get(665);
strButtonImage = String.Empty;
strButtonImageFocus = String.Empty;
strPictureImage = @"hover_my radio.png";
return true;
}
public int GetWindowId()
{
return WindowId.RadioHome;
}
public bool HasSetup()
{
return false;
}
public string PluginName()
{
return "ARGUS Radio";
}
public void ShowPlugin()
{ }
#endregion
#region overrides
public override bool Init()
{
bool result = Load(GUIGraphicsContext.Skin + @"\ARGUS_RadioHome.xml");
if (result)
{
LoadSettings();
base.Init();
}
return result;
}
public override void DeInit()
{
base.DeInit();
}
protected override void OnWindowLoaded()
{
base.OnWindowLoaded();
_tvGuideButton.Label = Utility.GetLocalizedText(TextId.RadioGuide);
_recordingsButton.Label = Utility.GetLocalizedText(TextId.RecordedRadio);
_tvOnOffButton.Label = Utility.GetLocalizedText(TextId.RadioOn);
_teletextButton = null;
}
protected override void OnPageDestroy(int new_windowId)
{
SaveSettings();
base.OnPageDestroy(new_windowId);
}
public override int GetID
{
get { return WindowId.RadioHome; }
set { }
}
#endregion
#region public methods
public static void UpdateProgressPercentageBar()
{
DoUpdateProgressPercentageBar(ChannelType.Radio,false);
}
public static void SetMusicProperties(string chanName, Guid channelId)
{
string logo = string.Empty;
if (channelId != Guid.Empty && chanName != string.Empty)
{
logo = Utility.GetLogoImage(channelId, chanName);
}
else
{
chanName = string.Empty;
}
if (string.IsNullOrEmpty(logo))
{
logo = "defaultMyRadioBig.png";
}
GUIPropertyManager.RemovePlayerProperties();
GUIPropertyManager.SetProperty("#Play.Current.Thumb", logo);
GUIPropertyManager.SetProperty("#Play.Current.ArtistThumb", chanName);
GUIPropertyManager.SetProperty("#Play.Current.Album", chanName);
GUIPropertyManager.SetProperty("#Play.Current.Title", chanName);
GUIPropertyManager.SetProperty("#Play.Current.Artist", chanName);
}
#endregion
#region Serialisation
private static bool _settingsLoaded;
private void LoadSettings()
{
if (!_settingsLoaded)
{
_settingsLoaded = true;
}
}
private void SaveSettings()
{ }
protected override bool AutoTurnOnStream
{
get { return false; }
}
#endregion
#region IPlugin Members
public void Start()
{}
public void Stop()
{}
#endregion
#region IShowPlugin Members
public bool ShowDefaultHome()
{
return true;
}
#endregion
}
}