Skip to content

Commit

Permalink
Change the channel info expire time and retry count.
Browse files Browse the repository at this point in the history
  • Loading branch information
kfstorm authored and Kai Yang committed Jun 12, 2015
1 parent 2935432 commit 20768ed
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions DoubanFM.Core/DoubanFM.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Xml" />
Expand Down
6 changes: 4 additions & 2 deletions DoubanFM.Core/Player/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Threading;
using System.Windows;
using System.Diagnostics;
using System.Configuration;

namespace DoubanFM.Core
{
Expand Down Expand Up @@ -466,7 +467,7 @@ private static ChannelInfo GetChannelInfo()
}

//满足条件时采用本地频道列表
var distance = TimeSpan.FromHours(6);
var distance = TimeSpan.FromSeconds(int.Parse(ConfigurationManager.AppSettings["Player.ChannelInfoExpireSeconds"]));
if (localChannelInfo != null && DateTime.Now - localChannelInfoTime < distance)
{
return localChannelInfo;
Expand All @@ -480,10 +481,11 @@ private static ChannelInfo GetChannelInfo()

//尝试获取服务器频道列表
int tryCount = 0;
int tryCountMax = int.Parse(ConfigurationManager.AppSettings["Player.ChannelInfoRetryCount"]);
while (true)
{
//获取服务器频道列表多次失败后采用本地频道列表
if (tryCount == 5 && localChannelInfo != null) return localChannelInfo;
if (tryCount == tryCountMax && localChannelInfo != null) return localChannelInfo;

++tryCount;

Expand Down
2 changes: 1 addition & 1 deletion DoubanFM.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@
//
// 可以指定所有这些值,也可以使用“内部版本号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
[assembly: AssemblyVersion("2.1.2.1")]
[assembly: AssemblyVersion("2.1.2.2")]
//[assembly: AssemblyVersion("1.0.0.0")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
4 changes: 4 additions & 0 deletions DoubanFM/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
<add key="ColorFunctions.FaceColor" value="#FFCDA38F"/>
<add key="ColorFunctions.ZeroWeightFaceColorDifference" value="0.03"/>
<add key="ColorFunctions.MinWeight" value="0.2"/>

<!-- DoubanFM.Core -->
<add key="Player.ChannelInfoExpireSeconds" value="432000"/>
<add key="Player.ChannelInfoRetryCount" value="3"/>


<!-- DoubanFM.Bass -->
Expand Down
2 changes: 1 addition & 1 deletion version.dat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.2.1
2.1.2.2

0 comments on commit 20768ed

Please sign in to comment.