Skip to content

Conversation

Alexwijn
Copy link
Contributor

@Alexwijn Alexwijn commented Aug 4, 2024

Breaking change

Proposed change

Add support for retrieving the total view count of each channel that has been added.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.

To help with the load of incoming pull requests:

@Alexwijn Alexwijn requested a review from joostlek as a code owner August 4, 2024 12:17
Copy link

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Alexwijn

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant
Copy link

home-assistant bot commented Aug 4, 2024

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant
Copy link

home-assistant bot commented Aug 4, 2024

Hey there @joostlek, mind taking a look at this pull request as it has been labeled with an integration (youtube) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of youtube can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign youtube Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the pull request.

@frenck frenck changed the title [YouTube] Add support for Total Views Add support for total YouTube views Aug 5, 2024
@Alexwijn Alexwijn marked this pull request as ready for review August 11, 2024 20:47
native_unit_of_measurement="views",
available_fn=lambda _: True,
value_fn=lambda channel: channel[ATTR_TOTAL_VIEWS],
entity_picture_fn=lambda channel: channel[ATTR_ICON],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we just do an icon here instead of the channel icon? I think it can look strange if you add more sensors that they all have the same picture.

Wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, although it doesn't bother me. Not sure if there is an appropriate icon for both of them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think subscribers is fine as is, but let's add one for the views, not sure if there is a viable icon for that. Please use the icon translations to add one

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering, what makes the views any different from the subscribers?

Copy link
Member

@joostlek joostlek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are failing. Can you delete the snapshots folder and run python3 -m script.translations develop --all and pytest ./tests/components/youtube --snapshot-update?

@home-assistant home-assistant bot marked this pull request as draft August 30, 2024 12:41
@Alexwijn
Copy link
Contributor Author

Tests are failing. Can you delete the snapshots folder and run python3 -m script.translations develop --all and pytest ./tests/components/youtube --snapshot-update?

Done!

@joostlek
Copy link
Member

And push it?

@Alexwijn Alexwijn marked this pull request as ready for review August 30, 2024 19:24
@home-assistant home-assistant bot requested a review from joostlek August 30, 2024 19:24
@Alexwijn
Copy link
Contributor Author

Yes, the push got rejected because I had to rebase. All good now!

@joostlek joostlek merged commit 00533ba into home-assistant:dev Sep 3, 2024
26 checks passed
@Alexwijn Alexwijn deleted the feature/youtube-total-views branch September 4, 2024 15:42
iloveicedgreentea pushed a commit to iloveicedgreentea/core that referenced this pull request Sep 4, 2024
* Add support for retrieving the total views of a channel.

* Add missing tests

* Re-order imports

* Another run on code format

* Add missing translation

* Update YouTube test snapshots
@github-actions github-actions bot locked and limited conversation to collaborators Sep 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants