quoting and unquoting url paths
This commit is contained in:
parent
1848ebdff4
commit
d1e065d9f6
16
musik.py
16
musik.py
|
@ -12,7 +12,7 @@ from flask import Flask, Response, render_template, send_file, url_for
|
||||||
from flask_restful import reqparse, abort, Api, Resource
|
from flask_restful import reqparse, abort, Api, Resource
|
||||||
import mutagen
|
import mutagen
|
||||||
|
|
||||||
MUSIC_DIR = "/mnt/music/Music"
|
MUSIC_DIR = "/home/iou1name/music/Music"
|
||||||
MUSIC_EXT = ['flac', 'mp3', 'wav', 'm4a']
|
MUSIC_EXT = ['flac', 'mp3', 'wav', 'm4a']
|
||||||
FFMPEG_CMD = [
|
FFMPEG_CMD = [
|
||||||
'ffmpeg', '-y',
|
'ffmpeg', '-y',
|
||||||
|
@ -127,14 +127,14 @@ class Selection(Resource):
|
||||||
found.pop('filepath')
|
found.pop('filepath')
|
||||||
found['streampath'] = url_for(
|
found['streampath'] = url_for(
|
||||||
'stream',
|
'stream',
|
||||||
artist=track.artist,
|
artist=parse.quote(track.artist, safe=''),
|
||||||
album=track.album,
|
album=parse.quote(track.album, safe=''),
|
||||||
track=track.title)
|
track=parse.quote(track.title, safe=''))
|
||||||
found['coverart'] = url_for(
|
found['coverart'] = url_for(
|
||||||
'coverart',
|
'coverart',
|
||||||
artist=track.artist,
|
artist=parse.quote(track.artist, safe=''),
|
||||||
album=track.album,
|
album=parse.quote(track.album, safe=''),
|
||||||
track=track.title)
|
track=parse.quote(track.title, safe=''))
|
||||||
return found
|
return found
|
||||||
|
|
||||||
elif args.get('album'):
|
elif args.get('album'):
|
||||||
|
@ -186,6 +186,7 @@ api.init_app(app)
|
||||||
@app.route('/stream/<artist>/<album>/<track>')
|
@app.route('/stream/<artist>/<album>/<track>')
|
||||||
def stream(artist, album, track):
|
def stream(artist, album, track):
|
||||||
"""View for the raw audio file."""
|
"""View for the raw audio file."""
|
||||||
|
artist, album, track = map(parse.unquote, (artist, album, track))
|
||||||
for t in tracks:
|
for t in tracks:
|
||||||
if (t.artist == artist and
|
if (t.artist == artist and
|
||||||
t.album == album and
|
t.album == album and
|
||||||
|
@ -208,6 +209,7 @@ def stream(artist, album, track):
|
||||||
@app.route('/coverart/<artist>/<album>/<track>')
|
@app.route('/coverart/<artist>/<album>/<track>')
|
||||||
def coverart(artist, album, track):
|
def coverart(artist, album, track):
|
||||||
"""View for the raw audio file."""
|
"""View for the raw audio file."""
|
||||||
|
artist, album, track = map(parse.unquote, (artist, album, track))
|
||||||
for t in tracks:
|
for t in tracks:
|
||||||
if (t.artist == artist and
|
if (t.artist == artist and
|
||||||
t.album == album and
|
t.album == album and
|
||||||
|
|
Loading…
Reference in New Issue
Block a user