Hier ist meine Jinja -Vorlage: < /p>
Code: Select all
M3U_TEMPLATE = jinja2.Template(
textwrap.dedent("""\
#EXTM3U
{% for item in playlist %}
#EXTALB:{{ item.strAlbum }} ({{ item.release }})
#EXTART:{{ item.strAlbumArtists }}
#EXTINF:{{ item.iDuration }},{{ item.strArtists }} - {{ item.strTitle }}
{{ item.path }}
{% endfor %}
""")
)
#EXTM3U
#EXTALB:Offramp (1982)
#EXTART:Pat Metheny Group
#EXTINF:408,Pat Metheny Group - James
/media/Jazz, Fusion etc/Pat Metheny Group/1982 • Offramp/06 James.m4a
#EXTALB:Blue Moon (1961)
#EXTART:The Marcels
#EXTINF:133,The Marcels - Blue Moon
/media/Pop/The Marcels/1961 • Blue Moon/01 Blue Moon.m4a
< /code>
Aber ich bekomme Folgendes: < /p>
#EXTM3U
#EXTALB:Offramp (1982)
#EXTART:Pat Metheny Group
#EXTINF:408,Pat Metheny Group - James
/media/Jazz, Fusion etc/Pat Metheny Group/1982 • Offramp/06 James.m4a
#EXTALB:Blue Moon (1961)
#EXTART:The Marcels
#EXTINF:133,The Marcels - Blue Moon
/media/Pop/The Marcels/1961 • Blue Moon/01 Blue Moon.m4a
< /code>
Ich möchte, dass die Blockeinklage des Elements im Code, jedoch nicht im Endergebnis. Wie kann man das loswerden? Ich kann kein Jinja -Beispiel finden, das meinen Fall abdeckt.