Add patterned rename and Move to, and keep settings, selection, and queue speed from resetting.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -52,9 +52,59 @@ public class RenamePlannerTests
|
||||
[File(@"C:\a\clip.mp4")],
|
||||
new RenameRuleSet { Prefix = "Clip_{Counter}_", UseCounter = true, CounterPadding = 3 });
|
||||
Assert.Equal("Clip_001_clip.mp4", plan.Preview[0].NewName);
|
||||
Assert.Contains("{Width}", new RenamePlanner().Build(
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Media_placeholders_use_supplied_tags()
|
||||
{
|
||||
var plan = new RenamePlanner().Build(
|
||||
[File(@"C:\a\clip.mp4")],
|
||||
new RenameRuleSet { Prefix = "{Width}_" }).Preview[0].NewName);
|
||||
new RenameRuleSet { Prefix = "{Width}_", NamePattern = "{Artist} - {Title}" },
|
||||
tagsByPath: new Dictionary<string, MediaTagFields>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
[@"C:\a\clip.mp4"] = new()
|
||||
{
|
||||
Width = 1920,
|
||||
Artist = "Queen",
|
||||
Title = "Bohemian Rhapsody",
|
||||
Stem = "clip",
|
||||
Extension = "mp4"
|
||||
}
|
||||
});
|
||||
Assert.Equal("1920_Queen - Bohemian Rhapsody.mp4", plan.Preview[0].NewName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Online_only_media_placeholder_is_an_error()
|
||||
{
|
||||
var plan = new RenamePlanner().Build(
|
||||
[File(@"C:\cloud\clip.mp4")],
|
||||
new RenameRuleSet { Prefix = "{Artist}_" },
|
||||
tagsByPath: new Dictionary<string, MediaTagFields>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
[@"C:\cloud\clip.mp4"] = new() { HydrationBlocked = true, Stem = "clip", Extension = "mp4" }
|
||||
});
|
||||
Assert.False(plan.CanEnqueue);
|
||||
Assert.Contains(plan.Issues, i => i.Message.Contains("online-only", StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Project_and_taken_placeholders_expand()
|
||||
{
|
||||
var plan = new RenamePlanner().Build(
|
||||
[File(@"C:\src\Explorer\photos\DSC_001.jpg")],
|
||||
new RenameRuleSet { NamePattern = "{Project}_{TakenDate:yyyyMMdd}_{Name}" },
|
||||
tagsByPath: new Dictionary<string, MediaTagFields>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
[@"C:\src\Explorer\photos\DSC_001.jpg"] = new()
|
||||
{
|
||||
Project = "Explorer",
|
||||
Taken = new DateTimeOffset(new DateTime(2024, 8, 26, 0, 0, 0, DateTimeKind.Local)),
|
||||
Stem = "DSC_001",
|
||||
Extension = "jpg"
|
||||
}
|
||||
});
|
||||
Assert.Equal("Explorer_20240826_DSC_001.jpg", plan.Preview[0].NewName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
Reference in New Issue
Block a user