Skip to content

Instantly share code, notes, and snippets.

View alastair's full-sized avatar

Alastair Porter alastair

View GitHub Profile
EXPLAIN analyze SELECT COUNT(*) FROM "comments_comment" WHERE ("comments_comment"."object_id" = 192313 AND "comments_comment"."content_type_id" = 20 );
QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------------------
Aggregate (cost=19.44..19.45 rows=1 width=0) (actual time=0.011..0.011 rows=1 loops=1)
-> Index Scan using comments_comment_object_id on comments_comment (cost=0.00..19.43 rows=5 width=0) (actual time=0.008..0.008 rows=0 loops=1)
Index Cond: (object_id = 192313)
Filter: (content_type_id = 20)
Total runtime: 0.043 ms
(5 rows)
Wed Apr 9 17:57:23 2014 : load artist
artist 835584 99% 147106Error loading /tmp/MBImport-vMaVNDHx/mbdump/artist: DBD::Pg::db pg_putcopyend failed: ERROR: extra data after last expected column
CONTEXT: COPY artist, line 1: "805192 8972b1c1-6482-4750-b51f-596d2edea8b1 WIK▲N WIK▲N \N \N \N \N \N \N \N \N \N 0 2011-05-17..." at /home/alastair/code/musicbrainz-server/admin/MBImport.pl line 296, <LOAD> line 836797.
Wed Apr 9 17:57:29 2014 : load artist_alias
artist_alias 126976 98% 61756Error loading /tmp/MBImport-vMaVNDHx/mbdump/artist_alias: DBD::Pg::db pg_putcopyend failed: ERROR: extra data after last expected column
CONTEXT: COPY artist_alias, line 1: "125531 932664 Jared Kotler en_US 0 2012-10-22 21:00:20.526211+00 2 Kotler, Jared \N \N \N \N \N \N t..." at /home/alastair/code/musicbrainz-server/admin/MBImport.pl line 296, <LOAD> line 965151.
Wed Apr 9 17:57:31 2014 : load artist_alias_type
artist_alias_type 3 100% 6
Key Value
User-Agent Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11.0) like Gecko
Request GET /player/audio.mp3 HTTP/1.1
Referer http://dunya.compmusic.upf.edu/player/
Pragma getIfoFileURI.dlna.org
Host dunya.compmusic.upf.edu
GetContentFeatures.DLNA.ORG 1
DNT 1
Connection Keep-Alive
Cache-Control no-cache
import requests
import xspf
g = requests.get("https://gist.githubusercontent.com/iainmullan/f40cf1e0e66be62a629f/raw/4b0e2e3b9272e0378586f9a46317d4af850ff21a/pitchfork200.json")
j = g.json()
x = xspf.Xspf()
for t in j:
x.add_track(title=t["title"], creator=t["artist"])
open("top200.jspf", "w").write(x.toXml())
import requests
import xspf # https://github.com/alastair/xspf
g = requests.get("https://gist.githubusercontent.com/iainmullan/f40cf1e0e66be62a629f/raw/4b0e2e3b9272e0378586f9a46317d4af850ff21a/pitchfork200.json")
j = g.json()
x = xspf.Xspf()
for t in j:
x.add_track(title=t["title"], creator=t["artist"])
open("pitchfork200.xspf", "w").write(x.toXml())
"highlevel": {
"essentia": "2.1-beta1",
"essentia_git_sha": "v2.1_beta1-223-gf107d2b-dirty",
"extractor": "music 1.0",
"gaia": "2.4-dev",
"gaia_git_sha": "2fd6559-dirty"
},
"lo
3a096c4b-5950-4f18-8ba8-d09092cc0294 | 1
f467b0da-bdea-4606-b3f6-91fae601cd7a | 1
9b7d2d22-e002-4124-9cf7-947a479be6b9 | 1
a15af8c1-78cf-4174-a3e5-f00715d05655 | 1
1de01f97-3e6c-4e3d-9b30-9f6748e18bbb | 1
6e98aef8-3a45-4ab2-b596-634f919791aa | 1
9fce87e5-f3fa-4071-bce5-ee3728bc71a5 | 1
98bd9bdc-038b-49b2-a43e-77c9c8007b97 | 1
1040d9b8-4f86-48e7-9c8a-8f686f13fb9b | 1
42370c80-41c4-47d1-86b0-5587528f010e | 1
mbid | bpm
--------------------------------------+---------------
e0e2b363-61a2-4535-a272-9085f1edd7bf | 215.33203125
e0e2b363-61a2-4535-a272-9085f1edd7bf | 215.33203125
e20ad03f-80e9-4100-a8b7-08e4f5d97661 | 215.33203125
e20ad03f-80e9-4100-a8b7-08e4f5d97661 | 206.718765259
e0e2b363-61a2-4535-a272-9085f1edd7bf | 206.71875
797b4533-8574-4611-8939-2d57f8e0366c | 206.71875
93497424-896f-41c4-a3b2-0f0d570f2fcb | 206.71875
e4ff51ec-3181-47fa-8ac1-272ebd69e7b7 | 198.768066406
@alastair
alastair / gist:69d5658e1f9269bc1a8e
Last active August 29, 2015 14:09
top bpms from acousticbrainz
select mbid, (data#>>'{rhythm,bpm}')::float bpm from lowlevel where (data#>>'{metadata,audio_properties,length}')::float > 60 order by bpm desc limit 100;
mbid | bpm
--------------------------------------+---------------
a5854210-4919-4242-9ad3-5dce57338265 | 191.407272339
e0f6ca81-a5a0-49b2-86f2-feae4142d0c6 | 191.40675354
d6ff357c-4782-41e7-ab2c-a93babd8c233 | 191.406707764
f09a32f2-bbd5-42f3-a6c3-a0d10385d6f6 | 191.406646729
012dfdb5-2b48-44d4-85df-e577937b60fb | 191.406600952