Don't download file as attachment for podcast
This commit is contained in:
parent
964ec53ffb
commit
547c4ea554
|
@ -829,7 +829,9 @@ def rss_serialize_item(upload):
|
||||||
"enclosure": [
|
"enclosure": [
|
||||||
{
|
{
|
||||||
# we enforce MP3, since it's the only format supported everywhere
|
# we enforce MP3, since it's the only format supported everywhere
|
||||||
"url": federation_utils.full_url(upload.get_listen_url(to="mp3")),
|
"url": federation_utils.full_url(
|
||||||
|
upload.get_listen_url(to="mp3", download=False)
|
||||||
|
),
|
||||||
"length": upload.size or 0,
|
"length": upload.size or 0,
|
||||||
"type": "audio/mpeg",
|
"type": "audio/mpeg",
|
||||||
}
|
}
|
||||||
|
|
|
@ -890,10 +890,13 @@ class Upload(models.Model):
|
||||||
def listen_url(self):
|
def listen_url(self):
|
||||||
return self.track.listen_url + "?upload={}".format(self.uuid)
|
return self.track.listen_url + "?upload={}".format(self.uuid)
|
||||||
|
|
||||||
def get_listen_url(self, to=None):
|
def get_listen_url(self, to=None, download=True):
|
||||||
url = self.listen_url
|
url = self.listen_url
|
||||||
if to:
|
if to:
|
||||||
url += "&to={}".format(to)
|
url += "&to={}".format(to)
|
||||||
|
if not download:
|
||||||
|
url += "&download=false"
|
||||||
|
|
||||||
return url
|
return url
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -314,7 +314,9 @@ def test_rss_item_serializer(factories):
|
||||||
"link": [{"value": federation_utils.full_url(upload.track.get_absolute_url())}],
|
"link": [{"value": federation_utils.full_url(upload.track.get_absolute_url())}],
|
||||||
"enclosure": [
|
"enclosure": [
|
||||||
{
|
{
|
||||||
"url": federation_utils.full_url(upload.get_listen_url("mp3")),
|
"url": federation_utils.full_url(
|
||||||
|
upload.get_listen_url("mp3", download=False)
|
||||||
|
),
|
||||||
"length": upload.size,
|
"length": upload.size,
|
||||||
"type": "audio/mpeg",
|
"type": "audio/mpeg",
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue