Skip to content
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

Media More Info: Convert to Lit Element #6619

Merged
merged 4 commits into from
Aug 17, 2020
Merged

Media More Info: Convert to Lit Element #6619

merged 4 commits into from
Aug 17, 2020

Conversation

zsarnett
Copy link
Contributor

Proposed change

Convert to Lit

Type of change

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

Comment on lines 355 to 364
const services = this.hass.services.tts;
const serviceKeys = Object.keys(services).sort();
let service: string | undefined;

for (let i = 0; i < serviceKeys.length; i++) {
if (serviceKeys[i].indexOf("_say") !== -1) {
service = serviceKeys[i];
break;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Ugh, this is so ugly, we should look into it sometime...

const services = this.hass.services.tts;
const serviceKeys = Object.keys(services).sort();

const service = serviceKeys.find((key) => key.indexOf("_say") !== -1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bramkragten This should be a bit better than the for loop I think. Still maybe not the best way

Copy link
Member

Choose a reason for hiding this comment

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

the fact that we just pick the first one is wrong, to begin with... But yeah, this code is a lot better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yea... that's what I was thinking. We also sort them... but from the data, we are given from the service there doesn't seem to be a way to find the preferred one

@zsarnett zsarnett merged commit 39f24c4 into dev Aug 17, 2020
@zsarnett zsarnett deleted the media-more-info branch August 17, 2020 16:24
@bramkragten bramkragten mentioned this pull request Aug 20, 2020
@kg333 kg333 mentioned this pull request Nov 5, 2020
3 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Jul 5, 2022
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.

None yet

3 participants