mirror of
https://github.com/fiso64/slsk-batchdl.git
synced 2025-01-09 15:02:43 +00:00
improve track str parser
This commit is contained in:
parent
7c428f84d5
commit
55571f4156
4 changed files with 17 additions and 12 deletions
|
@ -1088,7 +1088,7 @@ public class Config
|
||||||
case "--pref-strict-title":
|
case "--pref-strict-title":
|
||||||
setNullableFlag(ref preferredCond.StrictTitle, ref i);
|
setNullableFlag(ref preferredCond.StrictTitle, ref i);
|
||||||
break;
|
break;
|
||||||
case "--psa":
|
case "--psar":
|
||||||
case "--pref-strict-artist":
|
case "--pref-strict-artist":
|
||||||
setNullableFlag(ref preferredCond.StrictArtist, ref i);
|
setNullableFlag(ref preferredCond.StrictArtist, ref i);
|
||||||
break;
|
break;
|
||||||
|
@ -1142,7 +1142,7 @@ public class Config
|
||||||
case "--strict-title":
|
case "--strict-title":
|
||||||
setNullableFlag(ref necessaryCond.StrictTitle, ref i);
|
setNullableFlag(ref necessaryCond.StrictTitle, ref i);
|
||||||
break;
|
break;
|
||||||
case "--sa":
|
case "--sar":
|
||||||
case "--strict-artist":
|
case "--strict-artist":
|
||||||
setNullableFlag(ref necessaryCond.StrictArtist, ref i);
|
setNullableFlag(ref necessaryCond.StrictArtist, ref i);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -131,11 +131,17 @@ namespace Extractors
|
||||||
setProperty(currentKey, currentVal.Trim());
|
setProperty(currentKey, currentVal.Trim());
|
||||||
|
|
||||||
other = other.Trim();
|
other = other.Trim();
|
||||||
if (other.Length > 0)
|
if (other.Length > 0 && (isAlbum && track.Album.Length > 0 || !isAlbum && track.Title.Length > 0))
|
||||||
|
{
|
||||||
|
Printing.WriteLine($"Warning: Input part '{other}' provided without a property name " +
|
||||||
|
$"and album or title is already set. Ignoring.", ConsoleColor.DarkYellow);
|
||||||
|
}
|
||||||
|
else if (other.Length > 0)
|
||||||
{
|
{
|
||||||
string artist = "", album = "", title = "";
|
string artist = "", album = "", title = "";
|
||||||
parts = other.Split(" - ", StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
parts = other.Split(" - ", 2, StringSplitOptions.TrimEntries);
|
||||||
if (parts.Length == 1 || parts.Length > 3)
|
|
||||||
|
if (parts.Length == 1 || track.Artist.Length > 0)
|
||||||
{
|
{
|
||||||
if (isAlbum)
|
if (isAlbum)
|
||||||
album = other.Trim();
|
album = other.Trim();
|
||||||
|
@ -151,12 +157,6 @@ namespace Extractors
|
||||||
else
|
else
|
||||||
title = parts[1];
|
title = parts[1];
|
||||||
}
|
}
|
||||||
else if (parts.Length == 3)
|
|
||||||
{
|
|
||||||
artist = parts[0];
|
|
||||||
album = parts[1];
|
|
||||||
title = parts[2];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (track.Artist.Length == 0)
|
if (track.Artist.Length == 0)
|
||||||
track.Artist = artist;
|
track.Artist = artist;
|
||||||
|
|
|
@ -1372,6 +1372,7 @@ static partial class Program
|
||||||
.Replace("{uri}", track.URI)
|
.Replace("{uri}", track.URI)
|
||||||
.Replace("{length}", track.Length.ToString())
|
.Replace("{length}", track.Length.ToString())
|
||||||
.Replace("{row}", (track.CsvOrListRow == -1 ? -1 : track.CsvOrListRow + 1).ToString())
|
.Replace("{row}", (track.CsvOrListRow == -1 ? -1 : track.CsvOrListRow + 1).ToString())
|
||||||
|
.Replace("{line}", (track.CsvOrListRow == -1 ? -1 : track.CsvOrListRow + 1).ToString())
|
||||||
.Replace("{artist-maybe-wrong}", track.ArtistMaybeWrong.ToString())
|
.Replace("{artist-maybe-wrong}", track.ArtistMaybeWrong.ToString())
|
||||||
.Replace("{type}", track.Type.ToString())
|
.Replace("{type}", track.Type.ToString())
|
||||||
.Replace("{is-not-audio}", track.IsNotAudio.ToString())
|
.Replace("{is-not-audio}", track.IsNotAudio.ToString())
|
||||||
|
|
|
@ -94,6 +94,8 @@ public static class Printing
|
||||||
Console.WriteLine($" Title: {tracks[i].Title}");
|
Console.WriteLine($" Title: {tracks[i].Title}");
|
||||||
if (!string.IsNullOrEmpty(tracks[i].Album) || tracks[i].Type == TrackType.Album)
|
if (!string.IsNullOrEmpty(tracks[i].Album) || tracks[i].Type == TrackType.Album)
|
||||||
Console.WriteLine($" Album: {tracks[i].Album}");
|
Console.WriteLine($" Album: {tracks[i].Album}");
|
||||||
|
if (tracks[i].MinAlbumTrackCount != -1 || tracks[i].MaxAlbumTrackCount != -1)
|
||||||
|
Console.WriteLine($" Min,Max tracks: {tracks[i].MinAlbumTrackCount},{tracks[i].MaxAlbumTrackCount}");
|
||||||
if (tracks[i].Length > -1 || tracks[i].Type == TrackType.Normal)
|
if (tracks[i].Length > -1 || tracks[i].Type == TrackType.Normal)
|
||||||
Console.WriteLine($" Length: {tracks[i].Length}s");
|
Console.WriteLine($" Length: {tracks[i].Length}s");
|
||||||
if (!string.IsNullOrEmpty(tracks[i].DownloadPath))
|
if (!string.IsNullOrEmpty(tracks[i].DownloadPath))
|
||||||
|
@ -132,7 +134,9 @@ public static class Printing
|
||||||
}
|
}
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
}
|
}
|
||||||
Console.WriteLine();
|
|
||||||
|
if (i < number - 1)
|
||||||
|
Console.WriteLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue