Need help/direction
#1
I'm working migrating DBMC with a solid understanding of python3 but python2 is still newer to me;
  1. Noob question here first, where do I obtain the libraries, like 'requests', for use in the lib directory? 
  2. How should I be debugging this? I am currently trying to install/launch the plugin then looking at the logfile in kodi directory. 
  3. Besides the syntax and module change what other hurdles will I likely run into? 
Reply
#2
(2023-09-07, 09:42)dazemc Wrote: Noob question here first, where do I obtain the libraries, like 'requests', for use in the lib directory? 

they are provided by the python environment in most cases so just import, there are 2 ways of doing it

you can explicitly tell kodi your addon uses it like this addon - https://github.com/jurialmunkey/plugin.v...don.xml#L8

but you can see this addon uses it without the explicit entry -
https://github.com/wargio/plugin.video.s.../addon.xml
https://github.com/wargio/plugin.video.s...ark.py#L17
 
(2023-09-07, 09:42)dazemc Wrote: How should I be debugging this? I am currently trying to install/launch the plugin then looking at the logfile in kodi directory. 

that is all i do but i believe there may be a better way i do not use
 
(2023-09-07, 09:42)dazemc Wrote: Besides the syntax and module change what other hurdles will I likely run into? 

i can't give a useful answer to this, i did not review the code and i do not know your skill level


useful links -

https://kodi.tv/addons/matrix/script.module.dropbox

https://kodi.wiki/view/Add-on_development


strictly opinion - it will likely be easier to write a new addon using this one as an outline rather than a straight port of the code
Reply
#3
Thank you for the info.
I think you are right about creating a new addon.
Reply
#4
(2023-09-07, 09:42)dazemc Wrote: I'm working migrating DBMC with a solid understanding of python3 but python2 is still newer to me;
  1. Noob question here first, where do I obtain the libraries, like 'requests', for use in the lib directory? 

  2. How should I be debugging this? I am currently trying to install/launch the plugin then looking at the logfile in kodi directory. 

  3. Besides the syntax and module change what other hurdles will I likely run into? 

I've migrated a few older addons from Kodi 18 and before to Kodi 19.  Here's the basic steps I use:

1. Device if you are going to maintain a single addon which supports both Python 2 and 3 or have separate addons.  I don't recommend the single addon approach except for the most basic addons
2.  Use the Python 2to3 program on each PY file 
3.  Convert the settings file using the Team Kodi provided tool
4.  Eliminate deprecated calls that are no longer supported  (i.e. xbmc.translatePath to xbmcvfs.translatePath etc..)

Don't worry about the last one too much.  The Kodi logs will call these out for you to fix.  I've converted around 6 addons so far, including maintaining a monster addon with Kodi 18 and 19+ versions.  One area which can be a problem is if your addon has external dependencies that aren't part of the standard Kodi repo. I don't use those.  Some common Python libraries have Kodi wrappers for them so you just need to call those in the addon.xml file as a dependency. 


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#5
I have used 2to3 on all py files, replaced the xbmc with xbmcvfs calls, switched from urllib3 to requests, and changed to xbmc.python 3.0.1.

I'm having issues with the setting script. It won't run on addons that are not installed. I'm missing dependencies on the local files that it's calling outside of the addon.xml
"from resources.lib.utils import *" are how they are brought in. I assume that this needs to be in the addon.xml now? I can't figure out how to add local file dependencies in the xml.

I put up a repo, 
plugin_dbmc
Reply
#6
(2023-09-11, 10:04)dazemc Wrote: I have used 2to3 on all py files, replaced the xbmc with xbmcvfs calls, switched from urllib3 to requests, and changed to xbmc.python 3.0.1.

I'm having issues with the setting script. It won't run on addons that are not installed. I'm missing dependencies on the local files that it's calling outside of the addon.xml
"from resources.lib.utils import *" are how they are brought in. I assume that this needs to be in the addon.xml now? I can't figure out how to add local file dependencies in the xml.

I put up a repo, 
plugin_dbmc

You've added it manually in your addon.xml file on line 7.  This is per how @jepsizofye instructed.  This is a Kodi wrapper for requests to be pulled into the Python environment.  You need to confirm that Kodi has loaded script.module.requests as an addon, which it should have.  If Kodi has loaded it then it would be best to post the kodi.log error message you are getting.  I am no a requests expert but we should be able to figure it out.  I am old school and still using urllib but it is a lot more work and less flexible than  requests.

Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#7
Yes I was able to figure out the how to add dependency in addon.xml.
I have gotten it installed without errors and I think I've gotten most of the py2 stuff out of the way.
I had to change some of the logging that was still using LOGNOTICE instead of LOGINFO, etc. 
I'm now getting stuck on the dropbox API handling I believe. 
I'm also getting an attribute error for 'abortRequested' on xbmc but I can't find anything about that being unsupported 

Here is the log file;
logfile
Reply
#8
(2023-09-12, 06:50)dazemc Wrote: I'm also getting an attribute error for 'abortRequested' on xbmc but I can't find anything about that being unsupported 

https://forum.kodi.tv/showthread.php?tid=354975
 
Quote:Disabled debug logging due to GUI setting. Level 0.

enable debug logging for more verbose information - Debug Log
Reply
#9
Okay thank you no more attribute error

Here's updated logfile;
logfile with debug actually on
Reply
#10
(2023-09-12, 09:29)dazemc Wrote: Okay thank you no more attribute error

Here's updated logfile;
logfile with debug actually on

I can't see your code but this is a type error on the result passed to ord().  Just change it to ord(str(c1)) and ord(str(c2))  on line 68 of your utils.py file. I tried to post the code but keep getting blocked by Cloudflare.



Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#11
from an outside viewpoint it looks like it is not getting a response it expects to get from dropbox

need to find out what is being returned by the server and compare it to what should be returned

i suspect it has to do with an api change and now the old api isn't viable
Reply
#12
(2023-09-12, 15:52)jepsizofye Wrote: from an outside viewpoint it looks like it is not getting a response it expects to get from dropbox

need to find out what is being returned by the server and compare it to what should be returned

i suspect it has to do with an api change and now the old api isn't viable

Yeah, that was my assumption too.  My fix was quick and dirty to get the type mismatch fixed.  Then troubleshoot he underlying cause.  Don't have enough info to go much further. 


Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
#13
I'm almost positive that it's an API change. It looks like that ord() function is handling the authentication token. I can try to change to a string to get pass the errors but I will be looking at the API changes later today. I'll most likely end up just rewriting that entire portion of the code depending on the changes Dropbox has made. It looks like the are using 0auth 2.0 now.

Here let's try just the url for the code, https://github.com/dazemc/plugin_dbmc
Reply
#14
(2023-09-12, 20:41)dazemc Wrote: I'm almost positive that it's an API change. It looks like that ord() function is handling the authentication token. I can try to change to a string to get pass the errors but I will be looking at the API changes later today. I'll most likely end up just rewriting that entire portion of the code depending on the changes Dropbox has made. It looks like the are using 0auth 2.0 now.

Here let's try just the url for the code, https://github.com/dazemc/plugin_dbmc

I looked at your utils.py file and there is no exception handling to catch exception errors.  I'd go the str approach to force the variable type.  At least that way you won't get exception errors.  I always try to eliminate exception errors in addons because the results can often be nondeterministic.  Forcing types and catching exceptions are standard approaches I use.  Yes, Dropbox's v2 API is OAuth 2.0 .  Kodi has an OAuth 2.0 wrapper.


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply

Logout Mark Read Team Forum Stats Members Help
Need help/direction0