-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from alexmohr/dev
Misc Fixes and imrovements
- Loading branch information
Showing
6 changed files
with
89 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from sonyapilib.device import SonyDevice | ||
|
||
def save_device(): | ||
data = device.save_to_json() | ||
text_file = open("bluray.json", "w") | ||
text_file.write(data) | ||
text_file.close() | ||
|
||
if __name__ == "__main__": | ||
|
||
stored_config = "bluray.json" | ||
device = None | ||
import os.path | ||
if os.path.exists(stored_config): | ||
with open(stored_config, 'r') as content_file: | ||
json_data = content_file.read() | ||
device = SonyDevice.load_from_json(json_data) | ||
else: | ||
# device must be on for registration | ||
host = "10.0.0.102" | ||
device = SonyDevice(host, "SonyApiLib Python Test") | ||
device.register() | ||
pin = input("Enter the PIN displayed at your device: ") | ||
device.send_authentication(pin) | ||
save_device() | ||
|
||
# wake device | ||
is_on = device.get_power_status() | ||
if not is_on: | ||
device.power(True) | ||
|
||
apps = device.get_apps() | ||
|
||
device.start_app(apps[0]) | ||
|
||
# Play media | ||
device.play() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,18 +15,19 @@ | |
# and be sure to test it firstly using "python setup.py register sdist upload -r pypitest" | ||
setup(name='sonyapilib', | ||
packages = ['sonyapilib'], # this must be the same as the name above | ||
version = '0.3.10', | ||
description = 'Lib to control sony devices with theier soap api', | ||
version = '0.3.11', | ||
description = 'Lib to control sony devices with their soap api', | ||
author = 'Alexander Mohr', | ||
author_email = '[email protected]', | ||
url = 'https://github.com/alexmohr/sonyapilib', # use the URL to the github repo | ||
download_url = 'https://codeload.github.com/alexmohr/sonyapilib/tar.gz/0.3.7', | ||
download_url = 'https://codeload.github.com/alexmohr/sonyapilib/tar.gz/0.3.11', | ||
keywords = ['soap', 'sony', 'api'], # arbitrary keywords | ||
classifiers = [], | ||
install_requires=[ | ||
'jsonpickle', | ||
'setuptools', | ||
'requests' | ||
'requests', | ||
'wakeonlan' | ||
], | ||
|
||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters