Kodi Community Forum
[Release] Parsedom and other functions - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: [Release] Parsedom and other functions (/showthread.php?tid=116498)

Pages: 1 2 3 4 5 6 7 8 9


RE: [Release] Parsedom and other functions - cancan101 - 2012-12-29

I am all of a sudden getting the following:
Code:
01:01:45 T:2960104304  NOTICE: -->Python Interpreter Initialized<--
01:01:45 T:2960104304  NOTICE: YouTube-3.3.0
01:01:45 T:2960104304  NOTICE: CommonFunctions Beta-1.5.0
01:01:45 T:2960104304   ERROR: Error Type: <type 'exceptions.ValueError'>
01:01:45 T:2960104304   ERROR: Error Contents: invalid literal for float(): 11.0 Git:Unknow
01:01:45 T:2960104304   ERROR: Traceback (most recent call last):
                                              File "/home/xbmc/.xbmc/addons/plugin.video.youtube/default.py", line 107, in <module>
                                                params = common.getParameters(sys.argv[2])
                                              File "/home/xbmc/.xbmc/addons/script.module.parsedom/lib/CommonFunctions.py", line 110, in getParameters
                                                if getXBMCVersion() >= 12.0:
                                              File "/home/xbmc/.xbmc/addons/script.module.parsedom/lib/CommonFunctions.py", line 102, in getXBMCVersion
                                                version = float(version)
                                            ValueError: invalid literal for float(): 11.0 Git:Unknow
01:01:45 T:6706960   ERROR: XBMC.PlayMedia could not play media: plugin://plugin.video.youtube/?path=/root/search&action=play_video&videoid=XXXX

It looks like this issue was introduced here: http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commitdiff;h=7283827f6b422071d2f9c96bf90f12114033d123



RE: [Release] Parsedom and other functions - dschaeggi - 2012-12-29

Hi all!

The same error has occurred to me, out of the blue, this morning.
When I looked at CommonFunctions.py I found out, that function getXBMCVersion is not able to handle the string "11.0 Git:Unknown".
As I am used to write scripts in Perl and therefore prefer regular expression to do such things, I replaced
Code:
if version.find("-") -1:
        version = version[:version.find("-")]
by
Code:
version = re.findall(r"\d+\.\d", version).pop()

Fortunately it works again now.

Have a nice day with youtube! :-)

Dschaeggi


RE: [Release] Parsedom and other functions - cancan101 - 2012-12-29

I am pretty sure this line is buggy:

Code:
if version.find("-") -1:

My guess is the predicate is missing an == . All it does is drop the last character of the version string when no - is found.


RE: [Release] Parsedom and other functions - bit555 - 2013-01-01

NM


RE: [Release] Parsedom and other functions - Kr0nZ - 2013-01-01

hi, I found a bug... Parsedom wasn't returning all elements for me when trying to get <li>'s with other <li>'s as children.
I found the cause and fixed it
At the end of the parsedom function there is this line:
Code:
else:
    log("Getting element content for %s matches " % len(lst), 3)
    lst2 = []
    for match in lst:
        log("Getting element content for %s" % match, 4)
        temp = _getDOMContent(item, name, match, ret).strip()
        item = item[item.find(temp, item.find(match)) + len(temp):]
        lst2.append(temp)
    lst = lst2
This tries to get the content of every 'match' element in 'lst', but some of the matches could be children of other matches. So its then possible for 'getDOMContent' to return a blank str. The blank string (for me), kept matching the end on the html content, so when the line 'item = item[item.find(temp, item.find(match)) + len(temp):]' executes, it then truncates the entire content.

I fixed it by adding an if clause, so the above now becomes:
Code:
else:
    log("Getting element content for %s matches " % len(lst), 3)
    lst2 = []
    for match in lst:
        log("Getting element content for %s" % match, 4)
        temp = _getDOMContent(item, name, match, ret).strip()
        if temp:
            item = item[item.find(temp, item.find(match)) + len(temp):]
            lst2.append(temp)
    lst = lst2



RE: [Release] Parsedom and other functions - Kr0nZ - 2013-01-02

(2012-12-29, 22:15)cancan101 Wrote: I am pretty sure this line is buggy:

Code:
if version.find("-") -1:

My guess is the predicate is missing an == . All it does is drop the last character of the version string when no - is found.

I also just came across this bug,
I think its because its checking for a dash in the version string but not checking for a space
I added
Code:
if version.find(" ") -1:
    version = version[:version.find(" ")]
now its working


RE: [Release] Parsedom and other functions - rmk1139 - 2013-01-02

It looks like the issue I'm having is a common one. I am having the problem with XBMCbuntu. The problem arises because the call to:

Code:
version = xbmc.getInfoLabel( "System.BuildVersion" )

returns:

Code:
11.0 git:Unkown

I fixed the problem by changing the getXBMCVersion function to the following.

Code:
def getXBMCVersion():
    log("", 3)
    version = xbmc.getInfoLabel( "System.BuildVersion" )
    log(version, 3)
    if version.find("-") -1:
        version = version[:version.find("-")]
    if version.find(" ") -1:
        version = version[:version.find(" ")]
    version = float(version)
    log(repr(version))
    return version



RE: [Release] Parsedom and other functions - fightnight - 2013-11-07

This is missing on frodo repo.. Any chance to upload?


RE: [Release] Parsedom and other functions - Kib - 2013-11-08

the fact that it is missing seems to be an issue with the addons generator on the mirroring server, we are looking into it.


RE: [Release] Parsedom and other functions - Kib - 2013-11-08

Martijn regenerated the 33 addons which went missing. Should be OK now. Thanks for the heads up.


RE: [Release] Parsedom and other functions - realtebo - 2014-01-20

Hi !

I'm the author of plugin.video.jworg, already on xbmc official repo from some monthes.

I'd like to implement one new feature base on this addon.
Is it stable for html ?
Is it's develop going on ? Or.. is the author available here, on the forum?

Sorry for this questions, but I didn't know this addon before a recent search, and I'd like to be carefull about the future of my addon.
My addon is already dependant on common plugin cache, and I'll add new dependency only if this is stable.

Thanks of all, and of course thanks to the author of this addon !


RE: [Release] Parsedom and other functions - realtebo - 2014-01-21

Quote: ImportError: No module named CommonFunctions

Ehm ... I cannot find it in the official plugin installer in xbmc.
How can I include it if it's not in official repo ?


RE: [Release] Parsedom and other functions - bossanova808 - 2014-01-21

parsedom has known bugs (e.g. with non ascii chars) and I haven't seen the author for quite some time....I had to re-write one of the functions locally to work around it and plan to eventually abandon it for something better supported.


RE: [Release] Parsedom and other functions - takoi - 2014-01-24

(2014-01-21, 00:44)bossanova808 Wrote: parsedom has known bugs (e.g. with non ascii chars) and I haven't seen the author for quite some time....I had to re-write one of the functions locally to work around it and plan to eventually abandon it for something better supported.

send PR? https://github.com/HenrikDK/xbmc-common-plugin-functions


RE: [Release] Parsedom and other functions - bossanova808 - 2014-01-28

Yeah might as well I guess. May well get ignored but it's a simple fix so here's hoping...