What's new? | Help | Directory | Sign in
Google
tivoaccess
TivoAccess is a python module for programmatically accessing your Tivo for downloads
  
  
  
  
    
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/python
#
# archive_tivo is a quick example of a program to selectively copy some
# video's off your tivo

import sys
import os
import time
import TivoAccess
import progrun


DOWNLOAD = os.path.expanduser('~/Downloads')


def EntryFilename(entry):
if entry.episode:
fn = '%s - %s.tivo' % (entry.title, entry.episode)
else:
fn = '%s.tivo' % (entry.title)
fn = fn.replace("'", '')
fn = fn.replace(":", ' -')
fn = fn.replace("/", ' - ')
return os.path.join(DOWNLOAD, fn)


def main(argv):
try:
progrun.do_lock('/tmp/archive_tivo.lock')
except progrun.LockFailed:
return

media_key = TivoAccess.LoadMak()
hosts = TivoAccess.FindTivos()
for host in hosts:
tf = TivoAccess.TivoFetcher(host, media_key)
entries = tf.FetchPlayList()
matching = []
for entry in entries:
if entry.inprogress: continue
for dl in ['South Park', 'Robot Chicken', 'Venture', 'NHL']:
if entry.title.find(dl) != -1:
if os.path.exists(EntryFilename(entry)): continue
matching.append(entry)

if len(matching):
print "Tivo %s has %d shows, %d to download" % (host, len(entries),
len(matching))
for entry in matching:
print "Downloading %s" % EntryFilename(entry)
tf.Download(entry, EntryFilename(entry))
# wait 15s between downloads to let the tivo recover
time.sleep(15)


if __name__ == "__main__":
main(sys.argv)
Show details
Hide

Change log

r1 by blong42 on Feb 18, 2008   Diff
Initial check-in

Older revisions

All revisions of this file

File properties

svn:executable

File info

Size: 1446 bytes, 57 lines