Skip to content

Commit

Permalink
Merge branch 'release-1.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Otiel committed Aug 7, 2019
2 parents 458188b + 28e4d16 commit f734c5c
Show file tree
Hide file tree
Showing 22 changed files with 880 additions and 589 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 1.3.0

## Improvements

* Added the following languages thanks to [contributors](https://github.com/Otiel/BandcampDownloader/pull/113): Chinese.
* Updated the following languages thanks to [contributors](https://github.com/Otiel/BandcampDownloader/pull/113): German, Italian, Spanish, Turkish.
* Removed the Ukrainian language as not complete.

## Bug fixes

* Fixed the log position reset when opening the Settings window. [#112](https://github.com/Otiel/BandcampDownloader/issues/112)

# 1.2.0

## Improvements
Expand Down
2 changes: 1 addition & 1 deletion docs/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ BandcampDownloader relies on a number of open-source libraries, all listed below
* [`Json.NET`](https://github.com/JamesNK/Newtonsoft.Json): used to parse Json from bandcamp.com pages.
* [`Markdig`](https://github.com/lunet-io/markdig): required by `Markdig.WPF`.
* [`Markdig.WPF`](https://github.com/Kryptos-FR/markdig.wpf): used to display Markdown.
* [`MessageBoxManager`](https://www.codeproject.com/Articles/18399/Localizing-System-MessageBox): used to localize the buttons of the Windows system message box.
* [`NLog`](https://github.com/NLog/NLog): used to log events.
* [`PlaylistsNET`](https://github.com/tmk907/PlaylistsNET): used to create playlists.
* [`Resource.Embedder`](https://github.com/MarcStan/Resource.Embedder): used to embed localization resources (_*.resources.dll_) in the main _exe_ file (not supported by `Costura`).
* [`TagLib#`](https://github.com/mono/taglib-sharp): used to save ID3 tags in MP3 files.
* [`WPFLocalizationExtension`](https://github.com/XAMLMarkupExtensions/WPFLocalizationExtension): used to manage the localization.
* [`WpfMessageBox`](https://github.com/Otiel/WpfMessageBox): used to display message boxes.
* [`XAMLMarkupExtensions`](https://github.com/XAMLMarkupExtensions/XAMLMarkupExtensions): required by `WpfLocalizeExtension`.
4 changes: 4 additions & 0 deletions src/BandcampDownloader/BandcampDownloader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -295,16 +295,20 @@
<EmbeddedResource Include="Properties\Resources.de.resx" />
<EmbeddedResource Include="Properties\Resources.es.resx" />
<EmbeddedResource Include="Properties\Resources.fr.resx" />
<EmbeddedResource Include="Properties\Resources.id.resx" />
<EmbeddedResource Include="Properties\Resources.it.resx" />
<EmbeddedResource Include="Properties\Resources.ko.resx" />
<EmbeddedResource Include="Properties\Resources.nb-NO.resx" />
<EmbeddedResource Include="Properties\Resources.pl.resx" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.ru.resx" />
<EmbeddedResource Include="Properties\Resources.tr.resx" />
<EmbeddedResource Include="Properties\Resources.uk.resx" />
<EmbeddedResource Include="Properties\Resources.zh.resx" />
<None Include="app.config">
<SubType>Designer</SubType>
</None>
Expand Down
18 changes: 12 additions & 6 deletions src/BandcampDownloader/Core/DownloadManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ internal class DownloadManager {
private CancellationTokenSource _cancellationTokenSource;

/// <summary>
/// The files to download, or being downloaded, or already downloaded. Used to compute the current received bytes and the total bytes to download.
/// The files to download, or being downloaded, or already downloaded. Used to compute the current received bytes
/// and the total bytes to download.
/// </summary>
public List<TrackFile> DownloadingFiles { get; set; }

Expand All @@ -47,7 +48,8 @@ internal class DownloadManager {
public DownloadManager(string urls) {
_urls = urls;

// Increase the maximum of concurrent connections to be able to download more than 2 (which is the default value) files at the same time
// Increase the maximum of concurrent connections to be able to download more than 2 (which is the default
// value) files at the same time
ServicePointManager.DefaultConnectionLimit = 50;
}

Expand Down Expand Up @@ -200,6 +202,7 @@ private async Task<bool> DownloadAndTagTrackAsync(Album album, Track track, TagL
try {
await webClient.DownloadFileTaskAsync(track.Mp3Url, track.Path);
trackDownloaded = true;
LogAdded(this, new LogArgs($"Downloaded track \"{track.Title}\" from url: {track.Mp3Url}", LogType.VerboseInfo));
} catch (WebException ex) when (ex.Status == WebExceptionStatus.RequestCanceled) {
// Downloads cancelled by the user
return false;
Expand Down Expand Up @@ -228,13 +231,15 @@ private async Task<bool> DownloadAndTagTrackAsync(Album album, Track track, TagL
tagFile = TagHelper.UpdateTrackLyrics(tagFile, track.Lyrics, App.UserSettings.TagLyrics);
tagFile = TagHelper.UpdateComments(tagFile, App.UserSettings.TagComments);
tagFile.Save();
LogAdded(this, new LogArgs($"Tags saved for track \"{Path.GetFileName(track.Path)}\" from album \"{album.Title}\"", LogType.VerboseInfo));
}

if (App.UserSettings.SaveCoverArtInTags && artwork != null) {
// Save cover in tags when downloaded
var tagFile = TagLib.File.Create(track.Path);
tagFile.Tag.Pictures = new TagLib.IPicture[1] { artwork };
tagFile.Save();
LogAdded(this, new LogArgs($"Cover art saved in tags for track \"{Path.GetFileName(track.Path)}\" from album \"{album.Title}\"", LogType.VerboseInfo));
}

// Note the file as downloaded
Expand All @@ -253,8 +258,8 @@ private async Task<bool> DownloadAndTagTrackAsync(Album album, Track track, TagL
}

/// <summary>
/// Downloads and returns the cover art of the specified album.
/// Depending on UserSettings, save the cover art in the album folder.
/// Downloads and returns the cover art of the specified album. Depending on UserSettings, save the cover art in
/// the album folder.
/// </summary>
/// <param name="album">The album.</param>
private async Task<TagLib.Picture> DownloadCoverArtAsync(Album album) {
Expand Down Expand Up @@ -499,8 +504,9 @@ private async Task<long> GetFileSizeAsync(string url, string titleForLog, FileTy
break;
case FileType.Track:
fileTypeForLog = "MP3 file for the track";
// Using the HEAD method on tracks urls does not work (Error 405: Method not allowed)
// Surprisingly, using the GET method does not seem to download the whole file, so we will use it to retrieve the mp3 sizes
// Using the HEAD method on tracks urls does not work (Error 405: Method not allowed) Surprisingly,
// using the GET method does not seem to download the whole file, so we will use it to retrieve the
// mp3 sizes
protocolMethod = "GET";
break;
default:
Expand Down
12 changes: 10 additions & 2 deletions src/BandcampDownloader/Core/UserSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,30 @@ namespace BandcampDownloader {
public enum Language {
[Description("English")]
en,
[Description("Chinese (Simplified) (汉语)")]
zh,
[Description("French (Français)")]
fr,
[Description("German (Deutsch)")]
de,
//[Description("Indonesian (Bahasa Indonesia)")]
//id,
[Description("Italian (Italiano)")]
it,
//[Description("Korean (한국어)")]
//ko,
[Description("Norwegian Bokmål (Norsk Bokmål)")]
nb_NO,
[Description("Polish (język polski)")]
pl,
//[Description("Russian (русский)")]
//ru,
[Description("Spanish (Español)")]
es,
[Description("Turkish (Türkçe)")]
tr,
[Description("Ukrainian (Українська)")]
uk,
//[Description("Ukrainian (Українська)")]
//uk,
}

public enum PlaylistFormat {
Expand Down
17 changes: 13 additions & 4 deletions src/BandcampDownloader/Helpers/LanguageHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,34 @@ public static void ApplyLanguage(Language language) {
/// </summary>
/// <param name="language">The Language.</param>
private static CultureInfo GetCultureInfo(Language language) {
// Existing cultures: https://dotnetfiddle.net/e1BX7M
switch (language) {
case Language.en:
return new CultureInfo("en");
case Language.de:
return new CultureInfo("de");
case Language.en:
return new CultureInfo("en");
case Language.es:
return new CultureInfo("es");
case Language.fr:
return new CultureInfo("fr");
//case Language.id:
// return new CultureInfo("id");
case Language.it:
return new CultureInfo("it");
case Language.nb_NO:
return new CultureInfo("nb-NO");
case Language.pl:
return new CultureInfo("pl");
//case Language.ko:
// return new CultureInfo("ko");
//case Language.ru:
// return new CultureInfo("ru");
case Language.tr:
return new CultureInfo("tr");
case Language.uk:
return new CultureInfo("uk");
//case Language.uk:
// return new CultureInfo("uk");
case Language.zh:
return new CultureInfo("zh");
default:
throw new NotImplementedException();
}
Expand Down
4 changes: 2 additions & 2 deletions src/BandcampDownloader/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,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("1.2.0")]
[assembly: AssemblyFileVersion("1.2.0")]
[assembly: AssemblyVersion("1.3.0")]
[assembly: AssemblyFileVersion("1.3.0")]
[assembly: GuidAttribute("8C171C7F-9BAC-4EC0-A287-59908B48953F")]
2 changes: 1 addition & 1 deletion src/BandcampDownloader/Properties/Resources.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root">
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
Expand Down
Loading

0 comments on commit f734c5c

Please sign in to comment.