Things are moving fast, since my last
post. Indeed, Frederick just put
online the
Musicbrainz RDF dump, with dereferencable URIs, SPARQL end-point,
everything. Great job Fred!!
This data set will surely be a sort of hub
for music-related data on
the Semantic Web, as it gives URIs for a large number of
artists, tracks, albums, but also timelines, performances, recordings, etc.
Well, almost everything defined in the Music
Ontology.
I am happy to announce the first hack using this dataset:-) This is called
GNAT (for GNAT is
not a tagger
). It is just some lines of python code which, from an audio
file in your music collection, gives you the corresponding dereferencable
URI.
It also puts this URI into the ID3v2 Universal File Identifier
(UFID) frame. I am not sure it is the right place to put such an information
though, as it is an identifier of the manifestation, not the
item iself. Maybe I should use the user-defined link frames in
the ID3v2 header...
So it is actually the first step of the application mentioned here!
It is quite easy to use:
$ python trackuri.py 7-don\'t_look_back.mp3
- ID3 tags
Artist: Artemis
Title: Don't Look Back
Album: Undone
- Zitgist URI
http://zitgist.com/music/track/2b78923b-c260-44c1-b333-2caa020df172
Then:
$ eyeD3 7-don\'t_look_back.mp3
7-don't_look_back.mp3 [ 3.23 MB ]
--------------------------------------------------------------------------------
Time: 3:31 MPEG1, Layer III [ 128 kb/s @ 44100 Hz - Stereo ]
--------------------------------------------------------------------------------
ID3 v2.4:
title: Don't Look Back artist: Artemis
album: Undone year: 2000
track: 7 genre: Trip-Hop (id 27)
Unique File ID: [http://zitgist.com/music/] http://zitgist.com/music/track/2b78923b-c260-44c1-b333-2caa020df172
Comment: [Description: http] [Lang: ]
//www.magnatune.com/artists/artemis
Comment: [Description: ID3v1 Comment] [Lang: XXX]
From www.magnatune.com
You can also output the corresponding RDF, in RDF/XML or N3:
$ python trackuri.py 1-i\'m_alive.mp3 xml
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:_3="http://purl.org/ontology/mo/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
<rdf:Description
rdf:about=
"http://zitgist.com/music/track/67a1fab6-aea4-47f4-891d-6d42bb856a40">
<_3:availableAs rdf:resource=""/>
</rdf:Description>
</rdf:RDF>
$ python trackuri.py 1-i\'m_alive.mp3 n3
@prefix _3: <http://zitgist.com/music/track/67>.
@prefix _4: <http://purl.org/ontology/mo/>.
_3:a1fab6-aea4-47f4-891d-6d42bb856a40 _4:availableAs <>.
... even though I still have to put the good Item URI, instead of
<>.
Get it!
You can download the code here, and it is GPL licensed.
The dependencies are:
- python-id3
- python-musicbrainz2
- RDFLib (
easy_install -U rdflib)
- mutagen (
easy_install -U mutagen)