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:
parent
8874bd2f29
commit
7ccce88772
1
.gitignore
vendored
1
.gitignore
vendored
@ -10,6 +10,7 @@
|
|||||||
*.swp
|
*.swp
|
||||||
*.DotSettings.user
|
*.DotSettings.user
|
||||||
/packages
|
/packages
|
||||||
|
/Test/Cache
|
||||||
/Test/Capture_img
|
/Test/Capture_img
|
||||||
/Test/Config.ini
|
/Test/Config.ini
|
||||||
/Test/bs1770gain**
|
/Test/bs1770gain**
|
||||||
|
@ -104,6 +104,9 @@ namespace TJAPlayer3
|
|||||||
if (TJAPlayer3.Songs管理.list曲ルート[i].strジャンル == "Download")
|
if (TJAPlayer3.Songs管理.list曲ルート[i].strジャンル == "Download")
|
||||||
downloadBox = TJAPlayer3.Songs管理.list曲ルート[i];
|
downloadBox = TJAPlayer3.Songs管理.list曲ルート[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (downloadBox != null)
|
||||||
|
{
|
||||||
for (int i = 0; i < downloadBox.list子リスト.Count; i++)
|
for (int i = 0; i < downloadBox.list子リスト.Count; i++)
|
||||||
{
|
{
|
||||||
if (downloadBox.list子リスト[i].eノード種別 != C曲リストノード.Eノード種別.BACKBOX)
|
if (downloadBox.list子リスト[i].eノード種別 != C曲リストノード.Eノード種別.BACKBOX)
|
||||||
@ -113,9 +116,15 @@ namespace TJAPlayer3
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t曲を検索してリストを作成する(@"Songs\S3 Download", true, downloadBox.list子リスト, downloadBox);
|
var path = downloadBox.arスコア[0].ファイル情報.フォルダの絶対パス;
|
||||||
|
|
||||||
|
|
||||||
|
//t曲を検索してリストを作成する(@"Songs\S3 Download", true, downloadBox.list子リスト, downloadBox);
|
||||||
|
t曲を検索してリストを作成する(path, true, downloadBox.list子リスト, downloadBox);
|
||||||
tSongsDBになかった曲をファイルから読み込んで反映する(downloadBox.list子リスト);
|
tSongsDBになかった曲をファイルから読み込んで反映する(downloadBox.list子リスト);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
public void t曲を検索してリストを作成する( string str基点フォルダ, bool b子BOXへ再帰する )
|
public void t曲を検索してリストを作成する( string str基点フォルダ, bool b子BOXへ再帰する )
|
||||||
{
|
{
|
||||||
this.t曲を検索してリストを作成する( str基点フォルダ, b子BOXへ再帰する, this.list曲ルート, null );
|
this.t曲を検索してリストを作成する( str基点フォルダ, b子BOXへ再帰する, this.list曲ルート, null );
|
||||||
|
@ -516,17 +516,35 @@ namespace TJAPlayer3
|
|||||||
{
|
{
|
||||||
IsDownloading = true;
|
IsDownloading = true;
|
||||||
|
|
||||||
|
// Create Cache folder if does not exist
|
||||||
System.IO.Directory.CreateDirectory($@"Cache\");
|
System.IO.Directory.CreateDirectory($@"Cache\");
|
||||||
|
|
||||||
var song = apiMethods.FetchedSongsList[this.cdnSongListIndex - 1];
|
var song = apiMethods.FetchedSongsList[this.cdnSongListIndex - 1];
|
||||||
var zipPath = $@"Cache\{song.Md5}.zip";
|
var zipPath = $@"Cache\{song.Md5}.zip";
|
||||||
|
|
||||||
|
// Download zip from cdn
|
||||||
System.Net.WebClient wc = new System.Net.WebClient();
|
System.Net.WebClient wc = new System.Net.WebClient();
|
||||||
|
|
||||||
wc.DownloadFile($"{dbCDNData.BaseUrl}{dbCDNData.Download["default"]}{song.Id}", zipPath);
|
wc.DownloadFile($"{dbCDNData.BaseUrl}{dbCDNData.Download["default"]}{song.Id}", zipPath);
|
||||||
wc.Dispose();
|
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;
|
IsDownloading = false;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +0,0 @@
|
|||||||
#TITLE:Download
|
|
||||||
#GENRE:Download
|
|
||||||
#BOXEXPLANATION1:
|
|
||||||
#BOXEXPLANATION2:
|
|
||||||
#BOXEXPLANATION3:
|
|
||||||
#BGCOLOR:#ff00a2
|
|
||||||
#BOXCOLOR:#ff00a2
|
|
||||||
#BOXTYPE:0
|
|
||||||
#BGTYPE:1
|
|
||||||
#BOXCHARA:0
|
|
10
Test/Songs/X4 Downloaded Songs/box.def
Normal file
10
Test/Songs/X4 Downloaded Songs/box.def
Normal 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
|
Loading…
x
Reference in New Issue
Block a user