annotate bin/listsongs @ 1447:8a9a9b58a4e2

live page now knows that collector needs all settings on each request Ignore-this: 79ad8d1e001b98b6fce6d14f75f92745
author drewp@bigasterisk.com
date Sat, 11 Jun 2016 21:40:37 +0000
parents a38955ba6f40
children 6fa4288da8a6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
2
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
3 """for completion, print the available song uris on stdout
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
4
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
5 in .zshrc:
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
6
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
7 function _songs { local expl; _description files expl 'songs'; compadd "$expl[@]" - `${LIGHT9_SHOW}/../../bin/listsongs` }
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
8 compdef _songs curvecalc
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
9 """
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
10
891
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
11 from run_local import log
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
12 from twisted.internet import reactor
440
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
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
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
15 from light9.namespaces import L9
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
16 from light9.rdfdb.syncedgraph import SyncedGraph
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
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
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
19
891
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
20 @graph.initiallySynced.addCallback
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
21 def printSongs(result):
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
22 with graph.currentState() as current:
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
23 for song in current.subjects(RDF.type, L9['Song']):
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
24 print song
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
25 reactor.stop()
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
26
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
27 reactor.run()