Skip to content

Commit 524a596

Browse files
committed
Update to 1.9.0.0
1 parent fadf2db commit 524a596

File tree

13 files changed

+104
-162
lines changed

13 files changed

+104
-162
lines changed

IMDbAPI_Client/IMDbAPI_Client.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
<ApplicationIcon>ProjectIcon.ico</ApplicationIcon>
5252
</PropertyGroup>
5353
<ItemGroup>
54-
<Reference Include="IMDbApiLib, Version=1.8.0.0, Culture=neutral, processorArchitecture=MSIL">
55-
<HintPath>..\packages\IMDbApiLib.1.8.0\lib\net46\IMDbApiLib.dll</HintPath>
54+
<Reference Include="IMDbApiLib, Version=1.9.0.0, Culture=neutral, processorArchitecture=MSIL">
55+
<HintPath>..\packages\IMDbApiLib.1.9.0\lib\net46\IMDbApiLib.dll</HintPath>
5656
</Reference>
5757
<Reference Include="MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
5858
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.dll</HintPath>
@@ -64,7 +64,7 @@
6464
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.Fonts.dll</HintPath>
6565
</Reference>
6666
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
67-
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
67+
<HintPath>..\packages\Newtonsoft.Json.13.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
6868
</Reference>
6969
<Reference Include="System" />
7070
<Reference Include="System.ComponentModel.Annotations, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">

IMDbAPI_Client/Models/ClientOptions.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ public class ClientOptions
99
// Default values
1010
public ClientOptions()
1111
{
12-
PlotLanguage = Language.fa;
12+
PlotLanguage = Language.en;
1313
Report_Ratings = true;
1414
Posters = true;
1515
Posters_EnglishOnly = true;
1616
Report = true;
17-
Subtitles = true;
18-
Subtitles_Language = SubtitleLanguage.Fa;
1917
Images_Short = true;
2018
}
2119

@@ -34,9 +32,6 @@ public ClientOptions()
3432
public bool Posters_EnglishOnly { get; set; }
3533

3634

37-
public bool Subtitles { get; set; }
38-
public SubtitleLanguage Subtitles_Language { get; set; }
39-
4035
public bool Images { get; set; }
4136
public bool Images_Short { get; set; }
4237
public bool Images_Full { get; set; }
@@ -46,6 +41,8 @@ public ClientOptions()
4641

4742
public bool ExternalSites { get; set; }
4843

44+
public bool ResizeImagesAndPosters { get; set; }
45+
4946
public override string ToString()
5047
{
5148
var sb = new StringBuilder();

IMDbAPI_Client/MoreInfoForm.cs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,19 +78,33 @@ private async void MoreInfoForm_Shown(object sender, EventArgs e)
7878
lblCompany.Text = data.Companies;
7979
lblRuntime.Text = data.RuntimeStr;
8080
lblGenre.Text = string.Join(", ", data.GenreList.Select(cx => cx.Key));
81-
82-
data.Image = data.Image.Replace("/original/", "/224x308/");
83-
using (var wc = new WebClient())
81+
if (Properties.Settings.Default.ClientOptions.ResizeImagesAndPosters)
8482
{
85-
picPoster.Image = ClientUtils.BytesToImage(await wc.DownloadDataTaskAsync(data.Image));
83+
var imageBytes = await _apiLib.ResizeImageBytesAsync("224x308", data.Image);
84+
picPoster.Image = ClientUtils.BytesToImage(imageBytes);
85+
}
86+
else
87+
{
88+
using (var webClient = new WebClient())
89+
{
90+
picPoster.Image = ClientUtils.BytesToImage(await webClient.DownloadDataTaskAsync(data.Image));
91+
}
8692
}
87-
8893
foreach (var act in data.ActorList.Take(6))
8994
{
9095
var uc = new CastUserControl();
91-
act.Image = act.Image.Replace("/original/", "/96x132/");
92-
using (var wc = new WebClient())
93-
uc.CastImage = ClientUtils.BytesToImage(await wc.DownloadDataTaskAsync(act.Image));
96+
if (Properties.Settings.Default.ClientOptions.ResizeImagesAndPosters)
97+
{
98+
var imageBytes = await _apiLib.ResizeImageBytesAsync("96x132", act.Image);
99+
uc.CastImage = ClientUtils.BytesToImage(imageBytes);
100+
}
101+
else
102+
{
103+
using (var webClient = new WebClient())
104+
{
105+
uc.CastImage = ClientUtils.BytesToImage(await webClient.DownloadDataTaskAsync(act.Image));
106+
}
107+
}
94108
uc.CastName = act.Name;
95109
uc.CastAsCharacter = act.AsCharacter;
96110

IMDbAPI_Client/MoreInfoForm.designer.cs

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

IMDbAPI_Client/Properties/AssemblyInfo.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
// set of attributes. Change these attribute values to modify the information
66
// associated with an assembly.
77
[assembly: AssemblyTitle("IMDbAPI Client")]
8-
[assembly: AssemblyDescription("For manage and organize movies and series")]
8+
[assembly: AssemblyDescription("Manage and organize movies and series")]
99
[assembly: AssemblyConfiguration("")]
1010
[assembly: AssemblyCompany("IMDb-API")]
1111
[assembly: AssemblyProduct("IMDbAPI Client")]
12-
[assembly: AssemblyCopyright("Copyright © 2021")]
12+
[assembly: AssemblyCopyright("Copyright © 2022")]
1313
[assembly: AssemblyTrademark("")]
1414
[assembly: AssemblyCulture("")]
1515

@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("1.6.2.0")]
35-
[assembly: AssemblyFileVersion("1.6.2.0")]
34+
[assembly: AssemblyVersion("1.9.0.0")]
35+
[assembly: AssemblyFileVersion("1.9.0.0")]

IMDbAPI_Client/SearchForm.cs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,16 @@ public SearchForm(SearchData searchData)
2525

2626
string apiKey = Properties.Settings.Default.ApiKey;
2727
if (Properties.Settings.Default.UseProxy)
28+
{
2829
_apiLib = new ApiLib(apiKey,
2930
Properties.Settings.Default.ProxyAddress,
3031
Properties.Settings.Default.ProxyUsername,
3132
Properties.Settings.Default.ProxyPassword);
33+
}
3234
else
35+
{
3336
_apiLib = new ApiLib(apiKey);
37+
}
3438
}
3539

