[PATCH] Live Filter (Live Search) - Build for Win32 Users to test + comment on.

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
bripeace Offline
Junior Member
Posts: 42
Joined: Nov 2007
Reputation: 0
Post: #1
This is something I've been wanting to do for awhile, but haven't had the time. I sat down last night and I've gotten it close enough to working order than I can run it by people and see what they think.

I've made a video that demonstrates the basic functionality so that it's very easy to see how it works and what it intends to do, but here is a text overview:

The Idea/Problem

When I wanted to watch a specific show I would have to scroll through the list of shows. Since I have quite a lot of stuff in my library this actually takes quite awhile to find a specific thing even with paging/scrolling. The other options is to use the Filter (or search) to limit results. Unfortunately this just takes more time to find something rather than less when you don't have a keyboard so is useless as a navigation tool.

The solution

I found myself wishing XBMC had a sort of adaptive text filtering on the various views. Something like T9 on verizon phones where 228 is (cat, bat, etc). So if you want to find a show you just enter the numbers that correspond with some consecutive group of letters in the title. For house it's 46873. This is a very quick and responsive way to find information.

The Code

I'm not the best coder and my knowledge of the codebase is limited, but it does what I want it to do and I think it's fairly unoffensive. The regular type filtering is a bit messy right now, but something easily that can be cleaned up once I finish this out.

I also fixed stringutils::findnumber which would not return a number as being part of the string if it started with that number. (for instance 46 in my house 46873 example)

I'd like comments and suggestions as I clean up the code and hopefully get it added. I imagine this will need to be some sort of configuration option for those who don't want to have this on or find it confusing.

Here is the youtube example an explanation of it's functionality: http://www.youtube.com/watch?v=wcbs7RsrPHM

The code is definately not completely finished, but I'll post a patch tonight. For now I have to run. Check out the youtube let me know what you think!
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,181
Joined: Oct 2003
Reputation: 175
Post: #2
Hi there.

First off, great stuff - fantastic to see someone taking and XBMC, finding a problem they have with it and hacking up a solution to suit their needs. What you've done works really nicely and we've been wanting to add such a thing for quite some time. I'm a little gutted that I haven't had time to get through to doing my implementation of the same thing. Smile

Now to critique Wink

First off, the numeric input works in the virtual keyboard, so it's less buttons than you make out, though still rather clunky and ugly, somewhat defeating the coolness of the feature.

Secondly, it should only hit start of words - this is an easy modification (search for either start of string then chars, or space then chars), and is how the "Search" stuff works for instance (which hits the db rather than filtering the list, so you get matches within plot and so on.)

Thirdly, it takes up the numeric buttons on the remote within the window which means that volume control and so on is taken away - this is technically more of a problem with the keymapping system we have which is restricted to window level keymapping, rather than control-level, but is a problem nonetheless.

Lastly, it only filters on what you can actually see in the title - it could be easily extended via the filteritems() code (which I presume you are using) to search other fields, or we could use the same technique to do a search.

I'm very interested in what others think, but here is how I always imagined this thing going:

1. Have a function to start a filter or search. This gets around the "number mapping" problem in keymap.xml - not sure if it's the best way to do it or not, but it could be a button on the left (filter or search) or a key on the remote, keyboard, or gamepad to start it (single button mapping in keymap.xml)

2. This would pop up an edit control. Keyboard users can thump away immediately. Similarly, the editcontrol suitably extended for remote input would allow remote-number users to thump away immediately. Gamepad users could hit SELECT to get to the real virtual keyboard (or we could detect what we should do and auto-do the appropriate input control).

3. Pressing UP, DOWN, or whatever would navigate away from said edit control back onto your nicely filtered or searched list.

Cheers,
Jonathan

EDIT: One last thing: Do you wanna be our PR guy? Nice work on the video Smile

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
(This post was last modified: 2008-07-28 23:56 by jmarshall.)
find quote
bripeace Offline
Junior Member
Posts: 42
Joined: Nov 2007
Reputation: 0
Post: #3
jmarshall Wrote:Hi there.

First off, great stuff - fantastic to see someone taking and XBMC, finding a problem they have with it and hacking up a solution to suit their needs. What you've done works really nicely and we've been wanting to add such a thing for quite some time. I'm a little gutted that I haven't had time to get through to doing my implementation of the same thing. Smile

