mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2026-02-19 21:40:05 -06:00
FF-1423 - added use folder name to tv episode lookup
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,7 @@
|
||||
using DM.MovieApi;
|
||||
using DM.MovieApi.MovieDb.TV;
|
||||
using FileFlows.Plugin;
|
||||
using FileFlows.Plugin.Attributes;
|
||||
|
||||
namespace MetaNodes.TheMovieDb;
|
||||
|
||||
@@ -36,6 +37,12 @@ public class TVEpisodeLookup : Node
|
||||
/// Gets the Variables this flow element provides
|
||||
/// </summary>
|
||||
public override Dictionary<string, object> Variables => _Variables;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets if the folder name should be used
|
||||
/// </summary>
|
||||
[Boolean(1)]
|
||||
public bool UseFolderName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance of this flow element
|
||||
@@ -65,10 +72,10 @@ public class TVEpisodeLookup : Node
|
||||
public override int Execute(NodeParameters args)
|
||||
{
|
||||
string filename = args.FileName.Replace("\\", "/");
|
||||
filename = filename.Substring(filename.LastIndexOf("/", StringComparison.Ordinal) + 1);
|
||||
filename = filename.Substring(0, filename.LastIndexOf(".", StringComparison.Ordinal));
|
||||
filename = filename[(filename.LastIndexOf("/", StringComparison.Ordinal) + 1)..];
|
||||
filename = filename[..filename.LastIndexOf(".", StringComparison.Ordinal)];
|
||||
|
||||
(string lookupName, string year) = TVShowLookup.GetLookupName(filename, false);
|
||||
(string lookupName, string year) = TVShowLookup.GetLookupName(filename, UseFolderName);
|
||||
|
||||
(string showName, int? season, int? episode, int? lastEpisode, string year2) = TVShowLookup.GetTVShowInfo(filename);
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ public class TVShowLookup : Node
|
||||
if (useFolderName)
|
||||
{
|
||||
lookupName = fileInfo.Directory.Name;
|
||||
if (Regex.IsMatch(lookupName, "^(Season|Staffel|Saison)", RegexOptions.IgnoreCase))
|
||||
if (Regex.IsMatch(lookupName, "^(Season|Staffel|Saison|Specials)", RegexOptions.IgnoreCase))
|
||||
lookupName = fileInfo.Directory.Parent.Name;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -67,6 +67,10 @@
|
||||
"Outputs": {
|
||||
"1": "TV Episode found",
|
||||
"2": "TV Episode NOT found"
|
||||
},
|
||||
"Fields": {
|
||||
"UseFolderName": "Use Folder Name",
|
||||
"UseFolderName-Help": "If the folder name should be used instead of the filename.\n\nNote if the folder starts with Season or Staffel or Saison the parent folder will be used."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ public class VideoHasStream : VideoNode
|
||||
{
|
||||
_StreamTypeOptions = new List<ListOption>
|
||||
{
|
||||
new ListOption { Label = "Video", Value = "Video" },
|
||||
new ListOption { Label = "Audio", Value = "Audio" },
|
||||
new ListOption { Label = "Subtitle", Value = "Subtitle" }
|
||||
new () { Label = "Video", Value = "Video" },
|
||||
new () { Label = "Audio", Value = "Audio" },
|
||||
new () { Label = "Subtitle", Value = "Subtitle" }
|
||||
};
|
||||
}
|
||||
return _StreamTypeOptions;
|
||||
|
||||
Reference in New Issue
Block a user