diff --git a/CHANGELOG.md b/CHANGELOG.md
index ee519fd7..a0c15cf5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,14 @@
+# 0.2.3.0
+
+## New features
+
+* Added an option to disable notifications sound (off by default). [#71](https://github.com/Otiel/BandcampDownloader/issues/71)
+
+## Bug fixes
+
+* Fixed race condition [#54](https://github.com/Otiel/BandcampDownloader/issues/54) that would make the program crash when downloading two albums with the same name.
+* Fixed issue with albums name too long to be supported by Windows.
+
# 0.2.2.0
## New features
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index f380f182..3e2da2e4 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -13,4 +13,4 @@ This repository follows [git flow](https://nvie.com/posts/a-successful-git-branc
## Commits
-Please follow the [commit message conventions](/Docs/commits-conventions.md).
+Please follow the [commit message conventions](/docs/commits-conventions.md).
diff --git a/README.md b/README.md
index 320942f4..705eb83e 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,12 @@
-# ![Logo](Docs/Cloud.png) Bandcamp Downloader
+# ![Logo](docs/images/Cloud.png) Bandcamp Downloader
-[![Download](Docs/DownloadButton.png)](https://github.com/Otiel/BandcampDownloader/releases/latest)
+
+
+
## Description
-_BandcampDownloader_ is a Windows application written in C# (targeting .NET Framework 4.5.2) that helps downloading albums from [bandcamp.com](https://bandcamp.com). _BandcampDownloader_ retrieves the 128 kbps MP3 files that are streamed on the website.
+BandcampDownloader is a Windows application that helps downloading albums from [bandcamp.com](https://bandcamp.com) by retrieving the 128 kbps MP3 files streamed on the website. Its goal isn't to pirate albums, but simply to make life easier for those who prefer to listen to music on their favorite player.
## Features
@@ -21,7 +23,9 @@ _BandcampDownloader_ is a Windows application written in C# (targeting .NET Fram
## Screenshot
-![Screenshot](Docs/Screenshot.png)
+
+
+
## Release notes
@@ -29,7 +33,7 @@ See the [changelog](CHANGELOG.md).
## License
-_BandcampDownloader_ is licensed under the MIT license - see the [LICENSE](LICENSE) file for details.
+BandcampDownloader is licensed under the MIT license - see the [LICENSE](LICENSE) file for details.
## Credits
diff --git a/Docs/commits-conventions.md b/docs/commits-conventions.md
similarity index 99%
rename from Docs/commits-conventions.md
rename to docs/commits-conventions.md
index d03f5f72..ae393a4e 100644
--- a/Docs/commits-conventions.md
+++ b/docs/commits-conventions.md
@@ -25,7 +25,6 @@
### Allowed `` values:
-
Type | Release | Description | Changelog
---------|---------|-------------|----------
feat | `minor` | New feature or enhancement (for the user - not a new feature for a build script). | Visible
diff --git a/Docs/Cloud.png b/docs/images/Cloud.png
similarity index 100%
rename from Docs/Cloud.png
rename to docs/images/Cloud.png
diff --git a/Docs/DownloadButton.png b/docs/images/DownloadButton.png
similarity index 100%
rename from Docs/DownloadButton.png
rename to docs/images/DownloadButton.png
diff --git a/Docs/Screenshot.png b/docs/images/Screenshot.png
similarity index 100%
rename from Docs/Screenshot.png
rename to docs/images/Screenshot.png
diff --git a/Sources/BandcampDownloader.sln b/src/BandcampDownloader.sln
similarity index 100%
rename from Sources/BandcampDownloader.sln
rename to src/BandcampDownloader.sln
diff --git a/Sources/BandcampDownloader/App.xaml b/src/BandcampDownloader/App.xaml
similarity index 81%
rename from Sources/BandcampDownloader/App.xaml
rename to src/BandcampDownloader/App.xaml
index f91ba61d..64fbf6ec 100644
--- a/Sources/BandcampDownloader/App.xaml
+++ b/src/BandcampDownloader/App.xaml
@@ -2,5 +2,5 @@
x:Class="BandcampDownloader.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- StartupUri="Windows/WindowMain.xaml">
+ StartupUri="UI/Dialogs/WindowMain.xaml">
\ No newline at end of file
diff --git a/Sources/BandcampDownloader/App.xaml.cs b/src/BandcampDownloader/App.xaml.cs
similarity index 100%
rename from Sources/BandcampDownloader/App.xaml.cs
rename to src/BandcampDownloader/App.xaml.cs
diff --git a/Sources/BandcampDownloader/BandcampDownloader.csproj b/src/BandcampDownloader/BandcampDownloader.csproj
similarity index 82%
rename from Sources/BandcampDownloader/BandcampDownloader.csproj
rename to src/BandcampDownloader/BandcampDownloader.csproj
index 30312575..50372bda 100644
--- a/Sources/BandcampDownloader/BandcampDownloader.csproj
+++ b/src/BandcampDownloader/BandcampDownloader.csproj
@@ -1,300 +1,300 @@
-
-
-
-
- Debug
- x86
- 8.0.30703
- 2.0
- {F6E97E00-B958-4745-974E-14C6A72E5D03}
- WinExe
- Properties
- BandcampDownloader
- BandcampDownloader
- v4.5.2
-
-
- 512
- {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- 4
- false
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- false
- 0
- 1.0.0.0
- false
- true
-
-
-
-
- x86
- true
- full
- false
- bin\Debug\
- DEBUG;TRACE
- prompt
- 4
- false
-
-
- x86
- pdbonly
- true
- bin\Release\
- TRACE
- prompt
- 4
- false
-
-
- true
- bin\Debug\
- DEBUG;TRACE
- full
- AnyCPU
- prompt
- false
-
-
- bin\Release\
- TRACE
- true
- pdbonly
- AnyCPU
- prompt
- false
-
-
- Resources\Cloud.ico
-
-
-
- ..\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll
-
-
- ..\packages\Config.Net.4.11.0\lib\net452\Config.Net.dll
-
-
- ..\packages\HtmlAgilityPack.1.8.11\lib\Net45\HtmlAgilityPack.dll
-
-
- ..\packages\ImageResizer.4.2.5\lib\net45\ImageResizer.dll
-
-
-
- ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll
-
-
- ..\packages\NLog.4.5.11\lib\net45\NLog.dll
-
-
-
-
-
-
-
-
-
-
-
-
- 4.0
-
-
-
- ..\packages\taglib.2.1.0.0\lib\taglib-sharp.dll
-
-
-
-
-
-
-
- MSBuild:Compile
- Designer
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- UserControlSettingsAdvanced.xaml
-
-
- UserControlSettingsCoverArt.xaml
-
-
- UserControlSettingsDownloads.xaml
-
-
- UserControlSettingsGeneral.xaml
-
-
- UserControlSettingsNetwork.xaml
-
-
- UserControlSettingsTags.xaml
-
-
-
- App.xaml
- Code
-
-
-
-
-
-
-
-
-
-
- WindowMain.xaml
-
-
- WindowSettings.xaml
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
- Designer
- MSBuild:Compile
-
-
- MSBuild:Compile
- Designer
-
-
- MSBuild:Compile
- Designer
-
-
-
-
- Code
-
-
- True
- True
- Resources.resx
-
-
- True
- Settings.settings
- True
-
-
- ResXFileCodeGenerator
- Resources.Designer.cs
- Designer
-
-
- Designer
-
-
- Designer
-
-
- SettingsSingleFileGenerator
- Settings.Designer.cs
-
-
-
-
-
- False
- Microsoft .NET Framework 4 Client Profile %28x86 and x64%29
- true
-
-
- False
- .NET Framework 3.5 SP1 Client Profile
- false
-
-
- False
- .NET Framework 3.5 SP1
- false
-
-
- False
- Windows Installer 3.1
- true
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
+
+
+
+
+ Debug
+ x86
+ 8.0.30703
+ 2.0
+ {F6E97E00-B958-4745-974E-14C6A72E5D03}
+ WinExe
+ Properties
+ BandcampDownloader
+ BandcampDownloader
+ v4.5.2
+
+
+ 512
+ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 4
+ false
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ false
+ 0
+ 1.0.0.0
+ false
+ true
+
+
+
+
+ x86
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+ false
+
+
+ x86
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+ false
+
+
+ true
+ bin\Debug\
+ DEBUG;TRACE
+ full
+ AnyCPU
+ prompt
+ false
+
+
+ bin\Release\
+ TRACE
+ true
+ pdbonly
+ AnyCPU
+ prompt
+ false
+
+
+ Resources\Cloud.ico
+
+
+
+ ..\packages\Castle.Core.4.3.1\lib\net45\Castle.Core.dll
+
+
+ ..\packages\Config.Net.4.11.0\lib\net452\Config.Net.dll
+
+
+ ..\packages\HtmlAgilityPack.1.8.11\lib\Net45\HtmlAgilityPack.dll
+
+
+ ..\packages\ImageResizer.4.2.5\lib\net45\ImageResizer.dll
+
+
+
+ ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll
+
+
+ ..\packages\NLog.4.5.11\lib\net45\NLog.dll
+
+
+
+
+
+
+
+
+
+
+
+
+ 4.0
+
+
+
+ ..\packages\taglib.2.1.0.0\lib\taglib-sharp.dll
+
+
+
+
+
+
+
+ MSBuild:Compile
+ Designer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ UserControlSettingsAdvanced.xaml
+
+
+ UserControlSettingsCoverArt.xaml
+
+
+ UserControlSettingsDownloads.xaml
+
+
+ UserControlSettingsGeneral.xaml
+
+
+ UserControlSettingsNetwork.xaml
+
+
+ UserControlSettingsTags.xaml
+
+
+
+ App.xaml
+ Code
+
+
+
+
+
+
+
+
+
+
+ WindowMain.xaml
+
+
+ WindowSettings.xaml
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ MSBuild:Compile
+ Designer
+
+
+
+
+ Code
+
+
+ True
+ True
+ Resources.resx
+
+
+ True
+ Settings.settings
+ True
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+ Designer
+
+
+ Designer
+
+
+ Designer
+
+
+ SettingsSingleFileGenerator
+ Settings.Designer.cs
+
+
+
+
+
+ False
+ Microsoft .NET Framework 4 Client Profile %28x86 and x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Sources/BandcampDownloader/Miscellaneous/Constants.cs b/src/BandcampDownloader/Core/Constants.cs
similarity index 98%
rename from Sources/BandcampDownloader/Miscellaneous/Constants.cs
rename to src/BandcampDownloader/Core/Constants.cs
index 68cd94ed..b3e54cbb 100644
--- a/Sources/BandcampDownloader/Miscellaneous/Constants.cs
+++ b/src/BandcampDownloader/Core/Constants.cs
@@ -1,37 +1,37 @@
-using System;
-using System.IO;
-using System.Reflection;
-
-namespace BandcampDownloader {
-
- internal static class Constants {
- ///
- /// The version number of BandcampDownloader.
- ///
- public static readonly String AppVersion = Assembly.GetEntryAssembly().GetName().Version.ToString();
- ///
- /// The URL redirecting to the latest release on GitHub.
- ///
- public static readonly String LatestReleaseWebsite = "https://github.com/Otiel/BandcampDownloader/releases/latest";
- ///
- /// The absolute path to the log file.
- ///
- public static readonly String LogFilePath = Directory.GetParent(Assembly.GetExecutingAssembly().Location) + @"\BandcampDownloader.log";
- ///
- /// The log file maximum size in bytes.
- ///
- public static readonly long MaxLogSize = 1024 * 1024;
- ///
- /// The website URL of BandcampDownloader.
- ///
- public static readonly String ProjectWebsite = "https://github.com/Otiel/BandcampDownloader";
- ///
- /// The help text displayed in the URL list textbox.
- ///
- public static readonly String UrlsHint = "Paste URLs of albums to download here. You can specify multiple URLs by writing one URL per line.\n\nA Bandcamp URL looks like: http://[artist].bandcamp.com/album/[album] or http://[artist].bandcamp.com/track/[track]\nPaste artist pages: http://[artist].bandcamp.com and check \"☑ Download artist discography\" to download all their albums.";
- ///
- /// The absolute path to the settings file.
- ///
- public static readonly String UserSettingsFilePath = Directory.GetParent(Assembly.GetExecutingAssembly().Location) + @"\BandcampDownloader.ini";
- }
+using System;
+using System.IO;
+using System.Reflection;
+
+namespace BandcampDownloader {
+
+ internal static class Constants {
+ ///
+ /// The version number of BandcampDownloader.
+ ///
+ public static readonly String AppVersion = Assembly.GetEntryAssembly().GetName().Version.ToString();
+ ///
+ /// The URL redirecting to the latest release on GitHub.
+ ///
+ public static readonly String LatestReleaseWebsite = "https://github.com/Otiel/BandcampDownloader/releases/latest";
+ ///
+ /// The absolute path to the log file.
+ ///
+ public static readonly String LogFilePath = Directory.GetParent(Assembly.GetExecutingAssembly().Location) + @"\BandcampDownloader.log";
+ ///
+ /// The log file maximum size in bytes.
+ ///
+ public static readonly long MaxLogSize = 1024 * 1024;
+ ///
+ /// The website URL of BandcampDownloader.
+ ///
+ public static readonly String ProjectWebsite = "https://github.com/Otiel/BandcampDownloader";
+ ///
+ /// The help text displayed in the URL list textbox.
+ ///
+ public static readonly String UrlsHint = "Paste URLs of albums to download here. You can specify multiple URLs by writing one URL per line.\n\nA Bandcamp URL looks like: http://[artist].bandcamp.com/album/[album] or http://[artist].bandcamp.com/track/[track]\nPaste artist pages: http://[artist].bandcamp.com and check \"☑ Download artist discography\" to download all their albums.";
+ ///
+ /// The absolute path to the settings file.
+ ///
+ public static readonly String UserSettingsFilePath = Directory.GetParent(Assembly.GetExecutingAssembly().Location) + @"\BandcampDownloader.ini";
+ }
}
\ No newline at end of file
diff --git a/Sources/BandcampDownloader/Miscellaneous/LogType.cs b/src/BandcampDownloader/Core/LogType.cs
similarity index 94%
rename from Sources/BandcampDownloader/Miscellaneous/LogType.cs
rename to src/BandcampDownloader/Core/LogType.cs
index cff9e95a..3ec04075 100644
--- a/Sources/BandcampDownloader/Miscellaneous/LogType.cs
+++ b/src/BandcampDownloader/Core/LogType.cs
@@ -1,11 +1,11 @@
-namespace BandcampDownloader {
-
- internal enum LogType {
- VerboseInfo,
- Info,
- IntermediateSuccess,
- Success,
- Warning,
- Error,
- }
+namespace BandcampDownloader {
+
+ internal enum LogType {
+ VerboseInfo,
+ Info,
+ IntermediateSuccess,
+ Success,
+ Warning,
+ Error,
+ }
}
\ No newline at end of file
diff --git a/Sources/BandcampDownloader/Miscellaneous/UserSettings.cs b/src/BandcampDownloader/Core/UserSettings.cs
similarity index 96%
rename from Sources/BandcampDownloader/Miscellaneous/UserSettings.cs
rename to src/BandcampDownloader/Core/UserSettings.cs
index 45bf8471..95559ac1 100644
--- a/Sources/BandcampDownloader/Miscellaneous/UserSettings.cs
+++ b/src/BandcampDownloader/Core/UserSettings.cs
@@ -1,126 +1,129 @@
-using System;
-using System.ComponentModel;
-using Config.Net;
-
-namespace BandcampDownloader {
-
- public enum ProxyType {
- None,
- System,
- Manual,
- }
-
- public enum TagEditAction {
- [Description("Empty tag")]
- Empty,
- [Description("Save in tag")]
- Modify,
- [Description("Do not modify")]
- DoNotModify
- }
-
- public enum TagRemoveAction {
- [Description("Empty tag")]
- Empty,
- [Description("Do not modify")]
- DoNotModify
- }
-
- public interface IUserSettings {
-
- [Option(DefaultValue = 0.05)]
- Double AllowedFileSizeDifference { get; set; }
-
- [Option(DefaultValue = true)]
- Boolean CheckForUpdates { get; set; }
-
- [Option(DefaultValue = true)]
- Boolean CoverArtInFolderConvertToJpg { get; set; }
-
- [Option(DefaultValue = 1000)]
- int CoverArtInFolderMaxSize { get; set; }
-
- [Option(DefaultValue = false)]
- Boolean CoverArtInFolderResize { get; set; }
-
- [Option(DefaultValue = true)]
- Boolean CoverArtInTagsConvertToJpg { get; set; }
-
- [Option(DefaultValue = 1000)]
- int CoverArtInTagsMaxSize { get; set; }
-
- [Option(DefaultValue = true)]
- Boolean CoverArtInTagsResize { get; set; }
-
- [Option(DefaultValue = false)]
- Boolean DownloadArtistDiscography { get; set; }
-
- [Option(DefaultValue = 7)]
- int DownloadMaxTries { get; set; }
-
- [Option(DefaultValue = false)]
- Boolean DownloadOneAlbumAtATime { get; set; }
-
- // Time in seconds between retries
- [Option(DefaultValue = 0.2)]
- Double DownloadRetryCooldown { get; set; }
-
- // Exponential per cooldown - ex. (value of 1.2 would yield cooldowns of x^(1.2^0), x^(1.2^1), x^(1.2^2), ..)
- [Option(DefaultValue = 4.0)]
- Double DownloadRetryExponent { get; set; }
-
- [Option(DefaultValue = "")]
- String DownloadsPath { get; set; }
-
- [Option(DefaultValue = "{tracknum} {artist} - {title}.mp3")]
- String FileNameFormat { get; set; }
-
- [Option(DefaultValue = true)]
- Boolean ModifyTags { get; set; }
-
- [Option(DefaultValue = ProxyType.System)]
- ProxyType Proxy { get; set; }
-
- [Option(DefaultValue = "")]
- String ProxyHttpAddress { get; set; }
-
- [Option(DefaultValue = "")]
- int ProxyHttpPort { get; set; }
-
- [Option(DefaultValue = true)]
- Boolean RetrieveFilesSize { get; set; }
-
- [Option(DefaultValue = false)]
- Boolean SaveCoverArtInFolder { get; set; }
-
- [Option(DefaultValue = true)]
- Boolean SaveCoverArtInTags { get; set; }
-
- [Option(DefaultValue = false)]
- Boolean ShowVerboseLog { get; set; }
-
- [Option(DefaultValue = TagEditAction.Modify)]
- TagEditAction TagAlbumArtist { get; set; }
-
- [Option(DefaultValue = TagEditAction.Modify)]
- TagEditAction TagAlbumTitle { get; set; }
-
- [Option(DefaultValue = TagEditAction.Modify)]
- TagEditAction TagArtist { get; set; }
-
- [Option(DefaultValue = TagRemoveAction.Empty)]
- TagRemoveAction TagComments { get; set; }
-
- [Option(DefaultValue = TagEditAction.Modify)]
- TagEditAction TagLyrics { get; set; }
-
- [Option(DefaultValue = TagEditAction.Modify)]
- TagEditAction TagTrackNumber { get; set; }
-
- [Option(DefaultValue = TagEditAction.Modify)]
- TagEditAction TagTrackTitle { get; set; }
-
- [Option(DefaultValue = TagEditAction.Modify)]
- TagEditAction TagYear { get; set; }
- }
+using System;
+using System.ComponentModel;
+using Config.Net;
+
+namespace BandcampDownloader {
+
+ public enum ProxyType {
+ None,
+ System,
+ Manual,
+ }
+
+ public enum TagEditAction {
+ [Description("Empty tag")]
+ Empty,
+ [Description("Save in tag")]
+ Modify,
+ [Description("Do not modify")]
+ DoNotModify
+ }
+
+ public enum TagRemoveAction {
+ [Description("Empty tag")]
+ Empty,
+ [Description("Do not modify")]
+ DoNotModify
+ }
+
+ public interface IUserSettings {
+
+ [Option(DefaultValue = 0.05)]
+ Double AllowedFileSizeDifference { get; set; }
+
+ [Option(DefaultValue = true)]
+ Boolean CheckForUpdates { get; set; }
+
+ [Option(DefaultValue = true)]
+ Boolean CoverArtInFolderConvertToJpg { get; set; }
+
+ [Option(DefaultValue = 1000)]
+ int CoverArtInFolderMaxSize { get; set; }
+
+ [Option(DefaultValue = false)]
+ Boolean CoverArtInFolderResize { get; set; }
+
+ [Option(DefaultValue = true)]
+ Boolean CoverArtInTagsConvertToJpg { get; set; }
+
+ [Option(DefaultValue = 1000)]
+ int CoverArtInTagsMaxSize { get; set; }
+
+ [Option(DefaultValue = true)]
+ Boolean CoverArtInTagsResize { get; set; }
+
+ [Option(DefaultValue = false)]
+ Boolean DownloadArtistDiscography { get; set; }
+
+ [Option(DefaultValue = 7)]
+ int DownloadMaxTries { get; set; }
+
+ [Option(DefaultValue = false)]
+ Boolean DownloadOneAlbumAtATime { get; set; }
+
+ // Time in seconds between retries
+ [Option(DefaultValue = 0.2)]
+ Double DownloadRetryCooldown { get; set; }
+
+ // Exponential per cooldown - ex. (value of 1.2 would yield cooldowns of x^(1.2^0), x^(1.2^1), x^(1.2^2), ..)
+ [Option(DefaultValue = 4.0)]
+ Double DownloadRetryExponent { get; set; }
+
+ [Option(DefaultValue = "")]
+ String DownloadsPath { get; set; }
+
+ [Option(DefaultValue = false)]
+ Boolean EnableApplicationSounds { get; set; }
+
+ [Option(DefaultValue = "{tracknum} {artist} - {title}.mp3")]
+ String FileNameFormat { get; set; }
+
+ [Option(DefaultValue = true)]
+ Boolean ModifyTags { get; set; }
+
+ [Option(DefaultValue = ProxyType.System)]
+ ProxyType Proxy { get; set; }
+
+ [Option(DefaultValue = "")]
+ String ProxyHttpAddress { get; set; }
+
+ [Option(DefaultValue = "")]
+ int ProxyHttpPort { get; set; }
+
+ [Option(DefaultValue = true)]
+ Boolean RetrieveFilesSize { get; set; }
+
+ [Option(DefaultValue = false)]
+ Boolean SaveCoverArtInFolder { get; set; }
+
+ [Option(DefaultValue = true)]
+ Boolean SaveCoverArtInTags { get; set; }
+
+ [Option(DefaultValue = false)]
+ Boolean ShowVerboseLog { get; set; }
+
+ [Option(DefaultValue = TagEditAction.Modify)]
+ TagEditAction TagAlbumArtist { get; set; }
+
+ [Option(DefaultValue = TagEditAction.Modify)]
+ TagEditAction TagAlbumTitle { get; set; }
+
+ [Option(DefaultValue = TagEditAction.Modify)]
+ TagEditAction TagArtist { get; set; }
+
+ [Option(DefaultValue = TagRemoveAction.Empty)]
+ TagRemoveAction TagComments { get; set; }
+
+ [Option(DefaultValue = TagEditAction.Modify)]
+ TagEditAction TagLyrics { get; set; }
+
+ [Option(DefaultValue = TagEditAction.Modify)]
+ TagEditAction TagTrackNumber { get; set; }
+
+ [Option(DefaultValue = TagEditAction.Modify)]
+ TagEditAction TagTrackTitle { get; set; }
+
+ [Option(DefaultValue = TagEditAction.Modify)]
+ TagEditAction TagYear { get; set; }
+ }
}
\ No newline at end of file
diff --git a/Sources/BandcampDownloader/FodyWeavers.xml b/src/BandcampDownloader/FodyWeavers.xml
similarity index 100%
rename from Sources/BandcampDownloader/FodyWeavers.xml
rename to src/BandcampDownloader/FodyWeavers.xml
diff --git a/Sources/BandcampDownloader/FodyWeavers.xsd b/src/BandcampDownloader/FodyWeavers.xsd
similarity index 100%
rename from Sources/BandcampDownloader/FodyWeavers.xsd
rename to src/BandcampDownloader/FodyWeavers.xsd
diff --git a/Sources/BandcampDownloader/Helpers/BandcampHelper.cs b/src/BandcampDownloader/Helpers/BandcampHelper.cs
similarity index 97%
rename from Sources/BandcampDownloader/Helpers/BandcampHelper.cs
rename to src/BandcampDownloader/Helpers/BandcampHelper.cs
index 42e3e3b1..12b9914c 100644
--- a/Sources/BandcampDownloader/Helpers/BandcampHelper.cs
+++ b/src/BandcampDownloader/Helpers/BandcampHelper.cs
@@ -1,110 +1,110 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-using HtmlAgilityPack;
-using Newtonsoft.Json;
-
-namespace BandcampDownloader {
-
- internal static class BandcampHelper {
-
- ///
- /// Retrieves the data on the album of the specified Bandcamp page.
- ///
- /// The HTML source code of a Bandcamp album page.
- /// The data on the album of the specified Bandcamp page.
- public static Album GetAlbum(String htmlCode) {
- // Keep the interesting part of htmlCode only
- String albumData;
- try {
- albumData = GetAlbumData(htmlCode);
- } catch (Exception e) {
- throw new Exception("Could not retrieve album data in HTML code.", e);
- }
-
- // Fix some wrongly formatted JSON in source code
- albumData = FixJson(albumData);
-
- // Deserialize JSON
- Album album;
- try {
- var settings = new JsonSerializerSettings {
- NullValueHandling = NullValueHandling.Ignore,
- MissingMemberHandling = MissingMemberHandling.Ignore
- };
- album = JsonConvert.DeserializeObject(albumData, settings).ToAlbum();
- } catch (Exception e) {
- throw new Exception("Could not deserialize JSON data.", e);
- }
-
- // Extract lyrics from album page
- HtmlDocument htmlDoc = new HtmlDocument();
- htmlDoc.LoadHtml(htmlCode);
- foreach (Track track in album.Tracks) {
- HtmlNode lyricsElement = htmlDoc.GetElementbyId("_lyrics_" + track.Number);
- if (lyricsElement != null) {
- track.Lyrics = lyricsElement.InnerText.Trim();
- }
- }
-
- return album;
- }
-
- ///
- /// Retrieves all the albums URL existing on the specified Bandcamp page.
- ///
- /// The HTML source code of a Bandcamp page.
- /// The albums URL existing on the specified Bandcamp page.
- public static List GetAlbumsUrl(String htmlCode) {
- // Get artist bandcamp page
- var regex = new Regex("band_url = \"(?.*)\"");
- if (!regex.IsMatch(htmlCode)) {
- throw new NoAlbumFoundException();
- }
- String artistPage = regex.Match(htmlCode).Groups["url"].Value;
-
- // Get albums ("real" albums or track-only pages) relative urls
- regex = new Regex("href=\"(?/(album|track)/.*)\"");
- if (!regex.IsMatch(htmlCode)) {
- throw new NoAlbumFoundException();
- }
-
- var albumsUrl = new List();
- foreach (Match m in regex.Matches(htmlCode)) {
- albumsUrl.Add(artistPage + m.Groups["url"].Value);
- }
-
- // Remove duplicates
- albumsUrl = albumsUrl.Distinct().ToList();
- return albumsUrl;
- }
-
- private static String FixJson(String albumData) {
- // Some JSON is not correctly formatted in bandcamp pages, so it needs to be fixed before we can deserialize it
-
- // In trackinfo property, we have for instance:
- // url: "http://verbalclick.bandcamp.com" + "/album/404"
- // -> Remove the " + "
- var regex = new Regex("(?url: \".+)\" \\+ \"(?.+\",)");
- String fixedData = regex.Replace(albumData, "${root}${album}");
-
- return fixedData;
- }
-
- private static String GetAlbumData(String htmlCode) {
- String startString = "var TralbumData = {";
- String stopString = "};";
-
- if (htmlCode.IndexOf(startString) == -1) {
- // Could not find startString
- throw new Exception("Could not find the following string in HTML code: var TralbumData = {");
- }
-
- String albumDataTemp = htmlCode.Substring(htmlCode.IndexOf(startString) + startString.Length - 1);
- String albumData = albumDataTemp.Substring(0, albumDataTemp.IndexOf(stopString) + 1);
-
- return albumData;
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text.RegularExpressions;
+using HtmlAgilityPack;
+using Newtonsoft.Json;
+
+namespace BandcampDownloader {
+
+ internal static class BandcampHelper {
+
+ ///
+ /// Retrieves the data on the album of the specified Bandcamp page.
+ ///
+ /// The HTML source code of a Bandcamp album page.
+ /// The data on the album of the specified Bandcamp page.
+ public static Album GetAlbum(String htmlCode) {
+ // Keep the interesting part of htmlCode only
+ String albumData;
+ try {
+ albumData = GetAlbumData(htmlCode);
+ } catch (Exception e) {
+ throw new Exception("Could not retrieve album data in HTML code.", e);
+ }
+
+ // Fix some wrongly formatted JSON in source code
+ albumData = FixJson(albumData);
+
+ // Deserialize JSON
+ Album album;
+ try {
+ var settings = new JsonSerializerSettings {
+ NullValueHandling = NullValueHandling.Ignore,
+ MissingMemberHandling = MissingMemberHandling.Ignore
+ };
+ album = JsonConvert.DeserializeObject(albumData, settings).ToAlbum();
+ } catch (Exception e) {
+ throw new Exception("Could not deserialize JSON data.", e);
+ }
+
+ // Extract lyrics from album page
+ HtmlDocument htmlDoc = new HtmlDocument();
+ htmlDoc.LoadHtml(htmlCode);
+ foreach (Track track in album.Tracks) {
+ HtmlNode lyricsElement = htmlDoc.GetElementbyId("_lyrics_" + track.Number);
+ if (lyricsElement != null) {
+ track.Lyrics = lyricsElement.InnerText.Trim();
+ }
+ }
+
+ return album;
+ }
+
+ ///
+ /// Retrieves all the albums URL existing on the specified Bandcamp page.
+ ///
+ /// The HTML source code of a Bandcamp page.
+ /// The albums URL existing on the specified Bandcamp page.
+ public static List GetAlbumsUrl(String htmlCode) {
+ // Get artist bandcamp page
+ var regex = new Regex("band_url = \"(?.*)\"");
+ if (!regex.IsMatch(htmlCode)) {
+ throw new NoAlbumFoundException();
+ }
+ String artistPage = regex.Match(htmlCode).Groups["url"].Value;
+
+ // Get albums ("real" albums or track-only pages) relative urls
+ regex = new Regex("href=\"(?/(album|track)/.*)\"");
+ if (!regex.IsMatch(htmlCode)) {
+ throw new NoAlbumFoundException();
+ }
+
+ var albumsUrl = new List();
+ foreach (Match m in regex.Matches(htmlCode)) {
+ albumsUrl.Add(artistPage + m.Groups["url"].Value);
+ }
+
+ // Remove duplicates
+ albumsUrl = albumsUrl.Distinct().ToList();
+ return albumsUrl;
+ }
+
+ private static String FixJson(String albumData) {
+ // Some JSON is not correctly formatted in bandcamp pages, so it needs to be fixed before we can deserialize it
+
+ // In trackinfo property, we have for instance:
+ // url: "http://verbalclick.bandcamp.com" + "/album/404"
+ // -> Remove the " + "
+ var regex = new Regex("(?url: \".+)\" \\+ \"(?.+\",)");
+ String fixedData = regex.Replace(albumData, "${root}${album}");
+
+ return fixedData;
+ }
+
+ private static String GetAlbumData(String htmlCode) {
+ String startString = "var TralbumData = {";
+ String stopString = "};";
+
+ if (htmlCode.IndexOf(startString) == -1) {
+ // Could not find startString
+ throw new Exception("Could not find the following string in HTML code: var TralbumData = {");
+ }
+
+ String albumDataTemp = htmlCode.Substring(htmlCode.IndexOf(startString) + startString.Length - 1);
+ String albumData = albumDataTemp.Substring(0, albumDataTemp.IndexOf(stopString) + 1);
+
+ return albumData;
+ }
+ }
}
\ No newline at end of file
diff --git a/Sources/BandcampDownloader/Miscellaneous/EnumerationExtension.cs b/src/BandcampDownloader/Helpers/EnumerationExtension.cs
similarity index 91%
rename from Sources/BandcampDownloader/Miscellaneous/EnumerationExtension.cs
rename to src/BandcampDownloader/Helpers/EnumerationExtension.cs
index 90632765..2fb01af3 100644
--- a/Sources/BandcampDownloader/Miscellaneous/EnumerationExtension.cs
+++ b/src/BandcampDownloader/Helpers/EnumerationExtension.cs
@@ -12,21 +12,21 @@ public class EnumerationMember {
public Object Value { get; set; }
}
- private Type enumType;
+ private Type _enumType;
public Type EnumType {
get {
- return enumType;
+ return _enumType;
}
private set {
- if (enumType == value) {
+ if (_enumType == value) {
return;
}
var underlyingType = Nullable.GetUnderlyingType(value) ?? value;
if (!underlyingType.IsEnum) {
throw new ArgumentException("Type must be an Enum.");
}
- enumType = value;
+ _enumType = value;
}
}
diff --git a/Sources/BandcampDownloader/Miscellaneous/Exceptions.cs b/src/BandcampDownloader/Helpers/Exceptions.cs
similarity index 100%
rename from Sources/BandcampDownloader/Miscellaneous/Exceptions.cs
rename to src/BandcampDownloader/Helpers/Exceptions.cs
index b5c6edd7..0e3b8d98 100644
--- a/Sources/BandcampDownloader/Miscellaneous/Exceptions.cs
+++ b/src/BandcampDownloader/Helpers/Exceptions.cs
@@ -2,9 +2,9 @@
namespace BandcampDownloader {
- internal class NoAlbumFoundException: Exception {
+ internal class CouldNotCheckForUpdatesException: Exception {
}
- internal class CouldNotCheckForUpdatesException: Exception {
+ internal class NoAlbumFoundException: Exception {
}
}
\ No newline at end of file
diff --git a/Sources/BandcampDownloader/Miscellaneous/Extensions.cs b/src/BandcampDownloader/Helpers/Extensions.cs
similarity index 97%
rename from Sources/BandcampDownloader/Miscellaneous/Extensions.cs
rename to src/BandcampDownloader/Helpers/Extensions.cs
index 87e725ff..0692ae49 100644
--- a/Sources/BandcampDownloader/Miscellaneous/Extensions.cs
+++ b/src/BandcampDownloader/Helpers/Extensions.cs
@@ -1,63 +1,63 @@
-using System;
-using System.Text.RegularExpressions;
-using System.Windows.Controls;
-using NLog;
-
-namespace BandcampDownloader {
-
- internal static class Extensions {
-
- ///
- /// Returns true if scroll position of the current RichTextBox is at the end; false otherwise.
- ///
- public static Boolean IsScrolledToEnd(this RichTextBox richTextBox) {
- return richTextBox.VerticalOffset > richTextBox.ExtentHeight - richTextBox.ViewportHeight - 10;
- }
-
- ///
- /// Replaces the forbidden chars \ / : * ? " < > | from the System.String
- /// object by an underscore _ in order to be used for a Windows file or folder.
- ///
- public static String ToAllowedFileName(this String fileName) {
- if (fileName == null) {
- throw new ArgumentNullException("fileName");
- }
-
- fileName = fileName.Replace("\\", "_");
- fileName = fileName.Replace("/", "_");
- fileName = fileName.Replace(":", "_");
- fileName = fileName.Replace("*", "_");
- fileName = fileName.Replace("?", "_");
- fileName = fileName.Replace("\"", "_");
- fileName = fileName.Replace("<", "_");
- fileName = fileName.Replace(">", "_");
- fileName = fileName.Replace("|", "_");
- fileName = fileName.Replace(Environment.NewLine, "_");
- fileName = Regex.Replace(fileName, @"\s+", " ");
-
- return fileName;
- }
-
- ///
- /// Returns the NLog.LogLevel associated to the specified LogType.
- ///
- public static LogLevel ToNLogLevel(this LogType logType) {
- switch (logType) {
- case LogType.VerboseInfo:
- return LogLevel.Debug;
- case LogType.Info:
- return LogLevel.Info;
- case LogType.IntermediateSuccess:
- return LogLevel.Info;
- case LogType.Success:
- return LogLevel.Info;
- case LogType.Warning:
- return LogLevel.Warn;
- case LogType.Error:
- return LogLevel.Error;
- default:
- throw new NotImplementedException();
- }
- }
- }
+using System;
+using System.Text.RegularExpressions;
+using System.Windows.Controls;
+using NLog;
+
+namespace BandcampDownloader {
+
+ internal static class Extensions {
+
+ ///
+ /// Returns true if scroll position of the current RichTextBox is at the end; false otherwise.
+ ///
+ public static Boolean IsScrolledToEnd(this RichTextBox richTextBox) {
+ return richTextBox.VerticalOffset > richTextBox.ExtentHeight - richTextBox.ViewportHeight - 10;
+ }
+
+ ///
+ /// Replaces the forbidden chars \ / : * ? " < > | from the System.String
+ /// object by an underscore _ in order to be used for a Windows file or folder.
+ ///
+ public static String ToAllowedFileName(this String fileName) {
+ if (fileName == null) {
+ throw new ArgumentNullException("fileName");
+ }
+
+ fileName = fileName.Replace("\\", "_");
+ fileName = fileName.Replace("/", "_");
+ fileName = fileName.Replace(":", "_");
+ fileName = fileName.Replace("*", "_");
+ fileName = fileName.Replace("?", "_");
+ fileName = fileName.Replace("\"", "_");
+ fileName = fileName.Replace("<", "_");
+ fileName = fileName.Replace(">", "_");
+ fileName = fileName.Replace("|", "_");
+ fileName = fileName.Replace(Environment.NewLine, "_");
+ fileName = Regex.Replace(fileName, @"\s+", " ");
+
+ return fileName;
+ }
+
+ ///
+ /// Returns the NLog.LogLevel associated to the specified LogType.
+ ///
+ public static LogLevel ToNLogLevel(this LogType logType) {
+ switch (logType) {
+ case LogType.VerboseInfo:
+ return LogLevel.Debug;
+ case LogType.Info:
+ return LogLevel.Info;
+ case LogType.IntermediateSuccess:
+ return LogLevel.Info;
+ case LogType.Success:
+ return LogLevel.Info;
+ case LogType.Warning:
+ return LogLevel.Warn;
+ case LogType.Error:
+ return LogLevel.Error;
+ default:
+ throw new NotImplementedException();
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Sources/BandcampDownloader/Helpers/FileHelper.cs b/src/BandcampDownloader/Helpers/FileHelper.cs
similarity index 100%
rename from Sources/BandcampDownloader/Helpers/FileHelper.cs
rename to src/BandcampDownloader/Helpers/FileHelper.cs
diff --git a/Sources/BandcampDownloader/Helpers/LogHelper.cs b/src/BandcampDownloader/Helpers/LogHelper.cs
similarity index 100%
rename from Sources/BandcampDownloader/Helpers/LogHelper.cs
rename to src/BandcampDownloader/Helpers/LogHelper.cs
diff --git a/Sources/BandcampDownloader/Helpers/TagHelper.cs b/src/BandcampDownloader/Helpers/TagHelper.cs
similarity index 100%
rename from Sources/BandcampDownloader/Helpers/TagHelper.cs
rename to src/BandcampDownloader/Helpers/TagHelper.cs
diff --git a/Sources/BandcampDownloader/Helpers/UpdatesHelper.cs b/src/BandcampDownloader/Helpers/UpdatesHelper.cs
similarity index 100%
rename from Sources/BandcampDownloader/Helpers/UpdatesHelper.cs
rename to src/BandcampDownloader/Helpers/UpdatesHelper.cs
diff --git a/Sources/BandcampDownloader/Business Objects/Album.cs b/src/BandcampDownloader/Model/Album.cs
similarity index 100%
rename from Sources/BandcampDownloader/Business Objects/Album.cs
rename to src/BandcampDownloader/Model/Album.cs
diff --git a/Sources/BandcampDownloader/Miscellaneous/DownloadProgress.cs b/src/BandcampDownloader/Model/DownloadProgress.cs
similarity index 100%
rename from Sources/BandcampDownloader/Miscellaneous/DownloadProgress.cs
rename to src/BandcampDownloader/Model/DownloadProgress.cs
diff --git a/Sources/BandcampDownloader/Business Objects/JSON/JsonAlbum.cs b/src/BandcampDownloader/Model/JSON/JsonAlbum.cs
similarity index 77%
rename from Sources/BandcampDownloader/Business Objects/JSON/JsonAlbum.cs
rename to src/BandcampDownloader/Model/JSON/JsonAlbum.cs
index 1823f4e7..d1a992db 100644
--- a/Sources/BandcampDownloader/Business Objects/JSON/JsonAlbum.cs
+++ b/src/BandcampDownloader/Model/JSON/JsonAlbum.cs
@@ -1,40 +1,40 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Newtonsoft.Json;
-
-namespace BandcampDownloader {
-
- internal class JsonAlbum {
- public String urlEnd = "_0.jpg";
- public String urlStart = "https://f4.bcbits.com/img/a"; // Uses the art_id variable to retrieve the image from Bandcamp hosting site
-
- [JsonProperty("current")]
- public JsonAlbumData AlbumData { get; set; }
-
- [JsonProperty("art_id")]
- public String ArtId { get; set; }
-
- [JsonProperty("artist")]
- public String Artist { get; set; }
-
- [JsonProperty("album_release_date")]
- public DateTime ReleaseDate { get; set; }
-
- [JsonProperty("trackinfo")]
- public List Tracks { get; set; }
-
- public Album ToAlbum() {
- return new Album() {
- Artist = Artist,
- // Some albums do not have a cover art
- ArtworkUrl = ArtId == null ? null : urlStart + ArtId.PadLeft(10, '0') + urlEnd,
- ReleaseDate = ReleaseDate,
- Title = AlbumData.AlbumTitle,
- // Some tracks do not have their URL filled on some albums (pre-release...)
- // Forget those tracks here
- Tracks = Tracks.Where(t => t.File != null).Select(t => t.ToTrack()).ToList()
- };
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Newtonsoft.Json;
+
+namespace BandcampDownloader {
+
+ internal class JsonAlbum {
+ private readonly String _urlEnd = "_0.jpg";
+ private readonly String _urlStart = "https://f4.bcbits.com/img/a"; // Uses the art_id variable to retrieve the image from Bandcamp hosting site
+
+ [JsonProperty("current")]
+ public JsonAlbumData AlbumData { get; set; }
+
+ [JsonProperty("art_id")]
+ public String ArtId { get; set; }
+
+ [JsonProperty("artist")]
+ public String Artist { get; set; }
+
+ [JsonProperty("album_release_date")]
+ public DateTime ReleaseDate { get; set; }
+
+ [JsonProperty("trackinfo")]
+ public List Tracks { get; set; }
+
+ public Album ToAlbum() {
+ return new Album() {
+ Artist = Artist,
+ // Some albums do not have a cover art
+ ArtworkUrl = ArtId == null ? null : _urlStart + ArtId.PadLeft(10, '0') + _urlEnd,
+ ReleaseDate = ReleaseDate,
+ Title = AlbumData.AlbumTitle,
+ // Some tracks do not have their URL filled on some albums (pre-release...)
+ // Forget those tracks here
+ Tracks = Tracks.Where(t => t.File != null).Select(t => t.ToTrack()).ToList()
+ };
+ }
+ }
}
\ No newline at end of file
diff --git a/Sources/BandcampDownloader/Business Objects/JSON/JsonAlbumData.cs b/src/BandcampDownloader/Model/JSON/JsonAlbumData.cs
similarity index 95%
rename from Sources/BandcampDownloader/Business Objects/JSON/JsonAlbumData.cs
rename to src/BandcampDownloader/Model/JSON/JsonAlbumData.cs
index 959e2f61..d040069d 100644
--- a/Sources/BandcampDownloader/Business Objects/JSON/JsonAlbumData.cs
+++ b/src/BandcampDownloader/Model/JSON/JsonAlbumData.cs
@@ -1,11 +1,11 @@
-using System;
-using Newtonsoft.Json;
-
-namespace BandcampDownloader {
-
- internal class JsonAlbumData {
-
- [JsonProperty("title")]
- public String AlbumTitle { get; set; }
- }
+using System;
+using Newtonsoft.Json;
+
+namespace BandcampDownloader {
+
+ internal class JsonAlbumData {
+
+ [JsonProperty("title")]
+ public String AlbumTitle { get; set; }
+ }
}
\ No newline at end of file
diff --git a/Sources/BandcampDownloader/Business Objects/JSON/JsonMp3File.cs b/src/BandcampDownloader/Model/JSON/JsonMp3File.cs
similarity index 100%
rename from Sources/BandcampDownloader/Business Objects/JSON/JsonMp3File.cs
rename to src/BandcampDownloader/Model/JSON/JsonMp3File.cs
diff --git a/Sources/BandcampDownloader/Business Objects/JSON/JsonTrack.cs b/src/BandcampDownloader/Model/JSON/JsonTrack.cs
similarity index 100%
rename from Sources/BandcampDownloader/Business Objects/JSON/JsonTrack.cs
rename to src/BandcampDownloader/Model/JSON/JsonTrack.cs
diff --git a/Sources/BandcampDownloader/Business Objects/Track.cs b/src/BandcampDownloader/Model/Track.cs
similarity index 100%
rename from Sources/BandcampDownloader/Business Objects/Track.cs
rename to src/BandcampDownloader/Model/Track.cs
diff --git a/Sources/BandcampDownloader/Business Objects/TrackFile.cs b/src/BandcampDownloader/Model/TrackFile.cs
similarity index 100%
rename from Sources/BandcampDownloader/Business Objects/TrackFile.cs
rename to src/BandcampDownloader/Model/TrackFile.cs
diff --git a/Sources/BandcampDownloader/Properties/AssemblyInfo.cs b/src/BandcampDownloader/Properties/AssemblyInfo.cs
similarity index 96%
rename from Sources/BandcampDownloader/Properties/AssemblyInfo.cs
rename to src/BandcampDownloader/Properties/AssemblyInfo.cs
index 24da7999..0655acdc 100644
--- a/Sources/BandcampDownloader/Properties/AssemblyInfo.cs
+++ b/src/BandcampDownloader/Properties/AssemblyInfo.cs
@@ -51,6 +51,6 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.2.2.0")]
-[assembly: AssemblyFileVersion("0.2.2.0")]
+[assembly: AssemblyVersion("0.2.3.0")]
+[assembly: AssemblyFileVersion("0.2.3.0")]
[assembly: GuidAttribute("8C171C7F-9BAC-4EC0-A287-59908B48953F")]
diff --git a/Sources/BandcampDownloader/Properties/Resources.Designer.cs b/src/BandcampDownloader/Properties/Resources.Designer.cs
similarity index 100%
rename from Sources/BandcampDownloader/Properties/Resources.Designer.cs
rename to src/BandcampDownloader/Properties/Resources.Designer.cs
diff --git a/Sources/BandcampDownloader/Properties/Resources.resx b/src/BandcampDownloader/Properties/Resources.resx
similarity index 100%
rename from Sources/BandcampDownloader/Properties/Resources.resx
rename to src/BandcampDownloader/Properties/Resources.resx
diff --git a/Sources/BandcampDownloader/Properties/Settings.Designer.cs b/src/BandcampDownloader/Properties/Settings.Designer.cs
similarity index 100%
rename from Sources/BandcampDownloader/Properties/Settings.Designer.cs
rename to src/BandcampDownloader/Properties/Settings.Designer.cs
diff --git a/Sources/BandcampDownloader/Properties/Settings.settings b/src/BandcampDownloader/Properties/Settings.settings
similarity index 100%
rename from Sources/BandcampDownloader/Properties/Settings.settings
rename to src/BandcampDownloader/Properties/Settings.settings
diff --git a/Sources/BandcampDownloader/Resources/ArrowCircle225Left.png b/src/BandcampDownloader/Resources/ArrowCircle225Left.png
similarity index 100%
rename from Sources/BandcampDownloader/Resources/ArrowCircle225Left.png
rename to src/BandcampDownloader/Resources/ArrowCircle225Left.png
diff --git a/Sources/BandcampDownloader/Resources/Cloud.ico b/src/BandcampDownloader/Resources/Cloud.ico
similarity index 100%
rename from Sources/BandcampDownloader/Resources/Cloud.ico
rename to src/BandcampDownloader/Resources/Cloud.ico
diff --git a/Sources/BandcampDownloader/Resources/Cloud.png b/src/BandcampDownloader/Resources/Cloud.png
similarity index 100%
rename from Sources/BandcampDownloader/Resources/Cloud.png
rename to src/BandcampDownloader/Resources/Cloud.png
diff --git a/Sources/BandcampDownloader/Resources/ExclamationSmall.png b/src/BandcampDownloader/Resources/ExclamationSmall.png
similarity index 100%
rename from Sources/BandcampDownloader/Resources/ExclamationSmall.png
rename to src/BandcampDownloader/Resources/ExclamationSmall.png
diff --git a/Sources/BandcampDownloader/Resources/InformationSmallWhite.png b/src/BandcampDownloader/Resources/InformationSmallWhite.png
similarity index 100%
rename from Sources/BandcampDownloader/Resources/InformationSmallWhite.png
rename to src/BandcampDownloader/Resources/InformationSmallWhite.png
diff --git a/Sources/BandcampDownloader/Value Converters/BooleanAndConverter.cs b/src/BandcampDownloader/UI/Converters/BooleanAndConverter.cs
similarity index 100%
rename from Sources/BandcampDownloader/Value Converters/BooleanAndConverter.cs
rename to src/BandcampDownloader/UI/Converters/BooleanAndConverter.cs
diff --git a/Sources/BandcampDownloader/Value Converters/ComparisonConverter.cs b/src/BandcampDownloader/UI/Converters/ComparisonConverter.cs
similarity index 100%
rename from Sources/BandcampDownloader/Value Converters/ComparisonConverter.cs
rename to src/BandcampDownloader/UI/Converters/ComparisonConverter.cs
diff --git a/Sources/BandcampDownloader/Value Converters/DoubleToPercentConverter.cs b/src/BandcampDownloader/UI/Converters/DoubleToPercentConverter.cs
similarity index 100%
rename from Sources/BandcampDownloader/Value Converters/DoubleToPercentConverter.cs
rename to src/BandcampDownloader/UI/Converters/DoubleToPercentConverter.cs
diff --git a/Sources/BandcampDownloader/Value Converters/InverseBooleanConverter.cs b/src/BandcampDownloader/UI/Converters/InverseBooleanConverter.cs
similarity index 100%
rename from Sources/BandcampDownloader/Value Converters/InverseBooleanConverter.cs
rename to src/BandcampDownloader/UI/Converters/InverseBooleanConverter.cs
diff --git a/Sources/BandcampDownloader/Value Converters/InverseBooleanToVisibilityConverter.cs b/src/BandcampDownloader/UI/Converters/InverseBooleanToVisibilityConverter.cs
similarity index 100%
rename from Sources/BandcampDownloader/Value Converters/InverseBooleanToVisibilityConverter.cs
rename to src/BandcampDownloader/UI/Converters/InverseBooleanToVisibilityConverter.cs
diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsAdvanced.xaml
similarity index 100%
rename from Sources/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml
rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsAdvanced.xaml
diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml.cs b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsAdvanced.xaml.cs
similarity index 100%
rename from Sources/BandcampDownloader/Windows/UserControlSettingsAdvanced.xaml.cs
rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsAdvanced.xaml.cs
diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsCoverArt.xaml
similarity index 100%
rename from Sources/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml
rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsCoverArt.xaml
diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml.cs b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsCoverArt.xaml.cs
similarity index 100%
rename from Sources/BandcampDownloader/Windows/UserControlSettingsCoverArt.xaml.cs
rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsCoverArt.xaml.cs
diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsDownloads.xaml
similarity index 100%
rename from Sources/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml
rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsDownloads.xaml
diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml.cs b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsDownloads.xaml.cs
similarity index 100%
rename from Sources/BandcampDownloader/Windows/UserControlSettingsDownloads.xaml.cs
rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsDownloads.xaml.cs
diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml
similarity index 81%
rename from Sources/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml
rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml
index 214046a5..cb1c6a53 100644
--- a/Sources/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml
+++ b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml
@@ -6,8 +6,8 @@
xmlns:local="clr-namespace:BandcampDownloader"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="userControlSettingsGeneral"
- Width="287"
- Height="51"
+ Width="286"
+ Height="75"
KeyboardNavigation.TabNavigation="Local"
mc:Ignorable="d">
@@ -57,5 +57,16 @@
VerticalAlignment="Top"
Content="(the log file is always verbose)"
Foreground="#FF858585" />
+
\ No newline at end of file
diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml.cs b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml.cs
similarity index 96%
rename from Sources/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml.cs
rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml.cs
index ec6b63d8..ac629dec 100644
--- a/Sources/BandcampDownloader/Windows/UserControlSettingsGeneral.xaml.cs
+++ b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsGeneral.xaml.cs
@@ -28,6 +28,7 @@ public void LoadSettings() {
///
public void SaveSettings() {
checkBoxCheckForUpdates.GetBindingExpression(CheckBox.IsCheckedProperty).UpdateSource();
+ checkBoxEnableApplicationSounds.GetBindingExpression(CheckBox.IsCheckedProperty).UpdateSource();
checkBoxVerboseLog.GetBindingExpression(CheckBox.IsCheckedProperty).UpdateSource();
}
diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsNetwork.xaml
similarity index 100%
rename from Sources/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml
rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsNetwork.xaml
diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml.cs b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsNetwork.xaml.cs
similarity index 100%
rename from Sources/BandcampDownloader/Windows/UserControlSettingsNetwork.xaml.cs
rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsNetwork.xaml.cs
diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsTags.xaml b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsTags.xaml
similarity index 100%
rename from Sources/BandcampDownloader/Windows/UserControlSettingsTags.xaml
rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsTags.xaml
diff --git a/Sources/BandcampDownloader/Windows/UserControlSettingsTags.xaml.cs b/src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsTags.xaml.cs
similarity index 100%
rename from Sources/BandcampDownloader/Windows/UserControlSettingsTags.xaml.cs
rename to src/BandcampDownloader/UI/Dialogs/Settings/UserControlSettingsTags.xaml.cs
diff --git a/Sources/BandcampDownloader/Windows/WindowSettings.xaml b/src/BandcampDownloader/UI/Dialogs/Settings/WindowSettings.xaml
similarity index 100%
rename from Sources/BandcampDownloader/Windows/WindowSettings.xaml
rename to src/BandcampDownloader/UI/Dialogs/Settings/WindowSettings.xaml
diff --git a/Sources/BandcampDownloader/Windows/WindowSettings.xaml.cs b/src/BandcampDownloader/UI/Dialogs/Settings/WindowSettings.xaml.cs
similarity index 100%
rename from Sources/BandcampDownloader/Windows/WindowSettings.xaml.cs
rename to src/BandcampDownloader/UI/Dialogs/Settings/WindowSettings.xaml.cs
diff --git a/Sources/BandcampDownloader/Windows/WindowMain.xaml b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml
similarity index 100%
rename from Sources/BandcampDownloader/Windows/WindowMain.xaml
rename to src/BandcampDownloader/UI/Dialogs/WindowMain.xaml
diff --git a/Sources/BandcampDownloader/Windows/WindowMain.xaml.cs b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs
similarity index 87%
rename from Sources/BandcampDownloader/Windows/WindowMain.xaml.cs
rename to src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs
index b0c3c699..f544c31e 100644
--- a/Sources/BandcampDownloader/Windows/WindowMain.xaml.cs
+++ b/src/BandcampDownloader/UI/Dialogs/WindowMain.xaml.cs
@@ -32,31 +32,35 @@ public partial class WindowMain: Window {
///
/// True if there are active downloads; false otherwise.
///
- private Boolean activeDownloads = false;
+ private Boolean _activeDownloads = false;
///
/// Used to update the downloaded bytes / files count on the UI.
///
- private ConcurrentQueue downloadProgresses;
+ private ConcurrentQueue _downloadProgresses;
///
/// The files to download, or being downloaded, or downloaded. Used to compute the current received bytes and the total bytes to download.
///
- private List filesDownload;
+ private List _filesDownload;
///
/// Used to compute and display the download speed.
///
- private DateTime lastDownloadSpeedUpdate;
+ private DateTime _lastDownloadSpeedUpdate;
///
/// Used to compute and display the download speed.
///
- private long lastTotalReceivedBytes = 0;
+ private long _lastTotalReceivedBytes = 0;
///
/// Used when user clicks on 'Cancel' to abort all current downloads.
///
- private List pendingDownloads;
+ private List _pendingDownloads;
+ ///
+ /// Random class used to create random numbers.
+ ///
+ private Random _random = new Random();
///
/// Used when user clicks on 'Cancel' to manage the cancelation (UI...).
///
- private Boolean userCancelled;
+ private Boolean _userCancelled;
#endregion
@@ -81,7 +85,7 @@ public WindowMain() {
}
#if DEBUG
textBoxUrls.Text = ""
- + "https://projectmooncircle.bandcamp.com" /* Lots of albums (124) */ + Environment.NewLine
+ //+ "https://projectmooncircle.bandcamp.com" /* Lots of albums (124) */ + Environment.NewLine
//+ "https://goataholicskjald.bandcamp.com/album/dogma" /* #65 Downloaded size ≠ predicted */ + Environment.NewLine
//+ "https://mstrvlk.bandcamp.com/album/-" /* #64 Album with big cover */ + Environment.NewLine
//+ "https://mstrvlk.bandcamp.com/track/-" /* #64 Track with big cover */ + Environment.NewLine
@@ -90,6 +94,7 @@ public WindowMain() {
//+ "https://goataholicskjald.bandcamp.com/track/europa" + Environment.NewLine
//+ "https://goataholicskjald.bandcamp.com/track/epilogue" + Environment.NewLine
//+ "https://afterdarkrecordings.bandcamp.com/album/adr-unreleased-tracks" /* #69 Album without cover */ + Environment.NewLine
+ + "https://liluglymane.bandcamp.com/album/study-of-the-hypothesized-removable-and-or-expandable-nature-of-human-capability-and-limitations-primarily-regarding-introductory-experiences-with-new-and-exciting-technologies-by-way-of-motivati-2" /* #54 long path */ + Environment.NewLine
;
#endif
}
@@ -127,7 +132,7 @@ private void CheckForUpdates() {
/// The album to download.
/// The path where to save the album.
private void DownloadAlbum(Album album, String downloadsFolder) {
- if (this.userCancelled) {
+ if (_userCancelled) {
// Abort
return;
}
@@ -159,7 +164,7 @@ private void DownloadAlbum(Album album, String downloadsFolder) {
// Wait for all tracks to be downloaded before saying the album is downloaded
Task.WaitAll(tasks);
- if (!this.userCancelled) {
+ if (!_userCancelled) {
// Tasks have not been aborted
if (tracksDownloaded.All(x => x == true)) {
Log($"Successfully downloaded album \"{album.Title}\"", LogType.Success);
@@ -181,16 +186,18 @@ private Boolean DownloadAndTagTrack(String albumDirectoryPath, Album album, Trac
// Set path to save the file
String trackPath = albumDirectoryPath + "\\" + GetFileName(album, track);
- if (trackPath.Length > 256) {
- // Shorten the path (Windows doesn't support a path > 256 characters)
- trackPath = albumDirectoryPath + "\\" + GetFileName(album, track).Substring(0, 3) + Path.GetExtension(trackPath);
+ if (trackPath.Length >= 260) {
+ // Windows doesn't do well with path + filename >= 260 characters (and path >= 248 characters)
+ // Path has been shorten to 247 characters before, so we have 12 characters max left for filename.ext
+ int fileNameMaxLength = 12 - Path.GetExtension(trackPath).ToString().Length;
+ trackPath = albumDirectoryPath + "\\" + GetFileName(album, track).Substring(0, fileNameMaxLength) + Path.GetExtension(trackPath);
}
int tries = 0;
Boolean trackDownloaded = false;
if (File.Exists(trackPath)) {
long length = new FileInfo(trackPath).Length;
- foreach (TrackFile trackFile in filesDownload) {
+ foreach (TrackFile trackFile in _filesDownload) {
if (track.Mp3Url == trackFile.Url &&
trackFile.Size > length - (trackFile.Size * App.UserSettings.AllowedFileSizeDifference) &&
trackFile.Size < length + (trackFile.Size * App.UserSettings.AllowedFileSizeDifference)) {
@@ -222,7 +229,7 @@ private Boolean DownloadAndTagTrack(String albumDirectoryPath, Album album, Trac
// Update progress bar when downloading
webClient.DownloadProgressChanged += (s, e) => {
- this.downloadProgresses.Enqueue(new DownloadProgress(track.Mp3Url, e.BytesReceived));
+ _downloadProgresses.Enqueue(new DownloadProgress(track.Mp3Url, e.BytesReceived));
UpdateProgress();
};
@@ -253,7 +260,7 @@ private Boolean DownloadAndTagTrack(String albumDirectoryPath, Album album, Trac
}
// Note the file as downloaded
- TrackFile currentFile = this.filesDownload.Where(f => f.Url == track.Mp3Url).First();
+ TrackFile currentFile = _filesDownload.Where(f => f.Url == track.Mp3Url).First();
currentFile.Downloaded = true;
Log($"Downloaded track \"{GetFileName(album, track)}\" from album \"{album.Title}\"", LogType.IntermediateSuccess);
} else if (!e.Cancelled && e.Error != null) {
@@ -272,20 +279,20 @@ private Boolean DownloadAndTagTrack(String albumDirectoryPath, Album album, Trac
doneEvent.Set();
};
- lock (this.pendingDownloads) {
- if (this.userCancelled) {
+ lock (_pendingDownloads) {
+ if (_userCancelled) {
// Abort
return false;
}
// Register current download
- this.pendingDownloads.Add(webClient);
+ _pendingDownloads.Add(webClient);
// Start download
webClient.DownloadFileAsync(new Uri(track.Mp3Url), trackPath);
}
// Wait for download to be finished
doneEvent.WaitOne();
- lock (this.pendingDownloads) {
- this.pendingDownloads.Remove(webClient);
+ lock (_pendingDownloads) {
+ _pendingDownloads.Remove(webClient);
}
}
} while (!trackDownloaded && tries < App.UserSettings.DownloadMaxTries);
@@ -302,13 +309,22 @@ private TagLib.Picture DownloadCoverArt(Album album, String downloadsFolder) {
// Compute paths where to save artwork
String artworkTempPath = Path.GetTempPath() + "\\" + album.Title.ToAllowedFileName() + Path.GetExtension(album.ArtworkUrl);
String artworkFolderPath = downloadsFolder + "\\" + album.Title.ToAllowedFileName() + Path.GetExtension(album.ArtworkUrl);
- if (artworkTempPath.Length > 256 || artworkFolderPath.Length > 256) {
- // Shorten the path (Windows doesn't support a path > 256 characters)
- // There may be only one path to shorten, but it's better to use the same file name in both places
- artworkTempPath = Path.GetTempPath() + "\\" + album.Title.ToAllowedFileName().Substring(0, 3) + Path.GetExtension(album.ArtworkUrl);
- artworkFolderPath = downloadsFolder + "\\" + album.Title.ToAllowedFileName().Substring(0, 3) + Path.GetExtension(album.ArtworkUrl);
+
+ if (artworkTempPath.Length >= 260 || artworkFolderPath.Length >= 260) {
+ // Windows doesn't do well with path + filename >= 260 characters (and path >= 248 characters)
+ // Path has been shorten to 247 characters before, so we have 12 characters max left for filename.ext
+ // There may be only one path needed to shorten, but it's better to use the same file name in both places
+ int fileNameMaxLength = 12 - Path.GetExtension(album.ArtworkUrl).ToString().Length;
+ artworkTempPath = Path.GetTempPath() + "\\" + album.Title.ToAllowedFileName().Substring(0, fileNameMaxLength) + Path.GetExtension(album.ArtworkUrl);
+ artworkFolderPath = downloadsFolder + "\\" + album.Title.ToAllowedFileName().Substring(0, fileNameMaxLength) + Path.GetExtension(album.ArtworkUrl);
}
+ // In order to prevent #54 (artworkTempPath used at the same time by another downloading thread):
+ // Change the name of the artwork file: replace the last 3 characters with a random number between 1-999
+ String artworkFileWithoutExt = Path.GetFileNameWithoutExtension(artworkTempPath);
+ artworkFileWithoutExt = artworkFileWithoutExt.Remove(artworkFileWithoutExt.Length - 3, 3) + _random.Next(1, 1000).ToString("00#");
+ artworkTempPath = Path.GetDirectoryName(artworkTempPath) + "\\" + artworkFileWithoutExt + Path.GetExtension(artworkTempPath);
+
TagLib.Picture artworkInTags = null;
int tries = 0;
@@ -336,7 +352,7 @@ private TagLib.Picture DownloadCoverArt(Album album, String downloadsFolder) {
// Update progress bar when downloading
webClient.DownloadProgressChanged += (s, e) => {
- this.downloadProgresses.Enqueue(new DownloadProgress(album.ArtworkUrl, e.BytesReceived));
+ _downloadProgresses.Enqueue(new DownloadProgress(album.ArtworkUrl, e.BytesReceived));
UpdateProgress();
};
@@ -383,7 +399,7 @@ private TagLib.Picture DownloadCoverArt(Album album, String downloadsFolder) {
}
// Note the file as downloaded
- TrackFile currentFile = this.filesDownload.Where(f => f.Url == album.ArtworkUrl).First();
+ TrackFile currentFile = _filesDownload.Where(f => f.Url == album.ArtworkUrl).First();
currentFile.Downloaded = true;
Log($"Downloaded artwork for album \"{album.Title}\"", LogType.IntermediateSuccess);
} else if (!e.Cancelled && e.Error != null) {
@@ -397,21 +413,21 @@ private TagLib.Picture DownloadCoverArt(Album album, String downloadsFolder) {
doneEvent.Set();
};
- lock (this.pendingDownloads) {
- if (this.userCancelled) {
+ lock (_pendingDownloads) {
+ if (_userCancelled) {
// Abort
return null;
}
// Register current download
- this.pendingDownloads.Add(webClient);
+ _pendingDownloads.Add(webClient);
// Start download
webClient.DownloadFileAsync(new Uri(album.ArtworkUrl), artworkTempPath);
}
// Wait for download to be finished
doneEvent.WaitOne();
- lock (this.pendingDownloads) {
- this.pendingDownloads.Remove(webClient);
+ lock (_pendingDownloads) {
+ _pendingDownloads.Remove(webClient);
}
}
} while (!artworkDownloaded && tries < App.UserSettings.DownloadMaxTries);
@@ -448,7 +464,7 @@ private List GetAlbums(List urls) {
throw new NotImplementedException(); // Shouldn't happen
}
- if (this.userCancelled) {
+ if (_userCancelled) {
// Abort
return new List();
}
@@ -502,7 +518,7 @@ private List GetArtistDiscography(List urls) {
throw new NotImplementedException(); // Shouldn't happen
}
- if (this.userCancelled) {
+ if (_userCancelled) {
// Abort
return new List();
}
@@ -541,7 +557,7 @@ private List GetArtistDiscography(List urls) {
throw new NotImplementedException(); // Shouldn't happen
}
- if (this.userCancelled) {
+ if (_userCancelled) {
// Abort
return new List();
}
@@ -603,7 +619,7 @@ private List GetFilesToDownload(List albums, Boolean downloadC
int tries = 0;
if (App.UserSettings.RetrieveFilesSize) {
do {
- if (this.userCancelled) {
+ if (_userCancelled) {
// Abort
return new List();
}
@@ -636,7 +652,7 @@ private List GetFilesToDownload(List albums, Boolean downloadC
// Temporarily save the index or we will have a race condition exception when i hits its maximum value
int trackIndex = i;
- if (this.userCancelled) {
+ if (_userCancelled) {
// Abort
return new List();
}
@@ -647,7 +663,7 @@ private List GetFilesToDownload(List albums, Boolean downloadC
int tries = 0;
if (App.UserSettings.RetrieveFilesSize) {
do {
- if (this.userCancelled) {
+ if (_userCancelled) {
// Abort
break;
}
@@ -713,7 +729,7 @@ private void Log(String message, LogType logType) {
// Log to window
if (App.UserSettings.ShowVerboseLog || logType == LogType.Error || logType == LogType.Info || logType == LogType.IntermediateSuccess || logType == LogType.Success) {
- this.Dispatcher.Invoke(new Action(() => {
+ Dispatcher.Invoke(new Action(() => {
// Time
var textRange = new TextRange(richTextBoxLog.Document.ContentEnd, richTextBoxLog.Document.ContentEnd) {
Text = DateTime.Now.ToString("HH:mm:ss") + " "
@@ -745,6 +761,12 @@ private String ParseDownloadPath(String downloadPath, Album album) {
downloadPath = downloadPath.Replace("{day}", album.ReleaseDate.Day.ToString().ToAllowedFileName());
downloadPath = downloadPath.Replace("{artist}", album.Artist.ToAllowedFileName());
downloadPath = downloadPath.Replace("{album}", album.Title.ToAllowedFileName());
+
+ if (downloadPath.Length >= 248) {
+ // Windows doesn't do well with path >= 248 characters (and path + filename >= 260 characters)
+ downloadPath = downloadPath.Substring(0, 247);
+ }
+
return downloadPath;
}
@@ -753,7 +775,7 @@ private String ParseDownloadPath(String downloadPath, Album album) {
///
/// True if the download just started, false if it just stopped.
private void UpdateControlsState(Boolean downloadStarted) {
- this.Dispatcher.Invoke(new Action(() => {
+ Dispatcher.Invoke(new Action(() => {
if (downloadStarted) {
// We just started the download
buttonBrowse.IsEnabled = false;
@@ -792,40 +814,40 @@ private void UpdateControlsState(Boolean downloadStarted) {
private void UpdateProgress() {
DateTime now = DateTime.Now;
- this.downloadProgresses.TryDequeue(out DownloadProgress downloadProgress);
+ _downloadProgresses.TryDequeue(out DownloadProgress downloadProgress);
// Compute new progress values
- TrackFile currentFile = this.filesDownload.Where(f => f.Url == downloadProgress.FileUrl).First();
+ TrackFile currentFile = _filesDownload.Where(f => f.Url == downloadProgress.FileUrl).First();
currentFile.BytesReceived = downloadProgress.BytesReceived;
- long totalReceivedBytes = this.filesDownload.Sum(f => f.BytesReceived);
- long bytesToDownload = this.filesDownload.Sum(f => f.Size);
- Double downloadedFilesCount = this.filesDownload.Count(f => f.Downloaded);
+ long totalReceivedBytes = _filesDownload.Sum(f => f.BytesReceived);
+ long bytesToDownload = _filesDownload.Sum(f => f.Size);
+ Double downloadedFilesCount = _filesDownload.Count(f => f.Downloaded);
Double bytesPerSecond;
- if (this.lastTotalReceivedBytes == 0) {
+ if (_lastTotalReceivedBytes == 0) {
// First time we update the progress
bytesPerSecond = 0;
- this.lastTotalReceivedBytes = totalReceivedBytes;
- this.lastDownloadSpeedUpdate = now;
- } else if ((now - this.lastDownloadSpeedUpdate).TotalMilliseconds > 500) {
+ _lastTotalReceivedBytes = totalReceivedBytes;
+ _lastDownloadSpeedUpdate = now;
+ } else if ((now - _lastDownloadSpeedUpdate).TotalMilliseconds > 500) {
// Last update of progress happened more than 500 milliseconds ago
// We only update the download speed every 500+ milliseconds
bytesPerSecond =
- ((Double) (totalReceivedBytes - this.lastTotalReceivedBytes)) /
- (now - this.lastDownloadSpeedUpdate).TotalSeconds;
- this.lastTotalReceivedBytes = totalReceivedBytes;
- this.lastDownloadSpeedUpdate = now;
+ ((Double) (totalReceivedBytes - _lastTotalReceivedBytes)) /
+ (now - _lastDownloadSpeedUpdate).TotalSeconds;
+ _lastTotalReceivedBytes = totalReceivedBytes;
+ _lastDownloadSpeedUpdate = now;
// Update UI
- this.Dispatcher.Invoke(new Action(() => {
+ Dispatcher.Invoke(new Action(() => {
// Update download speed
labelDownloadSpeed.Content = (bytesPerSecond / 1024).ToString("0.0") + " kB/s";
}));
}
// Update UI
- this.Dispatcher.Invoke(new Action(() => {
- if (!this.userCancelled) {
+ Dispatcher.Invoke(new Action(() => {
+ if (!_userCancelled) {
// Update progress label
labelProgress.Content =
((Double) totalReceivedBytes / (1024 * 1024)).ToString("0.00") + " MB" +
@@ -867,7 +889,7 @@ private void ButtonBrowse_Click(object sender, RoutedEventArgs e) {
}
private void ButtonOpenSettingsWindow_Click(object sender, RoutedEventArgs e) {
- var windowSettings = new WindowSettings(activeDownloads) {
+ var windowSettings = new WindowSettings(_activeDownloads) {
Owner = this,
ShowInTaskbar = false,
};
@@ -881,12 +903,12 @@ private void ButtonStart_Click(object sender, RoutedEventArgs e) {
return;
}
- this.userCancelled = false;
+ _userCancelled = false;
- this.pendingDownloads = new List();
+ _pendingDownloads = new List();
// Set controls to "downloading..." state
- this.activeDownloads = true;
+ _activeDownloads = true;
UpdateControlsState(true);
Log("Starting download...", LogType.Info);
@@ -897,7 +919,7 @@ private void ButtonStart_Click(object sender, RoutedEventArgs e) {
var urls = new List();
var albums = new List();
- this.downloadProgresses = new ConcurrentQueue();
+ _downloadProgresses = new ConcurrentQueue();
Task.Factory.StartNew(() => {
// Get URLs of albums to download
@@ -912,17 +934,17 @@ private void ButtonStart_Click(object sender, RoutedEventArgs e) {
albums = GetAlbums(urls);
}).ContinueWith(x => {
// Save files to download (we'll need the list to update the progressBar)
- this.filesDownload = GetFilesToDownload(albums, App.UserSettings.SaveCoverArtInTags || App.UserSettings.SaveCoverArtInFolder);
+ _filesDownload = GetFilesToDownload(albums, App.UserSettings.SaveCoverArtInTags || App.UserSettings.SaveCoverArtInFolder);
}).ContinueWith(x => {
// Set progressBar max value
long maxProgressBarValue;
if (App.UserSettings.RetrieveFilesSize) {
- maxProgressBarValue = this.filesDownload.Sum(f => f.Size); // Bytes to download
+ maxProgressBarValue = _filesDownload.Sum(f => f.Size); // Bytes to download
} else {
- maxProgressBarValue = this.filesDownload.Count; // Number of files to download
+ maxProgressBarValue = _filesDownload.Count; // Number of files to download
}
if (maxProgressBarValue > 0) {
- this.Dispatcher.Invoke(new Action(() => {
+ Dispatcher.Invoke(new Action(() => {
progressBar.IsIndeterminate = false;
progressBar.Maximum = maxProgressBarValue;
TaskbarItemInfo.ProgressState = TaskbarItemProgressState.Normal;
@@ -947,17 +969,19 @@ private void ButtonStart_Click(object sender, RoutedEventArgs e) {
Task.WaitAll(tasks);
}
}).ContinueWith(x => {
- if (this.userCancelled) {
+ if (_userCancelled) {
// Display message if user cancelled
Log("Downloads cancelled by user", LogType.Info);
}
// Set controls to "ready" state
- this.activeDownloads = false;
+ _activeDownloads = false;
UpdateControlsState(false);
- // Play a sound
- try {
- (new SoundPlayer(@"C:\Windows\Media\Windows Ding.wav")).Play();
- } catch {
+ if (App.UserSettings.EnableApplicationSounds) {
+ // Play a sound
+ try {
+ (new SoundPlayer(@"C:\Windows\Media\Windows Ding.wav")).Play();
+ } catch {
+ }
}
});
}
@@ -967,12 +991,12 @@ private void ButtonStop_Click(object sender, RoutedEventArgs e) {
return;
}
- this.userCancelled = true;
+ _userCancelled = true;
Cursor = Cursors.Wait;
Log("Cancelling downloads. Please wait...", LogType.Info);
- lock (this.pendingDownloads) {
- if (this.pendingDownloads.Count == 0) {
+ lock (_pendingDownloads) {
+ if (_pendingDownloads.Count == 0) {
// Nothing to cancel
Cursor = Cursors.Arrow;
return;
@@ -985,9 +1009,9 @@ private void ButtonStop_Click(object sender, RoutedEventArgs e) {
TaskbarItemInfo.ProgressState = TaskbarItemProgressState.None;
TaskbarItemInfo.ProgressValue = 0;
- lock (this.pendingDownloads) {
+ lock (_pendingDownloads) {
// Stop current downloads
- foreach (WebClient webClient in this.pendingDownloads) {
+ foreach (WebClient webClient in _pendingDownloads) {
webClient.CancelAsync();
}
}
@@ -1016,7 +1040,7 @@ private void TextBoxUrls_LostFocus(object sender, RoutedEventArgs e) {
}
private void WindowMain_Closing(object sender, CancelEventArgs e) {
- if (this.activeDownloads) {
+ if (_activeDownloads) {
// There are active downloads, ask for confirmation
if (MessageBox.Show("There are currently active downloads. Are you sure you want to close the application and stop all downloads?", "Bandcamp Downloader", MessageBoxButton.OKCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel) == MessageBoxResult.Cancel) {
// Cancel closing the window
diff --git a/Sources/BandcampDownloader/Miscellaneous/DoubleRule.cs b/src/BandcampDownloader/UI/Validation/DoubleRule.cs
similarity index 100%
rename from Sources/BandcampDownloader/Miscellaneous/DoubleRule.cs
rename to src/BandcampDownloader/UI/Validation/DoubleRule.cs
diff --git a/Sources/BandcampDownloader/app.config b/src/BandcampDownloader/app.config
similarity index 100%
rename from Sources/BandcampDownloader/app.config
rename to src/BandcampDownloader/app.config
diff --git a/Sources/BandcampDownloader/packages.config b/src/BandcampDownloader/packages.config
similarity index 98%
rename from Sources/BandcampDownloader/packages.config
rename to src/BandcampDownloader/packages.config
index b3a7d1ec..49055997 100644
--- a/Sources/BandcampDownloader/packages.config
+++ b/src/BandcampDownloader/packages.config
@@ -1,12 +1,12 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file