Now to critique Wink

No problem on critques. I actually like working on this kind of stuff and will be happy to work towards an implementation that would be best.

Quote:First off, the numeric input works in the virtual keyboard, so it's less buttons than you make out, though still rather clunky and ugly, somewhat defeating the coolness of the feature.

I see now that it does in fact work like you say. That certainly does cut down, but the major problem is the fact that it's still tons of typing and everything to type out say 'House'. The reason I like this implementation so much is no extra mucking around just direct and to the point. 468 gets in my library 2 options, one the one i'm looking for.

Quote:Secondly, it should only hit start of words - this is an easy modification (search for either start of string then chars, or space then chars), and is how the "Search" stuff works for instance (which hits the db rather than filtering the list, so you get matches within plot and so on.)

I could easily make it just hit the start of words that's no problem. I did this for 2 reasons. One is the monorail issue in the youtube where by you want to find something but your not sure exactly what the title is or starts with or even how certain parts of it are spelled. Of course the downfall of that is the fact that you get a few extra entries. I figured it was worth trading off the extra results since refining is just a click of a number away. Of course theres the problem with various shows that start with The or A. I could filter those out, but i figured extraneous results were fine.

Quote:Thirdly, it takes up the numeric buttons on the remote within the window which means that volume control and so on is taken away - this is technically more of a problem with the keymapping system we have which is restricted to window level keymapping, rather than control-level, but is a problem nonetheless.

I never understood volume etc being on 3 and 6 when even the old xbox remote had actual volume controls and nearly every remote does as well. I found this to be rather annoying. One of the more useful features with a keyboard when actually viewing a movie is the ability to jump around to a specific offset using numbers, yet without one your left to turning the sound up or down. Unless I'm missing something this is a rather antiquated use. I guess the idea is that you want your tv sound on volup/down and then this sound on 6/3 but if your turning sound up with one why both?

Quote:Lastly, it only filters on what you can actually see in the title - it could be easily extended via the filteritems() code (which I presume you are using) to search other fields, or we could use the same technique to do a search.

