Fix feed formatting so it passes w3c validation

Feeds generated by Funkwhale do not pass validation with the [w3c
validator](https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fpodcast.midline.pl%2Fapi%2Fv1%2Fchannels%2FMidline%2Frss).
This commit addresses the problems identified during validation:

1. The `isPermalink` is not recognized -> changed it to
   `isPermaLink` (capital "L")

2. `itunes:summary` and `itunes:subtitle` are 256 characters after
   truncating, but the maximum is 255. The truncating function trims the
   text to 255 chars, but then adds `…`, so the text is one character
   too long

3. The tags within `itunes:keywords` are now separated with commas
   instead of spaces (https://validator.w3.org/feed/docs/warning/InvalidKeywords.html)
This commit is contained in:
Kuba Orlik 2020-10-22 15:06:28 +02:00 committed by Agate
commit 3a83290cc0
5 changed files with 12 additions and 8 deletions

View file

@ -300,13 +300,13 @@ def test_rss_item_serializer(factories):
expected = {
"title": [{"value": upload.track.title}],
"itunes:title": [{"value": upload.track.title}],
"itunes:subtitle": [{"value": description.truncate(255)}],
"itunes:subtitle": [{"value": description.truncate(254)}],
"itunes:summary": [{"cdata_value": description.rendered}],
"description": [{"value": description.as_plain_text}],
"guid": [{"cdata_value": str(upload.uuid), "isPermalink": "false"}],
"guid": [{"cdata_value": str(upload.uuid), "isPermaLink": "false"}],
"pubDate": [{"value": serializers.rfc822_date(upload.creation_date)}],
"itunes:duration": [{"value": serializers.rss_duration(upload.duration)}],
"itunes:keywords": [{"value": "pop rock"}],
"itunes:keywords": [{"value": "pop,rock"}],
"itunes:explicit": [{"value": "no"}],
"itunes:episodeType": [{"value": "full"}],
"itunes:season": [{"value": upload.track.disc_number}],