Better handle multiple tags respecting US format (#878)
* Better handle multiple tags respecting US format Based on unversioned, V1 & V2 of US formats : https://github.com/UltraStar-Deluxe/format Should address #623 Creator now takes multiple values Maintain backward compatibility * Update file path properties to match US formats
This commit is contained in:
1 parent
cae67eb4ab
commit
1bba340cf8
10 files changed
+97
-160
No files matched your search
@@ -108,11 +108,11 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
_CancelToken.Token.ThrowIfCancellationRequested();
|
_CancelToken.Token.ThrowIfCancellationRequested();
|
||||||
var coverBmp = !_CoverGenerators.ContainsKey(type)
|
var coverBmp = !_CoverGenerators.ContainsKey(type)
|
||||||
? null : _CoverGenerators[type].GetCover(text, firstSong != null ? Path.Combine(firstSong.Folder, firstSong.CoverFileName) : null);
|
? null : _CoverGenerators[type].GetCover(text, firstSong != null ? Path.Combine(firstSong.Folder, firstSong.Cover) : null);
|
||||||
_CancelToken.Token.ThrowIfCancellationRequested();
|
_CancelToken.Token.ThrowIfCancellationRequested();
|
||||||
if (coverBmp == null && _CoverGenerators.ContainsKey(ECoverGeneratorType.Default))
|
if (coverBmp == null && _CoverGenerators.ContainsKey(ECoverGeneratorType.Default))
|
||||||
{
|
{
|
||||||
coverBmp = _CoverGenerators[ECoverGeneratorType.Default].GetCover(text, firstSong != null ? Path.Combine(firstSong.Folder, firstSong.CoverFileName) : null);
|
coverBmp = _CoverGenerators[ECoverGeneratorType.Default].GetCover(text, firstSong != null ? Path.Combine(firstSong.Folder, firstSong.Cover) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
_CancelToken.Token.ThrowIfCancellationRequested();
|
_CancelToken.Token.ThrowIfCancellationRequested();
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ namespace Vocaluxe.Base
|
|||||||
String searchForLanguage = null; // l:
|
String searchForLanguage = null; // l:
|
||||||
String searchForCreator = null; // c:
|
String searchForCreator = null; // c:
|
||||||
String searchForEdition = null; // e:
|
String searchForEdition = null; // e:
|
||||||
String searchForTags = null; // #:
|
String searchForTag = null; // #:
|
||||||
String searchForAlbum = null; // al:
|
String searchForAlbum = null; // al:
|
||||||
String searchForFileName = null; // fi:
|
String searchForFileName = null; // fi:
|
||||||
String searchForFolderName = null; // fo:
|
String searchForFolderName = null; // fo:
|
||||||
@@ -146,7 +146,7 @@ namespace Vocaluxe.Base
|
|||||||
searchForEdition = searchToken.Substring(2);
|
searchForEdition = searchToken.Substring(2);
|
||||||
break;
|
break;
|
||||||
case "#:":
|
case "#:":
|
||||||
searchForTags = searchToken.Substring(2);
|
searchForTag = searchToken.Substring(2);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
foundIt = false;
|
foundIt = false;
|
||||||
@@ -230,11 +230,6 @@ namespace Vocaluxe.Base
|
|||||||
_FilteredSongs.Add(song);
|
_FilteredSongs.Add(song);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchForCreator != null && song.Creator.ToUpper().Contains(searchForCreator))
|
|
||||||
{
|
|
||||||
_FilteredSongs.Add(song);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (searchForFileName != null && song.FileName.ToUpper().Contains(searchForFileName))
|
if (searchForFileName != null && song.FileName.ToUpper().Contains(searchForFileName))
|
||||||
{
|
{
|
||||||
_FilteredSongs.Add(song);
|
_FilteredSongs.Add(song);
|
||||||
@@ -245,48 +240,29 @@ namespace Vocaluxe.Base
|
|||||||
_FilteredSongs.Add(song);
|
_FilteredSongs.Add(song);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchForGenre != null)
|
if (searchForCreator != null && song.Creators.Any(t => t.ToUpper().Contains(searchForCreator)))
|
||||||
{
|
{
|
||||||
foreach (var genre in song.Genres)
|
_FilteredSongs.Add(song);
|
||||||
{
|
|
||||||
if (genre.ToUpper().Contains(searchForGenre))
|
|
||||||
{
|
|
||||||
_FilteredSongs.Add(song);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchForLanguage != null)
|
if (searchForGenre != null && song.Genres.Any(t => t.ToUpper().Contains(searchForGenre)))
|
||||||
{
|
{
|
||||||
foreach (var language in song.Languages)
|
_FilteredSongs.Add(song);
|
||||||
{
|
|
||||||
if (language.ToUpper().Contains(searchForLanguage))
|
|
||||||
{
|
|
||||||
_FilteredSongs.Add(song);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchForEdition != null)
|
if (searchForLanguage != null && song.Languages.Any(t => t.ToUpper().Contains(searchForLanguage)))
|
||||||
{
|
{
|
||||||
foreach (var edition in song.Editions)
|
_FilteredSongs.Add(song);
|
||||||
{
|
|
||||||
if (edition.ToUpper().Contains(searchForEdition))
|
|
||||||
{
|
|
||||||
_FilteredSongs.Add(song);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchForTags != null)
|
if (searchForEdition != null && song.Editions.Any(t => t.ToUpper().Contains(searchForEdition)))
|
||||||
{
|
{
|
||||||
foreach (var tag in song.Tags)
|
_FilteredSongs.Add(song);
|
||||||
{
|
}
|
||||||
if (tag.ToUpper().Contains(searchForTags))
|
|
||||||
{
|
if (searchForTag != null && song.Tags.Any(t => t.ToUpper().Contains(searchForTag)))
|
||||||
_FilteredSongs.Add(song);
|
{
|
||||||
}
|
_FilteredSongs.Add(song);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchForYear != null)
|
if (searchForYear != null)
|
||||||
|
|||||||
@@ -707,13 +707,13 @@ namespace Vocaluxe.Base.Server
|
|||||||
result.SongId = song.Id;
|
result.SongId = song.Id;
|
||||||
if (includeCover)
|
if (includeCover)
|
||||||
{
|
{
|
||||||
if (song.CoverFileName == "")
|
if (song.Cover == "")
|
||||||
{
|
{
|
||||||
result.Cover = new CBase64Image(_CreateDelayedImage("Website\\img\\noCover.png"));
|
result.Cover = new CBase64Image(_CreateDelayedImage("Website\\img\\noCover.png"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result.Cover = new CBase64Image(_CreateDelayedImage(song.Folder + "\\" + song.CoverFileName));
|
result.Cover = new CBase64Image(_CreateDelayedImage(song.Folder + "\\" + song.Cover));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1591,9 +1591,9 @@ namespace Vocaluxe.Screens
|
|||||||
}
|
}
|
||||||
|
|
||||||
_VideoAspect = song.VideoAspect;
|
_VideoAspect = song.VideoAspect;
|
||||||
if (!string.IsNullOrEmpty(song.VideoFileName))
|
if (!string.IsNullOrEmpty(song.Video))
|
||||||
{
|
{
|
||||||
_CurrentVideo = CVideo.Load(Path.Combine(song.Folder, song.VideoFileName));
|
_CurrentVideo = CVideo.Load(Path.Combine(song.Folder, song.Video));
|
||||||
CVideo.Skip(_CurrentVideo, song.Start, song.VideoGap);
|
CVideo.Skip(_CurrentVideo, song.Start, song.VideoGap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -305,7 +305,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
_SongYear.Text = song.Year;
|
_SongYear.Text = song.Year;
|
||||||
_DuetIcon.Visible = song.IsDuet;
|
_DuetIcon.Visible = song.IsDuet;
|
||||||
_RapIcon.Visible = song.IsRap;
|
_RapIcon.Visible = song.IsRap;
|
||||||
_VideoIcon.Visible = song.VideoFileName != "";
|
_VideoIcon.Visible = song.Video != "";
|
||||||
_MedleyCalcIcon.Visible = song.Medley.Source == EDataSource.Calculated;
|
_MedleyCalcIcon.Visible = song.Medley.Source == EDataSource.Calculated;
|
||||||
_MedleyTagIcon.Visible = song.Medley.Source == EDataSource.Tag;
|
_MedleyTagIcon.Visible = song.Medley.Source == EDataSource.Tag;
|
||||||
_InstrumentalIcon.Visible = song.HasInstrumental();
|
_InstrumentalIcon.Visible = song.HasInstrumental();
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
|||||||
_SongYear.Text = song.Year;
|
_SongYear.Text = song.Year;
|
||||||
_DuetIcon.Visible = song.IsDuet;
|
_DuetIcon.Visible = song.IsDuet;
|
||||||
_RapIcon.Visible = song.IsRap;
|
_RapIcon.Visible = song.IsRap;
|
||||||
_VideoIcon.Visible = song.VideoFileName != "";
|
_VideoIcon.Visible = song.Video != "";
|
||||||
_MedleyCalcIcon.Visible = song.Medley.Source == EDataSource.Calculated;
|
_MedleyCalcIcon.Visible = song.Medley.Source == EDataSource.Calculated;
|
||||||
_MedleyTagIcon.Visible = song.Medley.Source == EDataSource.Tag;
|
_MedleyTagIcon.Visible = song.Medley.Source == EDataSource.Tag;
|
||||||
_InstrumentalIcon.Visible = song.HasInstrumental();
|
_InstrumentalIcon.Visible = song.HasInstrumental();
|
||||||
|
|||||||
+32
-40
@@ -98,12 +98,12 @@ namespace VocaluxeLib.Songs
|
|||||||
public string FileName = string.Empty;
|
public string FileName = string.Empty;
|
||||||
public bool Relative;
|
public bool Relative;
|
||||||
|
|
||||||
public string MP3FileName = string.Empty;
|
public string Audio = string.Empty;
|
||||||
public string InstrumentalFileName = string.Empty;
|
public string Instrumental = string.Empty;
|
||||||
public string VocalsFileName = string.Empty;
|
public string Vocals = string.Empty;
|
||||||
public string CoverFileName = string.Empty;
|
public string Cover = string.Empty;
|
||||||
public readonly List<string> BackgroundFileNames = new List<string>();
|
public readonly List<string> BackgroundFileNames = new();
|
||||||
public string VideoFileName = string.Empty;
|
public string Video = string.Empty;
|
||||||
|
|
||||||
public EAspect VideoAspect = EAspect.Automatic;
|
public EAspect VideoAspect = EAspect.Automatic;
|
||||||
|
|
||||||
@@ -120,14 +120,11 @@ namespace VocaluxeLib.Songs
|
|||||||
|
|
||||||
return _CoverTextureSmall;
|
return _CoverTextureSmall;
|
||||||
}
|
}
|
||||||
|
|
||||||
set { _CoverTextureSmall = value; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public CTextureRef CoverTextureBig
|
public CTextureRef CoverTextureBig
|
||||||
{
|
{
|
||||||
get { return _CoverTextureBig ?? _CoverTextureSmall; }
|
get => _CoverTextureBig ?? _CoverTextureSmall;
|
||||||
set { _CoverTextureBig = value; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Title = string.Empty;
|
public string Title = string.Empty;
|
||||||
@@ -136,11 +133,10 @@ namespace VocaluxeLib.Songs
|
|||||||
public string TitleSorting = string.Empty;
|
public string TitleSorting = string.Empty;
|
||||||
public string ArtistSorting = string.Empty;
|
public string ArtistSorting = string.Empty;
|
||||||
|
|
||||||
public string Creator = "";
|
|
||||||
public string Version = "";
|
public string Version = "";
|
||||||
public string Length = ""; //Length set in song file, SHOULD match actual song length but is more a hint
|
public string Length = ""; //Length set in song file, SHOULD match actual song length but is more a hint
|
||||||
public string Source = "";
|
public string Source = "";
|
||||||
public readonly List<String> UnknownTags = new List<string>();
|
public readonly List<string> UnknownTags = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start of the song in s (s in txt)
|
/// Start of the song in s (s in txt)
|
||||||
@@ -168,27 +164,24 @@ namespace VocaluxeLib.Songs
|
|||||||
private readonly bool _Visible = true;
|
private readonly bool _Visible = true;
|
||||||
private readonly int _CatIndex = -1;
|
private readonly int _CatIndex = -1;
|
||||||
private readonly bool _Selected;
|
private readonly bool _Selected;
|
||||||
public bool IsDuet
|
public bool IsDuet => Notes.VoiceCount > 1;
|
||||||
{
|
|
||||||
get { return Notes.VoiceCount > 1; }
|
|
||||||
}
|
|
||||||
public bool IsRap = false;
|
public bool IsRap = false;
|
||||||
|
|
||||||
public readonly List<string> Editions = new List<string>();
|
public readonly List<string> Creators = new();
|
||||||
public readonly List<string> Genres = new List<string>();
|
public readonly List<string> Editions = new();
|
||||||
public readonly List<string> Tags = new List<string>();
|
public readonly List<string> Genres = new();
|
||||||
|
public readonly List<string> Tags = new();
|
||||||
|
public readonly List<string> Languages = new();
|
||||||
public string Album = "";
|
public string Album = "";
|
||||||
public string Year = "";
|
public string Year = "";
|
||||||
|
|
||||||
public readonly List<string> Languages = new List<string>();
|
|
||||||
|
|
||||||
public int DataBaseSongId = -1;
|
public int DataBaseSongId = -1;
|
||||||
public DateTime DateAdded = DateTime.Today;
|
public DateTime DateAdded = DateTime.Today;
|
||||||
public int NumPlayed;
|
public int NumPlayed;
|
||||||
public int NumPlayedSession;
|
public int NumPlayedSession;
|
||||||
|
|
||||||
// Notes
|
// Notes
|
||||||
public readonly CNotes Notes = new CNotes();
|
public readonly CNotes Notes = new();
|
||||||
|
|
||||||
public IList<EGameMode> AvailableGameModes
|
public IList<EGameMode> AvailableGameModes
|
||||||
{
|
{
|
||||||
@@ -241,12 +234,12 @@ namespace VocaluxeLib.Songs
|
|||||||
FileName = song.FileName;
|
FileName = song.FileName;
|
||||||
Relative = song.Relative;
|
Relative = song.Relative;
|
||||||
|
|
||||||
MP3FileName = song.MP3FileName;
|
Audio = song.Audio;
|
||||||
InstrumentalFileName = song.InstrumentalFileName;
|
Instrumental = song.Instrumental;
|
||||||
VocalsFileName = song.VocalsFileName;
|
Vocals = song.Vocals;
|
||||||
CoverFileName = song.CoverFileName;
|
Cover = song.Cover;
|
||||||
BackgroundFileNames = song.BackgroundFileNames;
|
BackgroundFileNames = song.BackgroundFileNames;
|
||||||
VideoFileName = song.VideoFileName;
|
Video = song.Video;
|
||||||
|
|
||||||
VideoAspect = song.VideoAspect;
|
VideoAspect = song.VideoAspect;
|
||||||
NotesLoaded = song.NotesLoaded;
|
NotesLoaded = song.NotesLoaded;
|
||||||
@@ -256,7 +249,6 @@ namespace VocaluxeLib.Songs
|
|||||||
ArtistSorting = song.ArtistSorting;
|
ArtistSorting = song.ArtistSorting;
|
||||||
TitleSorting = song.TitleSorting;
|
TitleSorting = song.TitleSorting;
|
||||||
|
|
||||||
Creator = song.Creator;
|
|
||||||
Version = song.Version;
|
Version = song.Version;
|
||||||
Length = song.Length;
|
Length = song.Length;
|
||||||
Source = song.Source;
|
Source = song.Source;
|
||||||
@@ -276,14 +268,14 @@ namespace VocaluxeLib.Songs
|
|||||||
_CatIndex = song._CatIndex;
|
_CatIndex = song._CatIndex;
|
||||||
_Selected = song._Selected;
|
_Selected = song._Selected;
|
||||||
|
|
||||||
|
Creators = new List<string>(song.Creators);
|
||||||
Editions = new List<string>(song.Editions);
|
Editions = new List<string>(song.Editions);
|
||||||
Genres = new List<string>(song.Genres);
|
Genres = new List<string>(song.Genres);
|
||||||
Tags = new List<string>(song.Tags);
|
Tags = new List<string>(song.Tags);
|
||||||
|
Languages = new List<string>(song.Languages);
|
||||||
Album = song.Album;
|
Album = song.Album;
|
||||||
Year = song.Year;
|
Year = song.Year;
|
||||||
|
|
||||||
Languages = new List<string>(song.Languages);
|
|
||||||
|
|
||||||
DataBaseSongId = song.DataBaseSongId;
|
DataBaseSongId = song.DataBaseSongId;
|
||||||
DateAdded = song.DateAdded;
|
DateAdded = song.DateAdded;
|
||||||
NumPlayed = song.NumPlayed;
|
NumPlayed = song.NumPlayed;
|
||||||
@@ -318,32 +310,32 @@ namespace VocaluxeLib.Songs
|
|||||||
|
|
||||||
public string GetMP3()
|
public string GetMP3()
|
||||||
{
|
{
|
||||||
return Path.Combine(Folder, MP3FileName);
|
return Path.Combine(Folder, Audio);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetInstrumental()
|
public string GetInstrumental()
|
||||||
{
|
{
|
||||||
return Path.Combine(Folder, InstrumentalFileName);
|
return Path.Combine(Folder, Instrumental);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasInstrumental()
|
public bool HasInstrumental()
|
||||||
{
|
{
|
||||||
return !string.IsNullOrEmpty(InstrumentalFileName);
|
return !string.IsNullOrEmpty(Instrumental);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetVocals()
|
public string GetVocals()
|
||||||
{
|
{
|
||||||
return Path.Combine(Folder, VocalsFileName);
|
return Path.Combine(Folder, Vocals);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasVocals()
|
public bool HasVocals()
|
||||||
{
|
{
|
||||||
return !string.IsNullOrEmpty(VocalsFileName);
|
return !string.IsNullOrEmpty(Vocals);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetVideo()
|
public string GetVideo()
|
||||||
{
|
{
|
||||||
return Path.Combine(Folder, VideoFileName);
|
return Path.Combine(Folder, Video);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadSmallCover()
|
public void LoadSmallCover()
|
||||||
@@ -353,9 +345,9 @@ namespace VocaluxeLib.Songs
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CoverFileName != "")
|
if (Cover != "")
|
||||||
{
|
{
|
||||||
if (CBase.DataBase.GetCover(Path.Combine(Folder, CoverFileName), ref _CoverTextureSmall, CBase.Config.GetCoverSize()))
|
if (CBase.DataBase.GetCover(Path.Combine(Folder, Cover), ref _CoverTextureSmall, CBase.Config.GetCoverSize()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -366,7 +358,7 @@ namespace VocaluxeLib.Songs
|
|||||||
|
|
||||||
private void _CheckFiles()
|
private void _CheckFiles()
|
||||||
{
|
{
|
||||||
if (CoverFileName == "")
|
if (Cover == "")
|
||||||
{
|
{
|
||||||
var files = CHelper.ListImageFiles(Folder);
|
var files = CHelper.ListImageFiles(Folder);
|
||||||
foreach (var file in files)
|
foreach (var file in files)
|
||||||
@@ -374,7 +366,7 @@ namespace VocaluxeLib.Songs
|
|||||||
if (file.ContainsIgnoreCase("[CO]") &&
|
if (file.ContainsIgnoreCase("[CO]") &&
|
||||||
(file.ContainsIgnoreCase(Title) || file.ContainsIgnoreCase(Artist)))
|
(file.ContainsIgnoreCase(Title) || file.ContainsIgnoreCase(Artist)))
|
||||||
{
|
{
|
||||||
CoverFileName = file;
|
Cover = file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using VocaluxeLib.Log;
|
using VocaluxeLib.Log;
|
||||||
@@ -180,11 +181,6 @@ namespace VocaluxeLib.Songs
|
|||||||
case "ARTIST-ON-SORTING":
|
case "ARTIST-ON-SORTING":
|
||||||
_Song.ArtistSorting = value;
|
_Song.ArtistSorting = value;
|
||||||
break;
|
break;
|
||||||
case "CREATOR":
|
|
||||||
case "AUTHOR":
|
|
||||||
case "AUTOR":
|
|
||||||
_Song.Creator = value;
|
|
||||||
break;
|
|
||||||
case "VERSION":
|
case "VERSION":
|
||||||
_Song.Version = value;
|
_Song.Version = value;
|
||||||
break;
|
break;
|
||||||
@@ -200,7 +196,7 @@ namespace VocaluxeLib.Songs
|
|||||||
case "AUDIO":
|
case "AUDIO":
|
||||||
if (File.Exists(Path.Combine(_Song.Folder, value)))
|
if (File.Exists(Path.Combine(_Song.Folder, value)))
|
||||||
{
|
{
|
||||||
_Song.MP3FileName = value;
|
_Song.Audio = value;
|
||||||
headerFlags |= EHeaderFlags.MP3;
|
headerFlags |= EHeaderFlags.MP3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -213,7 +209,7 @@ namespace VocaluxeLib.Songs
|
|||||||
case "INSTRUMENTAL":
|
case "INSTRUMENTAL":
|
||||||
if (File.Exists(Path.Combine(_Song.Folder, value)))
|
if (File.Exists(Path.Combine(_Song.Folder, value)))
|
||||||
{
|
{
|
||||||
_Song.InstrumentalFileName = value;
|
_Song.Instrumental = value;
|
||||||
headerFlags |= EHeaderFlags.Instrumental;
|
headerFlags |= EHeaderFlags.Instrumental;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -227,7 +223,7 @@ namespace VocaluxeLib.Songs
|
|||||||
case "VOCALS":
|
case "VOCALS":
|
||||||
if (File.Exists(Path.Combine(_Song.Folder, value)))
|
if (File.Exists(Path.Combine(_Song.Folder, value)))
|
||||||
{
|
{
|
||||||
_Song.VocalsFileName = value;
|
_Song.Vocals = value;
|
||||||
headerFlags |= EHeaderFlags.Vocals;
|
headerFlags |= EHeaderFlags.Vocals;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -249,39 +245,23 @@ namespace VocaluxeLib.Songs
|
|||||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid BPM value: {Value}", CLog.Params(_Song.FileName, value));
|
CLog.CSongLog.Warning("[{SongFileName}] Invalid BPM value: {Value}", CLog.Params(_Song.FileName, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case "CREATOR":
|
||||||
|
case "AUTHOR":
|
||||||
|
case "AUTOR":
|
||||||
|
_Song.Creators.AddRange(_GetMultipleHeaderValues(value));
|
||||||
break;
|
break;
|
||||||
case "EDITION":
|
case "EDITION":
|
||||||
if (value.Length > 1)
|
_Song.Editions.AddRange(_GetMultipleHeaderValues(value));
|
||||||
{
|
|
||||||
_Song.Editions.Add(value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid edition: {Value}", CLog.Params(_Song.FileName, value));
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "GENRE":
|
case "GENRE":
|
||||||
if (value.Length > 1)
|
_Song.Genres.AddRange(_GetMultipleHeaderValues(value));
|
||||||
{
|
|
||||||
_Song.Genres.Add(value);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid genre: {Value}", CLog.Params(_Song.FileName, value));
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "TAGS":
|
case "TAGS":
|
||||||
if (value.Length > 1)
|
_Song.Tags.AddRange(_GetMultipleHeaderValues(value));
|
||||||
{
|
break;
|
||||||
_Song.Tags.AddRange(value.Split(','));
|
case "LANGUAGE":
|
||||||
}
|
_Song.Languages.AddRange(_GetMultipleHeaderValues(value).Select(_UnifyLanguage));
|
||||||
else
|
|
||||||
{
|
|
||||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid tags: {Value}", CLog.Params(_Song.FileName, value));
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "ALBUM":
|
case "ALBUM":
|
||||||
_Song.Album = value;
|
_Song.Album = value;
|
||||||
@@ -297,17 +277,6 @@ namespace VocaluxeLib.Songs
|
|||||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid year: {Value}", CLog.Params(_Song.FileName, value));
|
CLog.CSongLog.Warning("[{SongFileName}] Invalid year: {Value}", CLog.Params(_Song.FileName, value));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
case "LANGUAGE":
|
|
||||||
if (value.Length > 1)
|
|
||||||
{
|
|
||||||
_Song.Languages.Add(_UnifyLanguage(value));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CLog.CSongLog.Warning("[{SongFileName}] Invalid language: {Value}", CLog.Params(_Song.FileName, value));
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "COMMENT":
|
case "COMMENT":
|
||||||
if (!string.IsNullOrEmpty(_Song._Comment))
|
if (!string.IsNullOrEmpty(_Song._Comment))
|
||||||
@@ -331,7 +300,7 @@ namespace VocaluxeLib.Songs
|
|||||||
case "COVER":
|
case "COVER":
|
||||||
if (File.Exists(Path.Combine(_Song.Folder, value)))
|
if (File.Exists(Path.Combine(_Song.Folder, value)))
|
||||||
{
|
{
|
||||||
_Song.CoverFileName = value;
|
_Song.Cover = value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -354,7 +323,7 @@ namespace VocaluxeLib.Songs
|
|||||||
case "VIDEO":
|
case "VIDEO":
|
||||||
if (File.Exists(Path.Combine(_Song.Folder, value)))
|
if (File.Exists(Path.Combine(_Song.Folder, value)))
|
||||||
{
|
{
|
||||||
_Song.VideoFileName = value;
|
_Song.Video = value;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -597,6 +566,11 @@ namespace VocaluxeLib.Songs
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IEnumerable<string> _GetMultipleHeaderValues(string value)
|
||||||
|
{
|
||||||
|
return value.Split(',').Select(v => v.Trim()).Where(v => !string.IsNullOrEmpty(v));
|
||||||
|
}
|
||||||
|
|
||||||
private static string _UnifyLanguage(string lang)
|
private static string _UnifyLanguage(string lang)
|
||||||
{
|
{
|
||||||
if (lang != "")
|
if (lang != "")
|
||||||
|
|||||||
@@ -66,17 +66,13 @@ namespace VocaluxeLib.Songs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _WriteHeaderEntrys(string id, ICollection<string> value)
|
private void _WriteHeaderEntries(string id, ICollection<string> value)
|
||||||
{
|
{
|
||||||
if (value == null || value.Count <= 0)
|
if (value is not { Count: > 0 })
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
_WriteHeaderEntry(id, string.Join(",", value));
|
||||||
foreach (var val in value)
|
|
||||||
{
|
|
||||||
_WriteHeaderEntry(id, val);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void _WriteHeader()
|
private void _WriteHeader()
|
||||||
@@ -86,16 +82,10 @@ namespace VocaluxeLib.Songs
|
|||||||
_WriteHeaderEntry("ENCODING", _Song.Encoding.GetEncodingName());
|
_WriteHeaderEntry("ENCODING", _Song.Encoding.GetEncodingName());
|
||||||
}
|
}
|
||||||
|
|
||||||
_WriteHeaderEntry("CREATOR", _Song.Creator);
|
|
||||||
_WriteHeaderEntry("VERSION", _Song.Version);
|
_WriteHeaderEntry("VERSION", _Song.Version);
|
||||||
_WriteHeaderEntry("LENGTH", _Song.Length);
|
_WriteHeaderEntry("LENGTH", _Song.Length);
|
||||||
_WriteHeaderEntry("SOURCE", _Song.Source);
|
_WriteHeaderEntry("SOURCE", _Song.Source);
|
||||||
if (!string.IsNullOrEmpty(_Song._Comment))
|
_WriteHeaderEntry("COMMENT", _Song._Comment);
|
||||||
{
|
|
||||||
var comment = _Song._Comment.Replace("\r\n", "\n").Replace('\r', '\n');
|
|
||||||
char[] splitChar = { '\n' };
|
|
||||||
_WriteHeaderEntrys("COMMENT", comment.Split(splitChar));
|
|
||||||
}
|
|
||||||
|
|
||||||
_WriteHeaderEntry("TITLE", _Song.Title);
|
_WriteHeaderEntry("TITLE", _Song.Title);
|
||||||
_WriteHeaderEntry("ARTIST", _Song.Artist);
|
_WriteHeaderEntry("ARTIST", _Song.Artist);
|
||||||
@@ -109,16 +99,21 @@ namespace VocaluxeLib.Songs
|
|||||||
_WriteHeaderEntry("ARTIST-ON-SORTING", _Song.ArtistSorting);
|
_WriteHeaderEntry("ARTIST-ON-SORTING", _Song.ArtistSorting);
|
||||||
}
|
}
|
||||||
|
|
||||||
_WriteHeaderEntrys("EDITION", _Song.Editions);
|
_WriteHeaderEntries("CREATOR", _Song.Creators);
|
||||||
_WriteHeaderEntrys("GENRE", _Song.Genres);
|
_WriteHeaderEntries("EDITION", _Song.Editions);
|
||||||
_WriteHeaderEntry("TAGS", String.Join(",", _Song.Tags.ToArray()));
|
_WriteHeaderEntries("GENRE", _Song.Genres);
|
||||||
_WriteHeaderEntrys("LANGUAGE", _Song.Languages);
|
_WriteHeaderEntries("TAGS", _Song.Tags);
|
||||||
|
_WriteHeaderEntries("LANGUAGE", _Song.Languages);
|
||||||
_WriteHeaderEntry("ALBUM", _Song.Album);
|
_WriteHeaderEntry("ALBUM", _Song.Album);
|
||||||
_WriteHeaderEntry("YEAR", _Song.Year);
|
_WriteHeaderEntry("YEAR", _Song.Year);
|
||||||
_WriteHeaderEntry("MP3", _Song.MP3FileName);
|
_WriteHeaderEntry("MP3", _Song.Audio);
|
||||||
_WriteHeaderEntry("COVER", _Song.CoverFileName);
|
_WriteHeaderEntry("COVER", _Song.Cover);
|
||||||
_WriteHeaderEntrys("BACKGROUND", _Song.BackgroundFileNames);
|
// This is a custom behaviour, normally multiple backgrounds is not supported in official US format
|
||||||
_WriteHeaderEntry("VIDEO", _Song.VideoFileName);
|
foreach (var songBackgroundFileName in _Song.BackgroundFileNames)
|
||||||
|
{
|
||||||
|
_WriteHeaderEntry("BACKGROUND", songBackgroundFileName);
|
||||||
|
}
|
||||||
|
_WriteHeaderEntry("VIDEO", _Song.Video);
|
||||||
_WriteHeaderEntry("VIDEOGAP", _Song.VideoGap);
|
_WriteHeaderEntry("VIDEOGAP", _Song.VideoGap);
|
||||||
if (_Song.VideoAspect != EAspect.Crop)
|
if (_Song.VideoAspect != EAspect.Crop)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ namespace VocaluxeLib.Utils.Player
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return _Song != null && !string.IsNullOrEmpty(_Song.Folder) && !string.IsNullOrEmpty(_Song.VideoFileName) &&
|
return _Song != null && !string.IsNullOrEmpty(_Song.Folder) && !string.IsNullOrEmpty(_Song.Video) &&
|
||||||
File.Exists(Path.Combine(_Song.Folder, _Song.VideoFileName));
|
File.Exists(Path.Combine(_Song.Folder, _Song.Video));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +134,7 @@ namespace VocaluxeLib.Utils.Player
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var videoFilePath = Path.Combine(_Song.Folder, _Song.VideoFileName);
|
var videoFilePath = Path.Combine(_Song.Folder, _Song.Video);
|
||||||
_Video = CBase.Video.Load(videoFilePath);
|
_Video = CBase.Video.Load(videoFilePath);
|
||||||
if (_Video == null)
|
if (_Video == null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user