31 lines
943 B
Python
31 lines
943 B
Python
import os
|
|
import sys
|
|
|
|
from player import Player
|
|
#from local_player import LocalPlayer
|
|
from google_home_player import GoogleHomePlayer
|
|
|
|
|
|
def get_player(player_type: str, player_name: str) -> Player:
|
|
match player_type:
|
|
case 'google_home':
|
|
player = GoogleHomePlayer(player_name)
|
|
case 'local':
|
|
#player = LocalPlayer(player_name)
|
|
pass
|
|
case _:
|
|
raise ValueError(f'No player type "{player_type}"')
|
|
return player
|
|
|
|
|
|
if __name__ == '__main__':
|
|
if len(sys.argv) < 3:
|
|
raise ValueError('Missing arguments for player type/name')
|
|
|
|
player = get_player(player_type=sys.argv[1], player_name=sys.argv[2])
|
|
|
|
rabbitmq_host = os.environ.get('RABBITMQ_HOST', 'localhost')
|
|
rabbitmq_port = int(os.environ.get('RABBITMQ_PORT', '5672'))
|
|
rabbitmq_topics = os.environ['RABBITMQ_TOPICS'].split(',')
|
|
player.subscribe(rabbitmq_host, rabbitmq_port, rabbitmq_topics)
|