Handle gaps in epg and scrid suffixes
This commit is contained in:
parent
97c7c9830d
commit
8e556b19cf
|
@ -1,10 +1,10 @@
|
||||||
Package: schedchk
|
Package: schedchk
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: misc
|
Section: misc
|
||||||
Version: 0.1.0-0
|
Version: 0.1.1
|
||||||
Architecture: mipsel
|
Architecture: mipsel
|
||||||
Maintainer: mymsman
|
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
|
Description: Check scheduled recordings against EPG and reschedule, if possible, entries that don't match the EPG
|
||||||
or cause conflicts
|
or cause conflicts
|
||||||
|
|
||||||
|
|
|
@ -537,55 +537,67 @@ proc chkEpisode {resv epsd ecrid} {
|
||||||
|
|
||||||
# look for an alternate showing
|
# look for an alternate showing
|
||||||
set others [epg dbfetch dump -crid $epgcrid -sort "start" ]
|
set others [epg dbfetch dump -crid $epgcrid -sort "start" ]
|
||||||
if {$others == {}} {
|
|
||||||
# No luck by crid, try for same name/time/channel
|
# Check what is currently scheduled for that time
|
||||||
set others [epg dbfetch dump -term [strip_new $name] -service $svc -time "$(($start+$end)/2)" -sort "start" -debug 1 ]
|
# 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 ]
|
||||||
#puts $others
|
if {$showingnow == {}} {
|
||||||
set other [findAlternate $resv $others $start $def 1]
|
log "+++ Nothing in epg forhis time +++ $deps" 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 {
|
} else {
|
||||||
# is it a duplicate entry for the sametime and channel?
|
foreach snow $showingnow {
|
||||||
foreach aul [$resv aul] {
|
set sname [$snow get name]
|
||||||
if {$epsd == $aul} {continue}
|
log "Now scheduled: $sname " 1
|
||||||
lassign $aul aservice_id astart aend aevent_id
|
if {[string first [strip_new $name] $sname] >= 0
|
||||||
if {$service_id == $aservice_id
|
&& ![$snow scheduled]} {
|
||||||
&& $start == $aevent_id} {
|
ladd others $snow
|
||||||
update_event $resv 0 $epsd "$deps" "Duplicate Event"
|
}
|
||||||
conflict-list
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#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 {
|
} else {
|
||||||
|
@ -771,6 +783,7 @@ proc scrid_chg {resv desc lasttime} {
|
||||||
set oend $($ostart+$odur)
|
set oend $($ostart+$odur)
|
||||||
set oname [$other get name]
|
set oname [$other get name]
|
||||||
set ocname [$other get channel_name]
|
set ocname [$other get channel_name]
|
||||||
|
set occrid [$other get channel_crid]
|
||||||
set oscrid [$other get series_crid]
|
set oscrid [$other get series_crid]
|
||||||
set oecrid [$other get event_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"
|
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
|
log "-noSCRID - Not applying SCRID change" 2
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if {[string first [string toupper $oscrid] $scrid] >= 0} {
|
if {[string equal -nocase "$occrid$oscrid" $scrid]} {
|
||||||
# found episode of current series
|
# found episode of current series
|
||||||
log "Current series - $dother" 2
|
log "Current series - $dother" 1
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if {[$other scheduled]} {
|
if {[$other scheduled]} {
|
||||||
|
|
Loading…
Reference in New Issue