audiothek

alternative frontend for ardaudiothek.de  https://audiothek.ce9e.org/
git clone https://git.ce9e.org/audiothek.git

commit
fe7b549502d7afe275fc648c459564e3c0b456a9
parent
d9d896c11cb55addfc16f98ff76cda110fefec39
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-09-17 12:37
move programSet data to top of query

Diffstat

M audiothek.py 21 ++++++++-------------

1 files changed, 8 insertions, 13 deletions


diff --git a/audiothek.py b/audiothek.py

@@ -8,6 +8,11 @@ import aiohttp
    8     8 QUERY = """
    9     9 query ProgramSetEpisodesQuery($id:ID!, $offset:Int!, $count:Int!) {
   10    10 	result:programSet(id:$id) {
   -1    11 		id
   -1    12 		title
   -1    13 		path
   -1    14 		image{ url1X1 }
   -1    15 		publicationService{ title }
   11    16 		items(offset:$offset first:$count orderBy:PUBLISH_DATE_DESC filter:{isPublished:{equalTo:true}}) {
   12    17 			pageInfo{hasNextPage endCursor}
   13    18 			nodes{
@@ -17,13 +22,7 @@ query ProgramSetEpisodesQuery($id:ID!, $offset:Int!, $count:Int!) {
   17    22 				summary
   18    23 				duration
   19    24 				path
   20    -1 				programSet{
   21    -1 					id
   22    -1 					title
   23    -1 					path
   24    -1 					image{ url1X1 }
   25    -1 					publicationService{ title }
   26    -1 				}
   -1    25 				image{ url1X1 }
   27    26 				audios{ url }
   28    27 			}
   29    28 		}
@@ -83,11 +82,8 @@ async def feed(request):
   83    82 			response.raise_for_status()
   84    83 			data = await response.json()
   85    84 
   86    -1 	nodes = data['data']['result']['items']['nodes']
   87    -1 
   88    -1 	show = nodes[0]['programSet']
   -1    85 	show = data['data']['result']
   89    86 	show_data = {
   90    -1 		'id': request.match_info['id'],
   91    87 		'title': show['title'],
   92    88 		'url': 'https://www.ardaudiothek.de' + show['path'],
   93    89 		'img_url': show['image']['url1X1'].replace('{width}', '64'),
@@ -96,13 +92,12 @@ async def feed(request):
   96    92 
   97    93 	episode_data = [{
   98    94 		'title': node['title'],
   99    -1 		'id': 'audiothek:' + node['id'],
  100    95 		'url': 'https://www.ardaudiothek.de' + node['path'],
  101    96 		'summary': node['summary'],
  102    97 		'updated': node['publishDate'],
  103    98 		'downloadUrl': node['audios'][0]['url'],  # FIXME: more than one
  104    99 		'duration': str(node['duration']),
  105    -1 	} for node in nodes]
   -1   100 	} for node in show['items']['nodes']]
  106   101 
  107   102 	body = render_feed(show_data, episode_data)
  108   103