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

Reviewed-on: hummypkg/webif#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]
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 {}} {

View File

@ -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
}