Changeset 60d4905cac9de8210e94fd05da1189d83dbf22d6

Show
Ignore:
Timestamp:
02/09/08 23:01:04 (1 year ago)
Author:
William McBrine <wmcbrine@gmail.com>
git-committer:
William McBrine <wmcbrine@gmail.com> 1202619664 -0500
git-parent:

[ebc6b29e44be3ef4b94a64e8ab642d8a633e57ae]

git-author:
KRKeegan <kevin@krkeegan.com> 1202592099 -0800
Message:

New: Limit shares which appear on certain TiVos?

Adapted from ticket #32:
There is now a share option available under any [_tivo_12345] section. This option takes a comma seperated list of available shares. Only the shares listed will appear on that specific tivo. Incorrect shares are ignored.

For example, the following conf file would be used to prevent share Adult from being seen on the TiVo with a tsn=12345, only Movies and Photos would be seen on this TiVo. Adult would still be visible on ALL other TiVos? in the network.
[_tivo_12345]
shares = Movies, Photos

[Adult]
type = video
path = /store/Adult

[Movies]
type = video
path = /store/Movies

[Photos]
type = photo
path = /store/Photos

[Server]
debug = true
ffmpeg = /usr/bin/ffmpeg
hack83 = true
port = 9032

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • config.py

    r3be2079 r60d4905  
    4242    return True 
    4343 
    44 def getShares(): 
     44def getShares(tsn=''): 
    4545    shares = [(section, dict(config.items(section))) 
    4646              for section in config.sections() 
    4747              if not(section.startswith('_tivo_') or section == 'Server')] 
     48 
     49    if config.has_section('_tivo_' + tsn): 
     50        if config.has_option('_tivo_' + tsn, 'shares'): 
     51            # clean up leading and trailing spaces & make sure ref is valid 
     52            tsnshares = [] 
     53            for x in config.get('_tivo_' + tsn, 'shares').split(','): 
     54                y = x.lstrip().rstrip() 
     55                if config.has_section(y): 
     56                    tsnshares += [(y, dict(config.items(y)))] 
     57            if tsnshares: 
     58                shares = tsnshares 
    4859 
    4960    for name, data in shares: 
  • httpserver.py

    rf4a13d8 r60d4905  
    7474 
    7575    def root_container(self): 
     76         tsn = self.headers.getheader('TiVo_TCD_ID', '') 
     77         tsnshares = config.getShares(tsn) 
     78         tsncontainers = {} 
     79         for section, settings in tsnshares: 
     80            settings['content_type'] = GetPlugin(settings['type']).CONTENT_TYPE 
     81            tsncontainers[section] = settings 
    7682         t = Template(file=os.path.join(SCRIPTDIR, 'templates', 
    7783                                        'root_container.tmpl')) 
    78          t.containers = self.server.containers 
     84         t.containers = tsncontainers 
    7985         t.hostname = socket.gethostname() 
    8086         t.escape = escape