Do you tend to favor the work of a particular director? Do the words of a particular writer keep you riveted to the screen? Chances are that you haven't given your favorite creatives much thought. Thankfully, TiVo keeps track of them for you .
A variation on [Hack #91], let's give a little credit to the creativesthe writers, producers, and directorswhile at the same time learning a little more Tcl.
#!/tvbin/tivosh global creatives proc addcreative { c type } { global creatives foreach epcreative $c { set slashpos [string first "" $epcreative] set repcreative \ " [string range $epcreative 0 [expr $slashpos - 1]]," [RETURN] set repcreative \ " $repcreative [string range $epcreative [expr $slashpos + 1] [RETURN] end] " set repcreative \ " $repcreative $type " lappend creatives $repcreative } } # open the database set db [dbopen] # pull out the first 50 recorded shows from the database set recdir "/Recording/NowShowingByTitle" RetryTransaction { set files [mfs scan $recdir -count 50] } set creatives { } while { [llength $files] > 0 } { # iterate through the shows we extracted foreach rec $files { # grab the FSID of the program from the list set fsid [lindex $rec 0] RetryTransaction { # get the object that represents this recording and the # object that represents this episode. wrap it in # a catch just in case # it doesn't work set recordingobj [db $db openid $fsid] set episodeobj [dbobj [dbobj $recordingobj get Showing] get Program] # pull out the list of writers, directors, and producers of the # shows. none of these are guaranteed to be here set epwriters [dbobj $episodeobj get Writer] set epdirectors [dbobj $episodeobj get Director] set epproducers [dbobj $episodeobj get ExecProducer] } # add all those creatives to a list to work with addcreative $epwriters "Writer " addcreative $epdirectors "Director " addcreative $epproducers "ExecProducer " } # and grab the next 49 television shows [RETURN] set lastName [lindex [lindex $files end] 1] RetryTransaction { set files [mfs scan $recdir -start $lastName -count 50] } if { $lastName == [lindex [lindex $files 0] 1] } { set files [lrange $files 1 end] } } # create a new list called fcreatives that is the frequency count # of the creatives on the shows we have watched set fcreatives { } foreach l $creatives { if ![ info exists a($l) ] { set a($l) 0 } incr a($l) } foreach i [ array names a ] { lappend fcreatives [list $i $a($i)] } # and let's quickly alphabetically sort then print the list set fcreatives [lsort -index 0 $fcreatives] foreach fcreative $fcreatives { puts "[lindex $fcreative 0] [lindex $fcreative 1]" }
Save the code as creatives.tcl in TiVo's /var/hack/bin directory and make it executable:
bash-2.02# chmod 755 /var/hack/bin/creatives.tcl
Run the script from TiVo's command line Section 3.3:
bash-2.02# /var/hack/bin/creatives.tcl Babbit, Jamie Director 1 Beeman, Greg Director 1 Berlanti, Greg ExecProducer 15 Berman, Rick ExecProducer 1 Braga, Brannon Writer 1 Bruckheimer, Jerry ExecProducer 1 Camp, Brandon ExecProducer 1 Cochran, Bob ExecProducer 1 Fattore, Gina Writer 5 Foy, John ExecProducer 1 Fricke, Anna Writer 3 Friedman, Maggie Writer 3 Garcia, Liz Writer 1 Gereghty, Bill Director 1 Gough, Al Writer 1 Gough, Alfred ExecProducer 4 Jackson, Joshua Director 1 Kapinos, Tom Writer 3 Kowalski, Peter Director 1 Kroll, Jon ExecProducer 1 Lange, Michael Director 3 Leahy, Janet Writer 1 Leder, Mimi ExecProducer 1 Marshall, James Director 1 McNeill, Robbie Director 2 Millar, Miles ExecProducer 4 Millar, Miles Writer 1 Moore, Jason Director 1 Nash, Bruce ExecProducer 1 Nelson, Todd ExecProducer 1 ...
To capture your list of favorite writers, producers, and directors as a pipe-delimited text file, use the > redirect symbol and supply the name of a file to which to write. For example, sending output to a file called creatives.out in the /var/out directory would look like this:
bash-2.02# /var/hack/bin/creatives.tcl > /var/out/creatives.out
Take note that people can be listed under more than one role, and they can also be listed more than once for a given role. Take a look at Miles Millar; he was credited four times as an Executive Producer and once as a writer. If we gather enough of this information over time, we can create our own Internet Movie Database (http://www.imdb.com) from our television listings alone.
Top |