完善
This commit is contained in:
parent
c82a22bf31
commit
79eaeb24c2
@ -38,7 +38,7 @@ public partial class MainTreePanel : Tree
|
|||||||
SetColumnTitlesVisible(true);
|
SetColumnTitlesVisible(true);
|
||||||
|
|
||||||
SetColumnTitle(0, "文件名");
|
SetColumnTitle(0, "文件名");
|
||||||
SetColumnCustomMinimumWidth(0, 400);
|
SetColumnCustomMinimumWidth(0, 500);
|
||||||
SetColumnExpand(0, true);
|
SetColumnExpand(0, true);
|
||||||
|
|
||||||
MultiSelected += OnMultiSelected;
|
MultiSelected += OnMultiSelected;
|
||||||
|
|||||||
37
FileMover.cs
37
FileMover.cs
@ -25,6 +25,12 @@ public class FileMover(string targetPath, bool preview)
|
|||||||
|
|
||||||
path = $"{title} ({year})/";
|
path = $"{title} ({year})/";
|
||||||
|
|
||||||
|
|
||||||
|
if (node.TryGetValue(ItemFields.Key_SeasonOffsetBase, out var seasonBase, out _))
|
||||||
|
{
|
||||||
|
season = seasonBase;
|
||||||
|
}
|
||||||
|
|
||||||
if (int.TryParse(season, out var seasonNum))
|
if (int.TryParse(season, out var seasonNum))
|
||||||
{
|
{
|
||||||
path += $"Season {seasonNum}";
|
path += $"Season {seasonNum}";
|
||||||
@ -54,11 +60,21 @@ public class FileMover(string targetPath, bool preview)
|
|||||||
filenameParts.Add($"({year})");
|
filenameParts.Add($"({year})");
|
||||||
|
|
||||||
var seasonAndEpisodePart = "";
|
var seasonAndEpisodePart = "";
|
||||||
|
|
||||||
|
if (node.TryGetValue(ItemFields.Key_SeasonOffsetBase, out var seasonBase, out _))
|
||||||
|
{
|
||||||
|
season = seasonBase;
|
||||||
|
}
|
||||||
if (int.TryParse(season, out var seasonNum))
|
if (int.TryParse(season, out var seasonNum))
|
||||||
{
|
{
|
||||||
seasonAndEpisodePart += $"S{NumToString(seasonNum)}";
|
seasonAndEpisodePart += $"S{NumToString(seasonNum)}";
|
||||||
}
|
}
|
||||||
var episodeNum = int.Parse(episode);
|
|
||||||
|
if (!node.TryGetValue(ItemFields.Key_EpisodeOffset, out var episodeOffset, out _) || !int.TryParse(episodeOffset, out var episodeOffsetNum))
|
||||||
|
{
|
||||||
|
episodeOffsetNum = 0;
|
||||||
|
}
|
||||||
|
var episodeNum = int.Parse(episode) + episodeOffsetNum;
|
||||||
seasonAndEpisodePart += $"E{NumToString(episodeNum)}";
|
seasonAndEpisodePart += $"E{NumToString(episodeNum)}";
|
||||||
filenameParts.Add(seasonAndEpisodePart);
|
filenameParts.Add(seasonAndEpisodePart);
|
||||||
|
|
||||||
@ -67,16 +83,28 @@ public class FileMover(string targetPath, bool preview)
|
|||||||
metaParts.Add(group);
|
metaParts.Add(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (node.TryGetValue(ItemFields.Key_TMDBID, out var tmdbid, out _))
|
||||||
|
{
|
||||||
|
metaParts.Add($"tmdbid-{tmdbid}");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (node.TryGetValue(ItemFields.Key_ExtraMeta, out var extraMeta, out _))
|
||||||
|
{
|
||||||
|
metaParts.Add(extraMeta);
|
||||||
|
}
|
||||||
|
|
||||||
|
var filename = string.Join(" ", string.Join(" ", filenameParts), string.Join("", metaParts.Select(part => $"[{part}]")));
|
||||||
|
|
||||||
if (type == ItemFields.ItemType.Subtitle.ToString())
|
if (type == ItemFields.ItemType.Subtitle.ToString())
|
||||||
{
|
{
|
||||||
if (node.TryGetValue(ItemFields.Key_SubtitleLanguage, out var subLang, out _))
|
if (node.TryGetValue(ItemFields.Key_SubtitleLanguage, out var subLang, out _))
|
||||||
{
|
{
|
||||||
metaParts.Add(subLang);
|
filename += "." + subLang;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var filename = string.Join(" ", string.Join(" ", filenameParts), string.Join("", metaParts.Select(part => $"[{part}]")));
|
|
||||||
filename += Path.GetExtension(path);
|
filename += Path.GetExtension(path);
|
||||||
|
|
||||||
var target = string.Join("/", targetPath, relativePath, filename);
|
var target = string.Join("/", targetPath, relativePath, filename);
|
||||||
MoveIt(node, target);
|
MoveIt(node, target);
|
||||||
}
|
}
|
||||||
@ -84,10 +112,11 @@ public class FileMover(string targetPath, bool preview)
|
|||||||
private void MoveExtra(TreeNode node)
|
private void MoveExtra(TreeNode node)
|
||||||
{
|
{
|
||||||
if (!TryGetPath(node, out var relativePath)) return;
|
if (!TryGetPath(node, out var relativePath)) return;
|
||||||
|
if (!node.TryGetValue(ItemFields.Key_Season, out var season, out _)) return;
|
||||||
|
|
||||||
var path = node.Info.MainInfo[ItemFields.MainKey_Path];
|
var path = node.Info.MainInfo[ItemFields.MainKey_Path];
|
||||||
var name = Path.GetFileName(path);
|
var name = Path.GetFileName(path);
|
||||||
var target = string.Join("/", targetPath, relativePath, "Extra", name);
|
var target = string.Join("/", targetPath, relativePath, "extras", $"Season {season}", name);
|
||||||
MoveIt(node, target);
|
MoveIt(node, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -62,8 +62,8 @@ layout_mode = 2
|
|||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_stretch_ratio = 7.0
|
size_flags_stretch_ratio = 7.0
|
||||||
theme_override_font_sizes/font_size = 8
|
theme_override_font_sizes/font_size = 14
|
||||||
theme_override_font_sizes/title_button_font_size = 12
|
theme_override_font_sizes/title_button_font_size = 14
|
||||||
allow_search = false
|
allow_search = false
|
||||||
hide_root = true
|
hide_root = true
|
||||||
select_mode = 2
|
select_mode = 2
|
||||||
|
|||||||
@ -47,8 +47,10 @@ public static class ItemFields
|
|||||||
|
|
||||||
public static string Key_TMDBID => "TMDBID";
|
public static string Key_TMDBID => "TMDBID";
|
||||||
|
|
||||||
public static string Key_Offset => "EpisodeOffset";
|
public static string Key_EpisodeOffset => "EpisodeOffset";
|
||||||
|
|
||||||
|
public static string Key_SeasonOffsetBase => "SeasonOffsetBase";
|
||||||
|
public static string Key_ExtraMeta => "ExtraMeta";
|
||||||
|
|
||||||
public static ItemType Type(this Item item)
|
public static ItemType Type(this Item item)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -17,8 +17,8 @@ config/icon="res://icon.svg"
|
|||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/viewport_width=1600
|
window/size/viewport_width=1920
|
||||||
window/size/viewport_height=900
|
window/size/viewport_height=1080
|
||||||
window/stretch/mode="canvas_items"
|
window/stretch/mode="canvas_items"
|
||||||
window/stretch/aspect="expand"
|
window/stretch/aspect="expand"
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user