1
0
mirror of synced 2025-01-18 17:14:07 +01:00

Fix crash on song download if Songs/S3 Download does not exist, allows it to work with any folder with 'Download' genre and with any songs folder name

This commit is contained in:
0aubsq 2022-05-24 07:24:22 +02:00
parent 8874bd2f29
commit 7ccce88772
5 changed files with 49 additions and 21 deletions

1
.gitignore vendored
View File

@ -10,6 +10,7 @@
*.swp
*.DotSettings.user
/packages
/Test/Cache
/Test/Capture_img
/Test/Config.ini
/Test/bs1770gain**

View File

@ -104,17 +104,26 @@ namespace TJAPlayer3
if (TJAPlayer3.Songs管理.list曲ルート[i].strジャンル == "Download")
downloadBox = TJAPlayer3.Songs管理.list曲ルート[i];
}
for (int i = 0; i < downloadBox.list子リスト.Count; i++)
{
if (downloadBox.list子リスト[i].eード種別 != C曲リストード.Eード種別.BACKBOX)
{
downloadBox.list子リスト.Remove(downloadBox.list子リスト[i]);
i--;
if (downloadBox != null)
{
for (int i = 0; i < downloadBox.list子リスト.Count; i++)
{
if (downloadBox.list子リスト[i].eード種別 != C曲リストード.Eード種別.BACKBOX)
{
downloadBox.list子リスト.Remove(downloadBox.list子リスト[i]);
i--;
}
}
}
t曲を検索してリストを作成する(@"Songs\S3 Download", true, downloadBox.list子リスト, downloadBox);
tSongsDBになかった曲をファイルから読み込んで反映する(downloadBox.list子リスト);
var path = downloadBox.arスコア[0]..;
//t曲を検索してリストを作成する(@"Songs\S3 Download", true, downloadBox.list子リスト, downloadBox);
t曲を検索してリストを作成する(path, true, downloadBox.list子リスト, downloadBox);
tSongsDBになかった曲をファイルから読み込んで反映する(downloadBox.list子リスト);
}
}
public void t曲を検索してリストを作成する( string str基点フォルダ, bool b子BOXへ再帰する )
{

View File

@ -516,17 +516,35 @@ namespace TJAPlayer3
{
IsDownloading = true;
// Create Cache folder if does not exist
System.IO.Directory.CreateDirectory($@"Cache\");
var song = apiMethods.FetchedSongsList[this.cdnSongListIndex - 1];
var zipPath = $@"Cache\{song.Md5}.zip";
// Download zip from cdn
System.Net.WebClient wc = new System.Net.WebClient();
wc.DownloadFile($"{dbCDNData.BaseUrl}{dbCDNData.Download["default"]}{song.Id}", zipPath);
wc.Dispose();
System.IO.Compression.ZipFile.ExtractToDirectory(zipPath, $@"Songs\S3 Download\{song.Md5}");
// Fetch closest Download folder node
C曲リストード downloadBox = null;
for (int i = 0; i < TJAPlayer3.Songs管理.list曲ルート.Count; i++)
{
if (TJAPlayer3.Songs管理.list曲ルート[i].strジャンル == "Download")
downloadBox = TJAPlayer3.Songs管理.list曲ルート[i];
}
// If there is at least one download folder, transfer the zip contents in it
if (downloadBox != null)
{
var path = downloadBox.arスコア[0]..;
System.IO.Compression.ZipFile.ExtractToDirectory(zipPath, $@"{path}{song.Md5}");
}
//System.IO.Compression.ZipFile.ExtractToDirectory(zipPath, $@"Songs\S3 Download\{song.Md5}");
IsDownloading = false;
}

View File

@ -1,10 +0,0 @@
#TITLE:Download
#GENRE:Download
#BOXEXPLANATION1:
#BOXEXPLANATION2:
#BOXEXPLANATION3:
#BGCOLOR:#ff00a2
#BOXCOLOR:#ff00a2
#BOXTYPE:0
#BGTYPE:1
#BOXCHARA:0

View File

@ -0,0 +1,10 @@
#TITLE:Downloaded Songs
#GENRE:Download
#BOXEXPLANATION1: Play songs downloaded
#BOXEXPLANATION2: from the Online Lounge !
#BOXEXPLANATION3:
#BGCOLOR:#ff00a2
#BOXCOLOR:#ff00a2
#BOXTYPE:0
#BGTYPE:1
#BOXCHARA:0