mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2025-12-30 19:40:44 -06:00
FF-1981: TV Show Lookup using cache
This commit is contained in:
@@ -78,12 +78,25 @@ public class TVShowLookup : Node
|
||||
args.Logger?.ILog("Lookup TV Show: " + lookupName);
|
||||
|
||||
string tvShowInfoCacheKey = $"TVShowInfo: {lookupName} ({year})";
|
||||
TVShowInfo result = args.Cache.GetObject<TVShowInfo>(tvShowInfoCacheKey);
|
||||
if (result != null)
|
||||
TVShowInfo result = null;
|
||||
var showInfoJson = args.Cache.GetJson(tvShowInfoCacheKey);
|
||||
if(string.IsNullOrWhiteSpace(showInfoJson) == false)
|
||||
{
|
||||
args.Logger?.ILog("Got TV show info from cache: " + result.Name + "\n" + System.Text.Json.JsonSerializer.Serialize(result));
|
||||
try
|
||||
{
|
||||
result = System.Text.Json.JsonSerializer.Deserialize<TVShowInfo>(showInfoJson);
|
||||
if (result != null)
|
||||
{
|
||||
args.Logger?.ILog("Got TV show info from cache: " + result.Name + "\n" + System.Text.Json.JsonSerializer.Serialize(result));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
args.Logger?.WLog("Failed to deserialize TV SHow Info Json: " + ex.Message + "\n" + showInfoJson);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (result == null)
|
||||
{
|
||||
result = LookupShow(lookupName, year);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user