diff --git a/DBObj/SongData.cs b/DBObj/SongData.cs index 6ddf8d7..1161ad8 100644 --- a/DBObj/SongData.cs +++ b/DBObj/SongData.cs @@ -75,13 +75,19 @@ namespace DBObj { try { + var check = IsFtpUriReachable(new Uri(new Uri(server), basic.getFileName()).ToString()); // string fullPath = Path.Combine(server, basic.getFileName()); Uri fullUri = new Uri(new Uri(server), basic.getFileName()); // if (File.Exists(fullPath)) // { // Console.WriteLine($"找到檔案: {fullPath}"); - return true; + // return true; // } + if (check) + { + Console.WriteLine($"找到檔案: {new Uri(new Uri(server), basic.getFileName())}"); + return true; + } } catch (Exception ex) { @@ -119,8 +125,8 @@ namespace DBObj foreach (var server in Utils.Env.GetSongServers()) { - var check = IsFtpUriReachable(new Uri(new Uri(server), filename).ToString()); - if (!string.IsNullOrWhiteSpace(server) && check != false) + + if (!string.IsNullOrWhiteSpace(server)&&FileExistsInServers()) { // Console.WriteLine(new Uri(new Uri(server), filename)); return new Uri(new Uri(server), filename); diff --git a/VideoPlayerForm.cs b/VideoPlayerForm.cs index 88ef3aa..8894764 100644 --- a/VideoPlayerForm.cs +++ b/VideoPlayerForm.cs @@ -351,12 +351,12 @@ namespace DualScreenDemo string pathToPlay = song.getFile(); Uri url = song.getFileUrl(); //影片畫面播放器載入media設置聲道 - if (pathToPlay == null) + if(url !=null) { _mediaService0.LoadMedia(url, 0); _mediaService1.LoadMedia(url, song.isPublicSong ? 0 : 1); } - else + if(pathToPlay != null) { _mediaService0.LoadMedia(pathToPlay, 0); _mediaService1.LoadMedia(pathToPlay, song.isPublicSong ? 0 : 1); @@ -371,8 +371,6 @@ namespace DualScreenDemo SetVolume(100 + song.getBasic().getDbChange()); Task.Run(() => Thread.Sleep(100)); if (isSyncToPrimaryMonitor) SyncToPrimaryMonitor(); - //ftp抓不到檔案跳下一首歌 - if (url == null && !song.isPublicSong) PlayNextSong(); PrimaryForm.Instance.standardKeyButton.PerformClick(); return Task.CompletedTask; }