Yes It is using the filter items code and I actually specifically took out the second label (Year/Rating/Episodes) or whatever just to give titles. It could certainly work on other fields and plot may actually be a very valuable one to use in episodes views in order to really find some obscure episode you don't know the title to. There is one problem, and thats the way i've done the adaptive text search right now. Theres really two ways to do it one is convert numbers to leters and actually search all the combinations of what you want to find, but that is really expensive (exponential 4->16->etc). The way I do it, which is pretty inefficient right now is in FilterItems I convert the title to the phone numeric equivalent and then do FindNUmber on it which is why I had to fix that (it will not find a number at the start of a string in it's current form)

Quote:I'm very interested in what others think, but here is how I always imagined this thing going:

1. Have a function to start a filter or search. This gets around the "number mapping" problem in keymap.xml - not sure if it's the best way to do it or not, but it could be a button on the left (filter or search) or a key on the remote, keyboard, or gamepad to start it (single button mapping in keymap.xml)

2. This would pop up an edit control. Keyboard users can thump away immediately. Similarly, the editcontrol suitably extended for remote input would allow remote-number users to thump away immediately. Gamepad users could hit SELECT to get to the real virtual keyboard (or we could detect what we should do and auto-do the appropriate input control).

3. Pressing UP, DOWN, or whatever would navigate away from said edit control back onto your nicely filtered or searched list.

Cheers,
Jonathan

I really don't have any problems per say with this implementation. I did it this specific way as it's how I'd like to use it and I know nothing of modifying the ui. I thought of having some text box to type in and it would filter based on that but since i actually search using 468 and don't convert that to acutal letters it wouldn't make much sense to anyone. I do think people with access to a keyboard actually would like to be able to start typing to find what they want. The only thing i'm worried about is alreayd my remote is full of buttons and my current setup actually unbinds clear 3 and 6 to make this work so adding more buttons is an intresting case.


Also I should note that it is, as you can see, very responsive on my system, but i'd like to see how it works on various systems. It really could do with some optimization cause all it does now is use .replace since i just wanted to do this as quick as possible (probably took about an hour what i have now). So either I need to optimize it or maybe it's not very costly or hell both.

More thoughts:

Currently you can't filter the TV Show or Movies views, filteritems actually kicks you out. Once your remove that there's another issue where Movies will work and Tv Shows don't due to Tv shows being a folder and movies not. So I'm wondering if that code has any impact to other systems I'm not anticipating. So on those views in current stuff the filter button does nothing, but is still usable which is counter intuitive.

Anyhow, I'll get to doing a patch. Haven't done one on windows yet so may take me a bit.
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,181
Joined: Oct 2003
Reputation: 175
Post: #4
Yeah - you've got a good point about the number input in an edit control - it'd either require old-school style text input (333 for F) which is clunky or it'd be pretty useless to show the number pattern.

Perhaps the best route is extending the keymapping stuff so that we can handle direct input while focused on the list, or enter a direct input mode via some action. This would alleviate the problems people may have with restricted numbers of buttons available on remotes. We could even highlight the substring matches within the labels to avoid confusion as to why things were matched.

And yes, I agree that volume control is silly to be mapped to numbers in general (pretty sure the original xbox remote doesn't have dedicated volume buttons though) - in fact, I'd be quite happy with removing all volume control from XBMC at all! Will discuss this point with the team, as most remotes do most definitely have dedicated buttons, so making the most use of the numeric buttons for text input is very desirable.

Performance-wise I doubt there's much of a problem - converting a thousand strings to numbers is a pretty quick thing to do with a lookup table or a single run through the string with minimal conditionals for the 4-letter cases. Not sure how one would deal with non-ascii characters though - I suspect there's no easy workaround for them other than a lookup table type thing. Then a simple text search on the resulting strings would do the trick.

About the spaces thing - I meant searching from start of words (for all words in the string) - eg in your monorail example it had another hit that matched due to matching the end of one word and the start of the next.

Will look forward to the patch.

Cheers,
Jonathan

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
d4rk Offline
Team-XBMC Developer
Posts: 499
Joined: May 2007
Reputation: 1
Location: Albuquerque
Post: #5
First of all, nice work bripeace.

Just a few thoughts related to the feature as a whole, not specific to this implementation:

- The substring search I think can be useful, where it matches even in the middle of words. I think as long as they are sorted in such a way that these type of matches come after start of word matches, one would get the benefit of both. It can also be used to find titles that have been mislabeled perhaps?

- It would nice if the input mechanism implementation were extensible. T9, keyboard, gamepad (maybe using something like TwoSticks).

Always read the XBMC online-manual, FAQ and search the forum before posting.
Please read and follow the forum rules.
For troubleshooting and bug reporting, please make sure you read this first.


[Image: badge.gif]
find quote
bripeace Offline
Junior Member
Posts: 42
Joined: Nov 2007
Reputation: 0
Post: #6
jmarshall Wrote:Yeah - you've got a good point about the number input in an edit control - it'd either require old-school style text input (333 for F) which is clunky or it'd be pretty useless to show the number pattern.

Perhaps the best route is extending the keymapping stuff so that we can handle direct input while focused on the list, or enter a direct input mode via some action. This would alleviate the problems people may have with restricted numbers of buttons available on remotes. We could even highlight the substring matches within the labels to avoid confusion as to why things were matched.

And yes, I agree that volume control is silly to be mapped to numbers in general (pretty sure the original xbox remote doesn't have dedicated volume buttons though) - in fact, I'd be quite happy with removing all volume control from XBMC at all! Will discuss this point with the team, as most remotes do most definitely have dedicated buttons, so making the most use of the numeric buttons for text input is very desirable.

Performance-wise I doubt there's much of a problem - converting a thousand strings to numbers is a pretty quick thing to do with a lookup table or a single run through the string with minimal conditionals for the 4-letter cases. Not sure how one would deal with non-ascii characters though - I suspect there's no easy workaround for them other than a lookup table type thing. Then a simple text search on the resulting strings would do the trick.

About the spaces thing - I meant searching from start of words (for all words in the string) - eg in your monorail example it had another hit that matched due to matching the end of one word and the start of the next.

Will look forward to the patch.

Cheers,
Jonathan


Good point about the performance issue. It really is not noticeable on either machine I have. I really like the idea of highlighting, it gives very clear feedback that something is happened and what exactly is happening. If we do filtering even having the numbers up there wouldn't be so bad. I was thinking even an entry at the top near the parrent directory saying something like 'Live Filter (or whatever you call it) results:' or something. I think highlighting is the best idea. Code wise it would be simple for me to get what exaclty to highlight since .Find() returns position of whatever string you search for. The only matter for me is I don't know how to highlight something ui wise and how that all works.

I got up the first incarnation of the patch so you can at least kind of see how it works and what weird things I've done. There are issues with the music view, but it's mostly to do with the different bindings that exist there.

For this to work though you need to bind Remote0-1 in your Keymap and you'll probably want to bind Clear Filter which will clear any active filter.
find quote
bripeace Offline
Junior Member
Posts: 42
Joined: Nov 2007
Reputation: 0
Post: #7
Sorry here is a link to the ticket with the patch

http://trac.xbmc.org/ticket/4386

and thats 'ClearFilter' not Clear Filter
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,181
Joined: Oct 2003
Reputation: 175
Post: #8
Awesome - will take a look through the code now and make some comments on trac.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
kricker Offline
Team-XBMC QA Specialist
Posts: 3,449
Joined: Apr 2004
Reputation: 20
Location: Knoxville, TN
Post: #9
This is excellent.

As for the original remote, I have one and there are no volume buttons. But....I never use the number buttons to control the volume. I remapped them to the up down on my remote in the screens where volume control matters. I did this only because I could not figure out how to make my all-in-one remote control XBMC, otherwise I wouldn't even be using the original XBMC remote.

Read this before using these builds.
XBMC win32 SVN builds
Changelog
find quote
WiSo Offline
Team-XBMC Developer
Posts: 2,733
Joined: Oct 2003
Reputation: 0
Location: Germany
Post: #10
bripeace Wrote:Anyhow, I'll get to doing a patch. Haven't done one on windows yet so may take me a bit.

You can use Tortoise SVN to update your repository and make a patch easily.
Nice work. Hope more to come Nod

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
(This post was last modified: 2008-07-29 09:27 by WiSo.)
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,181
Joined: Oct 2003
Reputation: 175
Post: #11
I've updated the diff on trac with my changes to your diff and below is a binary for win32 users to test.

Ideally I'd like to address the 3 points I posted on trac before it hits SVN, namely:

1. Skinnable highlighting.
2. Search on what the skin is displaying and/or on other fields?
3. Keyboard searching.

Here's the link to the updated diff against rev 14551:

http://trac.xbmc.org/attachment/ticket/4...ter-3.diff

And here's the executable + keymap.xml for win32 users to play with:

https://sourceforge.net/project/showfile..._id=585323

Cheers,
Jonathan

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
(This post was last modified: 2008-07-29 13:05 by jmarshall.)
find quote
kricker Offline
Team-XBMC QA Specialist
Posts: 3,449
Joined: Apr 2004
Reputation: 20
Location: Knoxville, TN
Post: #12
Thanks jmarshall. I'll play with it tonight.

Read this before using these builds.
XBMC win32 SVN builds
Changelog
find quote
Gamester17 Offline
Team-XBMC Forum Moderator
Posts: 10,523
Joined: Sep 2003
Reputation: 9
Location: Sweden
Thumbs Up  Thanks!
Post: #13
@bripeace, I just like to add that this will be a really great feature to have in XBMC! Cool

The only thing I do not personally like about it is the name "Live Filter" that you have picked for the feature (as IMHO the "Live" part of the name could possibly be to easily confused with the LiveUSB/LiveCD Linux Live Distro we plan on releasing of XBMC), ...so may I suggest that you instead pick a other name, maybe something like "Adaptive Filter", "Adaptive Search", "Dynamic Filter", or "Dynamic Seach", or similar?

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
find quote
sho Offline
Team-XBMC Member
Posts: 4,128
Joined: May 2004
Reputation: 3
Post: #14
At the risk of sounding stupid... will this work with keyboards also? (that is not just they numeric keypad)

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.
(This post was last modified: 2008-07-29 20:09 by sho.)
find quote
bripeace Offline
Junior Member
Posts: 42
Joined: Nov 2007
Reputation: 0
Post: #15
sho Wrote:At the risk of sounding stupid... will this work with keyboards also? (that is not just they numeric keypad)

That something we're planning on working in. It doesn't work right now but soon hopefully.
find quote
Post Reply