From 214a1486087abb992c9567c77632ca56ba979ca8 Mon Sep 17 00:00:00 2001 From: Jason Michalski Date: Sun, 18 Nov 2007 13:33:47 -0600 Subject: [PATCH] Cleened up content types --- httpserver.py | 2 +- plugin.py | 2 +- plugins/music/music.py | 2 +- plugins/video/video.py | 4 ++-- templates/root_container.tmpl | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/httpserver.py b/httpserver.py index b5eda8f..a575e41 100644 --- a/httpserver.py +++ b/httpserver.py @@ -17,6 +17,7 @@ class TivoHTTPServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer): def add_container(self, name, settings): if self.containers.has_key(name) or name == 'TivoConnect': raise "Container Name in use" + settings['content_type'] = GetPlugin(settings['type']).CONTENT_TYPE self.containers[name] = settings class TivoHTTPHandler(BaseHTTPServer.BaseHTTPRequestHandler): @@ -72,7 +73,6 @@ class TivoHTTPHandler(BaseHTTPServer.BaseHTTPRequestHandler): t = Template(file=os.path.join(SCRIPTDIR, 'templates', 'root_container.tmpl')) t.containers = self.server.containers t.hostname = socket.gethostname() - t.GetPlugin = GetPlugin self.send_response(200) self.end_headers() self.wfile.write(t) diff --git a/plugin.py b/plugin.py index 9e27521..58581a1 100644 --- a/plugin.py +++ b/plugin.py @@ -10,7 +10,7 @@ def GetPlugin(name): class Plugin(object): - content_type = '' + CONTENT_TYPE = '' def __new__(cls, *args, **kwds): it = cls.__dict__.get('__it__') diff --git a/plugins/music/music.py b/plugins/music/music.py index 8221572..e28af06 100644 --- a/plugins/music/music.py +++ b/plugins/music/music.py @@ -12,7 +12,7 @@ CLASS_NAME = 'Music' class Music(Plugin): - content_type = 'x-container/tivo-music' + CONTENT_TYPE = 'x-container/tivo-music' playable_cache = {} playable_cache = LRUCache(1000) media_data_cache = LRUCache(100) diff --git a/plugins/video/video.py b/plugins/video/video.py index 1d71777..2a05b9a 100644 --- a/plugins/video/video.py +++ b/plugins/video/video.py @@ -9,11 +9,11 @@ import config SCRIPTDIR = os.path.dirname(__file__) -CLASS_NAME = Video +CLASS_NAME = 'Video' class Video(Plugin): - content_type = 'x-container/tivo-videos' + CONTENT_TYPE = 'x-container/tivo-videos' def send_file(self, handler, container, name): diff --git a/templates/root_container.tmpl b/templates/root_container.tmpl index 761583c..b79d29f 100644 --- a/templates/root_container.tmpl +++ b/templates/root_container.tmpl @@ -11,7 +11,7 @@
$name - $GetPlugin($details.type).content_type + $details.content_type x-container/folder
-- 2.11.4.GIT