annotate bin/listsongs @ 2078:2c48e92ad5d3

make loadtest real enough to cause numbers to change on collector's web view
author drewp@bigasterisk.com
date Tue, 24 May 2022 01:21:32 -0700
parents 3c523c71da29
children
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 """for completion, print the available song uris on stdout
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
3
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
4 in .zshrc:
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
5
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
6 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
7 compdef _songs curvecalc
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
8 """
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
9
1866
3c523c71da29 pyflakes cleanups and some refactors
Drew Perttula <drewp@bigasterisk.com>
parents: 1859
diff changeset
10 from run_local import log # noqa
891
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
11 from twisted.internet import reactor
440
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
12 from rdflib import RDF
1114
a38955ba6f40 rdfdb port is now in the config
Drew Perttula <drewp@bigasterisk.com>
parents: 891
diff changeset
13 from light9 import networking
891
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
14 from light9.namespaces import L9
1692
6fa4288da8a6 rdfdb is its own package now
drewp@bigasterisk.com
parents: 1114
diff changeset
15 from rdfdb.syncedgraph import SyncedGraph
891
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
16
1114
a38955ba6f40 rdfdb port is now in the config
Drew Perttula <drewp@bigasterisk.com>
parents: 891
diff changeset
17 graph = SyncedGraph(networking.rdfdb.url, "listsongs")
440
8a59efa577c1 new zsh completer for curvecalc
drewp@bigasterisk.com
parents:
diff changeset
18
1858
7772cc48e016 reformat all python
drewp@bigasterisk.com
parents: 1692
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']):
1859
f066d6e874db 2to3 with these fixers: all idioms set_literal
drewp@bigasterisk.com
parents: 1858
diff changeset
24 print(song)
891
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
1858
7772cc48e016 reformat all python
drewp@bigasterisk.com
parents: 1692
diff changeset
27
891
27d2f148b630 port listSongs to use syncedgraph
drewp@bigasterisk.com
parents: 717
diff changeset
28 reactor.run()