New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change source, add attributes, and improve state of DirecTV #17536

Merged
merged 6 commits into from Oct 29, 2018

Conversation

Projects
None yet
6 participants
@ehendrix23
Contributor

ehendrix23 commented Oct 16, 2018

Description:

Following enhancements have been made:

  1. Added debug logging
  2. Added ability to change channel using select_source service of the remote platform.
  3. State will now show paused if a recorded program is paused, for live TV playing will always be returned.
  4. Added the following attributes:
    a. media_position: current position of the media (in seconds)
    b. media_position_updated_at: timestamp when media_position was updated.
    c. source: current source (channel).
    d. media_isbeingrecorded: if current media is being recorded or not.
    e. media_rating: TV/Movie rating of the media
    f. media_recorded: if current media is recorded or live TV
    g. media_starttime: Timestamp media was aired
  5. Reordered properties to follow same order as how they are in init.py of remote platform.

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
Enhancements for DirecTV media player
Following enhancements have been made:

1. Added debug logging
2. Added ability to change channel using select_source service of the remote platform.
3. State will now show paused if a recorded program is paused, for live TV playing will always be returned.
4. Added the following attributes:
    a. media_position: current position of the media (in seconds)
    b. media_position_updated_at: timestamp when media_position was updated.
   c. source: current source (channel).
   d. media_isbeingrecorded: if current media is being recorded or not.
   e. media_rating: TV/Movie rating of the media
   f. media_recorded: if current media is recorded or live TV
   g. media_starttime: Timestamp media was aired

Reordered properties to follow same order as how they are in __init__.py of remote platform.

@wafflebot wafflebot bot added the in progress label Oct 16, 2018

@fabaff fabaff changed the title from directv component: Change source, attributes, and state updates. to Change source, attributes, and state updates of DirecTV Oct 16, 2018

@ehendrix23 ehendrix23 changed the title from Change source, attributes, and state updates of DirecTV to directv component: change source, add attributes, and improve state. Oct 16, 2018

@fabaff fabaff changed the title from directv component: change source, add attributes, and improve state. to Change source, add attributes, and improve state of DirecTV Oct 16, 2018

@fabaff

This comment has been minimized.

Member

fabaff commented Oct 16, 2018

There is no need for prefixes in the title, we have labels.

@ehendrix23 ehendrix23 changed the title from Change source, add attributes, and improve state of DirecTV to Change source, add attributes, and add pause state Oct 16, 2018

@ehendrix23 ehendrix23 changed the title from Change source, add attributes, and add pause state to Change source, add attributes, and improve state of DirecTV Oct 16, 2018

@ehendrix23

This comment has been minimized.

Contributor

ehendrix23 commented Oct 16, 2018

Sorry, just noticed you had changed the title already as well. :-) Changed it back to how you set it. :-)

Fixed error and cleaned up few items
Fixed an issue when determining if a program is recorded or not.
Cleaned up some coding.

ehendrix23 added some commits Oct 22, 2018

Attribute last position update only updated when position changed.
The attribute media_position_updated_at will only be updated if the position changed (thus media is playing for recorded or live TV).
Added assumed_state; will be set to False if in standby or when a recorded show is watched. For live TV it will be set to True.
Added some empty lines for easier reading
Added some empty lines before returns to improve readability.
@houndci-bot

Some files could not be reviewed due to errors:

Traceback (most recent call last):
Traceback (most recent call last):
  File "/home/linters/.local/bin/flake8", line 7, in 
    from flake8.main.cli import main
ModuleNotFoundError: No module named 'flake8'
@ehendrix23

This comment has been minimized.

Contributor

ehendrix23 commented Oct 27, 2018

@MartinHjelmare Do you mind having a look at this? After my previous commit the travis checked never really finished even although when I clicked on details it said all done and all passed.

Made small update (just added a few empty lines before returns); makes it a bit easier to read as well.
Committed it and now I get the above. But when I check on details, none of the items that I see in there marked red is from direct.py (the one I changed).
What am I missing? :-)

Appreciate it!

@MartinHjelmare

We can ignore coveralls result. This module is excluded from coverage calculation.

Just tidy the variable names and we can merge.


REQUIREMENTS = ['directpy==0.5']

_LOGGER = logging.getLogger(__name__)

ATTR_MEDIA_CURRENTLYRECORDING = 'media_currently_recording'

This comment has been minimized.

@MartinHjelmare

MartinHjelmare Oct 27, 2018

Member

Please separate words with underscore in the constant.

ATTR_MEDIA_CURRENTLYRECORDING = 'media_currently_recording'
ATTR_MEDIA_RATING = 'media_rating'
ATTR_MEDIA_RECORDED = 'media_recorded'
ATTR_MEDIA_STARTTIME = 'media_starttime'

This comment has been minimized.

@MartinHjelmare

MartinHjelmare Oct 27, 2018

Member

Borderline case as above.

@@ -88,14 +99,46 @@ def __init__(self, name, host, port, device):
self._name = name
self._is_standby = True
self._current = None
self._lastupdate = None

This comment has been minimized.

@MartinHjelmare

MartinHjelmare Oct 27, 2018

Member

See above.

This comment has been minimized.

@MartinHjelmare
@@ -88,14 +99,46 @@ def __init__(self, name, host, port, device):
self._name = name
self._is_standby = True
self._current = None
self._lastupdate = None
self._paused = None
self._lastposition = None

This comment has been minimized.

@MartinHjelmare

MartinHjelmare Oct 27, 2018

Member

See above.

self._lastupdate = None
self._paused = None
self._lastposition = None
self._isrecorded = None

This comment has been minimized.

@MartinHjelmare

MartinHjelmare Oct 27, 2018

Member

See above.

Seperated words in constants
Seperated the words in constants.
@houndci-bot

Some files could not be reviewed due to errors:

Traceback (most recent call last):
Traceback (most recent call last):
  File "/home/linters/.local/bin/flake8", line 7, in 
    from flake8.main.cli import main
ModuleNotFoundError: No module named 'flake8'
Fix _lastupdate to _last_update
Split words in _lastupdate to _last_update as I missed it.
@houndci-bot

Some files could not be reviewed due to errors:

Traceback (most recent call last):
Traceback (most recent call last):
  File "/home/linters/.local/bin/flake8", line 7, in 
    from flake8.main.cli import main
ModuleNotFoundError: No module named 'flake8'
@ehendrix23

This comment has been minimized.

Contributor

ehendrix23 commented Oct 29, 2018

@MartinHjelmare grmbl, can't believe I missed that one. Updated it. Sorry about that!

@MartinHjelmare

Good!

@MartinHjelmare

This comment has been minimized.

Member

MartinHjelmare commented Oct 29, 2018

Ping me when build is finished.

@MartinHjelmare

This comment has been minimized.

Member

MartinHjelmare commented Oct 29, 2018

I'm merging now as the coverage result isn't accurate.

@MartinHjelmare MartinHjelmare merged commit deeb288 into home-assistant:dev Oct 29, 2018

4 of 5 checks passed

coverage/coveralls Coverage decreased (-0.6%) to 92.936%
Details
Hound No violations found. Woof!
WIP ready for review
Details
cla-bot Everyone involved has signed the CLA
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@wafflebot wafflebot bot removed the in progress label Oct 29, 2018

@balloob balloob referenced this pull request Nov 9, 2018

Merged

0.82 #18335

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment