Handle gaps in epg and scrid suffixes
This commit is contained in:
parent
97c7c9830d
commit
8e556b19cf
|
@ -1,10 +1,10 @@
|
|||
Package: schedchk
|
||||
Priority: optional
|
||||
Section: misc
|
||||
Version: 0.1.0-0
|
||||
Version: 0.1.1
|
||||
Architecture: mipsel
|
||||
Maintainer: mymsman
|
||||
Depends: webif(>=1.4.8-2)
|
||||
Depends: webif(>=1.4.8-3)
|
||||
Description: Check scheduled recordings against EPG and reschedule, if possible, entries that don't match the EPG
|
||||
or cause conflicts
|
||||
|
||||
|
|
|
@ -537,55 +537,67 @@ proc chkEpisode {resv epsd ecrid} {
|
|||
|
||||
# look for an alternate showing
|
||||
set others [epg dbfetch dump -crid $epgcrid -sort "start" ]
|
||||
if {$others == {}} {
|
||||
# No luck by crid, try for same name/time/channel
|
||||
set others [epg dbfetch dump -term [strip_new $name] -service $svc -time "$(($start+$end)/2)" -sort "start" -debug 1 ]
|
||||
}
|
||||
#puts $others
|
||||
set other [findAlternate $resv $others $start $def 1]
|
||||
if {$other != ""} {
|
||||
set ostart [$other get start]
|
||||
set odur [$other get duration]
|
||||
set oend $($ostart+$odur)
|
||||
set oname [$other get name]
|
||||
set ocname [$other get channel_name]
|
||||
set dother "[clock format $ostart -format {%d/%m/%y %H:%M}] [clock format $odur -format {%H:%M}] === $oname === $ocname"
|
||||
# attempt to schedule the alternate (inplace)
|
||||
if {!$::opts(noinplace)} {
|
||||
if {[$other scheduled]} {
|
||||
log "Alternate already scheduled "$deps--->$dother" 1
|
||||
set other {}
|
||||
}
|
||||
update_event $resv $other $epsd "$deps--->$dother" "Event Changed"
|
||||
conflict-list
|
||||
return
|
||||
}
|
||||
# attempt to schedule the alternate (new event+skip)
|
||||
if {[schedule $other $dother "Event Changed"]} {
|
||||
if {![$resv isseries]} {
|
||||
# delete single recording
|
||||
cancel $resv $deps "Event Changed"
|
||||
} else {
|
||||
# move crid from scheduled to recorded
|
||||
replaceskip $resv $ecrid $deps "Event Changed"
|
||||
#refresh $resv $deps
|
||||
}
|
||||
conflict-list
|
||||
return
|
||||
}
|
||||
|
||||
# Check what is currently scheduled for that time
|
||||
# If nothing, hole in epg data, dont look to reschedule
|
||||
set showingnow [epg dbfetch dump -service $svc -time "$(($start+$end)/2)" -sort "start" -debug 0 ]
|
||||
if {$showingnow == {}} {
|
||||
log "+++ Nothing in epg forhis time +++ $deps" 1
|
||||
} else {
|
||||
# is it a duplicate entry for the sametime and channel?
|
||||
foreach aul [$resv aul] {
|
||||
if {$epsd == $aul} {continue}
|
||||
lassign $aul aservice_id astart aend aevent_id
|
||||
if {$service_id == $aservice_id
|
||||
&& $start == $aevent_id} {
|
||||
update_event $resv 0 $epsd "$deps" "Duplicate Event"
|
||||
conflict-list
|
||||
break
|
||||
}
|
||||
foreach snow $showingnow {
|
||||
set sname [$snow get name]
|
||||
log "Now scheduled: $sname " 1
|
||||
if {[string first [strip_new $name] $sname] >= 0
|
||||
&& ![$snow scheduled]} {
|
||||
ladd others $snow
|
||||
}
|
||||
}
|
||||
|
||||
#puts $others
|
||||
set other [findAlternate $resv $others $start $def 1]
|
||||
if {$other != ""} {
|
||||
set ostart [$other get start]
|
||||
set odur [$other get duration]
|
||||
set oend $($ostart+$odur)
|
||||
set oname [$other get name]
|
||||
set ocname [$other get channel_name]
|
||||
set dother "[clock format $ostart -format {%d/%m/%y %H:%M}] [clock format $odur -format {%H:%M}] === $oname === $ocname"
|
||||
# attempt to schedule the alternate (inplace)
|
||||
if {!$::opts(noinplace)} {
|
||||
if {[$other scheduled]} {
|
||||
log "Alternate already scheduled "$deps--->$dother" 1
|
||||
set other {}
|
||||
}
|
||||
update_event $resv $other $epsd "$deps--->$dother" "Event Changed"
|
||||
conflict-list
|
||||
return
|
||||
}
|
||||
# attempt to schedule the alternate (new event+skip)
|
||||
if {[schedule $other $dother "Event Changed"]} {
|
||||
if {![$resv isseries]} {
|
||||
# delete single recording
|
||||
cancel $resv $deps "Event Changed"
|
||||
} else {
|
||||
# move crid from scheduled to recorded
|
||||
replaceskip $resv $ecrid $deps "Event Changed"
|
||||
#refresh $resv $deps
|
||||
}
|
||||
conflict-list
|
||||
return
|
||||
}
|
||||
} else {
|
||||
# is it a duplicate entry for the sametime and channel?
|
||||
foreach aul [$resv aul] {
|
||||
if {$epsd == $aul} {continue}
|
||||
lassign $aul aservice_id astart aend aevent_id
|
||||
if {$service_id == $aservice_id
|
||||
&& $start == $astart} {
|
||||
update_event $resv 0 $epsd "$deps" "Duplicate Event"
|
||||
conflict-list
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -771,6 +783,7 @@ proc scrid_chg {resv desc lasttime} {
|
|||
set oend $($ostart+$odur)
|
||||
set oname [$other get name]
|
||||
set ocname [$other get channel_name]
|
||||
set occrid [$other get channel_crid]
|
||||
set oscrid [$other get series_crid]
|
||||
set oecrid [$other get event_crid]
|
||||
set dother "[clock format $ostart -format {%d/%m/%y %H:%M}] [clock format $odur -format {%H:%M}] === $oname === $ocname"
|
||||
|
@ -786,9 +799,9 @@ proc scrid_chg {resv desc lasttime} {
|
|||
log "-noSCRID - Not applying SCRID change" 2
|
||||
continue
|
||||
}
|
||||
if {[string first [string toupper $oscrid] $scrid] >= 0} {
|
||||
if {[string equal -nocase "$occrid$oscrid" $scrid]} {
|
||||
# found episode of current series
|
||||
log "Current series - $dother" 2
|
||||
log "Current series - $dother" 1
|
||||
continue
|
||||
}
|
||||
if {[$other scheduled]} {
|
||||
|
|
Loading…
Reference in New Issue