# # get channel callsign # proc ltk_getcallsign {sp} { set station [dbobj $sp get Station] set callsign [dbobj $station get CallSign] return $callsign } # # get channel number # proc ltk_getchannum {sp} { global channeltablestation set station [dbobj $sp get Station] set stationfsid [dbobj $station fsid] set data $channeltablestation($stationfsid) set channum [lindex $data 0] return $channum } # # get channel name # proc ltk_getchanname {sp} { set station [dbobj $sp get Station] set channame [strim [dbobj $station get Name]] return $channame } proc print_nsrow {chan rec} { global db global tzoffset global cache_ns_rec global cache_ns_series set showing [dbobj $rec get Showing] set program [dbobj $showing get Program] set title [strim [dbobj $program get Title]] set manual 0 set suggestion 0 if {$::version3} { set recbeh [dbobj $rec get RecordingBehavior] set presbeh [dbobj $recbeh get PresentationBehavior] set progbeh [dbobj $recbeh get ProgramGuideBehavior] set seltype $presbeh if { $presbeh == 10 || $presbeh == 9 } { set manual 1 } if { $progbeh == 3 || $progbeh == 8 } { set manual 1 } if { $presbeh == 6 } { set suggestion 1 } } else { set seltype [dbobj $rec get SelectionType] if { $seltype == 10 || $seltype == 5 } { set manual 1 } if { $seltype == 6 } { set suggestion 1 } } if { $manual } { if { $title == "" } { set title "Manual Recording" } else { set title "Manual: $title" } } set fsid [dbobj $rec fsid] set index [lsearch $cache_ns_rec $fsid] set seriesfsid "" set series [dbobj $program get Series] if { $index == -1 } { if {$series != ""} { set seriesfsid [dbobj $series fsid] lappend cache_ns_rec $fsid lappend cache_ns_series $seriesfsid } } else { set seriesfsid [lindex $cache_ns_series $index] } set episodic [dbobj $series get Episodic] if { $episodic == 1 } { set eptitle [strim [dbobj $program get EpisodeTitle]] } else { set eptitle "" } set selectiontypes "{Show Recommendation} {Package Recommendation} {By Name} {By Channel} Manual {Suggestion} {Fuzzy Package} Bookmark {Season Pass} {Manual Season Pass} Guide IPreview WishListPass Extended ManualExtended CaptureRequest" set presentationbehtypes "Single {Season Pass} Wishlist {Watch Only} {Tivo Clips} Suggestion {Tivo Clips Suggestion} Invisible {Manual Season Pass} Manual {Cache History}" if { $seltype != "" } { if {$::version3} { if {$progbeh == 3} { if {$presbeh == 1} { set seltypestr "Manual" } elseif {$presbeh == 2} { set seltypestr "Manual Season Pass" } else { set seltypestr "Manual" } } else { set seltypestr [lindex $presentationbehtypes [expr $presbeh - 1]] } } else { set seltypestr [lindex $selectiontypes [expr $seltype - 1]] } } set seconds [expr [dbobj $showing get Date] * 86400 + [dbobj $showing get Time] + $tzoffset] set starttime [dbobj $showing get Time] set startdate [dbobj $showing get Date] set secs [expr [dbobj $showing get Date] * 86400 + [dbobj $showing get Time] + $tzoffset] set starttimestr [clock format $secs] set duration [dbobj $showing get Duration] set day [clock format $seconds -format "%a"] set date [clock format $seconds -format "%4Y.%2m.%2d"] set duration [clock format $duration -format "%1H:%2M"] set stationname [ltk_getchanname $showing] set stationcall [ltk_getcallsign $showing] set stationnum [ltk_getchannum $showing] set expdate [dbobj $rec get ExpirationDate] set expsecs [expr $expdate * 86400 + [dbobj $rec get ExpirationTime]] set nowsecs [clock seconds] set description [strim [dbobj $program get Description]] puts $chan "$title^$date^$eptitle^$description^$starttimestr^$duration^$stationname^$stationcall^$seltypestr^$stationnum" } proc action_tvd_nshow {chan path env} { # # Set global variable # global db global nowshowingdir ForeachMfsFileTrans fsid name type $nowshowingdir "" 15 { set rec [db $db openid $fsid] print_nsrow $chan $rec } } register_module "tvd_nshow" "TVD Now Showing List" "TVD's Now Showing List."