jcarbaugh / python-roku

Screw remotes. Control your Roku with Python.
https://pypi.python.org/pypi/roku
BSD 3-Clause "New" or "Revised" License
294 stars 95 forks source link

Fuzzy Finding Apps by Name #59

Open metagrapher opened 4 years ago

metagrapher commented 4 years ago

_app_for_name() used to use an equality operator to check for a match, meaning that you had to know the full and exact name of the app you wished to invoke. This function now does a find operation on the app.name string, allowing for a partial match of the app name.

metagrapher commented 4 years ago

It's worth noting that this change should be immediately merge-able without affecting existing implementations, as this does not change the function signature nor the return value. Most notably that it will not change the matched app for an exact match.

jcarbaugh commented 4 years ago

@metagrapher thanks for the contribution! If we're going to go with fuzzy matching, I'm trying to think through other scenarios here. Would we want to potentially ignore case as well with something like app.name.lower().find(name.lower())? What if we kept the get item access as it was but add a method that does fuzzy matching and returns multiple results? Just want to consider different scenarios before committing to something.