diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2011-08-16 14:49:40 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2011-08-16 14:49:40 +0200 |
commit | a3e86f3be768c8fa1fc2af12d5e5d66d9d9b82e8 (patch) | |
tree | b7ff0104001b62709e22cdaefa0adc23ea07b919 /app.py | |
parent | 74ad26edc2cf0d8aa8d5d485d708de1a34aa75c0 (diff) |
Implemented basic cuesheet support, some playlist fixes.
Diffstat (limited to 'app.py')
-rwxr-xr-x | app.py | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -35,8 +35,10 @@ class Application(object): return open(filename, 'rb') def cache(self, environ, start_response, path): + args = cgi.FieldStorage(environ = environ) path = os.path.join(*path[1:]) - cache_path = File(path).get_cache_path() + track = args.getvalue('track') if 'track' in args else None + cache_path = File(path, track = track).get_cache_path() if not os.path.exists(cache_path) or '..' in path: start_response('404 Not Found', []) @@ -61,8 +63,9 @@ class Application(object): def json_recode(self, environ, start_response, path): args = cgi.FieldStorage(environ = environ) path = args.getvalue('path') if 'path' in args else None + track = args.getvalue('track') if 'track' in args else None - f = File(path) + f = File(path, track = track) # see json_play() if not os.path.splitext(path)[1] in ('.mp3', '.ogg'): decoder = 'ffmpeg' @@ -76,8 +79,9 @@ class Application(object): args = cgi.FieldStorage(environ = environ) path = args.getvalue('path') + track = args.getvalue('track') if 'track' in args else None - f = File(path) + f = File(path, track = track) # TODO: replace this with some sane logic if not os.path.splitext(path)[1] in ('.mp3', '.ogg'): cache_path = f.get_cache_path() @@ -86,7 +90,7 @@ class Application(object): if not os.path.exists(cache_path): f.start_recode(decoder, encoder, environ['sessionid']) else: - events.event_pub.play(environ['sessionid'], '/cache/{0}'.format(path)) + events.event_pub.play(environ['sessionid'], '/cache/{0}{1}'.format(path, ('?track=' + track if track else ''))) else: events.event_pub.play(environ['sessionid'], '/files/{0}'.format(path)) |