0f1bbed6b9
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@1789 2a923420-c742-0410-a762-8d5b09965624
102 lines
1.7 KiB
Plaintext
Executable File
102 lines
1.7 KiB
Plaintext
Executable File
#!/mod/bin/jimsh
|
|
|
|
package require cgi
|
|
source /mod/webif/lib/setup
|
|
require ts.class pretty_size altrow
|
|
|
|
header
|
|
|
|
source normalise.jim
|
|
source process.jim
|
|
|
|
set dir [cgi_get dir "/media/My Video"]
|
|
set doit [cgi_get doit 0]
|
|
|
|
jscss script.js
|
|
|
|
puts "<fieldset style=\"display: inline\">
|
|
<legend>De-duplicate <span id=dir>$dir</span></legend>
|
|
<table class=borders>
|
|
<tr>
|
|
<th>File</th>
|
|
<th>Proposed Filename</th>
|
|
<th>Proposed Title</th>
|
|
<th>Status</th>
|
|
</tr>
|
|
"
|
|
|
|
loadseries $dir
|
|
set recalc 0
|
|
foreach file [readdir $dir] {
|
|
set file "$dir/$file"
|
|
if {[file extension $file] ne ".hmt"} { continue }
|
|
|
|
set base [file tail [file rootname $file]]
|
|
lassign [dedupprocess $file] stat ts syn fn
|
|
|
|
altrow
|
|
puts "<td nowrap>$base</td>"
|
|
puts "<td>$fn</td>"
|
|
puts "<td>$syn</td>"
|
|
puts "<td>"
|
|
switch $stat {
|
|
inuse {
|
|
puts -nonewline "In Use"
|
|
}
|
|
dup {
|
|
puts -nonewline "Duplicate"
|
|
if {$doit} {
|
|
set dupdir "$dir/_duplicates"
|
|
if {![file exists $dupdir]} { file mkdir $dupdir }
|
|
while {[file exists $dupdir/$fn.hmt]} {
|
|
append fn "~"
|
|
}
|
|
ts renamegroup $file "_duplicates/$fn"
|
|
puts -nonewline " - Renamed to _duplicates/$fn"
|
|
incr recalc
|
|
}
|
|
}
|
|
error {
|
|
puts -nonewline "Cannot process"
|
|
}
|
|
nothing {
|
|
puts -nonewline "Nothing to do"
|
|
}
|
|
preserve {
|
|
puts -nonewline "Preserving"
|
|
}
|
|
ok {
|
|
if {$doit} {
|
|
# Dooooo, it.
|
|
$ts settitle $syn
|
|
ts renamegroup $file $fn
|
|
$ts set_deduped
|
|
puts -nonewline "Done"
|
|
}
|
|
}
|
|
}
|
|
|
|
puts "</td>"
|
|
puts "</tr>"
|
|
}
|
|
|
|
if {$recalc} { ts resetnew $dir }
|
|
|
|
puts {
|
|
</table>
|
|
</fieldset>
|
|
<div style="padding-top: 2em">
|
|
<small>
|
|
<button id=browse>Back to media browser</button>
|
|
}
|
|
|
|
if {!$doit} { puts "<button id=dedup>Process folder</button>" }
|
|
|
|
puts {
|
|
</small>
|
|
</div>
|
|
}
|
|
|
|
footer
|
|
|