Mercurial > code > home > repos > light9
annotate bin/listsongs @ 1721:b4633fb9bccf
extract Project class with the larger graph-only methods
Ignore-this: e0d79e45fb053d8b7e228b6eb5687eba
author | Drew Perttula <drewp@bigasterisk.com> |
---|---|
date | Mon, 07 May 2018 00:38:56 +0000 |
parents | 6fa4288da8a6 |
children | 7772cc48e016 |
rev | line source |
---|---|
717
d8202a0a7fd5
fix up musicpad and wavecurve. ascoltami2 can now use relative paths in the config
Drew Perttula <drewp@bigasterisk.com>
parents:
440
diff
changeset
|
1 #!bin/python |
440 | 2 |
3 """for completion, print the available song uris on stdout | |
4 | |
5 in .zshrc: | |
6 | |
7 function _songs { local expl; _description files expl 'songs'; compadd "$expl[@]" - `${LIGHT9_SHOW}/../../bin/listsongs` } | |
8 compdef _songs curvecalc | |
9 """ | |
10 | |
891 | 11 from run_local import log |
12 from twisted.internet import reactor | |
440 | 13 from rdflib import RDF |
1114
a38955ba6f40
rdfdb port is now in the config
Drew Perttula <drewp@bigasterisk.com>
parents:
891
diff
changeset
|
14 from light9 import networking |
891 | 15 from light9.namespaces import L9 |
1692 | 16 from rdfdb.syncedgraph import SyncedGraph |
891 | 17 |
1114
a38955ba6f40
rdfdb port is now in the config
Drew Perttula <drewp@bigasterisk.com>
parents:
891
diff
changeset
|
18 graph = SyncedGraph(networking.rdfdb.url, "listsongs") |
440 | 19 |
891 | 20 @graph.initiallySynced.addCallback |
21 def printSongs(result): | |
22 with graph.currentState() as current: | |
23 for song in current.subjects(RDF.type, L9['Song']): | |
24 print song | |
25 reactor.stop() | |
26 | |
27 reactor.run() |