Move -inp file handling to chaseget, prerm to cleanup crontab
This commit is contained in:
parent
ae56e34ceb
commit
e5bc42ff0a
|
@ -1,7 +1,7 @@
|
|||
Package: chaseget
|
||||
Priority: optional
|
||||
Section: misc
|
||||
Version: 0.1.2-3
|
||||
Version: 0.1.3
|
||||
Architecture: mipsel
|
||||
Maintainer: mymsman
|
||||
Depends: webif(>=1.4.4-7), curl, ir (>=1.10-2), procps
|
||||
|
|
39
bin/chaseget
39
bin/chaseget
|
@ -51,6 +51,17 @@ proc getfile {file {fs 0}} {
|
|||
set ts [ts fetch $file]
|
||||
log "ChaseGet $file" 0
|
||||
|
||||
set fl [glob -nocomplain "/mod/tmp/*-inp.ts" ]
|
||||
log "orphan file list $fl" 2
|
||||
foreach f $fl {
|
||||
if {[file mtime $f]+3600 < [clock seconds]} {
|
||||
if {[safe_delete $file chaseget/orphans]} {
|
||||
log "$f safe deleted" 0
|
||||
} else {
|
||||
log "$f safe_delete failed" 0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
set blksize $(256*1024)
|
||||
# extract recording info & calculate
|
||||
|
@ -63,6 +74,17 @@ log "Recording start: [clock format $stime -format "%H:%M:%S"] end: [clock forma
|
|||
set csize [file size "$file"]
|
||||
set dlnaretry 0
|
||||
set dlnaalert 0
|
||||
set bname [file rootname [file tail $file]]
|
||||
set iname "$bname-inp"
|
||||
set ipath "/mod/tmp"
|
||||
set ifile "$ipath/$iname.ts"
|
||||
file delete -force "$ipath/$iname.ts"
|
||||
catch {file link -hard "$ipath/$iname.ts" "[file normalize [file rootname $file].ts]"}
|
||||
file delete -force "$ipath/$iname.hmt"
|
||||
catch {file link -hard "$ipath/$iname.hmt" "[file normalize [file rootname $file].hmt]"}
|
||||
|
||||
# Is file already indexed
|
||||
lassign [$ts dlnaloc "127.0.0.1"] fileurl
|
||||
|
||||
while {$csize > $fs} {
|
||||
if {[system dlnastatus]} {
|
||||
|
@ -110,16 +132,16 @@ while {$csize > $fs} {
|
|||
} else { set lrate ""}
|
||||
|
||||
set retrct 0
|
||||
lassign [$ts dlnaloc "127.0.0.1"] url
|
||||
set url $fileurl
|
||||
if {$url ne ""} {
|
||||
log " $file - has been indexed."
|
||||
set helper 0
|
||||
} else {
|
||||
log " $file - Not yet indexed, trying helper."
|
||||
if {[catch {
|
||||
lassign [system dlnahelper [file normalize $file]] url
|
||||
lassign [system dlnahelper [file normalize $ifile]] url
|
||||
} msg]} {
|
||||
log " $file - $msg"
|
||||
log " $ifile - $msg"
|
||||
system dlnahelper -release
|
||||
}
|
||||
if {$url eq ""} {
|
||||
|
@ -158,7 +180,7 @@ while {$csize > $fs} {
|
|||
incr fs [string bytelength $block]
|
||||
incr retrct [string bytelength $block]
|
||||
if {[eof $input]} {
|
||||
log "EOF detected $fs $retrct" 2
|
||||
log "EOF detected Files Size $fs Retrieved $retrct" 2
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -190,12 +212,16 @@ while {$csize > $fs} {
|
|||
set csize [file size "$file"]
|
||||
}
|
||||
|
||||
# remove alias
|
||||
file delete -force "$ipath/$iname.ts"
|
||||
file delete -force "$ipath/$iname.hmt"
|
||||
|
||||
if {[file size $file] >$fs } {
|
||||
log " Failed to retrieve entire file $([file size $file] -$fs) bytes missing" 0
|
||||
log " Attempt to recreate failure message" 1
|
||||
set curlout ""; set msg ""; set opts ""
|
||||
catch {set curlout [exec curl -C $fs $url > /dev/null]} msg opts
|
||||
log "Curl message: $msg" 1
|
||||
log "Curl message: $msg" 0
|
||||
log "Curl error: $opts" 1
|
||||
log "Curl output: $curlout" 1
|
||||
return -code error $msg
|
||||
|
@ -229,7 +255,8 @@ proc inTimeRange {start end} {
|
|||
}
|
||||
|
||||
proc awake_from_standy {} {
|
||||
catch {exec ir POWER}
|
||||
# Usee zero intead of Power for wakeup. less risk
|
||||
catch {exec ir ZERO}
|
||||
log "System power on attempted" 0
|
||||
set settings [settings]
|
||||
set mute [$settings _nval_setting "chaseget_mute" ]
|
||||
|
|
Loading…
Reference in New Issue