3640
private readonly ApiLib _apiLib;
@@ -40,9 +44,13 @@ private List<MovieResult> _results
4044
get
4145
{
4246
var rs = new List<MovieResult>();
43-
if (_searchData != null && _searchData.Results != null)
47+
if (_searchData != null && _searchData.Results != null && _searchData.Results.Count > 0)
48+
{
4449
foreach (var r in _searchData.Results)
50+
{
4551
rs.Add(new MovieResult(r.Id, $"{r.Title} {r.Description}"));
52+
}
53+
}
4654
return rs;
4755
}
4856
}
@@ -113,6 +121,10 @@ private void FillListBox()
113121
lbResults.DisplayMember = "Title";
114122
lbResults.ValueMember = "Id";
115123
lbResults.DataSource = _results;
124+
if (_results != null && _results.Count > 0)
125+
{
126+
lbResults.SelectedIndex = 0;
127+
}
116128
}
117129

118130
private void btnOK_Click(object sender, EventArgs e)
@@ -161,10 +173,17 @@ private async void lbSearchMovie_SelectedIndexChanged(object sender, EventArgs e
161173

162174
EnableControlls(false);
163175
picPoster.Image = null;
164-
item.Image = item.Image.Replace("/original/", "/224x308/");
165-
using (var wc = new WebClient())
176+
if (Properties.Settings.Default.ClientOptions.ResizeImagesAndPosters)
177+
{
178+
var imageBytes = await _apiLib.ResizeImageBytesAsync("224x308", item.Image);
179+
picPoster.Image = ClientUtils.BytesToImage(imageBytes);
180+
}
181+
else
166182
{
167-
picPoster.Image = ClientUtils.BytesToImage(await wc.DownloadDataTaskAsync(item.Image));
183+
using (var webClient = new WebClient())
184+
{
185+
picPoster.Image = ClientUtils.BytesToImage(await webClient.DownloadDataTaskAsync(item.Image));
186+
}
168187
}
169188
EnableControlls(true);
170189
}

IMDbAPI_Client/SettingsForm.designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

IMDbAPI_Client/UserControls/Step2_SearchUC.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ protected override async void OnLoad(EventArgs e)
112112
return;
113113
}
114114

115-
if (data.Results.Count == 1)
115+
if (data.Results != null && data.Results.Count == 1)
116116
{
117117
var result = data.Results.First();
118118
var titleData = await _apiLib.TitleAsync(result.Id);

0 commit comments

Comments
 (0)