diff --git a/CONTROL/control b/CONTROL/control index 57c3bb5..2c35c26 100644 --- a/CONTROL/control +++ b/CONTROL/control @@ -1,7 +1,7 @@ Package: webif Priority: optional Section: web -Version: 0.8.0-1 +Version: 0.8.0-2 Architecture: mipsel Maintainer: af123@hummypkg.org.uk Depends: mongoose(>=3.0-2),jim(>=0.71-1),jim-sqlite3(>=0.71-1),jim-cgi(>=0.4),jim-oo,jim-pack,service-control,busybox(>=1.18.3-1),lsof,epg(>=1.0.7),hmt(>=1.1.0),ssmtp diff --git a/var/mongoose/cgi-bin/browse/crop.jim b/var/mongoose/cgi-bin/browse/crop.jim index 36e734a..a326d8f 100755 --- a/var/mongoose/cgi-bin/browse/crop.jim +++ b/var/mongoose/cgi-bin/browse/crop.jim @@ -2,7 +2,7 @@ package require cgi source /mod/var/mongoose/lib/setup -require ts.class +require ts.class pretty_size puts "Content-Type: text/html\r\n\r\n" @@ -17,6 +17,9 @@ set dir [file dirname $rfile] set len [$ts duration 1] if {[cgi_get do] eq "it"} { + + set cropstart [clock milliseconds] + set base [file rootname $rfile] set origdir "$dir/_original" if {![file exists $origdir]} { file mkdir $origdir } @@ -24,15 +27,17 @@ if {[cgi_get do] eq "it"} { set shname [file tail $base] puts "Processing $shname" - puts "Moving recording to $origdir" + if {[file exists "$origdir/$shname.ts"]} { + puts "This recording already exists within _original" + puts "Cannot continue." + exit + } + puts "Moving recording to $origdir" foreach f [glob -nocomplain "${base}.*"] { set tail [file tail $f] puts " $tail" - while {[file exists "$origdir/$tail"]} { - append tail "~" - } - file rename $f "${origdir}/$tail" + file rename $f "$origdir/$tail" } puts [exec /mod/bin/nicesplice \ @@ -40,6 +45,14 @@ if {[cgi_get do] eq "it"} { -out "$dir/$shname" \ -cutBookMarks] + set newname "$shname-[clock seconds]" + puts "Renaming file group to $newname" + ts renamegroup "$dir/$shname.ts" $newname + exec /mod/bin/hmt "+setfilename=$newname" "$dir/$newname.hmt" + + set croptime [expr [expr [clock milliseconds] - $cropstart] / 1000.0] + puts "Time taken: $croptime" + exit } @@ -52,6 +65,7 @@ puts "
File: | $rfile |
---|---|
Length: | [clock format $len -format "%T"] |
Size: | [pretty_size [$ts size]] |
Bookmarks: | [$ts get bookmarks] @ " set flag 0 @@ -61,11 +75,9 @@ foreach b [$ts bookmarks] { puts -nonewline [clock format $b -format "%T"] } -puts " |