Merge pull request 'df-seriesnum-patchv2' (#44) from df/webif:df-seriesnum-patch into master

Reviewed-on: #44
This commit is contained in:
af123 2021-03-22 21:57:07 +00:00
commit 33e2f705c3
2 changed files with 16 additions and 6 deletions

View File

@ -28,14 +28,16 @@ if {[file isdirectory $file]} {
set old [$ts get $attr] set old [$ts get $attr]
if {$attr eq "title" || $attr eq "synopsis"} { if {$attr eq "title" || $attr eq "synopsis"} {
set new "\025$new" set new "\025$new"
} elseif {$attr eq "genre"} {
set new [ts genre $new]
} }
if {$new ne $old} { if {$new ne $old} {
if {$attr eq guidance || $new ne ""} { if {$attr eq "guidance" || $new ne ""} {
$ts set$attr $new $ts set$attr $new
} }
} }
} msg]} { } msg]} {
puts "$attr: $msg" stderr puts "$attr: $msg"
} }
} }
# deal with series number/ep num/ep total, which get set together # deal with series number/ep num/ep total, which get set together
@ -69,7 +71,7 @@ if {[file isdirectory $file]} {
lappend epdatanew $old lappend epdatanew $old
} }
} msg]} { } msg]} {
puts "$attr: $msg" stderr puts "$attr: $msg"
} }
} }
if {$epdatanew ne {}} { if {$epdatanew ne {}} {

View File

@ -322,10 +322,18 @@ ts method setguidance {newguidance} {
set guidance $newguidance set guidance $newguidance
} }
ts method setgenre {newgenre} { proc {ts genre} {genre} {
if {$newgenre <= 15} { if {![string is integer $genre] || $genre < 0} {
set newgenre $($newgenre << 4) 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 exec /mod/bin/hmt "+setgenre=-${newgenre}" $file
set genre $newgenre set genre $newgenre
} }