From 13e298e7725d172c3344b752fb17f2863d4435db Mon Sep 17 00:00:00 2001 From: Lukas Winkler Date: Mon, 27 Aug 2018 20:29:18 +0200 Subject: [PATCH] no empty line at start of sitemap --- sitemap.py | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/sitemap.py b/sitemap.py index a81f4fb..f6e330b 100644 --- a/sitemap.py +++ b/sitemap.py @@ -1,29 +1,20 @@ from peewee import SQL, fn -xml = """ - - -""" - from models import Channel, Play, Song +xml = """ + +""" + for channel in Channel.select().where(Channel.has_data == 1): - xml += """ - - https://radiostats.lw1.at/{channel} - -""".format(channel=channel.shortname) + xml += "https://radiostats.lw1.at/{channel}".format(channel=channel.shortname) get = Play.select(Play.song, Song.id, fn.Count(SQL('*')).alias("count")) \ .join(Channel).switch(Play).join(Song) \ .where((Song.show == 0) & (Channel.shortname == channel.shortname)) \ .group_by(Play.song).order_by(SQL('count').desc()).limit(500) for i in get: song = i.song.id - xml += """ - - https://radiostats.lw1.at/{channel}/song/{songid} - -""".format(channel=channel.shortname, songid=song) + xml += "https://radiostats.lw1.at/{channel}/song/{songid}".format(channel=channel.shortname, songid=song) xml += ""