FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python2-osc/examples/simple_server.py at python2 · kjcole/python2-osc · GitHub
kjcole
/
python2-osc
Public
forked from
mwicat/python2-osc
Notifications
You must be signed in to change notification settings
Fork
1
Star
2
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
python2-osc
/
examples
/
simple_server.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
42 lines (32 loc) · 1.25 KB
Breadcrumbs
python2-osc
/
examples
/
simple_server.py
Copy path
File metadata and controls
executable file
·
42 lines (32 loc) · 1.25 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python2.7
# -*- coding: utf-8 -*-
from
__future__
import
print_function
import
argparse
import
math
from
pythonosc
import
dispatcher
from
pythonosc
import
osc_server
def
print_volume_handler
(
unused_addr
,
args
,
volume
):
print
(
"[{0}] ~ {1}"
.
format
(
args
[
0
],
volume
))
def
print_compute_handler
(
unused_addr
,
args
,
volume
):
try
:
print
(
"[{0}] ~ {1}"
.
format
(
args
[
0
],
args
[
1
](
volume
)))
except
ValueError
:
pass
if
__name__
==
"__main__"
:
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"--ip"
,
default
=
"0.0.0.0"
,
help
=
"The ip to listen on"
)
parser
.
add_argument
(
"--port"
,
type
=
int
,
default
=
5005
,
help
=
"The port to listen on"
)
args
=
parser
.
parse_args
()
dispatcher
=
dispatcher
.
Dispatcher
()
dispatcher
.
map
(
"/debug"
,
print
)
dispatcher
.
map
(
"/volume"
,
print_volume_handler
,
"Volume"
)
dispatcher
.
map
(
"/logvolume"
,
print_compute_handler
,
"Log volume"
,
math
.
log
)
server
=
osc_server
.
ThreadingOSCUDPServer
((
args
.
ip
,
args
.
port
),
dispatcher
)
print
(
"Serving on {0}"
.
format
(
server
.
server_address
))
server
.
serve_forever
()
Back
|
FazBrowse Home
|
New Git URL