(2016-11-15, 02:14)raptorz Wrote: (2016-11-13, 23:57)primaeval Wrote: (2016-11-13, 23:41)raptorz Wrote: Nice program. I have two questions:
- If I open Simple Favourites from the Program Add-ons window, and then try to open a favourite to ActivateWindow(programs,"androidapp://sources/apps/",return), the shortcut doesn't open.
- I put a shortcut to a Simple Favourites folder on my home screen. When I press back, it goes up to the root level of Simple Favourites (the parent of the folder) instead of going back to the home screen. Is there a way to achieve this?
I don't really know. I have had a lot of problems trying to work out how to open links in the right windows and return.
spoyser is the master at this sort of information but some idiots upset him and he left. Hopefully he will return someday.
I don't know how much you know but the possible window ids are here:
http://kodi.wiki/view/Window_IDs
I use 10001 for programs in the code. Maybe it needs a special one for Android that isn't listed there.
The ActivateWindow return parameter should get you back to where you started. I'm not sure where a top level shortcut really thinks it is.
http://kodi.wiki/view/list_of_built-in_functions
Let us know if you find out.
If you return None from the base route (/), pressing back on a screen will directly exit:
Code:
@plugin.route('/')
def index():
#folder_path = "special://profile/addon_data/%s/folders/" % (addon_id())
#return index_of(folder_path)
return None
It seems the behavior of the back button when you are at a page like "plugin://plugin.program.simple.favourites/xxxxxx" is to go to "plugin://plugin.program.simple.favourites", which displays the list of folders in your current implementation. If you have some kind of setting to return None instead, it will exit rather than display the list of folders.
Index is the main page of the addon. If you return None there there is no addon.
Something that might be needed is the "return" parameter from ActivateWindow.
If you are up to the code see if you can find the best way to play the links.
The possibilities are:
ActivateWindow if it is a directory
PlayMedia if it is a file link
just the url if you are in the right media section: Video, Music, Programs etc
RunScript if the addon starts with script.something
maybe more...
The plugin.video.favourites just uses direct links. There is a flag to say if they are playable (is_playable).
If you can find the right way I'll add it as an option.
[EDIT]
There is also
Code:
Container.Update(path,replace)
and
Code:
ReplaceWindow(window,dir)
to reset the window history.