Grouping functions for mediaitemresults
Brought to you by:
shaneh
Quite often a dictionary is 'abused' to create counts of
artists/albums etc from a query. This is quite slow when
done in script, and is even slower when done out of
process (and I imagine over a network much slower still).
It woud be nice if there was a:
mediaitemresults.groupby("%artist%")
type function which would create a tree/map like object
which is basically returns an array of mediaitemresults
from a flat list. ie:
class mediaitemresults
{
string groupName;
itemRecord* []
}
mediaitemresults groupedArray[]
This is quite easily achieved using a hash_map/map
and iterating through the itemRecordList. Ive done
something similar for my ml_tree plugin.