Changeset cf1319956bf7411ce216cc5ab34e65b98755a9d1
- Timestamp:
- 11/18/07 20:16:11
(1 year ago)
- Author:
- Jason Michalski <armooo@armooo.net>
- git-committer:
- Jason Michalski <armooo@armooo.net> 1195438571 -0600
- git-parent:
[6ddab42fe78f34a472b3b1ad2d44b217a7e112d6]
- git-author:
- Jason Michalski <armooo@armooo.net> 1195438571 -0600
- Message:
Added auto subshares
Create a share for all subfolders
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r8698247 |
rcf13199 |
|
| 43 | 43 | |
|---|
| 44 | 44 | def getShares(): |
|---|
| 45 | | return ( (section, dict(config.items(section))) for section in config.sections() if not(section.startswith('_tivo_') or section == 'Server') ) |
|---|
| | 45 | shares = [ (section, dict(config.items(section))) for section in config.sections() if not(section.startswith('_tivo_') or section == 'Server') ] |
|---|
| | 46 | |
|---|
| | 47 | for name, data in shares: |
|---|
| | 48 | if not data.get('auto_subshares', 'False').lower() == 'true': |
|---|
| | 49 | continue |
|---|
| | 50 | |
|---|
| | 51 | base_path = data['path'] |
|---|
| | 52 | for item in os.listdir(base_path): |
|---|
| | 53 | item_path = os.path.join(base_path, item) |
|---|
| | 54 | if not os.path.isdir(item_path): |
|---|
| | 55 | continue |
|---|
| | 56 | |
|---|
| | 57 | new_name = name + '/' + item |
|---|
| | 58 | new_data = dict(data) |
|---|
| | 59 | new_data['path'] = item_path |
|---|
| | 60 | |
|---|
| | 61 | shares.append( (new_name, new_data) ) |
|---|
| | 62 | |
|---|
| | 63 | return shares |
|---|
| | 64 | |
|---|
| 46 | 65 | |
|---|
| 47 | 66 | def getDebug(): |
|---|
| r10fc438 |
rcf13199 |
|
| 54 | 54 | path=/home/armooo/Videos |
|---|
| 55 | 55 | |
|---|
| | 56 | #Make all subfolders in to top level shares |
|---|
| | 57 | #auto_subshares= True |
|---|
| | 58 | |
|---|
| | 59 | |
|---|
| 56 | 60 | |
|---|
| 57 | 61 | ##You can have more than one share |
|---|