Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't run plugin.initialize_gettext() ? #1

Closed
gordielachance opened this issue Oct 2, 2016 · 12 comments
Closed

can't run plugin.initialize_gettext() ? #1

gordielachance opened this issue Oct 2, 2016 · 12 comments

Comments

@gordielachance
Copy link

Hi romanvm !!!
I'm trying to build my first plugin with simpleplugin, it's my first time with Python too :)

My first tests are fine and i'm already getting some good results with the plugin.
I'm now trying to use localization :

# Create plugin instance
plugin = Plugin()

# initialize_gettext
_ = plugin.initialize_gettext()

But it crashes Kodi :

13:20:09 T:123145306673152 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.TypeError'>
Error Contents: 'str' object is not callable
Traceback (most recent call last):
File "/Users/Gordie/Library/Application Support/Kodi/addons/plugin.audio.subsonic2/main.py", line 23, in
_ = plugin.initialize_gettext()
TypeError: 'str' object is not callable
-->End of Python script error report<--
13:20:09 T:140735162187776 ERROR: GetDirectory - Error getting plugin://plugin.audio.subsonic2/

Could you help me here ?

Thanks !

@romanvm
Copy link
Collaborator

romanvm commented Oct 2, 2016

Some snippets from traceback and code are not informative. Show me your full plugin with all files.

@gordielachance
Copy link
Author

here you are : http://pastebin.com/4sgwjUgd

@romanvm
Copy link
Collaborator

romanvm commented Oct 2, 2016

Several notes:

  1. Please carefully read add the docs, including API docs. Plugin class inherits from Addon so you don't need to use both. Also Addon class has several helper methods and properties to access addon data, so generally you don't need to access the underlying xbmcaddon.Addon class. Plugin settings are better accessed via instance properties. Numeric and boolean settings are automatically converted into respective Python types and vice versa.
  2. You seem to be using some old version of simpleplugin library that does not have initialize_gettext method. The current version is 2.0.1 and can be downloaded from "Releases" tab.
  3. In v.2+ the recommended way to add actions is via @plugin.action() decorator. This makes code more readable and Pythonic. The old method still works but it's less convenient IMO, so I've added the decorator.

The example plugin needs to be updated, but the documentation is current and should be your primary source of information.

@gordielachance
Copy link
Author

Sorry, you can see the code here : https://github.com/gordielachance/plugin.audio.subsonic

@romanvm
Copy link
Collaborator

romanvm commented Oct 2, 2016

Have you read my reply above? Most probably you are using a very old version of SimplePlugin that does not support the method in question.

@gordielachance
Copy link
Author

gordielachance commented Oct 2, 2016

Thanks !
Perfect, it works. I've implemented your remarks.
Yet I don't know why SimplePlugin wasn't up to date in KODI. Is the last release available from the offical repositories ?

PS : nice framework ! Thanks !

gordielachance pushed a commit to warwickh/plugin.audio.subsonic that referenced this issue Oct 2, 2016
@romanvm
Copy link
Collaborator

romanvm commented Oct 2, 2016

The new procedure for submitting addons into the official Kodi repo is too fussy, so I don't update the plugin. It seems that nobody uses it anyway. You are the first I know besides myself.

@gordielachance
Copy link
Author

Okay ! But then, it means that it would be smarter that I include directly your library inside the plugin than rely on a dependency that will be out-of-date if a user install the plugin ?

@gordielachance
Copy link
Author

And do you know why nobody uses your framework ? It looks great. I read about xbmcswift2 but I thought it was not longer maintained..

@gordielachance
Copy link
Author

gordielachance commented Oct 3, 2016

The new procedure for submitting addons into the official Kodi repo is too fussy, so I don't update the plugin. It seems that nobody uses it anyway. You are the first I know besides myself.

But in a way, this is nonsense :)
Would be great to have it in the repo so it can be used as a dependency.

And if not, how can I include it as a lib, ideally as a submodule so I can keep it "synced" easyly with Github ?

Thanks !

@romanvm
Copy link
Collaborator

romanvm commented Oct 3, 2016

I use this library for my personal projects so a new version is automatically pushed to my private repo: https://github.com/romanvm/kodi_repo

@gordielachance
Copy link
Author

I understand, it's not a big deal for me to get the latest version.

But the purpose of the addon i'm building is to publish it, so I need to
find a way to ship the lastest version of your library with it...

2016-10-03 16:52 GMT+02:00 Roman Miroshnychenko notifications@github.com:

I use this library for my personal projects so a new version is
automatically pushed to my private repo: https://github.com/romanvm/
kodi_repo


You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
#1 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AD42zT1ZZ462lYXseXlkqyuGLM_Lb9C8ks5qwRbLgaJpZM4KL_Uf
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants