Kodi Community Forum

Full Version: How does the widget sorting work?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi guys

I switched from Arctic Zephyr to Mimic 4. I noticed the exact same problem (in my situation) in both skin. I guess they share some code, or perhaps the same addon that provides widget data?

My problem is this:
1) Widget does not follow playlists
I have a widget set to a playlist. The playlist is set to 'random order'. However, in the widget, it's alphabetically. Is this normal behavior? Can it be changed? (The odd thing is: another playlist, with the same settings, but different variables (e.g. other years, other ratings, but same sorting (random)), the widget is OK! Huh?
And, related, in another playlist, I noticed that watched movies are also shown in the widget. In the playlist I have specifically set the list to non-watched movies. Something's going wrong there.

2) Not all random widgets refresh between reboots.
For the Pictures section, I have the widget set to a folder with pictures. It shows them random (which I like), but they never update, not even between reboots. From my folder with a thousand images, it's always the same few that are shown. I noticed the pictures did change a bit when I changed the folder. Almost as if a cached version got updated when it noticed a change. But that's not exactly what I would like. Can I change this?


I don't know if this is a skin problem (or feature), or if there's some widget add-on that I'd need to investigate?
Can someone help me figure this out?
The widgets are provided by the skin.helper.service script. I use recently added and in progress widgets and they are always sorted the expected way. Not sure about the others.
Thanks! I'll check the forum thread about the script.

And yes, the other widgets are working just fine here as well!
When using a playlist as a widget, make sure "Group by" is set to "Default" and not "None', as this will mess up the ordering.
(2016-11-01, 18:18)BobCratchett Wrote: [ -> ]When using a playlist as a widget, make sure "Group by" is set to "Default" and not "None', as this will mess up the ordering.

Thanks! This has solved that problem. I would not have found that myself, since the difference between None and Default has apparently zero influence on the playlist view itself. But this helped.

Now I just have to find out why my photos widget never refreshes. Huh
How are you selecting the widget to get Random Pictures? (E.g. you click 'Select Widget' in the menu management dialog - you then select...? After that you select...?) I'm not aware of any widgets that provide random pictures - going through Select Widget > Pictures > [Source] > Use as Widget won't randomise it, and I'm not aware that Mimic (unless you've updated it since I last played, Braz) provides an option to choose the sorting for widgets.

Selecting a picture widget in the normal way should sort by Kodi's default method which is, IIRC, filename.
Well, that is in fact the method I used to get a pictures widget. And they are definitely randomized, no alphabetical order or anything (that I can see).

I also use this particular folder for a slideshow sometimes, and the folder is actually set to random when played. (Other folders are still ordered alphabetically). Could this have influenced the widget?

BTW, the same folder is also the source for the background images in this home screen tab, and they are randomized correctly.


Do you suppose there's any way to edit some XML or something to get the widget to truly randomize?
It's technically possible to add a sortby option for widgets, but I suspect its not for the faint-hearted (adjust the shortcuts/overrides.xml to provide different sort options and a button id to select between them; add a button with that id to script-skinshortcuts.xml; adjust the widget templates in shortcuts/template.xml to pull out that property and to insert it into the templates in the correct place - I can link you to the various docs for the Skin Shortcuts script elements if you're really interested, but you'd also need a good understanding of the skinning ui to pull it all together.)

Alternatively, if you know some Python, a relatively simple plugin could likely do the trick.

The other option is to ask braz very nicely to consider adding sorting options.

(It's also possible I'm entirely wrong and there is a way to have Kodi - which is itself providing the list of images directly to the skin in this case - to return them truly randomised)
Hmm, thank you for the explanation, but I think that's above my skill level. I know practically nothing about Kodi skinning. Unless braz (rightfully) agrees this might be the best idea ever, I'll let it rest. Wink
I'll see about adding a sort option. No promises though, I have a 2-week old daughter at home now so my time is limited.
Congratulations braz Big Grin

As you've got more important things to take care of, I've quickly written the simple plugin I mentioned - download here and install via 'Install from zip file' within Kodi, also available on my personal repo). Then when setting the widget choose 'Pictures >' > 'Picture add-ons >' > 'Random images from sources', then choose your source as you normally would.

The big downside is that you can only select and view a single image at a time (you can't pick an image and start a slideshow of all images, or navigate between the images), which appears to be a Kodi limitation, but there's options within the menu editor to add a menu item to start a slideshow.
That's awesome Bob, I'll check it later tonight. Thanks for doing this.

And congratulations Braz!
This is working splendidly! Thanks Bob!
Just added widget sorting options in Mimic 5.

Thanks for the hints Bob, that was just the nudge I needed to make this happen. Smile