Skip to content

Commit 770bcee

Browse files
Kevin JensenKevin Jensen
authored andcommitted
code cleanup
1 parent 4d6bda0 commit 770bcee

6 files changed

Lines changed: 170 additions & 189 deletions

File tree

Source/Plex.Library/ApiModels/Servers/Server.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,6 @@ public async Task<MediaContainer> Metadata(string ratingKey) =>
643643
/// <param name="ratingKey">The rating key to get poster from.</param>
644644
/// <returns>A <see cref="MediaContainer"/> containing the media info.</returns>
645645
public async Task<MediaContainer> Posters(string ratingKey) =>
646-
await this.plexServerClient.GetMediaPosterAsync(this.AccessToken, this.Uri.ToString(), ratingKey);
646+
await this.plexServerClient.GetMediaPostersAsync(this.AccessToken, this.Uri.ToString(), ratingKey);
647647
}
648648
}

Source/Plex.ServerApi/Clients/Interfaces/IPlexServerClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public interface IPlexServerClient
162162
/// <param name="plexServerHost">Plex Host Uri.</param>
163163
/// <param name="key">Rating Key.</param>
164164
/// <returns></returns>
165-
Task<MediaContainer> GetMediaPosterAsync(string authToken, string plexServerHost, string key);
165+
Task<MediaContainer> GetMediaPostersAsync(string authToken, string plexServerHost, string key);
166166

167167
/// <summary>
168168
/// Marks the Item in plex as 'Played'.

Source/Plex.ServerApi/Clients/PlexServerClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ public async Task<MediaContainer> GetChildrenMetadataAsync(string authToken, str
213213
}
214214

215215
/// <inheritdoc/>
216-
public async Task<MediaContainer> GetMediaPosterAsync(string authToken, string plexServerHost, string key) => await this.FetchWithWrapper<MediaContainer>(plexServerHost, $"library/metadata/{key}/posters", authToken, HttpMethod.Get);
216+
public async Task<MediaContainer> GetMediaPostersAsync(string authToken, string plexServerHost, string key) => await this.FetchWithWrapper<MediaContainer>(plexServerHost, $"library/metadata/{key}/posters", authToken, HttpMethod.Get);
217217

218218
/// <inheritdoc/>
219219
public async Task<PlexServer> GetPlexServerInfo(string authToken, string plexServerHost)
Lines changed: 28 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,31 @@
1-
namespace Plex.ServerApi.PlexModels.Media
2-
{
3-
using System.Collections.Generic;
4-
using System.Text.Json.Serialization;
5-
6-
public class MediaContainer
7-
{
8-
[JsonPropertyName("size")]
9-
public int Size { get; set; }
10-
11-
[JsonPropertyName("totalSize")]
12-
public int TotalSize { get; set; }
13-
14-
[JsonPropertyName("allowSync")]
15-
public bool AllowSync { get; set; }
16-
17-
[JsonPropertyName("art")]
18-
public string Art { get; set; }
19-
20-
[JsonPropertyName("identifier")]
21-
public string Identifier { get; set; }
22-
23-
[JsonPropertyName("librarySectionID")]
24-
public int LibrarySectionId { get; set; }
25-
26-
[JsonPropertyName("librarySectionTitle")]
27-
public string LibrarySectionTitle { get; set; }
28-
29-
[JsonPropertyName("librarySectionUUID")]
30-
public string LibrarySectionUuid { get; set; }
1+
namespace Plex.ServerApi.PlexModels.Media;
312

32-
[JsonPropertyName("mediaTagPrefix")]
33-
public string MediaTagPrefix { get; set; }
3+
using System.Collections.Generic;
4+
using System.Text.Json.Serialization;
345

35-
[JsonPropertyName("mediaTagVersion")]
36-
public int MediaTagVersion { get; set; }
37-
38-
[JsonPropertyName("offset")]
39-
public int Offset { get; set; }
40-
41-
[JsonPropertyName("thumb")]
42-
public string Thumb { get; set; }
43-
44-
[JsonPropertyName("title1")]
45-
public string Title1 { get; set; }
46-
47-
[JsonPropertyName("title2")]
48-
public string Title2 { get; set; }
49-
50-
[JsonPropertyName("viewGroup")]
51-
public string ViewGroup { get; set; }
52-
53-
[JsonPropertyName("viewMode")]
54-
public int ViewMode { get; set; }
55-
56-
[JsonPropertyName("Meta")]
57-
public MediaMeta Meta { get; set; }
58-
59-
[JsonPropertyName("Metadata")]
60-
public List<Metadata> Media { get; set; }
61-
}
6+
public class MediaContainer
7+
{
8+
public int Size { get; set; }
9+
public int TotalSize { get; set; }
10+
public bool AllowSync { get; set; }
11+
public string Art { get; set; }
12+
public string Identifier { get; set; }
13+
14+
[JsonPropertyName("librarySectionID")] public int LibrarySectionId { get; set; }
15+
public string LibrarySectionTitle { get; set; }
16+
17+
[JsonPropertyName("librarySectionUUID")]
18+
public string LibrarySectionUuid { get; set; }
19+
20+
public string MediaTagPrefix { get; set; }
21+
public int MediaTagVersion { get; set; }
22+
public int Offset { get; set; }
23+
public string Thumb { get; set; }
24+
public string Title1 { get; set; }
25+
public string Title2 { get; set; }
26+
public string ViewGroup { get; set; }
27+
public int ViewMode { get; set; }
28+
29+
[JsonPropertyName("Meta")] public MediaMeta Meta { get; set; }
30+
[JsonPropertyName("Metadata")] public List<Metadata> Media { get; set; }
6231
}

Tests/Plex.Library.Test/Tests/ServerTest.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,18 @@ public async void Test_GetPlayHistory()
4747
Assert.True(server.Size > 0);
4848
}
4949

50+
[Fact]
51+
public async void Test_GetPosterArt()
52+
{
53+
var server = await this.plexServerClient.GetPlexServerInfo(this.config.AuthenticationKey,
54+
this.config.Host);
55+
56+
var history = await this.plexServerClient.GetMediaPostersAsync(this.config.AuthenticationKey,
57+
this.config.Host, "288449");
58+
59+
Assert.NotNull(server);
60+
Assert.True(server.Size > 0);
61+
}
62+
5063
}
5164
}

0 commit comments

Comments
 (0)