Skip to content

Commit

Permalink
Use command line argument for configuration in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sdiemer committed May 24, 2019
1 parent 112afa8 commit 7b0ddb4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
6 changes: 4 additions & 2 deletions examples/fake_mediacoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
'''
Fake MediaCoder client for tests.
'''
import os
import json
import logging
import os
import sys
from mm_client.client import MirisManagerClient

logger = logging.getLogger('fake_mediacoder')
Expand Down Expand Up @@ -40,7 +41,8 @@ def handle_action(self, action, params):


if __name__ == '__main__':
client = FakeMediaCoder()
local_conf = sys.argv[1] if len(sys.argv) > 1 else None
client = FakeMediaCoder(local_conf)
client.update_capabilities()
client.set_status(status='ready', status_message='Ready to record', remaining_space='auto')
try:
Expand Down
4 changes: 3 additions & 1 deletion examples/recorder_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'''
import json
import logging
import sys
from mm_client.client import MirisManagerClient

logger = logging.getLogger('recorder_controller')
Expand Down Expand Up @@ -45,7 +46,8 @@ def handle_action(self, action, params):


if __name__ == '__main__':
client = RecorderController()
local_conf = sys.argv[1] if len(sys.argv) > 1 else None
client = RecorderController(local_conf)
try:
client.long_polling_loop()
except KeyboardInterrupt:
Expand Down
4 changes: 3 additions & 1 deletion examples/screen_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'''
import logging
import os
import sys
from mm_client.client import MirisManagerClient

logger = logging.getLogger('screen_controller')
Expand Down Expand Up @@ -43,7 +44,8 @@ def handle_action(self, action, params):


if __name__ == '__main__':
client = ScreenController()
local_conf = sys.argv[1] if len(sys.argv) > 1 else None
client = ScreenController(local_conf)
client.update_capabilities()
try:
client.long_polling_loop()
Expand Down
4 changes: 3 additions & 1 deletion examples/send_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
Script to send a message
'''
import datetime
import sys
from mm_client.client import MirisManagerClient


if __name__ == '__main__':
client = MirisManagerClient()
local_conf = sys.argv[1] if len(sys.argv) > 1 else None
client = MirisManagerClient(local_conf)
client.api_request('ADD_MESSAGE', data=dict(
content='%s\nTest message' % datetime.datetime.now(),
content_debug='Debug content with some special characters:\n\tđ€¶←←ħ¶ŧħ<< "\' fF5ef',
Expand Down
4 changes: 3 additions & 1 deletion examples/wol_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import logging
import os
import re
import sys
from mm_client.client import MirisManagerClient

logger = logging.getLogger('wol_relay')
Expand Down Expand Up @@ -55,7 +56,8 @@ def send_wake_on_lan(self, params):


if __name__ == '__main__':
client = WOLRelay()
local_conf = sys.argv[1] if len(sys.argv) > 1 else None
client = WOLRelay(local_conf)
client.update_capabilities()
try:
client.long_polling_loop()
Expand Down

0 comments on commit 7b0ddb4

Please sign in to comment.