Changeset 60d4905cac9de8210e94fd05da1189d83dbf22d6
- 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
| r3be2079 |
r60d4905 |
|
| 42 | 42 | return True |
|---|
| 43 | 43 | |
|---|
| 44 | | def getShares(): |
|---|
| | 44 | def getShares(tsn=''): |
|---|
| 45 | 45 | shares = [(section, dict(config.items(section))) |
|---|
| 46 | 46 | for section in config.sections() |
|---|
| 47 | 47 | 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 |
|---|
| 48 | 59 | |
|---|
| 49 | 60 | for name, data in shares: |
|---|
| rf4a13d8 |
r60d4905 |
|
| 74 | 74 | |
|---|
| 75 | 75 | 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 |
|---|
| 76 | 82 | t = Template(file=os.path.join(SCRIPTDIR, 'templates', |
|---|
| 77 | 83 | 'root_container.tmpl')) |
|---|
| 78 | | t.containers = self.server.containers |
|---|
| | 84 | t.containers = tsncontainers |
|---|
| 79 | 85 | t.hostname = socket.gethostname() |
|---|
| 80 | 86 | t.escape = escape |
|---|