Skip to content

Commit

Permalink
Specific chromecast device can be selected
Browse files Browse the repository at this point in the history
  • Loading branch information
palaviv committed Oct 18, 2016
1 parent d4e5c27 commit 4482fce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ How to use

```
caster /file/to/play.mp4
caster /file/to/play.mp4 --device ChromcastName
```

### Player control
Expand Down
10 changes: 9 additions & 1 deletion caster.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def handle_input(server_thread, dev, mc):
def get_args():
parser = argparse.ArgumentParser(description='Caster - cast media to chromecast')
parser.add_argument('file', help='The file to play')
parser.add_argument('--device', help='The chromecast device to use.'
' When not given first one found is used.',
default=None)
return parser.parse_args()


Expand All @@ -74,7 +77,12 @@ def main():

file_path = args.file

name, dev = pychromecast.get_chromecasts_as_dict().popitem()
device_name = args.device

if device_name:
dev = pychromecast.get_chromecasts_as_dict()[device_name]
else:
_, dev = pychromecast.get_chromecasts_as_dict().popitem()

dev.wait()

Expand Down

0 comments on commit 4482fce

Please sign in to comment.