1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Adding plugins to main menu

Discussion in 'General Satellite Discussion' started by Janso, Dec 29, 2016.

  1. Janso

    Janso TK Veteran

    1,775
    267
    103
    Male
    I've got a Vu with Kodi installed at my parents' house and I've had a few backup images on it from other sites but I wanted to make my own. Now on these backups, there's been Kodi on the main menu, and I want to do that in my image.

    I would have asked the people who put together the backups I've used previously but they're no longer active on the websites I found them, so that rules that out.

    I know it's easy enough to access through the plugins screen but it just makes it easier for them to get it open.

    Anybody know how I can do this?


    Sent from my iPhone using Tapatalk
     
  2. Pale-Rider

    Pale-Rider Registered

    100
    0
    0
    There was a plugin to do this if memory serves, or you would have to manually edit some of the python code. I can't remember any other way unless it has been added in the year or so I've been out of the sat scene.
     
  3. kiddac

    kiddac

    0
    39
    12
    I am bored today, so I have done googling for you.

    You come across as a guy that likes to faff, so pull up a chair... :faint:

    You can do this by editting the plugin.py of kodi.

    plugins on your box live in one of 2 folders in

    /usr/lib/enigma2/python/Plugins

    find your kodi plugin folder. Inside that you will have Plugin.pyo or Plugin.py.
    If you have only got the compiled pyo version. Either hunt down the original uncomplied version, or use Easy python decompiler (google it)
    decompiler will make a file called plugin.pyo_dis. Just rename it Plugin.py and edit it with something like notepad.

    Now somewhere in plugin.py file is the section where it is displayed on your box.

    def Plugins(**kwargs):

    In there you will have a command similar to below.

    where = [ PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_PLUGINMENU ],
    icon="./icon.png",
    fnc=main)

    you need to to change it to or add in the main menu.

    where = [ PluginDescriptor.WHERE_EXTENSIONSMENU, PluginDescriptor.WHERE_MENU ],
    icon="./icon.png",
    fnc=menu)


    Reupload your new plugin.py and reboot your box.

    That is in principle how you do it.
     
    Last edited: Dec 29, 2016
  4. Janso

    Janso TK Veteran

    1,775
    267
    103
    Male
    Okay so this is the code that resembles what you've given me (thank you by the way, I'd seen that thread on the forum that shall not be named but I had no idea which part I needed to edit). I changed the pluginmenu section to menu and the fnc= to mainmenu and it didn't seem to do anything

    HTML:
    [ Only registered users can see the bbcode. Click Here To Register... ]
    Also copied what you said more closely

    HTML:
    [ Only registered users can see the bbcode. Click Here To Register... ]
    but this also seemed to do nothing.

    Well, kind of. Both gave me a message saying that the thing I put next to the first fnc= wasn't available when I went to check if it was still in the plugins menu. So nothing that I wanted it to do, and it's also made it inaccessible. I do have the original file backed up though, something I learned while pissing about with your skin files. :)



    I'm probably missing something very simple here but can't quite manage to make the connection. Got me feeling a little like this - :anyonethere:
     
  5. kiddac

    kiddac

    0
    39
    12
    zip up the originally plugin file and post it on here. (go advanced add attachment) I don't use kodi so don't have access to the file.
     
  6. Janso

    Janso TK Veteran

    1,775
    267
    103
    Male
    Cheers, this is the original file.
     

    Attached Files:

  7. kiddac

    kiddac

    0
    39
    12
    try again, that is a corrupt zip file. or just post the full def Plugins(**kwargs): section here.
     
  8. Janso

    Janso TK Veteran

    1,775
    267
    103
    Male
    This is the full section -

    def Plugins(**kwargs):
    l = []
    l.append(PluginDescriptor(where=PluginDescriptor.WHERE_SESSIONSTART, fnc=session_start_main))
    l.append(PluginDescriptor(name=_("Kodi Launcher"), description=_("start kodi(formerly known as XBMC) mediacenter"), where=PluginDescriptor.WHERE_PLUGINMENU, fnc=plugin_start_xbmc))
    return l
     
  9. kiddac

    kiddac

    0
    39
    12
    so possible it should be

    def Plugins(**kwargs):
    l = []
    l.append(PluginDescriptor(where=PluginDescriptor.W HERE_SESSIONSTART, fnc=session_start_main))
    l.append(PluginDescriptor(name=_("Kodi Launcher"), description=_("start kodi(formerly known as XBMC) mediacenter"), where=PluginDescriptor.WHERE_MENU, fnc=plugin_start_xbmc))
    return l


    or

    def Plugins(**kwargs):
    l = []
    l.append(PluginDescriptor(where=PluginDescriptor.W HERE_SESSIONSTART, fnc=session_start_main))
    l.append(PluginDescriptor(name=_("Kodi Launcher"), description=_("start kodi(formerly known as XBMC) mediacenter"), where=PluginDescriptor.WHERE_MENU, fnc=menu))
    return l

    ---------- Post Merged at 02:34 PM ----------

    this is the dreamplex plugin code. This shows on the main menu

    def Plugins(**kwargs):
    myList = []
    boxResolution = getBoxResolution()
    if boxResolution == 'FHD':
    myList.append(PluginDescriptor(name='DreamPlex', description='plex client for enigma2', where=[PluginDescriptor.WHERE_PLUGINMENU], icon='pluginLogoHD.png', fnc=main))
    else:
    myList.append(PluginDescriptor(name='DreamPlex', description='plex client for enigma2', where=[PluginDescriptor.WHERE_PLUGINMENU], icon='pluginLogo.png', fnc=main))
    myList.append(PluginDescriptor(where=PluginDescriptor.WHERE_AUTOSTART, fnc=Autostart))
    myList.append(PluginDescriptor(where=PluginDescriptor.WHERE_SESSIONSTART, fnc=sessionStart))
    if config.plugins.dreamplex.showInMainMenu.value:
    myList.append(PluginDescriptor(name='DreamPlex', description=_('plex client for enigma2'), where=[PluginDescriptor.WHERE_MENU], fnc=menu_dreamplex))
    return myList


    ---------- Post Merged at 02:45 PM ----------

    I think we are missing a step. Whatever is referenced in the fnc needs to be defined in the plugin.py.

    I will have a play and add one of the other plugins to the main menu and see what actually needs to be done.
     
    Last edited: Dec 29, 2016
  10. Janso

    Janso TK Veteran

    1,775
    267
    103
    Male
    Tried both of these, the second one won't let me open the menu at all and the first one doesn't do it.

    I'll see if I can find anything else about it though.



    Ah, hadn't tried your edits there. I'll have a play with the things you've just added to the post and let you know if any of them work. Appreciate your help.
     
  11. kiddac

    kiddac

    0
    39
    12
    right....

    i have just tried this with epg importer.

    original code

    Code:
    [ Only registered users can see the bbcode. Click Here To Register... ]
    new code in red and green below

    Code:
    [ Only registered users can see the bbcode. Click Here To Register... ]
    so add in a new main menu line with your own menu function.
    Then define this function, using existing code references for kodi.
    In my example EPG-Importer is the description - epgimporter is what is called when I press the menu option. 44 is the pecking order. Increase or decrease it to move it up or down the menu list. Menu items by default are ordered 0,10,20,30,40... etc

    custom-image.jpg

    ---------- Post Merged at 03:25 PM ----------

    and if you can't work it out.... ;)

    Code:
    [ Only registered users can see the bbcode. Click Here To Register... ]
    simple in the end. Ha ha.
    But we like to learn.

    ---------- Post Merged at 03:44 PM ----------

    ??? have you got it working ???
     
    Last edited: Dec 29, 2016
  12. Janso

    Janso TK Veteran

    1,775
    267
    103
    Male
    Doesn't seem to have worked, it isn't on the menu and it says there's a bad block (237) in the python - is it important where the def mymenu goes? as I just put this in above the plugins part as you have above.
     

    Attached Files:

  13. kiddac

    kiddac

    0
    39
    12
    no but python is fussy. It all has to be tabbed correctly and no random spaces before or after lines of code.

    i.e correct

    Code:
    [ Only registered users can see the bbcode. Click Here To Register... ]
    wrong

    Code:
    [ Only registered users can see the bbcode. Click Here To Register... ]
    run it through a python checker.
    PEP8 online check

    ---------- Post Merged at 03:52 PM ----------

    there will be lots of errors like line to long etc, but just look at the lines of code you have entered.

    ---------- Post Merged at 03:54 PM ----------

    A good test is to delete the original pyo file. If there is an error it won't compile so you wont get a new pyo file on reboot.
     
    Last edited: Dec 29, 2016
  14. Janso

    Janso TK Veteran

    1,775
    267
    103
    Male
    skafUqz.png

    Okay this is what that's giving me. Trying to work out where the obvious things I can change are but the line too long messages I'm unsure on how to deal with.
     
  15. kiddac

    kiddac

    0
    39
    12
    you can edit the code live in that python checker until its correct.

    ignore line too long.
    delete all tabs and reapply them.
    Remove any line breaks and create another. (removing the tab it will create)
    remove surplus spaces it's moaning about i.e around ==
    and you need two blank lines after the menu declaration. my mistake.

    ---------- Post Merged at 04:14 PM ----------

    i have editted my code on post 11. I think I might have been missing an underscore and tidied up the spaces.
     
    Last edited: Dec 29, 2016
  16. Janso

    Janso TK Veteran

    1,775
    267
    103
    Male
    Just trying to amend the latest edit on your post 11 to make the checker happy as I'm still getting a few messages.

    Then I'll try and it'll hopefully give me some joy...


    If nothing else, I'm learning a little about python code, which I never expected.
     
  17. kiddac

    kiddac

    0
    39
    12
    if you are still struggling, start from scratch with the original py code and manually type in the new stuff. Instead of cut and pasting.
    This forum code is probably bringing in different formatting.

    Code:
    [ Only registered users can see the bbcode. Click Here To Register... ]
    ---------- Post Merged at 04:27 PM ----------

    and try notepad instead of notepad++. Notepad++ is probably also trying to format the code (usually badly)

    ---------- Post Merged at 04:28 PM ----------

    i am using dreamweaver which is designed for code input. So i don't have these format problems.
     
  18. Janso

    Janso TK Veteran

    1,775
    267
    103
    Male
    Nope, it's still not liking it.

    Think I'll just give this up as a bad job so as to not take up any more of your time - thank you anyway for trying.
     
  19. kiddac

    kiddac

    0
    39
    12
    i am sat on my computer doing other things anyway.
    Try zipping the original plugin.pyo again.

    If you have failed I will try editting it for you and see how we get on.
     
  20. Janso

    Janso TK Veteran

    1,775
    267
    103
    Male
    Hopefully this will upload properly...
     

    Attached Files: