From d6d01e737f2311e29a491f82bcbea6b9ed560928 Mon Sep 17 00:00:00 2001 From: Jason Michalski Date: Sun, 18 Nov 2007 14:27:46 -0600 Subject: [PATCH] Can have even more metadata --- plugins/video/templates/container.tmpl | 6 +++++- plugins/video/video.py | 28 ++++++++++++++++++++++++---- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/plugins/video/templates/container.tmpl b/plugins/video/templates/container.tmpl index a957e17..2dcfb26 100644 --- a/plugins/video/templates/container.tmpl +++ b/plugins/video/templates/container.tmpl @@ -31,7 +31,11 @@ video/x-ms-wmv $video.size $video.duration - $video.description + $escape($video.description) + $escape($video.episode_title) + $escape($video.source_channel) + $escape($video.source_station) + $video.series_id diff --git a/plugins/video/video.py b/plugins/video/video.py index 126f533..b5927b8 100644 --- a/plugins/video/video.py +++ b/plugins/video/video.py @@ -56,10 +56,30 @@ class Video(Plugin): def __metadata(self, full_path): description_file = full_path + '.txt' + + metadata = { + 'description' : '', + 'episode_title' : '', + 'source_channel' : '', + 'source_station' : '', + 'series_id' : '', + } + if os.path.exists(description_file): - return open(description_file).read() - else: - return '' + for line in open(description_file): + if line.strip().startswith('#'): + continue + if not ':' in line: + continue + + key, value = line.split(':', 1) + key = key.strip() + value = value.strip() + + if key in metadata and not metadata[key]: + metadata[key] = value + + return metadata def QueryContainer(self, handler, query): @@ -91,7 +111,7 @@ class Video(Plugin): if not video['is_dir']: video['size'] = self.__est_size(full_path) video['duration'] = self.__duration(full_path) - video['description'] = self.__description(full_path) + video.update(self.__metadata(full_path)) videos.append(video) -- 2.11.4.GIT