• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

7. Writing Code > 94. How Do You Watch TV?

How Do You Watch TV?

Compute your hunt-and-peck percentage to truly find out what kind of a viewer you are.

Are you a watch-the-show-all-the-way-through kind of TiVo user, or do you hunt and peck, watching 5 minutes of a show and moving on? Do you never finish watching what is on your Now Showing List? Continuing our personal data mining, let’s find out what kind of person you are—at least according to your TiVo. We’ll compute your hunt-and-peck percentage—what percentage, on average, of a show you typically watch—down to the second. And with a little JavaScript magic, we’ll share the outcome with the world on your web page.

The Code

 proc action_huntandpeck { chan path env } {       
    global db                  
            
    # pull out the first 50 todo list shows from the database        
    set tododir "/Recording/NowShowingByTitle"    
    RetryTransaction {         
        set files [mfs scan $tododir -count 50]   
    }       
            
    set nshows 0               
    set pshows 0               
    while { [llength $files] > 0 } {              
        # iterate through the shows we extracted  
        foreach rec $files {   
          set fsid [lindex $rec 0]              
            
          RetryTransaction { 
          # get the object that represents this recording. 
          # also figure out of the person has played this   
          #....[RETURN][RETURN]

PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint