Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

initial commit

  • Loading branch information...
commit f586d76af82c592b196be59872b9c39d28a81ba1 0 parents
@dokipen authored
4 .gitignore
@@ -0,0 +1,4 @@
+*.pyc
+*.egg-info
+build
+dist
29 setup.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+"""
+License: BSD
+
+(c) 2009 ::: Robert Corsaro (doki_pen@doki-pen.org)
+"""
+
+from setuptools import setup, find_packages
+
+setup(
+ name='TracXspfPlugin',
+ version='0.11',
+ license='BSD',
+ author='Robert Corsaro',
+ author_email='doki_pen@doki-pen.org',
+ url='http://github.com/dokipen',
+ description='Xspf flash mp3 player macros',
+ zip_safe=True,
+ packages=['tracxspf'],
+ package_data={
+ 'tracxspf': ['templates/*.html', 'htdocs/*.swf']
+ },
+ entry_points={
+ 'trac.plugins': [
+ 'tracxspf.macros = tracxspf.macros',
+ 'tracxspf.web_ui = tracxspf.web_ui',
+ ]
+ },
+)
0  tracxspf/__init__.py
No changes.
BIN  tracxspf/htdocs/button_player.swf
Binary file not shown
BIN  tracxspf/htdocs/slim_player.swf
Binary file not shown
25 tracxspf/macros.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+from trac.core import *
+
+from trac.web.chrome import Chrome
+from trac.wiki.api import parse_args
+from trac.wiki.macros import WikiMacroBase
+from trac.util.html import escape
+
+class XspfButtonMacro(WikiMacroBase):
+ def expand_macro(self, formatter, name, content):
+ _, kw = parse_args(content)
+ song_url = "/raw-attachment/wiki"\
+ "/%s/%s"%(formatter.resource.id, kw.get('attachment'))
+ name = kw.get('name', 'Unknown')
+ artist = kw.get('artist', 'Unknown')
+ song_title = escape("%s - %s"%(name, artist))
+ data = Chrome(self.env).populate_data(formatter.req, {
+ 'song_url': song_url,
+ 'song_title': song_title,
+ 'name': name,
+ 'artist': artist
+ });
+ return Chrome(self.env).load_template('xspf.html').\
+ generate(**data)
+
9 tracxspf/templates/xspf.html
@@ -0,0 +1,9 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:py="http://genshi.edgewall.org/"
+ py:strip="True">
+ <a href="${song_url}"><b>${name}</b></a> - <em>${artist}</em> <a href="${song_url}"><img src="${href('chrome', 'common', 'download.png')}"/></a><br/>
+ <object width="400" height="20" data="${href('chrome', 'tracxspf', 'slim_player.swf')}?song_url=${song_url}&amp;song_title=${song_title}" type="application/x-shockwave-flash">
+ <param name="player_title" value="Xspf : ${song_title}" />
+ <param name="movie" value="${href('chrome', 'tracxspf', 'slim_player.swf')}?song_url=${song_url}&amp;song_title=${song_title}" />
+ </object>
+</html>
13 tracxspf/web_ui.py
@@ -0,0 +1,13 @@
+from trac.core import *
+from trac.web.chrome import ITemplateProvider
+
+class XspfView(Component):
+ implements(ITemplateProvider)
+
+ def get_templates_dirs(self):
+ from pkg_resources import resource_filename
+ return [resource_filename(__name__, 'templates')]
+
+ def get_htdocs_dirs(self):
+ from pkg_resources import resource_filename
+ return [('tracxspf', resource_filename(__name__, 'htdocs'))]
Please sign in to comment.
Something went wrong with that request. Please try again.