-
Notifications
You must be signed in to change notification settings - Fork 50
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 #109 from dnetguru/master
Added support for listing/changing art mode mats
- Loading branch information
Showing
3 changed files
with
80 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import logging | ||
import sys | ||
|
||
sys.path.append("../") | ||
|
||
from samsungtvws import SamsungTVWS # noqa: E402 | ||
|
||
# Increase debug level | ||
logging.basicConfig(level=logging.INFO) | ||
|
||
# Normal constructor | ||
tv = SamsungTVWS("192.168.xxx.xxx") | ||
|
||
# Set all mats to this type | ||
target_matte_type = "none" | ||
|
||
# Is art mode supported? | ||
if not tv.art().supported(): | ||
logging.error("Art mode not supported") | ||
sys.exit(1) | ||
|
||
# List available mats for displaying art | ||
matte_types = [ | ||
matte_type for elem in tv.art().get_matte_list() for matte_type in elem.values() | ||
] | ||
|
||
if target_matte_type not in matte_types: | ||
logging.error( | ||
"Invalid matte type: {}. Supported matte types are: {}".format( | ||
target_matte_type, matte_types | ||
) | ||
) | ||
sys.exit(1) | ||
|
||
# List the art available on the device | ||
available_art = tv.art().available() | ||
|
||
for art in available_art: | ||
if art["matte_id"] != target_matte_type: | ||
logging.info( | ||
"Setting matte to {} for {}".format(target_matte_type, art["content_id"]) | ||
) | ||
tv.art().change_matte(art["content_id"], target_matte_type) |
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
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