aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs')
-rw-r--r--MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs45
1 files changed, 23 insertions, 22 deletions
diff --git a/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs b/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs
index 7ccf7cffa..e61d8792c 100644
--- a/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs
+++ b/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
+using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Configuration;
@@ -26,8 +27,6 @@ namespace MediaBrowser.Providers.Music
public static AudioDbAlbumProvider Current;
- private readonly CultureInfo _usCulture = new CultureInfo("en-US");
-
public AudioDbAlbumProvider(IServerConfigurationManager config, IFileSystem fileSystem, IHttpClient httpClient, IJsonSerializer json)
{
_config = config;
@@ -38,11 +37,18 @@ namespace MediaBrowser.Providers.Music
Current = this;
}
+ /// <inheritdoc />
+ public string Name => "TheAudioDB";
+
+ /// <inheritdoc />
+ // After music brainz
+ public int Order => 1;
+
+ /// <inheritdoc />
public Task<IEnumerable<RemoteSearchResult>> GetSearchResults(AlbumInfo searchInfo, CancellationToken cancellationToken)
- {
- return Task.FromResult((IEnumerable<RemoteSearchResult>)new List<RemoteSearchResult>());
- }
+ => Task.FromResult(Enumerable.Empty<RemoteSearchResult>());
+ /// <inheritdoc />
public async Task<MetadataResult<MusicAlbum>> GetMetadata(AlbumInfo info, CancellationToken cancellationToken)
{
var result = new MetadataResult<MusicAlbum>();
@@ -77,7 +83,7 @@ namespace MediaBrowser.Providers.Music
if (!string.IsNullOrEmpty(result.intYearReleased))
{
- item.ProductionYear = int.Parse(result.intYearReleased, _usCulture);
+ item.ProductionYear = int.Parse(result.intYearReleased, CultureInfo.InvariantCulture);
}
if (!string.IsNullOrEmpty(result.strGenre))
@@ -126,8 +132,6 @@ namespace MediaBrowser.Providers.Music
item.Overview = (overview ?? string.Empty).StripHtml();
}
- public string Name => "TheAudioDB";
-
internal Task EnsureInfo(string musicBrainzReleaseGroupId, CancellationToken cancellationToken)
{
var xmlPath = GetAlbumInfoPath(_config.ApplicationPaths, musicBrainzReleaseGroupId);
@@ -155,20 +159,18 @@ namespace MediaBrowser.Providers.Music
Directory.CreateDirectory(Path.GetDirectoryName(path));
- using (var httpResponse = await _httpClient.SendAsync(new HttpRequestOptions
- {
- Url = url,
- CancellationToken = cancellationToken
+ using (var httpResponse = await _httpClient.SendAsync(
+ new HttpRequestOptions
+ {
+ Url = url,
+ CancellationToken = cancellationToken
- }, "GET").ConfigureAwait(false))
+ },
+ "GET").ConfigureAwait(false))
+ using (var response = httpResponse.Content)
+ using (var xmlFileStream = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
{
- using (var response = httpResponse.Content)
- {
- using (var xmlFileStream = _fileSystem.GetFileStream(path, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read, true))
- {
- await response.CopyToAsync(xmlFileStream).ConfigureAwait(false);
- }
- }
+ await response.CopyToAsync(xmlFileStream).ConfigureAwait(false);
}
}
@@ -192,8 +194,6 @@ namespace MediaBrowser.Providers.Music
return Path.Combine(dataPath, "album.json");
}
- // After music brainz
- public int Order => 1;
public class Album
{
@@ -242,6 +242,7 @@ namespace MediaBrowser.Providers.Music
public List<Album> album { get; set; }
}
+ /// <inheritdoc />
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
{
throw new NotImplementedException();