歌庫路徑調整
This commit is contained in:
parent
656f773ec7
commit
1dcd63c6ec
@ -6,12 +6,13 @@ namespace DBObj
|
|||||||
public string Song { get; set; }
|
public string Song { get; set; }
|
||||||
public string ArtistA { get; set; }
|
public string ArtistA { get; set; }
|
||||||
public string ArtistB { get; set; }
|
public string ArtistB { get; set; }
|
||||||
|
public string FileName { get; set; }
|
||||||
public string SongFilePathHost1 { get; set; }
|
public string SongFilePathHost1 { get; set; }
|
||||||
public string SongFilePathHost2 { get; set; }
|
public string SongFilePathHost2 { get; set; }
|
||||||
public string ArtistASimplified { get; set; }
|
public string ArtistASimplified { get; set; }
|
||||||
public string ArtistBSimplified { get; set; }
|
public string ArtistBSimplified { get; set; }
|
||||||
public string SongSimplified { get; set; }
|
public string SongSimplified { get; set; }
|
||||||
public int HumanVoice { get; set; }
|
public int HumanVoice { get; set; }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
public SongData(string songNumber, string category, string song, double plays, string artistA, string artistB, string artistACategory, string artistBCategory, DateTime addedTime, string songFilePathHost1, string songFilePathHost2, string phoneticNotation, string pinyinNotation, string artistAPhonetic, string artistBPhonetic, string artistASimplified, string artistBSimplified, string songSimplified, string songGenre, string artistAPinyin, string artistBPinyin, int humanVoice)
|
public SongData(string songNumber, string category, string song, double plays, string artistA, string artistB, string artistACategory, string artistBCategory, DateTime addedTime, string songFilePathHost1, string songFilePathHost2, string phoneticNotation, string pinyinNotation, string artistAPhonetic, string artistBPhonetic, string artistASimplified, string artistBSimplified, string songSimplified, string songGenre, string artistAPinyin, string artistBPinyin, int humanVoice)
|
||||||
@ -41,12 +42,13 @@ namespace DBObj
|
|||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
public SongData(string songNumber, string song, string artistA, string artistB, string songFilePathHost1, string songFilePathHost2, string artistASimplified, string artistBSimplified, string songSimplified, int humanVoice)
|
public SongData(string songNumber, string song, string artistA, string artistB, string filename, string songFilePathHost1, string songFilePathHost2, string artistASimplified, string artistBSimplified, string songSimplified, int humanVoice)
|
||||||
{
|
{
|
||||||
SongNumber = songNumber;
|
SongNumber = songNumber;
|
||||||
Song = song;
|
Song = song;
|
||||||
ArtistA = artistA;
|
ArtistA = artistA;
|
||||||
ArtistB = artistB;
|
ArtistB = artistB;
|
||||||
|
FileName = filename;
|
||||||
SongFilePathHost1 = songFilePathHost1;
|
SongFilePathHost1 = songFilePathHost1;
|
||||||
SongFilePathHost2 = songFilePathHost2;
|
SongFilePathHost2 = songFilePathHost2;
|
||||||
ArtistASimplified = artistASimplified;
|
ArtistASimplified = artistASimplified;
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
using System.Data.SQLite;
|
|
||||||
using System.IO;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using DualScreenDemo;
|
using DualScreenDemo;
|
||||||
namespace DBObj
|
namespace DBObj
|
||||||
{
|
{
|
||||||
@ -17,7 +13,7 @@ namespace DBObj
|
|||||||
/*
|
/*
|
||||||
public void AddNewUser(string phoneNumber)
|
public void AddNewUser(string phoneNumber)
|
||||||
{
|
{
|
||||||
string databaseFileName = "KSongDatabase.db";
|
|
||||||
string databasePath = Path.Combine(Application.StartupPath, "db", databaseFileName);
|
string databasePath = Path.Combine(Application.StartupPath, "db", databaseFileName);
|
||||||
string connectionString = String.Format("Data Source={0};Version=3;", databasePath);
|
string connectionString = String.Format("Data Source={0};Version=3;", databasePath);
|
||||||
|
|
||||||
|
@ -1513,22 +1513,45 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
|
|||||||
ClearDisplay();
|
ClearDisplay();
|
||||||
DisplaySongs(currentPage);
|
DisplaySongs(currentPage);
|
||||||
}
|
}
|
||||||
|
// 歌庫路徑調整
|
||||||
public void AddSongToPlaylist(SongData songData)
|
public void AddSongToPlaylist(SongData songData)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var filePath1 = songData.SongFilePathHost1;
|
var filePath1 = songData.SongFilePathHost1;
|
||||||
var filePath2 = songData.SongFilePathHost2;
|
var filePath2 = songData.SongFilePathHost2;
|
||||||
|
// 之後還要設計成本地的資料夾位置
|
||||||
|
var filename = songData.FileName;
|
||||||
if (!File.Exists(filePath1) && !File.Exists(filePath2))
|
bool checkpath = false;
|
||||||
|
string pathToPlay = "";
|
||||||
|
if (File.Exists(filename))
|
||||||
{
|
{
|
||||||
// 點播失敗時,寫LOG至logfile.txt
|
pathToPlay = filename;
|
||||||
PrimaryForm.WriteLog(String.Format("File not found on both hosts: {0} and {1}", filePath1, filePath2));
|
checkpath = true;
|
||||||
|
PrimaryForm.WriteLog(String.Format("{0} Using local file: {1}", songData.Song,filename));
|
||||||
|
}
|
||||||
|
else if (File.Exists(filePath1))
|
||||||
|
{
|
||||||
|
pathToPlay = filePath1;
|
||||||
|
checkpath = true;
|
||||||
|
PrimaryForm.WriteLog(String.Format("{0} Using Host1 file: {1}", songData.Song, filePath1));
|
||||||
|
}
|
||||||
|
else if (File.Exists(filePath2))
|
||||||
|
{
|
||||||
|
pathToPlay = filePath2;
|
||||||
|
checkpath = true;
|
||||||
|
PrimaryForm.WriteLog(String.Format("{0} Using Host2 file: {1}", songData.Song, filePath2));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var pathToPlay = File.Exists(filePath1) ? filePath1 : filePath2;
|
PrimaryForm.WriteLog(String.Format("File not found on hosts: {0}, {1} and {2}", filename, filePath1, filePath2));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkpath)
|
||||||
|
{
|
||||||
|
//做判定 決定pathToPlay值
|
||||||
|
//pathToPlay = File.Exists(filePath1) ? filePath1 : filePath2;
|
||||||
|
|
||||||
bool wasEmpty = PrimaryForm.userRequestedSongs.Count == 0;
|
bool wasEmpty = PrimaryForm.userRequestedSongs.Count == 0;
|
||||||
|
|
||||||
PrimaryForm.userRequestedSongs.Add(songData);
|
PrimaryForm.userRequestedSongs.Add(songData);
|
||||||
@ -1536,12 +1559,12 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
|
|||||||
PrimaryForm.playStates.Add(wasEmpty ? PlayState.Playing : PlayState.NotPlayed);
|
PrimaryForm.playStates.Add(wasEmpty ? PlayState.Playing : PlayState.NotPlayed);
|
||||||
// 刷新頁面
|
// 刷新頁面
|
||||||
|
|
||||||
if(PrimaryForm.Instance.multiPagePanel.get_currentSongList() == PrimaryForm.playedSongsHistory)
|
if (PrimaryForm.Instance.multiPagePanel.get_currentSongList() == PrimaryForm.playedSongsHistory)
|
||||||
PrimaryForm.Instance.multiPagePanel.LoadSongs(PrimaryForm.Instance.currentSongList);
|
PrimaryForm.Instance.multiPagePanel.LoadSongs(PrimaryForm.Instance.currentSongList);
|
||||||
if (wasEmpty)
|
if (wasEmpty)
|
||||||
{
|
{
|
||||||
VideoPlayerForm.Instance.SetPlayingSongList(PrimaryForm.userRequestedSongs);
|
VideoPlayerForm.Instance.SetPlayingSongList(PrimaryForm.userRequestedSongs);
|
||||||
PrimaryForm.currentSongIndexInHistory += 1;
|
PrimaryForm.currentSongIndexInHistory += 1;
|
||||||
}
|
}
|
||||||
VideoPlayerForm.Instance.UpdateNextSongFromPlaylist();
|
VideoPlayerForm.Instance.UpdateNextSongFromPlaylist();
|
||||||
PrimaryForm.PrintPlayingSongList();
|
PrimaryForm.PrintPlayingSongList();
|
||||||
@ -1554,7 +1577,6 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
|
|||||||
{
|
{
|
||||||
Console.WriteLine("Error occurred: " + ex.Message);
|
Console.WriteLine("Error occurred: " + ex.Message);
|
||||||
}
|
}
|
||||||
// OverlayForm.MainForm.displayLabel.Text = String.Format("已點歌曲:{0}", selectedSong);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ namespace DualScreenDemo{
|
|||||||
int humanVoice = Convert.ToInt32(reader["vocal"]);
|
int humanVoice = Convert.ToInt32(reader["vocal"]);
|
||||||
|
|
||||||
searchResults.Add(new SongData(
|
searchResults.Add(new SongData(
|
||||||
songNumber, song, artistA, artistB,
|
songNumber, song, artistA, artistB,fileName,
|
||||||
songFilePathHost1, songFilePathHost2,
|
songFilePathHost1, songFilePathHost2,
|
||||||
artistASimplified, artistBSimplified,
|
artistASimplified, artistBSimplified,
|
||||||
songSimplified, humanVoice
|
songSimplified, humanVoice
|
||||||
|
@ -1596,7 +1596,7 @@ namespace DualScreenDemo
|
|||||||
//0, // songLength
|
//0, // songLength
|
||||||
"", // artistA
|
"", // artistA
|
||||||
"", // artistB
|
"", // artistB
|
||||||
//"", // language
|
"", // filename
|
||||||
//"", // category
|
//"", // category
|
||||||
//DateTime.Now, // dateAdded
|
//DateTime.Now, // dateAdded
|
||||||
songPath, // songFilePathHost1
|
songPath, // songFilePathHost1
|
||||||
@ -1624,7 +1624,7 @@ namespace DualScreenDemo
|
|||||||
//0, // songLength
|
//0, // songLength
|
||||||
"", // artistA
|
"", // artistA
|
||||||
"", // artistB
|
"", // artistB
|
||||||
//"", // language
|
"", // filename
|
||||||
//"", // category
|
//"", // category
|
||||||
//DateTime.Now, // dateAdded
|
//DateTime.Now, // dateAdded
|
||||||
songPath, // songFilePathHost1
|
songPath, // songFilePathHost1
|
||||||
|
@ -157,7 +157,7 @@ namespace DualScreenDemo
|
|||||||
if (File.Exists(closePath))
|
if (File.Exists(closePath))
|
||||||
{
|
{
|
||||||
SongData closeSong = new SongData(
|
SongData closeSong = new SongData(
|
||||||
"0", "結束播放", "", "",
|
"0", "結束播放", "", "", "",
|
||||||
closePath, "", "", "", "",
|
closePath, "", "", "", "",
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
@ -609,7 +609,7 @@ namespace DualScreenDemo
|
|||||||
if (File.Exists(welcomePath))
|
if (File.Exists(welcomePath))
|
||||||
{
|
{
|
||||||
publicPlaylist.Add(new SongData(
|
publicPlaylist.Add(new SongData(
|
||||||
"0", "歡迎光臨", "", "", welcomePath,
|
"0", "歡迎光臨", "", "","", welcomePath,
|
||||||
"", "", "", "", 1
|
"", "", "", "", 1
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -622,7 +622,7 @@ namespace DualScreenDemo
|
|||||||
{
|
{
|
||||||
publicPlaylist.Add(new SongData(
|
publicPlaylist.Add(new SongData(
|
||||||
i.ToString(), $"背景音樂{i:D2}",
|
i.ToString(), $"背景音樂{i:D2}",
|
||||||
"", "", bgmPath, "", "", "", "", 1
|
"", "", "",bgmPath, "", "", "", "", 1
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -636,7 +636,7 @@ namespace DualScreenDemo
|
|||||||
{
|
{
|
||||||
string fileName = Path.GetFileNameWithoutExtension(songPath);
|
string fileName = Path.GetFileNameWithoutExtension(songPath);
|
||||||
publicPlaylist.Add(new SongData(
|
publicPlaylist.Add(new SongData(
|
||||||
"0", fileName, "", "",
|
"0", fileName, "", "", "",
|
||||||
songPath, "", "", "", "",
|
songPath, "", "", "", "",
|
||||||
1
|
1
|
||||||
));
|
));
|
||||||
@ -958,7 +958,7 @@ namespace DualScreenDemo
|
|||||||
if (File.Exists(welcomePath))
|
if (File.Exists(welcomePath))
|
||||||
{
|
{
|
||||||
publicPlaylist.Add(new SongData(
|
publicPlaylist.Add(new SongData(
|
||||||
"0", "歡迎光臨", "", "", welcomePath, "", "", "", "", 1
|
"0", "歡迎光臨", "", "", "", welcomePath, "", "", "", "", 1
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -969,7 +969,7 @@ namespace DualScreenDemo
|
|||||||
if (File.Exists(bgmPath))
|
if (File.Exists(bgmPath))
|
||||||
{
|
{
|
||||||
publicPlaylist.Add(new SongData(
|
publicPlaylist.Add(new SongData(
|
||||||
i.ToString(), $"背景音樂{i:D2}", "", "", bgmPath,
|
i.ToString(), $"背景音樂{i:D2}", "", "", "", bgmPath,
|
||||||
"", "", "", "", 1
|
"", "", "", "", 1
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user