Skip to content

Commit

Permalink
625.0, 暂时禁用在线歌词查询
Browse files Browse the repository at this point in the history
  • Loading branch information
MATRIX-feather committed Jun 25, 2024
1 parent f80b373 commit 697c452
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 9 deletions.
4 changes: 1 addition & 3 deletions osu.Game.Rulesets.IGPlayer.Tests/TestScenePlayerScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@ private void load(Storage storage, OsuGameBase gameBase)

cacheAndAdd(new IdleTracker(6000));

var receptor = new BackButton.Receptor();
cacheAndAdd(receptor);
cacheAndAdd(backButton = new BackButton(receptor)
cacheAndAdd(backButton = new BackButton()
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
<PackageReference Include="ppy.osu.Game.Rulesets.Osu" Version="2024.521.2" />
<PackageReference Include="ppy.osu.Game.Rulesets.Osu" Version="2024.625.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\IGPlayerLoader\IGPlayerLoader.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System;
using osu.Game.Online.API;
using osu.Game.Rulesets.IGPlayer.Feature.Player.Plugins.Bundle.CloudMusic.Misc;

Expand All @@ -12,5 +13,17 @@ public APISearchRequest(string target)
{
Url = $"https://music.163.com/api/search/get/web?hlpretag=&hlposttag=&s={target}&type=1&total=true&limit=1";
}

protected override void ProcessResponse()
{
try
{
base.ProcessResponse();
}
catch (Exception e)
{
Logging.LogError(e, "无法将返回的内容转换为APISearchResponseRoot, 上游返回了意外的结果");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ public void Search(SearchOption searchOption)
}
}

//TODO: 实现新版网易云API的查询
if (true)
{
setState(SearchState.Success);
searchOption.OnFinish?.Invoke(new APILyricResponseRoot());
return;
}

encoder ??= UrlEncoder.Default;

//处理之前的请求
Expand Down Expand Up @@ -125,14 +133,15 @@ public void Search(SearchOption searchOption)
if (currentSearchRequest == req)
setState(SearchState.Fail);

string message = "查询歌曲失败";
string message = "[LyricProcessor] 查询歌曲失败";

if (e is HttpRequestException)
message += ", 未能送达http请求, 请检查当前网络以及代理";

Logging.LogError(e, message);
onFail?.Invoke(e.ToString());
};

req.PerformAsync(cancellationTokenSource.Token).ConfigureAwait(false);

currentSearchRequest = req;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,18 @@ public Toolbox()
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight
},
//TODO: 实现新版查询后移除此文本
new OsuSpriteText
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Colour = Color4.Gold,
Text = "在线查询功能暂时不可用,我们正在适配新的网易云音乐API"
},
buttonFillFlow = new FillFlowContainer
{
//TODO: REMOVE THIS
Scale = new Vector2(0),
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Spacing = new Vector2(5),
Expand Down Expand Up @@ -136,6 +146,19 @@ private void load(LyricConfigManager lcm, IImplementLLin llin, LyricPlugin plugi
});
}, true);

//TODO: UNDO THIS
contentFillFlow.Add(new SettingsSlider<double>
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Current = plugin.Offset,
LabelText = CloudMusicStrings.LocalOffset,
RelativeSizeAxes = Axes.X,
Padding = new MarginPadding { Right = 10 }
});

//TODO: UNDO THIS TOO
/*
contentFillFlow.AddRange(new Drawable[]
{
new SettingsSlider<double>
Expand Down Expand Up @@ -197,7 +220,9 @@ private void load(LyricConfigManager lcm, IImplementLLin llin, LyricPlugin plugi
}
}
});
*/

textBox = new OsuTextBox();
textBox.OnCommit += (sender, isNewText) =>
{
if (int.TryParse(sender.Text, out var id))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private partial class Header : OsuDropdown<string>.OsuDropdownHeader
public Header(string label)
{
Label = label;
Enabled.Value = true;
//Enabled.Value = true;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private void onScreenSwitch(IScreen lastscreen, IScreen newscreen)
}
}

private void pushPlayerScreen()
private void pushPlayerScreen(MainMenuButton? button)
{
game.PerformFromScreen(s => s.Push(new LLinScreen()), new[]
{
Expand Down Expand Up @@ -180,7 +180,7 @@ private void findFooter(PlaySongSelect playSongSelect)

footer.AddButton(new FooterButtonOpenInMvis
{
Action = pushPlayerScreen
Action = () => this.pushPlayerScreen(null)
}, null);

currentPlaySongSelect = playSongSelect;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<ItemGroup>
<PackageReference Include="NetCoreServer" Version="8.0.7" />
<PackageReference Include="NLua" Version="1.6.2" />
<PackageReference Include="ppy.osu.Game" Version="2024.521.2" />
<PackageReference Include="ppy.osu.Game" Version="2024.625.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\M.DBus\M.DBus.csproj" />
Expand Down

0 comments on commit 697c452

Please sign in to comment.