• 1
  • 5
  • 6
  • 7
  • 8(current)
  • 9
[Release] Parsedom and other functions
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/gitw...114033d123
Reply
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
Reply
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.
Reply
Thumbs Up 
NM
Reply
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
Reply
(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
Reply
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
Reply
This is missing on frodo repo.. Any chance to upload?
Reply
the fact that it is missing seems to be an issue with the addons generator on the mirroring server, we are looking into it.
Reply
Martijn regenerated the 33 addons which went missing. Should be OK now. Thanks for the heads up.
Reply
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 !
Reply
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 ?
Reply
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.
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
(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-...-functions
Reply
Yeah might as well I guess. May well get ignored but it's a simple fix so here's hoping...
Addons I wrote &/or maintain:
OzWeather (Australian BOM weather) | Check Previous Episode | Playback Resumer | Unpause Jumpback | XSqueezeDisplay | (Legacy - XSqueeze & XZen)
Sorry, no help w/out a *full debug log*.
Reply
  • 1
  • 5
  • 6
  • 7
  • 8(current)
  • 9

Logout Mark Read Team Forum Stats Members Help
[Release] Parsedom and other functions1