Changeset d6d01e737f2311e29a491f82bcbea6b9ed560928
- Timestamp:
- 11/18/07 14:27:46
(1 year ago)
- Author:
- Jason Michalski <armooo@armooo.net>
- git-committer:
- Jason Michalski <armooo@armooo.net> 1195417666 -0600
- git-parent:
[def6912c4eaf2972ffc8193e25a3b02f96e968b0]
- git-author:
- Jason Michalski <armooo@armooo.net> 1195417666 -0600
- Message:
Can have even more metadata
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r8218f71 |
rd6d01e7 |
|
| 32 | 32 | <SourceSize>$video.size</SourceSize> |
|---|
| 33 | 33 | <Duration>$video.duration</Duration> |
|---|
| 34 | | <Description>$video.description</Description> |
|---|
| | 34 | <Description>$escape($video.description)</Description> |
|---|
| | 35 | <EpisodeTitle>$escape($video.episode_title)</EpisodeTitle> |
|---|
| | 36 | <SourceChannel>$escape($video.source_channel)</SourceChannel> |
|---|
| | 37 | <SourceStation>$escape($video.source_station)</SourceStation> |
|---|
| | 38 | <SeriesId>$video.series_id</SeriesId> |
|---|
| 35 | 39 | </Details> |
|---|
| 36 | 40 | <Links> |
|---|
| rdef6912 |
rd6d01e7 |
|
| 57 | 57 | def __metadata(self, full_path): |
|---|
| 58 | 58 | description_file = full_path + '.txt' |
|---|
| | 59 | |
|---|
| | 60 | metadata = { |
|---|
| | 61 | 'description' : '', |
|---|
| | 62 | 'episode_title' : '', |
|---|
| | 63 | 'source_channel' : '', |
|---|
| | 64 | 'source_station' : '', |
|---|
| | 65 | 'series_id' : '', |
|---|
| | 66 | } |
|---|
| | 67 | |
|---|
| 59 | 68 | if os.path.exists(description_file): |
|---|
| 60 | | return open(description_file).read() |
|---|
| 61 | | else: |
|---|
| 62 | | return '' |
|---|
| | 69 | for line in open(description_file): |
|---|
| | 70 | if line.strip().startswith('#'): |
|---|
| | 71 | continue |
|---|
| | 72 | if not ':' in line: |
|---|
| | 73 | continue |
|---|
| | 74 | |
|---|
| | 75 | key, value = line.split(':', 1) |
|---|
| | 76 | key = key.strip() |
|---|
| | 77 | value = value.strip() |
|---|
| | 78 | |
|---|
| | 79 | if key in metadata and not metadata[key]: |
|---|
| | 80 | metadata[key] = value |
|---|
| | 81 | |
|---|
| | 82 | return metadata |
|---|
| 63 | 83 | |
|---|
| 64 | 84 | def QueryContainer(self, handler, query): |
|---|
| … | … | |
| 92 | 112 | video['size'] = self.__est_size(full_path) |
|---|
| 93 | 113 | video['duration'] = self.__duration(full_path) |
|---|
| 94 | | video['description'] = self.__description(full_path) |
|---|
| | 114 | video.update(self.__metadata(full_path)) |
|---|
| 95 | 115 | |
|---|
| 96 | 116 | videos.append(video) |
|---|