nate-parrott / Flashlight

The missing Spotlight plugin system
http://flashlight.nateparrott.com
Other
5.39k stars 411 forks source link

Search breaks if integer entered #192

Closed achterberg closed 9 years ago

achterberg commented 9 years ago

My python foo isn't great but I wanted to confirm this isn't a Flashlight issue. Using a syntax like the following in a custom plugin, where state can only be "on", "off" or an integer between and including 0 and 100: indigo ~state(state) device ~query(query) If an integer is entered for state, the plugin doesn't return the expected results but it works otherwise. If not a potential Flashlight issue I'll keep troubleshooting and this can be closed. TIA

nate-parrott commented 9 years ago

can you give an example of phrases that are and aren't working? thanks!

achterberg commented 9 years ago

I really believe this all more python probs than Flashlight but to try to answer your question: I have an if is_int(~state) function to screen for an int before ~state is filtered to just accept ("on, "off") working: indigo on device Bed Lamp (or any device matching a filtered list) indigo off device Bed Lamp (ditto) not working: indigo 58 device Dining Light (should dim to 58%) indigo on device All (should turn on all devices)

I think my parsing is off on ~state, I had to comment out if len(recip) != 1 to get it to work. As you can surmise, I'm repurposing other plugins. I'm amazed it works as well as it does.

achterberg commented 9 years ago

I solved the int issue, bad python as I expected. Now on to the all issue and to get "if len(recip) != 1" to work. This can be closed if you wish.

nate-parrott commented 9 years ago

sure — if you past in the context for the if len(recip) != 1 line that isn't working, I'll try to figure out what's wrong