Commit 5f8c01c0 authored by petitminion's avatar petitminion
Browse files

resolve black

parent 677c0274
Pipeline #15594 passed with stages
in 13 minutes and 25 seconds
import logging
import re
from datetime import datetime
# /!\ The next import have xml vulnerabilities but this shouldn't have security implication in funkwhale
# since there are only used to generate xspf file.
from xml.etree.ElementTree import Element, SubElement
......@@ -48,7 +49,9 @@ def get_track_id_from_xspf(xspf_file):
title = track.find(".//title").text
album = track.find(".//album").text
except AttributeError as e:
logger.info(f"Couldn't find the following attribute while parsing the xml file : {e!r}")
logger.info(
f"Couldn't find the following attribute while parsing the xml file : {e!r}"
)
continue
# Finding track id in the db
try:
......@@ -83,9 +86,11 @@ def generate_xspf_from_playlist(playlist_id):
This returns a string containing playlist data in xspf format
"""
fw_playlist = Playlist.objects.get(id=playlist_id)
plt_tracks = fw_playlist.playlist_tracks.prefetch_related('track')
plt_tracks = fw_playlist.playlist_tracks.prefetch_related("track")
xspf_playlist = Element("playlist")
xspf_tracklist = write_xspf_headers(xspf_playlist, fw_playlist.name, str(fw_playlist.creation_date))
xspf_tracklist = write_xspf_headers(
xspf_playlist, fw_playlist.name, str(fw_playlist.creation_date)
)
for plt_track in plt_tracks:
track = plt_track.track
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment