diff --git a/TIDALDL-UI-PRO/Else/Settings.cs b/TIDALDL-UI-PRO/Else/Settings.cs
index 5f586a8..d5cf4e6 100644
--- a/TIDALDL-UI-PRO/Else/Settings.cs
+++ b/TIDALDL-UI-PRO/Else/Settings.cs
@@ -148,11 +148,15 @@ public class Settings : Stylet.Screen
public ePositionYear AddYear { get; set; } = ePositionYear.None;
[JsonProperty("AlbumFolderFormat")]
- public string AlbumFolderFormat { get; set; } = "{Flag} {AlbumTitle} [{AlbumID}] [{AlbumYear}]";
+
+ public string AlbumFolderFormat { get; set; } = "{ArtistName}/{Flag} {AlbumTitle} [{AlbumID}] [{AlbumYear}]";
[JsonProperty("TrackFileFormat")]
public string TrackFileFormat { get; set; } = "{TrackNumber} - {ArtistName} - {TrackTitle}{ExplicitFlag}";
+ [JsonProperty("VideoFileFormat")]
+ public string VideoFileFormat { get; set; } = "{ArtistName}/{TrackNumber} - {VideoTitle}{ExplicitFlag}";
+
public static void Change(Settings newItem, Settings oldItem = null)
{
diff --git a/TIDALDL-UI-PRO/Else/Tools.cs b/TIDALDL-UI-PRO/Else/Tools.cs
index 8b6ae45..7c06133 100644
--- a/TIDALDL-UI-PRO/Else/Tools.cs
+++ b/TIDALDL-UI-PRO/Else/Tools.cs
@@ -55,11 +55,12 @@ public static string GetArtistPath(Artist artist, Settings settings)
return basepath;
}
- //[{Flag}] [{AlbumID}] [{AlbumYear}] {AlbumTitle}
+ //{ArtistName}/{Flag} [{AlbumID}] [{AlbumYear}] {AlbumTitle}
public static string GetAlbumPath(Album album, Settings settings)
{
- // outputdir/Album/artist/
- string basepath = $"{settings.OutputDir}/Album/{FormatPath(album.Artists[0].Name, settings)}";
+ // outputdir/Album/
+ string basepath = $"{settings.OutputDir}/Album/";
+ // string basepath = $"{settings.OutputDir}/Album/{FormatPath(album.Artists[0].Name, settings)}";
// album folder pre: [ME][ID]
string flag = Client.GetFlag(album, eType.ALBUM, true, "");
@@ -67,10 +68,13 @@ public static string GetAlbumPath(Album album, Settings settings)
flag = flag.Replace("M", "");
if (flag.IsNotBlank())
flag = $"[{flag}]";
+
+ string artist = FormatPath(album.Artists[0].Name, settings);
string name = settings.AlbumFolderFormat;
if (name.IsBlank())
- name = "[{Flag}] [{AlbumID}] [{AlbumYear}] {AlbumTitle}";
+ name = "{ArtistName}/{Flag} [{AlbumID}] [{AlbumYear}] {AlbumTitle}";
+ name = name.Replace("{ArtistName}", artist);
name = name.Replace("{AlbumID}", album.ID);
name = name.Replace("{AlbumYear}", album.ReleaseDate.Substring(0, 4));
name = name.Replace("{AlbumTitle}", FormatPath(album.Title, settings));
@@ -127,13 +131,13 @@ public static string GetTrackPath(Settings settings, Track track, StreamUrl stre
//get explicit
string sexplicit = "";
- if (settings.AddExplicitTag && track.Explicit)
+ if (track.Explicit)
sexplicit = "(Explicit)";
//get version
string version = "";
if (track.Version.IsNotBlank())
- version = "(" + track.Version + ")";
+ version = " (" + track.Version + ")";
//get title
string title = FormatPath(track.Title + version, settings, false);
@@ -159,6 +163,10 @@ public static string GetTrackPath(Settings settings, Track track, StreamUrl stre
name = name.Replace("{ArtistName}", artist);
name = name.Replace("{TrackTitle}", title);
name = name.Replace("{ExplicitFlag}", sexplicit);
+
+ name = name.Replace("{AlbumID}", album.ID);
+ name = name.Replace("{AlbumYear}", album.ReleaseDate.Substring(0, 4));
+ name = name.Replace("{AlbumTitle}", FormatPath(album.Title, settings));
return $"{basepath}{name}{extension}";
}
@@ -215,8 +223,47 @@ public static string GetTrackPath2(Settings settings, Track track, StreamUrl str
return path;
}
- // number - artist - title(Explicit).mp4
+ // {ArtistName}/{TrackNumber} - {VideoTitle}.mp4
public static string GetVideoPath(Settings settings, Video video, Album album, Playlist playlist = null, string ext = ".mp4")
+ {
+ //get number
+ string number = video.TrackNumber.ToString().PadLeft(2, '0');
+ if (playlist != null)
+ number = (playlist.Videos.IndexOf(video) + 1).ToString().PadLeft(2, '0');
+
+ //get artist
+ string artist = FormatPath(video.Artists[0].Name, settings, false);
+
+ //get explicit
+ string sexplicit = "";
+ if (video.Explicit)
+ sexplicit = "(Explicit)";
+
+ //get title
+ string title = FormatPath(video.Title, settings, false);
+
+ //base path
+ string basepath = null;
+ if (album != null)
+ basepath = GetAlbumPath(album, settings);
+ else if (playlist != null)
+ basepath = GetPlaylistPath(playlist, settings);
+ else
+ basepath = $"{settings.OutputDir}/Video/";
+
+ string name = settings.VideoFileFormat;
+ if (name.IsBlank())
+ name = "{ArtistName}/{TrackNumber} - {VideoTitle}";
+ name = name.Replace("{TrackNumber}", number);
+ name = name.Replace("{ArtistName}", artist);
+ name = name.Replace("{VideoTitle}", title);
+ name = name.Replace("{ExplicitFlag}", sexplicit);
+
+ return $"{basepath}{name}{ext}";
+ }
+
+ // number - artist - title(Explicit).mp4
+ public static string GetVideoPath2(Settings settings, Video video, Album album, Playlist playlist = null, string ext = ".mp4")
{
//hyphen
string hyphen = " ";
diff --git a/TIDALDL-UI-PRO/Else/TrackTask.cs b/TIDALDL-UI-PRO/Else/TrackTask.cs
index 9bf9ca9..0cf89a4 100644
--- a/TIDALDL-UI-PRO/Else/TrackTask.cs
+++ b/TIDALDL-UI-PRO/Else/TrackTask.cs
@@ -138,6 +138,7 @@ public void Download()
}
}
Progress.Errmsg = "Download failed!";
+ System.IO.File.Delete(path);
ERR_RETURN:
if (Progress.GetStatus() == ProgressHelper.STATUS.CANCLE)
diff --git a/TIDALDL-UI-PRO/Pages/SearchViewModel.cs b/TIDALDL-UI-PRO/Pages/SearchViewModel.cs
index 63d13ac..bef6c4c 100644
--- a/TIDALDL-UI-PRO/Pages/SearchViewModel.cs
+++ b/TIDALDL-UI-PRO/Pages/SearchViewModel.cs
@@ -306,7 +306,7 @@ public Detail(Album album)
ReleaseDate = $"Release date {album.ReleaseDate}";
Flag = album.Flag;
- for (int i = 0; i < album.NumberOfTracks; i++)
+ for (int i = 0; i < album.NumberOfTracks && i < album.Tracks.Count; i++)
{
Items.Add(new Item()
{
diff --git a/TIDALDL-UI-PRO/Pages/SettingsView.xaml b/TIDALDL-UI-PRO/Pages/SettingsView.xaml
index 6383b7e..65f0987 100644
--- a/TIDALDL-UI-PRO/Pages/SettingsView.xaml
+++ b/TIDALDL-UI-PRO/Pages/SettingsView.xaml
@@ -39,7 +39,8 @@
-
+
+
@@ -82,6 +83,9 @@
+
+
+
diff --git a/TIDALDL-UI-PRO/Properties/AssemblyInfo.cs b/TIDALDL-UI-PRO/Properties/AssemblyInfo.cs
index 3c9a0ac..0510f5c 100644
--- a/TIDALDL-UI-PRO/Properties/AssemblyInfo.cs
+++ b/TIDALDL-UI-PRO/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.2.0.5")]
-[assembly: AssemblyFileVersion("1.2.0.5")]
+[assembly: AssemblyVersion("1.2.0.6")]
+[assembly: AssemblyFileVersion("1.2.0.6")]
diff --git a/TIDALDL-UI-PRO/UPDATE_LOG.md b/TIDALDL-UI-PRO/UPDATE_LOG.md
index 0e94081..8486ebf 100644
--- a/TIDALDL-UI-PRO/UPDATE_LOG.md
+++ b/TIDALDL-UI-PRO/UPDATE_LOG.md
@@ -1,7 +1,11 @@
- [ ] Auto update
- [ ] Multi-language
-- [x] Fix: replace track "title(version)" illegal characters
+#### v1.2.0.6
+- [x] Fix: replace track "title (version)" illegal characters
+- [x] Default AlbumFolderFormat: {ArtistName}/{Flag} [{AlbumID}] [{AlbumYear}] {AlbumTitle}
+- [x] Settings: Video file format [#48](https://github.com/yaronzz/Tidal-Media-Downloader-PRO/issues/48)
+- [x] Delete file if download err. [#40](https://github.com/yaronzz/Tidal-Media-Downloader-PRO/issues/40)
#### v1.2.0.5
- [x] Fix: download video(get stream) [#30](https://github.com/yaronzz/Tidal-Media-Downloader-PRO/issues/30)