forked from hummypkg/webif
Support setting the seriesnum, episodenum, episodetot attributes in "rename"
This commit is contained in:
parent
1c868ae201
commit
18bed926b3
|
@ -103,7 +103,7 @@ if {[llength $plugins(dmenu)]} {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# the maxlength values for title and synopsis are 1 less than the maximum to
|
# the maxlength values for title and synopsis are 1 less than the maximum to
|
||||||
# allow for an extra byte to indicate character encoding (see rename.jim)
|
# allow for an extra byte to indicate character encoding (see rename.jim)
|
||||||
puts {
|
puts {
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -138,13 +138,44 @@ puts {
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr style="display: none" class=tstype>
|
||||||
|
<th>
|
||||||
|
<label for="rename_seriesnum" style="padding-top: 0.5em">
|
||||||
|
<b>New Series Number</b>
|
||||||
|
</label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<span title="Series number">
|
||||||
|
<input type=number name="rename_seriesnum" id="rename_seriesnum"
|
||||||
|
value=0 max=255
|
||||||
|
class="uint8_t ui-widget-content ui-corner-all">
|
||||||
|
</span>
|
||||||
|
<label for="rename_episodenum" style="padding-top: 0.5em">
|
||||||
|
<b>Episode</b>
|
||||||
|
</label>
|
||||||
|
<span title="Episode number">
|
||||||
|
<input type=number name="rename_episodenum"
|
||||||
|
id="rename_episodenum" value=0 max=255
|
||||||
|
class="uint8_t ui-widget-content ui-corner-all">
|
||||||
|
</span>
|
||||||
|
<label for="rename_episodetot" style="padding-top: 0.5em">
|
||||||
|
<b>of</b>
|
||||||
|
</label>
|
||||||
|
<span title="Episode total">
|
||||||
|
<input type=number name="rename_episodetot"
|
||||||
|
id="rename_episodetot" value=0 max=255
|
||||||
|
class="uint8_t ui-widget-content ui-corner-all">
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr style="display: none" class=tstype>
|
<tr style="display: none" class=tstype>
|
||||||
<th>
|
<th>
|
||||||
<label for="rename_synopsis" style="padding-top: 0.5em">
|
<label for="rename_synopsis" style="padding-top: 0.5em">
|
||||||
<b>New Synopsis</b>
|
<b>New Synopsis</b>
|
||||||
</label>
|
</label>
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td colspan=3>
|
||||||
<textarea name="rename_synopsis" id="rename_synopsis"
|
<textarea name="rename_synopsis" id="rename_synopsis"
|
||||||
value="" cols=70 rows=4 maxlength=251
|
value="" cols=70 rows=4 maxlength=251
|
||||||
class="text ui-widget-content ui-corner-all"></textarea>
|
class="text ui-widget-content ui-corner-all"></textarea>
|
||||||
|
|
|
@ -14,6 +14,9 @@ puts "{"
|
||||||
puts "\"title\" : \"[jescape [$ts get title]]\","
|
puts "\"title\" : \"[jescape [$ts get title]]\","
|
||||||
puts "\"synopsis\" : \"[jescape [$ts get synopsis]]\","
|
puts "\"synopsis\" : \"[jescape [$ts get synopsis]]\","
|
||||||
puts "\"guidance\" : \"[jescape [$ts get guidance]]\","
|
puts "\"guidance\" : \"[jescape [$ts get guidance]]\","
|
||||||
puts "\"genre\" : [jescape [$ts genrenib]]"
|
puts "\"genre\" : [jescape [$ts genrenib]],"
|
||||||
|
puts "\"seriesnum\" : [jescape [$ts get seriesnum]],"
|
||||||
|
puts "\"episodenum\" : [jescape [$ts get episodenum]],"
|
||||||
|
puts "\"episodetot\" : [jescape [$ts get episodetot]]"
|
||||||
puts "}"
|
puts "}"
|
||||||
|
|
||||||
|
|
|
@ -30,8 +30,7 @@ if {[file isdirectory $file]} {
|
||||||
set new "\025$new"
|
set new "\025$new"
|
||||||
}
|
}
|
||||||
if {$new ne $old} {
|
if {$new ne $old} {
|
||||||
if {$attr eq "guidance" ||
|
if {$attr eq guidance || $new ne ""} {
|
||||||
[string length $new] > 0} {
|
|
||||||
$ts set$attr $new
|
$ts set$attr $new
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,6 +38,45 @@ if {[file isdirectory $file]} {
|
||||||
puts "$attr: $msg"
|
puts "$attr: $msg"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
# deal with series number/ep num/ep total, which get set together
|
||||||
|
# list the old values seen in case a later one is changed
|
||||||
|
set epdataold {}
|
||||||
|
# list values to be set, or {}
|
||||||
|
set epdatanew {}
|
||||||
|
foreach attr {seriesnum episodenum episodetot} {
|
||||||
|
if {[catch {
|
||||||
|
set new [string map {"\n" ""} [
|
||||||
|
string trim [cgi_get "rename_$attr"]]]
|
||||||
|
set old [$ts get $attr]
|
||||||
|
if {$new ne $old} {
|
||||||
|
switch $attr {
|
||||||
|
seriesnum {
|
||||||
|
set epdatanew [list $new]
|
||||||
|
}
|
||||||
|
episodenum -
|
||||||
|
episodetot {
|
||||||
|
if {$epdatanew eq {}} {
|
||||||
|
set epdatanew $epdataold
|
||||||
|
}
|
||||||
|
lappend epdatanew $new
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} elseif {$epdatanew eq {}} {
|
||||||
|
# nothing to be changed yet
|
||||||
|
lappend epdataold $old
|
||||||
|
} else {
|
||||||
|
# fill to-be-set list with old value
|
||||||
|
lappend epdatanew $old
|
||||||
|
}
|
||||||
|
} msg]} {
|
||||||
|
puts "$attr: $msg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if {$epdatanew ne {}} {
|
||||||
|
if {[catch {$ts storeepisode $epdatanew} msg]} {
|
||||||
|
puts "ts::storeepisode: $msg"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if {"$dir/$newfile.ts" ne "$file"} { ts renamegroup $file $newfile }
|
if {"$dir/$newfile.ts" ne "$file"} { ts renamegroup $file $newfile }
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -105,6 +105,9 @@ function epginfo_callback(data, status, xhr)
|
||||||
$('#rename_synopsis').val(data.synopsis);
|
$('#rename_synopsis').val(data.synopsis);
|
||||||
$('#rename_guidance').val(data.guidance);
|
$('#rename_guidance').val(data.guidance);
|
||||||
$('#rename_genre').val(data.genre);
|
$('#rename_genre').val(data.genre);
|
||||||
|
$('#rename_seriesnum').val(data.seriesnum);
|
||||||
|
$('#rename_episodenum').val(data.episodenum);
|
||||||
|
$('#rename_episodetot').val(data.episodetot);
|
||||||
|
|
||||||
$('tr.tstype').show('slow');
|
$('tr.tstype').show('slow');
|
||||||
}
|
}
|
||||||
|
@ -113,11 +116,11 @@ function insert_folder_size(folder, size)
|
||||||
{
|
{
|
||||||
// folder = folder.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
|
// folder = folder.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/@])/g, '\\$1');
|
||||||
// ID of size element is ID + RFC4648 s5 encoding of folder name
|
// ID of size element is ID + RFC4648 s5 encoding of folder name
|
||||||
folder = "ID" +
|
folder = "ID" +
|
||||||
btoa(escape(folder))
|
btoa(escape(folder))
|
||||||
.replace(/\+/g, '-')
|
.replace(/\+/g, '-')
|
||||||
.replace(/\//g, '_')
|
.replace(/\//g, '_')
|
||||||
.replace(/=/g, '');
|
.replace(/=/g, '');
|
||||||
//console.log("Folder: (%s) = (%s)", folder, size);
|
//console.log("Folder: (%s) = (%s)", folder, size);
|
||||||
if (size.search(/\d$/) == -1)
|
if (size.search(/\d$/) == -1)
|
||||||
size += 'iB';
|
size += 'iB';
|
||||||
|
|
|
@ -30,3 +30,8 @@ img.qb
|
||||||
color: #ff4000;
|
color: #ff4000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input.uint8_t
|
||||||
|
{
|
||||||
|
width: 6ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue