blog

git clone https://git.ce9e.org/blog.git

commit
2f02e64253f2a41e0a334cf897094e74b884ce3f
parent
3b2291e25aef54d2378cd60ec07362c170e45bda
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2023-10-19 06:11
fixup 36dd1ee: rm traces of music

Diffstat

M _templates/base.html 2 +-
D _templates/player.html 8 --------
D music.py 22 ----------------------

3 files changed, 1 insertions, 31 deletions


diff --git a/_templates/base.html b/_templates/base.html

@@ -5,7 +5,7 @@
    5     5 	<meta charset="UTF-8">
    6     6 	<meta name="viewport" content="width=device-width, initial-scale=1">
    7     7 	<meta name="referrer" content="strict-origin-when-cross-origin">
    8    -1 	<meta http-equiv="Content-Security-Policy" content="default-src 'self'; media-src 'self' https://cf-media.sndcdn.com https://api.soundcloud.com">
   -1     8 	<meta http-equiv="Content-Security-Policy" content="default-src 'self'">
    9     9 	<title>Ξ{{#title}} - {{.}}{{/title}}</title>
   10    10 	<link rel="stylesheet" type="text/css" href="/static/style.css">
   11    11 	<link rel="alternate" type="application/atom+xml" href="/feed.xml">

diff --git a/_templates/player.html b/_templates/player.html

@@ -1,8 +0,0 @@
    1    -1 <div class="player">
    2    -1 	<ol>
    3    -1 		{{#tracks}}
    4    -1 			<li><a class="track" href="{{ url }}">{{ title }}</a></li>
    5    -1 		{{/tracks}}
    6    -1 	</ol>
    7    -1 </div>
    8    -1 <script src="/static/xiply.js"></script>

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

@@ -1,22 +0,0 @@
    1    -1 #!/usr/bin/env python3
    2    -1 
    3    -1 CLIENT_ID = '07a19efd09110c4085f3835842327b18'  # 'YOUR_CLIENT_ID'
    4    -1 USER_ID = '2813583'
    5    -1 URL = "http://api.soundcloud.com/users/{user_id}/tracks.json?client_id={client_id}"
    6    -1 
    7    -1 from urllib.request import urlopen
    8    -1 import json
    9    -1 
   10    -1 url = URL.format(user_id=USER_ID, client_id=CLIENT_ID)
   11    -1 with urlopen(url) as f:
   12    -1 	data = f.read();
   13    -1 	f.close()
   14    -1 
   15    -1 tracks = json.loads(data.decode())
   16    -1 
   17    -1 print('title: music')
   18    -1 print('player:')
   19    -1 print('  tracks:')
   20    -1 item = '    - {{title: "{title}", url: "{stream_url}?client_id={client_id}"}}'
   21    -1 for track in tracks:
   22    -1 	print(item.format(client_id=CLIENT_ID, **track))