diff --git a/webif/html/browse/rename.jim b/webif/html/browse/rename.jim
index c141ae7..6f7f31d 100755
--- a/webif/html/browse/rename.jim
+++ b/webif/html/browse/rename.jim
@@ -28,14 +28,16 @@ if {[file isdirectory $file]} {
set old [$ts get $attr]
if {$attr eq "title" || $attr eq "synopsis"} {
set new "\025$new"
+ } elseif {$attr eq "genre"} {
+ set new [ts genre $new]
}
if {$new ne $old} {
- if {$attr eq guidance || $new ne ""} {
+ if {$attr eq "guidance" || $new ne ""} {
$ts set$attr $new
}
}
} msg]} {
- puts "$attr: $msg"
+ stderr puts "$attr: $msg"
}
}
# deal with series number/ep num/ep total, which get set together
@@ -69,7 +71,7 @@ if {[file isdirectory $file]} {
lappend epdatanew $old
}
} msg]} {
- puts "$attr: $msg"
+ stderr puts "$attr: $msg"
}
}
if {$epdatanew ne {}} {
diff --git a/webif/lib/ts.class b/webif/lib/ts.class
index b38c97a..bcfe270 100644
--- a/webif/lib/ts.class
+++ b/webif/lib/ts.class
@@ -322,10 +322,18 @@ ts method setguidance {newguidance} {
set guidance $newguidance
}
-ts method setgenre {newgenre} {
- if {$newgenre <= 15} {
- set newgenre $($newgenre << 4)
+proc {ts genre} {genre} {
+ if {![string is integer $genre] || $genre < 0} {
+ set genre 0
}
+ if {$genre <= 15} {
+ set genre $($genre << 4)
+ }
+ return $genre
+}
+
+ts method setgenre {newgenre} {
+ set newgenre [ts genre $newgenre]
exec /mod/bin/hmt "+setgenre=-${newgenre}" $file
set genre $newgenre
}