summaryrefslogtreecommitdiff
path: root/SetMediaTag.cs
diff options
context:
space:
mode:
authorJake Mannens <jake@asger.xyz>2026-06-15 12:54:44 +1000
committerJake Mannens <jake@asger.xyz>2026-06-15 12:54:44 +1000
commitd36e27387eabf88845d364b9d3a2da54a583247f (patch)
tree716058aac0b72c1ec1bb0b7eb47d4e3a87926299 /SetMediaTag.cs
parentab46387d4d02e30b171a7c2fa07947b41ec691a0 (diff)
Diffstat (limited to 'SetMediaTag.cs')
-rw-r--r--SetMediaTag.cs19
1 files changed, 12 insertions, 7 deletions
diff --git a/SetMediaTag.cs b/SetMediaTag.cs
index 8931991..dc2bbd7 100644
--- a/SetMediaTag.cs
+++ b/SetMediaTag.cs
@@ -1,22 +1,27 @@
-using HyperBooru.ApiClient;
-using System.Management.Automation;
+using System.Management.Automation;
namespace HyperBooru.PowerShell;
[Alias("shbmt")]
[Cmdlet(VerbsCommon.Set, "HyperBooruMediaTag")]
-public class SetMediaTagCmdlet : PSCmdlet {
- [Parameter(Position = 0, Mandatory = true)]
- public required HBSession Session { get; set; }
-
+public class SetMediaTagCmdlet : SessionCmdlet {
[Parameter(Position = 1, Mandatory = true)]
public Guid MediaId { get; set; }
[Parameter(Position = 2, Mandatory = true)]
public Guid[] TagId { get; set; }
- protected override void ProcessRecord() =>
+ protected override void ProcessRecord() {
Session.Media.ReplaceTagsAsync(MediaId, TagId)
.GetAwaiter()
.GetResult();
+
+ var id = MediaId.ToString().ToUpper();
+ var tags = TagId
+ .Order()
+ .Distinct()
+ .Select(t => t.ToString().ToUpper());
+
+ WriteVerbose($"Set tags for media item {id} to {string.Join(", ", tags)}");
+ }
}