Kodi Community Forum
Beta Simple Favourites - defeats addons that hide the context menu - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Program Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=151)
+---- Thread: Beta Simple Favourites - defeats addons that hide the context menu (/showthread.php?tid=293511)

Pages: 1 2 3 4 5 6 7 8 9 10 11


RE: Simple Favourites - defeats addons that hide the context menu - primaeval - 2016-11-14

Warning: Experimental!

Video Favourites
plugin.video.favourites 0.0.1

Here is an experiment you might like to try.

I've made a similar addon to Simple Favourites that only works in Videos.

The difference is that the play links are direct.
That means that the context menu will have more relevant information to the link, like opening up the addon's settings menu.

I don't know if this is useful or not. Please let me know.

The favourites.xml for this addon are incompatible with favourites.xml files from the other favourite handling addons.


RE: Simple Favourites - defeats addons that hide the context menu - raptorz - 2016-11-15

(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.


RE: Simple Favourites - defeats addons that hide the context menu - primaeval - 2016-11-15

(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. Wink

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... Wink

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.


RE: Simple Favourites - defeats addons that hide the context menu - primaeval - 2016-11-21

Audio Favourites
plugin.audio.favourites 0.0.1

NEW addon just for the Music section of Kodi.
It show the same direct links as the original addons and should work better than Simple Favourites in difficult cases.


RE: Simple Favourites - defeats addons that hide the context menu - jwrv - 2016-11-28

Thanks primaeval for picking up the torch with this great addon!

I've been testing it out and starting a migration from super favourites which my setup relied on to integrate addons into widgets. Would it be possible to add an option for fanart and a description for each item in the same way change image is in the context menu? I've tried editing the xml to add the fanart and description but cant seem to figure it out. It doesn't seem to follow the same format as super favourites did. If that's outside the scope of simple favourites I totally understand but if you know of the format or how we could do it manually through the xml I'd be ever thankful!

Thanks again for all the work!


RE: Simple Favourites - defeats addons that hide the context menu - primaeval - 2016-11-28

(2016-11-28, 03:51)jwrv Wrote: Thanks primaeval for picking up the torch with this great addon!

I've been testing it out and starting a migration from super favourites which my setup relied on to integrate addons into widgets. Would it be possible to add an option for fanart and a description for each item in the same way change image is in the context menu? I've tried editing the xml to add the fanart and description but cant seem to figure it out. It doesn't seem to follow the same format as super favourites did. If that's outside the scope of simple favourites I totally understand but if you know of the format or how we could do it manually through the xml I'd be ever thankful!

Thanks again for all the work!

I never intended this to be a replacement for Super Favourites. I hope spoyser will come back some day.

There is no option for fan art at all so far.
If you really need it I'll see if I can add it sometime.


RE: Simple Favourites - defeats addons that hide the context menu - primaeval - 2016-12-06

version 0.1.9
- should respect the media type better now (videos, music, programs, pictures)
- returns to Simple Favourites after playing link: ActiveWindow(media,url,return)
- Fanart
- Setting to turn off Edit commands in context menu

@jwrv Fanart everywhere.

This seems a lot more bulletproof. Crosses fingers. Wink


RE: Simple Favourites - defeats addons that hide the context menu - User 325245 - 2016-12-06

Hmm, I'm getting:

Code:
14:05:16 T:2000   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.NameError'>
                                            Error Contents: global name 'fanart' is not defined
                                            Traceback (most recent call last):
                                              File "C:\Users\lanik\AppData\Roaming\Kodi\addons\plugin.program.simple.favourites\main.py", line 548, in <module>
                                                plugin.run()
                                              File "C:\Users\lanik\AppData\Roaming\Kodi\addons\script.module.xbmcswift2\lib\xbmcswift2\plugin.py", line 332, in run
                                                items = self._dispatch(self.request.path)
                                              File "C:\Users\lanik\AppData\Roaming\Kodi\addons\script.module.xbmcswift2\lib\xbmcswift2\plugin.py", line 306, in _dispatch
                                                listitems = view_func(**items)
                                              File "C:\Users\lanik\AppData\Roaming\Kodi\addons\plugin.program.simple.favourites\main.py", line 259, in add_favourites
                                                context_items.append(("[COLOR yellow][B]%s[/B][/COLOR] " % 'Add', 'XBMC.RunPlugin(%s)' % (plugin.url_for(add_favourite, favourites_file=output_file, name=label, url=url, thumbnail=thumbnail, fanart=fanart))))
                                            NameError: global name 'fanart' is not defined
                                            -->End of Python script error report<--

...when I try to add an item from Favorites


RE: Simple Favourites - defeats addons that hide the context menu - primaeval - 2016-12-06

(2016-12-06, 15:06)DaLanik Wrote: Hmm, I'm getting:

Code:
14:05:16 T:2000   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.NameError'>
                                            Error Contents: global name 'fanart' is not defined
                                            Traceback (most recent call last):
                                              File "C:\Users\lanik\AppData\Roaming\Kodi\addons\plugin.program.simple.favourites\main.py", line 548, in <module>
                                                plugin.run()
                                              File "C:\Users\lanik\AppData\Roaming\Kodi\addons\script.module.xbmcswift2\lib\xbmcswift2\plugin.py", line 332, in run
                                                items = self._dispatch(self.request.path)
                                              File "C:\Users\lanik\AppData\Roaming\Kodi\addons\script.module.xbmcswift2\lib\xbmcswift2\plugin.py", line 306, in _dispatch
                                                listitems = view_func(**items)
                                              File "C:\Users\lanik\AppData\Roaming\Kodi\addons\plugin.program.simple.favourites\main.py", line 259, in add_favourites
                                                context_items.append(("[COLOR yellow][B]%s[/B][/COLOR] " % 'Add', 'XBMC.RunPlugin(%s)' % (plugin.url_for(add_favourite, favourites_file=output_file, name=label, url=url, thumbnail=thumbnail, fanart=fanart))))
                                            NameError: global name 'fanart' is not defined
                                            -->End of Python script error report<--

Thanks. I'll fix it.


RE: Simple Favourites - defeats addons that hide the context menu - primaeval - 2016-12-06

@DaLanik Try 0.0.10.


RE: Simple Favourites - defeats addons that hide the context menu - User 325245 - 2016-12-06

Getting better, now it went to favorites let me select the item, but when I press C and "Add" it shows:

Code:
15:15:01 T:11780   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <class 'xbmcswift2.urls.NotFoundException'>
                                            Error Contents: No matching view found for /add_favourite/special%3A%2F%2Fprofile%2Faddon_data%2Fplugin.program.simple.favourites%2Ffolders%2FMovies%2Ffavourites.xml/Passion/PlayMedia%28%26quot%3BD%3A%5C%5C_BAK%5C%5C_BACKUP_Galaxy_Note_II%5C%5C20140612%5C%5CCard%5C%5CMy+Documents%5C%5CVideos%5C%5CPassion+%282012%29+Brian+De+Palma.wmv%26quot%3B%29/http%3A%2F%2Fimage.tmdb.org%2Ft%2Fp%2Foriginal%2FsJYO2bbDPTb0Giph57q56juXHZA.jpg/
                                            Traceback (most recent call last):
                                              File "C:\Users\lanik\AppData\Roaming\Kodi\addons\plugin.program.simple.favourites\main.py", line 554, in <module>
                                                plugin.run()
                                              File "C:\Users\lanik\AppData\Roaming\Kodi\addons\script.module.xbmcswift2\lib\xbmcswift2\plugin.py", line 332, in run
                                                items = self._dispatch(self.request.path)
                                              File "C:\Users\lanik\AppData\Roaming\Kodi\addons\script.module.xbmcswift2\lib\xbmcswift2\plugin.py", line 318, in _dispatch
                                                raise NotFoundException, 'No matching view found for %s' % path
                                            NotFoundException: No matching view found for /add_favourite/special%3A%2F%2Fprofile%2Faddon_data%2Fplugin.program.simple.favourites%2Ffolders%2FMovies%2Ffavourites.xml/Passion/PlayMedia%28%26quot%3BD%3A%5C%5C_BAK%5C%5C_BACKUP_Galaxy_Note_II%5C%5C20140612%5C%5CCard%5C%5CMy+Documents%5C%5CVideos%5C%5CPassion+%282012%29+Brian+De+Palma.wmv%26quot%3B%29/http%3A%2F%2Fimage.tmdb.org%2Ft%2Fp%2Foriginal%2FsJYO2bbDPTb0Giph57q56juXHZA.jpg/
                                            -->End of Python script error report<--



RE: Simple Favourites - defeats addons that hide the context menu - primaeval - 2016-12-06

(2016-12-06, 16:03)DaLanik Wrote: Getting better, now it went to favorites let me select the item, but when I press C and "Add" it shows:

Similar problem. I needed to trick xbmcswift2 when there is no fanart.
Try 0.1.11.


RE: Simple Favourites - defeats addons that hide the context menu - User 325245 - 2016-12-07

Seems OK now, thanx!


RE: Simple Favourites - defeats addons that hide the context menu - primaeval - 2016-12-07

context.simple.favourites is back.

You should be able to add to Simple Favourites from most places if you add the Context Menu addon from the repo.

I am not convinced the logic to tell how a link should be played is perfect.
There are just too many possibilities.
Let me know if it does something stupid.


RE: Simple Favourites - defeats addons that hide the context menu - OptimusGREEN - 2016-12-18

Dude! This is exactly what I was looking for to replace the now deprecated Super Faves. It does everything I need so thanks very much for your hard work. Tremendous effort.