Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

QueryItem for music plugin. Same notation.

  • Loading branch information...
commit 1c52cb2019abc1b6c01f82f0a0aa0a05142c587d 1 parent 0dba63e
@wmcbrine wmcbrine authored
Showing with 15 additions and 0 deletions.
  1. +15 −0 plugins/music/music.py
View
15 plugins/music/music.py
@@ -49,8 +49,10 @@
# Preload the templates
tfname = os.path.join(SCRIPTDIR, 'templates', 'container.tmpl')
tpname = os.path.join(SCRIPTDIR, 'templates', 'm3u.tmpl')
+iname = os.path.join(SCRIPTDIR, 'templates', 'item.tmpl')
FOLDER_TEMPLATE = file(tfname, 'rb').read()
PLAYLIST_TEMPLATE = file(tpname, 'rb').read()
+ITEM_TEMPLATE = file(iname, 'rb').read()
# XXX BIG HACK
# subprocess is broken for me on windows so super hack
@@ -282,6 +284,19 @@ def get_tag(tagname, d):
handler.send_xml(str(t))
+ def QueryItem(self, handler, query):
+ uq = urllib.unquote_plus
+ splitpath = [x for x in uq(query['Url'][0]).split('/') if x]
+ path = os.path.join(handler.container['path'], *splitpath[1:])
+
+ if path in self.media_data_cache:
+ t = Template(ITEM_TEMPLATE, filter=EncodeUnicode)
+ t.file = self.media_data_cache[path]
+ t.escape = escape
+ handler.send_xml(str(t))
+ else:
+ handler.send_error(404)
+
def parse_playlist(self, list_name, recurse):
ext = os.path.splitext(list_name)[1].lower()
Please sign in to comment.
Something went wrong with that request. Please try again.