-
Notifications
You must be signed in to change notification settings - Fork 1
/
TMDbFileEnumerator.cs
593 lines (519 loc) · 29.5 KB
/
TMDbFileEnumerator.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
#region License
/*
VPKSoft.TMDbFileUtils
A library to help enumerate both movie files and directories containing TV show seasons and the run them through the TMBb API.
Copyright © 2018 VPKSoft, Petteri Kautonen
Contact: vpksoft@vpksoft.net
This file is part of VPKSoft.TMDbFileUtils.
VPKSoft.TMDbFileUtils is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
VPKSoft.TMDbFileUtils is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with VPKSoft.TMDbFileUtils. If not, see <http://www.gnu.org/licenses/>.
*/
#endregion
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using TMdbEasy;
using TMdbEasy.ApiInterfaces;
using TMdbEasy.TmdbObjects.Movies;
using TMdbEasy.TmdbObjects.TV;
using VPKSoft.Utils;
namespace VPKSoft.TMDbFileUtils
{
/// <summary>
/// A class to contain a single movie or TV show details. This is used by the static TMDbFileEnumerator class.
/// </summary>
public class TMDbDetail
{
/// <summary>
/// A TMDb movie or TV show ID.
/// </summary>
public int ID { get; set; } = -1;
/// <summary>
/// A TMDb TV show season ID.
/// </summary>
public int SeasonID { get; set; } = -1;
/// <summary>
/// A TMDb TV show episode ID.
/// </summary>
public int EpisodeID { get; set; } = -1;
/// <summary>
/// A TMDb movie or TV show title.
/// </summary>
public string Title { get; set; } = string.Empty;
/// <summary>
/// A TMDb movie or TV show description.
/// </summary>
public string Description { get; set; } = string.Empty;
/// <summary>
/// A TMDb TV show episode description.
/// </summary>
public string DetailDescription { get; set; } = string.Empty;
/// <summary>
/// A full path to a local file.
/// </summary>
public string FileName { get; set; } = string.Empty;
/// <summary>
/// An Uri containing the URL of the TMDb movie or TV show season image.
/// </summary>
public Uri PosterOrStillURL { get; set; } = null;
/// <summary>
/// A TMBd season number of a TV show.
/// </summary>
public int Season { get; set; } = 0;
/// <summary>
/// A TMDB episode number of a TV show.
/// </summary>
public int Episode { get; set; } = 0;
}
/// <summary>
/// A class to enumerate files from the file system and then get details for these files from the TMDb database.
/// </summary>
public static class TMDbFileEnumerator
{
/// <summary>
/// Gets details for movie files from a given path from the TMDb database.
/// </summary>
/// <param name="easy">An instance to a TMdbEasy.EasyClient class instance.</param>
/// <param name="path">A path to enumerate the files from. Do note that these files names should only contain the original title of the movie.</param>
/// <param name="posterSize">The size of the poster to get the URL for.</param>
/// <returns>A collection of TMDbDetail class instances containing the movie information from the TMDb database.</returns>
public static IEnumerable<TMDbDetail> GetMovies(EasyClient easy, string path, string posterSize = "original")
{
return GetMoviesAsync(easy, path, posterSize).Result;
}
/// <summary>
/// Gets details for movie file from a given file name from the TMDb database.
/// </summary>
/// <param name="easy">An instance to a TMdbEasy.EasyClient class instance.</param>
/// <param name="fileName">A file name to get movie information from the TMDb database.</param>
/// <param name="posterSize">The size of the poster to get the URL for.</param>
/// <returns>A TMDbDetail class instance containing the movie information from the TMDb database.</returns>
public static TMDbDetail GetMovie(EasyClient easy, string fileName, string posterSize = "original")
{
return GetMovieAsync(easy, fileName, posterSize).Result;
}
/// <summary>
/// Gets details for movie file from a given file name from the TMDb database.
/// </summary>
/// <param name="easy">An instance to a TMdbEasy.EasyClient class instance.</param>
/// <param name="fileName">A file name to get movie information from the TMDb database.</param>
/// <param name="posterSize">The size of the poster to get the URL for.</param>
/// <returns>A TMDbDetail class instance containing the movie information from the TMDb database.</returns>
public static async Task<TMDbDetail> GetMovieAsync(EasyClient easy, string fileName, string posterSize = "original")
{
var movieApi = easy.GetApi<IMovieApi>().Value; // create a IMovieApi..
// get the file name without extension and without path..
string fileNameNoExt = Path.GetFileNameWithoutExtension(fileName);
// query the movie from the TMDb database..
MovieList list = await movieApi.SearchMoviesAsync(fileNameNoExt).ConfigureAwait(false);
// if something was found..
if (list != null && list.Total_results > 0)
{
return new TMDbDetail() // return the details of the movie..
{
ID = list.Results[0].Id, // the first result is only taken into account..
Title = list.Results[0].Title, // set the title..
Description = list.Results[0].Overview, // set the overview..
FileName = Path.GetFileName(fileName), // set the file name..
// create an Uri for the poster path..
PosterOrStillURL = new Uri("https://image.tmdb.org/t/p/" + posterSize + list.Results[0].Poster_path)
};
}
else // nothing was found..
{
return new TMDbDetail()
{
Title = fileNameNoExt, // the title can be the file name without path or extension..
Description = fileNameNoExt, // the description can be the file name without path or extension..
FileName = Path.GetFileName(fileName) // set the file name..
};
}
}
/// <summary>
/// Gets details for movie files from a given path from the TMDb database.
/// </summary>
/// <param name="easy">An instance to a TMdbEasy.EasyClient class instance.</param>
/// <param name="path">A path to enumerate the files from. Do note that these files names should only contain the original title of the movie.</param>
/// <param name="posterSize">The size of the poster to get the URL for.</param>
/// <returns>A collection of TMDbDetail class instances containing the movie information from the TMDb database.</returns>
public static async Task<IEnumerable<TMDbDetail>> GetMoviesAsync(EasyClient easy, string path, string posterSize = "original")
{
var movieApi = easy.GetApi<IMovieApi>().Value; // create a IMovieApi..
// List files of known video formats from the given path..
IEnumerable<FileEnumeratorFileEntry> fileEntries =
await FileEnumerator.RecurseFilesAsync(path, FileEnumerator.FiltersVideoVlcNoBinNoIso).ConfigureAwait(false);
// initialize the result..
List<TMDbDetail> result = new List<TMDbDetail>();
// loop through the files and try to get a details for them..
foreach (FileEnumeratorFileEntry entry in fileEntries)
{
// query the movie from the TMDb database..
MovieList list = await movieApi.SearchMoviesAsync(entry.FileNameNoExtension).ConfigureAwait(false);
// if something was found..
if (list != null && list.Total_results > 0)
{
result.Add(new TMDbDetail() // return the details of the movie..
{
ID = list.Results[0].Id, // the first result is only taken into account..
Title = list.Results[0].Title, // set the title..
Description = list.Results[0].Overview, // set the overview..
FileName = entry.FileName, // set the file name..
// create an Uri for the poster path..
PosterOrStillURL = new Uri("https://image.tmdb.org/t/p/" + posterSize + list.Results[0].Poster_path)
});
}
else // nothing was found..
{
result.Add(new TMDbDetail()
{
Title = entry.FileNameNoExtension, // the title can be the file name without path or extension..
Description = entry.FileNameNoExtension, // the description can be the file name without path or extension..
FileName = entry.FileName // set the file name..
});
}
}
return result;
}
/// <summary>
/// Removes the season information from a given path. E.g. SomeShow Season 1.
/// </summary>
/// <param name="path">A path to make a valid search string from.</param>
/// <returns>A string which should be suitable search string for the TMDb for a TV show.</returns>
private static string GetTVShowSearchString(string path)
{
string searchString = new DirectoryInfo(path).Name; // the last path part..
searchString = // multiple regular expressions as the programmer is not a guru with them..
Regex.Replace(searchString, @"Season [0-9]+", string.Empty, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant).Trim();
searchString =
Regex.Replace(searchString, @"S [0-9]+", string.Empty, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant).Trim();
searchString =
Regex.Replace(searchString, @"S[0-9]+", string.Empty, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant).Trim();
searchString =
Regex.Replace(searchString, @"[0-9]+", string.Empty, RegexOptions.IgnoreCase | RegexOptions.CultureInvariant).Trim();
return searchString; // return the string..
}
/// <summary>
/// Gets a TV show episode number of a given path string.
/// </summary>
/// <param name="path">A path string to get the episode number from.</param>
/// <returns>A TV show episode number.</returns>
private static int GetTVShowEpisodeNumber(string path)
{
string searchString; // = new DirectoryInfo(path).Name; // the last path part..
if (File.Exists(path))
{
searchString = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path));
}
else
{
searchString = new DirectoryInfo(path).Name;
}
string episodeNum = string.Empty; // first assume empty
// multiple regular expressions as the programmer is not a guru with them..
if ((episodeNum = Regex.Match(searchString, @"E\d+", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant).Value.TrimStart('E', 'e')) != string.Empty)
{
if (int.TryParse(episodeNum, out _)) // check for a valid integer..
{
return int.Parse(episodeNum); // ..if the integer was valid, return it..
}
}
if ((episodeNum = Regex.Match(searchString, @"X\d+", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant).Value.TrimStart('X', 'x')) != string.Empty)
{
if (int.TryParse(episodeNum, out _)) // check for a valid integer..
{
return int.Parse(episodeNum); // ..if the integer was valid, return it..
}
}
if ((episodeNum = Regex.Match(searchString, @"\d+", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant).Value) != string.Empty)
{
if (int.TryParse(episodeNum, out _)) // check for a valid integer..
{
return int.Parse(episodeNum); // ..if the integer was valid, return it..
}
}
return -1; // just return -1..
}
/// <summary>
/// Gets the TV show season number from a given path string.
/// </summary>
/// <param name="path">A path string to extract the season number from</param>
/// <returns></returns>
private static int GetTVShowSeason(string path)
{
string searchString = string.Empty;
if (File.Exists(path))
{
searchString = Path.GetDirectoryName(path);
}
else
{
searchString = new DirectoryInfo(path).Name; // the last path part..
}
searchString = Regex.Match(searchString, @"-?\d+").Value; // find a number from the path part..
if (int.TryParse(searchString, out _)) // check for a valid integer..
{
return int.Parse(searchString); // ..if the integer was valid, return it..
}
else
{
return -1; // else just return -1..
}
}
/// <summary>
/// A list of possible naming conventions for a TV show episode file name.
/// </summary>
public static List<string> EpisodeNamingStyles { get; set; } =
new List<string>(
new string[]
{
/* the episodes with only one number didn't work..
"s{0:00}e{1:00}", // SomeShow S01E01.*
"s{0}e{1}", // SomeShow S1E1.*
"s{0}e{1:00}", // SomeShow S1E01.*
"s{0:00}e{1}", // SomeShow S01E1.*
"{0:00}x{1:00}", // SomeShow 01x01.*
"{0}x{1:00}", // SomeShow 1x01.*
"{0}x{1}", // SomeShow 1x1.*
"{0:00}x{1}" // SomeShow 01x1.*
*/
// so the limited list goes as follows:
"s{0:00}e{1:00}", // SomeShow S01E01.*
"s{0}e{1:00}", // SomeShow S1E01.*
"{0:00}x{1:00}", // SomeShow 01x01.*
"{0}x{1:00}", // SomeShow 1x01.*
});
/// <summary>
/// Finds a matching file name from a give TV show season and episode number.
/// </summary>
/// <param name="fileEntries">A collection of FileEnumeratorFileEntry class instances to search for a match.</param>
/// <param name="season">A season number to be used in the search.</param>
/// <param name="episode">An episode number to be used in the search.</param>
/// <returns>A matching file name from a give TV show season and episode number from the given collection.</returns>
private static FileEnumeratorFileEntry GetFileNameMatchingTVSeasonEpisode(IEnumerable<FileEnumeratorFileEntry> fileEntries, int season, int episode)
{
FileEnumeratorFileEntry result = null; // nothing might be found..
foreach (string namingStyle in EpisodeNamingStyles) // loop through the given naming styles..
{
try // as the string format might be invalid, lets not cause the operation to fail because of that..
{
result = // try to get a result from the given collection..
fileEntries.FirstOrDefault(f => f.FileNameNoExtension.ToLowerInvariant().Contains(string.Format(namingStyle, season, episode)));
if (result != null) // if found..
{
return result; // ..return it..
}
}
catch // just an empty catch - there is no hope..
{
}
}
/* Leads to fail.. so realize name your files better!
result = // last try is just the episode number..
fileEntries.FirstOrDefault(f => f.FileNameNoExtension.Contains(episode.ToString()));
*/
return result; // return the result whether it's null or not..
}
/// <summary>
/// A format of how to give a title to a TV show episode. It must have four parameters.
/// The format is as {0} is the name of the series, {1} is the name of the season, {2} is the number of the episode
/// and {3} is the name of the episode.
/// <note type="note">Exceptions will occur if the format is incorrect.</note>
/// </summary>
public static string TVEpisodeFormat { get; set; } = "{0} {1}, Episode {2} - {3}";
/// <summary>
/// A format of how to give a title to a TV show episode. If given this will override the value of the TVEpisodeFormat property.
/// The format goes as follows:
/// #SNUM# = season number.
/// #ENUM# = episode number.
/// #EPISODE_NAME# = the name of the episode.
/// #SERIES_NAME# - the name of the series.
/// #SEASON_NAME# - the name of the season.
/// #SNUM2# = season number in two digits.
/// #ENUM2# = episode number in two digits.
/// </summary>
public static string TVEpisodeFormatCustom { get; set; } = string.Empty;
/// <summary>
/// Searches the TMDb database for a TV season based on a given path using a TMdbEasy.EasyClient class instance.
/// </summary>
/// <param name="easy">A TMdbEasy.EasyClient class instance to use for the search.</param>
/// <param name="path">A path to enumerate files from.</param>
/// <param name="stillSize">The size of the still image to get the URL for.</param>
/// <param name="excludeFileNames">File names to be left out of the search.</param>
/// <returns>A collection of TMDbDetail class instances containing the TV show season information from the TMDb database.</returns>
public static IEnumerable<TMDbDetail> GetSeason(EasyClient easy, string path, string stillSize = "original", List<string> excludeFileNames = null)
{
return GetSeasonAsync(easy, path, stillSize, excludeFileNames).Result;
}
/// <summary>
/// Gets a value indicating if a given file name is a TV show episode by the file name's format.
/// </summary>
/// <param name="fileName">A file name to check for.</param>
/// <param name="searchString">A search string used for the TMdbEasy client.</param>
/// <param name="season">A season number extracted from the file name.</param>
/// <param name="episode">An episode number extracted from the file name.</param>
/// <returns>True if the </returns>
public static bool IsTVSeasonEpisode(string fileName, out string searchString, out int season, out int episode)
{
// construct a search string of the given path..
searchString = GetTVShowSearchString(Path.GetDirectoryName(fileName));
season = GetTVShowSeason(fileName); // extract a season number from the given path..
episode = GetTVShowEpisodeNumber(fileName);
return (season != -1 && episode != -1); // return the value..
}
/// <summary>
/// Searches the TMDb database for a TV season based on a given path using a TMdbEasy.EasyClient class instance.
/// </summary>
/// <param name="easy">A TMdbEasy.EasyClient class instance to use for the search.</param>
/// <param name="path">A path to enumerate files from.</param>
/// <param name="stillSize">The size of the still image to get the URL for.</param>
/// <param name="excludeFileNames">File names to be left out of the search.</param>
/// <returns>A collection of TMDbDetail class instances containing the TV show season information from the TMDb database.</returns>
public static async Task<IEnumerable<TMDbDetail>> GetSeasonAsync(EasyClient easy, string path, string stillSize = "original", List<string> excludeFileNames = null)
{
var televisionApi = easy.GetApi<ITelevisionApi>().Value; // create a ITelevisionApi..
// avoid the null value..
excludeFileNames = excludeFileNames ?? new List<string>();
string fileName = string.Empty;
if (File.Exists(path))
{
fileName = path;
path = Path.GetDirectoryName(path);
}
// List files of known video formats from the given path..
IEnumerable<FileEnumeratorFileEntry> fileEntries =
await FileEnumerator.RecurseFilesAsync(path, FileEnumerator.FiltersVideoVlcNoBinNoIso).ConfigureAwait(false);
// remove the "useless" files from the list..
List<FileEnumeratorFileEntry> tmpFilesList = new List<FileEnumeratorFileEntry>();
// not in the include list..
if (fileName != string.Empty)
{
fileEntries = fileEntries.Where(f => f.FileNameWithPath == fileName);
}
foreach (FileEnumeratorFileEntry entry in fileEntries.ToList())
{
// excluded from the list..
if (excludeFileNames.Contains(entry.FileName))
{
continue; // ..so do continue..
}
tmpFilesList.Add(entry); // ..else add to the list..
}
fileEntries = tmpFilesList; // re-assign the list back to the source..
// don't start searching if the directory is empty - we don't want to cause excess stress for the TMDb database..
if (fileEntries.ToList().Count == 0)
{
// ..so just throw an exception..
throw new Exception("No files were found from the given path string.");
}
// construct a search string of the given path..
string searchString = GetTVShowSearchString(path);
int season = GetTVShowSeason(path); // extract a season number from the given path..
if (season == -1) // if no season number was in the given path..
{
// ..just throw an exception..
throw new Exception("The TV season number wasn't found of the given path string.");
}
// initialize the result..
List<TMDbDetail> result = new List<TMDbDetail>();
// search for TV shows base on the search string build from the given directory name..
TVShowList list = await televisionApi.SearchTVShowsAsync(searchString).ConfigureAwait(false);
// if something was found..
if (list != null && list.Total_results > 0) // ..deepen the search..
{
string seriesName = list.Results[0].Name; // save the name of the TV show..
int seriesID = list.Results[0].Id; // save the ID of the TV show..
// find the TV show season from the TMDb database with an ID and a season number..
TvSeason tvSeason = await televisionApi.GetSeasonDetailsAsync(seriesID, season).ConfigureAwait(false);
// if something was found..
if (tvSeason != null && tvSeason.Episodes != null)
{
foreach (Episode episode in tvSeason.Episodes) // return the details of the TV show season..
{
// don't return a file-less TMDbDetail class instance..
if (GetFileNameMatchingTVSeasonEpisode(fileEntries, season, episode.Episode_number) == null)
{
continue; // ..so just continue the loop..
}
result.Add(new TMDbDetail
{
ID = seriesID, // the TMDb id for the TV show..
SeasonID = tvSeason.Id, // the TMDb id for the TV show season..
EpisodeID = episode.Id, // the TMDb id for the TV show season episode..
// formulate the title base on the TVEpisodeFormat or the "overriding" TVEpisodeFormatCustom property value..
Title = TVEpisodeFormatCustom != string.Empty ?
TVEpisodeFormatCustom.
Replace("#SNUM#", tvSeason.Season_number.ToString()). // the season number as one digit..
Replace("#ENUM#", episode.Episode_number.ToString()). // the episode number as one digit..
Replace("#EPISODE_NAME#", episode.Name). // the name of the episode..
Replace("#SERIES_NAME#", seriesName). // the name of the series..
Replace("#SEASON_NAME#", tvSeason.Name). // the name of the TV show season..
Replace("#SNUM2#", string.Format("{0:00}", tvSeason.Season_number)). // the season number as two digits..
Replace("#ENUM2#", string.Format("{0:00}", episode.Episode_number)) : // the episode number as two digits..
string.Format(TVEpisodeFormat, seriesName, tvSeason.Name, episode.Episode_number, episode.Name),
// set the description..
Description = string.IsNullOrEmpty(tvSeason.Overview) ? episode.Overview : tvSeason.Overview,
DetailDescription = episode.Overview, // set the detailed description if any..
// find the file name for the TV show episode..
FileName = GetFileNameMatchingTVSeasonEpisode(fileEntries, season, episode.Episode_number).FileName,
// create an URL for the still using the TV season's poster path as a "fail safe"..
PosterOrStillURL = new Uri("https://image.tmdb.org/t/p/" + stillSize +
(string.IsNullOrEmpty(episode.Still_path) ? tvSeason.Poster_path : episode.Still_path)),
Season = season, // set the season number..
Episode = episode.Episode_number // set the episode number..
});
}
}
else // nothing was found..
{
// loop through the found files..
foreach (FileEnumeratorFileEntry entry in fileEntries)
{
result.Add(new TMDbDetail
{
Title = entry.FileNameNoExtension, // the title can be the file name without path or extension..
FileName = entry.FileName, // set the file name..
Season = season, // set the season number..
Episode = GetTVShowEpisodeNumber(entry.FileName) // set the episode number..
});
}
}
}
return result;
}
/// <summary>
/// Searches the TMDb database for a TV season based on a given path using a TMdbEasy.EasyClient class instance.
/// </summary>
/// <param name="easy">A TMdbEasy.EasyClient class instance to use for the search.</param>
/// <param name="path">A path to enumerate files from.</param>
/// <param name="excludeFileNames">File names to be left out of the search.</param>
/// <param name="stillSize">The size of the still image to get the URL for.</param>
/// <returns>A collection of TMDbDetail class instances containing the TV show season information from the TMDb database.</returns>
public static IEnumerable<TMDbDetail> GetSeason(EasyClient easy, string path, List<string> excludeFileNames, string stillSize = "original")
{
return GetSeasonAsync(easy, path, stillSize, excludeFileNames).Result;
}
/// <summary>
/// Searches the TMDb database for a TV season based on a given path using a TMdbEasy.EasyClient class instance.
/// </summary>
/// <param name="easy">A TMdbEasy.EasyClient class instance to use for the search.</param>
/// <param name="path">A path to enumerate files from.</param>
/// <param name="excludeFileNames">File names to be left out of the search.</param>
/// <param name="stillSize">The size of the still image to get the URL for.</param>
/// <returns>A collection of TMDbDetail class instances containing the TV show season information from the TMDb database.</returns>
public static async Task<IEnumerable<TMDbDetail>> GetSeasonAsync(EasyClient easy, string path, List<string> excludeFileNames, string stillSize = "original")
{
return await GetSeasonAsync(easy, path, stillSize, excludeFileNames).ConfigureAwait(false);
}
}
}