• 1
  • 2
  • 3
  • 4(current)
  • 5
  • 6
  • 40
Release ESPN 3
#46
(2015-07-18, 01:36)locomot1f Wrote: so, I downloaded the xml file.
just saved the link as...

and low and behold there's some funky escaped character in the title
<name><![CDATA[ The Open  Marquee Groups (First Round)]]></name>


-----------------------------------------------------
it doesn't even show up on here. just a space.


not sure if there's a whole lot I can do on my end.

Yep, it's a little box with two zeroes on top of a 13. WTF kind of encoding is this??

Weird that I can paste it into my post, and it can be seen when I quote yours, but it doesn't show up in the thread, or on the WatchESPN website. Huh

The problem is caused by the way xml.tree parsers the document. lxml has some kind of recovery argument that might be of use, but I'm not familiar enough with that, and there may be something similar for xml.tree, not sure. So I just hacked the crap out of the code using BeautifulSoup and it'll decode everything fine. Made a huge mess of the add-on though. lol

An easier fix is to add this after line 71:

Code:
data = data.replace('@','')

Just substitute that screwball box character for the @ in the above code snippet and the add-on will work fine and display today's replays, at least until ESPN uses some other weird character that starts this all over again.

Line 46 doesn't need to be modified if the above code change is used, but we really need to figure out a way to parse, decode, or escape those bizarre characters using xml.tree or re-write the add-on using BeautifulSoup to parse the xml.
Kodi Nexus on Dell Optiplex 980 Lubuntu 22.04 | Kodi Nexus on HTPC Lubuntu 20.04 | My Add-ons | Legacy Repo | Matrix Repo
>>>>> Newest MetalChris Addons: Redbox | NEWSnet | NHL Radio | Weather Unlocked
Reply
#47
Yeah, I guess I overlooked that my "fix" from yesterday was fixing a symptom and not the root cause. The root issue is that we're not sanitizing the data before we parse it, apparently. Other python libraries might be able to be used to ignore errors, but until then, we should sanitize the input. I created a function for this:

Code:
def sanitize(data):
    output = ''
    for i in data:
        for current in i:
            if ((current >= '\x20') and (current <= '\xD7FF')) or ((current >= '\xE000') and (current <= '\xFFFD')) or ((current >= '\x10000') and (current <= '\x10FFFF')):
               output = output + current
    return output


Ideally, we would use a regular expression to fix this issue, but I had trouble getting that to work.

There are two lines that hose the whole script if there's an error parsing the XML:
Code:
for event in ET.XML(data).findall('event'):
Before these two identical lines (one in INDEX and one in LISTSPORTS), include the following line so that it looks like this:
Code:
data = sanitize(data)
for event in ET.XML(data).findall('event'):
Now if there are any other special unicode characters within the parameters we're accepting that are causing it to break, we can identify those within the sanitize function and fix it in one place.

Let me know if you want me to post my whole file somehow. Seems to be working for me.
Reply
#48
(2015-07-18, 06:47)xirtamozne Wrote: Yeah, I guess I overlooked that my "fix" from yesterday was fixing a symptom and not the root cause.

Sometimes all you can do is throw a band-aid on it, until something better comes along. lol

Quote:Ideally, we would use a regular expression to fix this issue, but I had trouble getting that to work.

I struggled with this for while, trying to find a way to get the script to decode the character, or ignore it altogether, but I'm just not familiar enough with xml.etree to get it to work either. My fall-back was to use BeautifulSoup, and it works, but it would require a lot of re-writing of the code.

Quote:I created a function for this:

Nice job. Only took a few lines of code to make it work. I've added this to my addon.py and it seems to be working well on both my laptop and HTPC.
Kodi Nexus on Dell Optiplex 980 Lubuntu 22.04 | Kodi Nexus on HTPC Lubuntu 20.04 | My Add-ons | Legacy Repo | Matrix Repo
>>>>> Newest MetalChris Addons: Redbox | NEWSnet | NHL Radio | Weather Unlocked
Reply
#49
@MetalChris, @xirtamozne,

i have been meaning to switch those two functions to BeautifulSoup.

I will get on that today.

I put the changes made by @xirtamozne on my github, as this does seem to work.
Linux Mint 18 LTS 64-bit - Kodi 17 Beta6
Odroid-C2 - Libreelec v7.90.009
Reply
#50
I'm getting a 'script failed' error when trying to play historical (not live) content.

Log file here.
Zed's no moving parts HTPC
i3 2100, Thermalright Ultra 120 HS, 4GB DDR3, 60GB OCZ Vertex 2 SSD, Z68 Mobo, Silverstone TJ08B-E Case, Seasonic 400FL PSU, Onkyo TX-SR608

Zed's Trinity uHTPC
A10 5700, Noctua NH-L9a HSF, 4GB DDR3, 64GB Crucial M4 SSD, MSI FM2-A75IA-E53 Mobo, Wesena ITX4 Case w/90W PSU

Reply
#51
(2015-07-19, 13:53)bznotins Wrote: I'm getting a 'script failed' error when trying to play historical (not live) content.

Log file here.

Thanks for posting your log file. A fix for this has been implemented. You should download and install the latest master.zip from locomot1f's github page.
Kodi Nexus on Dell Optiplex 980 Lubuntu 22.04 | Kodi Nexus on HTPC Lubuntu 20.04 | My Add-ons | Legacy Repo | Matrix Repo
>>>>> Newest MetalChris Addons: Redbox | NEWSnet | NHL Radio | Weather Unlocked
Reply
#52
(2015-07-19, 14:57)MetalChris Wrote:
(2015-07-19, 13:53)bznotins Wrote: I'm getting a 'script failed' error when trying to play historical (not live) content.

Log file here.

Thanks for posting your log file. A fix for this has been implemented. You should download and install the latest master.zip from locomot1f's github page.

Thanks. Had to uninstall the old/default ESPN3 addon and re-install this one, but it works.

Will I have to do this with future OpenElec releases or will the addon persist through the beta/release update cycle?
Zed's no moving parts HTPC
i3 2100, Thermalright Ultra 120 HS, 4GB DDR3, 60GB OCZ Vertex 2 SSD, Z68 Mobo, Silverstone TJ08B-E Case, Seasonic 400FL PSU, Onkyo TX-SR608

Zed's Trinity uHTPC
A10 5700, Noctua NH-L9a HSF, 4GB DDR3, 64GB Crucial M4 SSD, MSI FM2-A75IA-E53 Mobo, Wesena ITX4 Case w/90W PSU

Reply
#53
(2015-07-19, 16:19)bznotins Wrote:
(2015-07-19, 14:57)MetalChris Wrote:
(2015-07-19, 13:53)bznotins Wrote: I'm getting a 'script failed' error when trying to play historical (not live) content.

Log file here.

Thanks for posting your log file. A fix for this has been implemented. You should download and install the latest master.zip from locomot1f's github page.

Thanks. Had to uninstall the old/default ESPN3 addon and re-install this one, but it works.

Will I have to do this with future OpenElec releases or will the addon persist through the beta/release update cycle?

I believe locomot1f is working on a more permanent fix for this issue and when finished, he will make a new version available through the main repo that should auto-update.
Kodi Nexus on Dell Optiplex 980 Lubuntu 22.04 | Kodi Nexus on HTPC Lubuntu 20.04 | My Add-ons | Legacy Repo | Matrix Repo
>>>>> Newest MetalChris Addons: Redbox | NEWSnet | NHL Radio | Weather Unlocked
Reply
#54
okay,

so I've gotten BS 4 for all the scraping.
also, updated the code to pull the full images for the fanart / thumbnail. so it should be a little sharper.

i've put the changes on my git so that you all can test it. if most of you seem fine with the changes, i'll put it up for a PR.
Linux Mint 18 LTS 64-bit - Kodi 17 Beta6
Odroid-C2 - Libreelec v7.90.009
Reply
#55
Looks good, locomot1f.

I downloaded the latest code and tested it. Looks fine to me. Thanks for supporting this addon.
Reply
#56
okay... that's good to hear.

i was worried it was a bit slower than original.
still looking for alternatives.

I think because bs4, by default, uses a html.parser, it slows things down.

still looking for a good XML parser.
Linux Mint 18 LTS 64-bit - Kodi 17 Beta6
Odroid-C2 - Libreelec v7.90.009
Reply
#57
Just tried the latest build and I like the changes. The speed did not bother me one bit.

I still can not view any of the Pan American games, SMIL missing error on everything. Was wondering if you had any other thoughts on that issue that I (and others?) are seeing. It's a shame as there are some cool events there that I would love to watch
Reply
#58
(2015-07-13, 23:49)MetalChris Wrote:
(2015-07-13, 21:32)mrdally204 Wrote: SMIL error on Live Beach Volleyball 2:30pm and Judo 3:00pm. Log attached

http://pastebin.com/dbUywBKP

I see you are using TWC as well. Do you have TWC cable and internet, or internet only? Are you able to watch any of the other streams, and can you watch anything on the WatchESPN website?

I totally missed this earlier. I can not watch anything as far as I can tell from the Watchespn website. I have TWC internet only. I can watch nearly everything I have tried so far, except the Pan America games. All of those have given me the SMIL missing error.
Reply
#59
(2015-07-20, 18:59)locomot1f Wrote: okay... that's good to hear.

i was worried it was a bit slower than original.
still looking for alternatives.

I think because bs4, by default, uses a html.parser, it slows things down.

still looking for a good XML parser.

lxml has a "recover=true" option that you can try, but when it comes down to it, an HTML parser like BeautifulSoup might fit the bill better because it doesn't have strict conformance checking like XML parsing will. If you go back to an XML parser, you will need to go back to sanitizing the input, which BeautifulSoup is able to ignore gracefully because it doesn't cause any invalid XML problems.

All "good" XML parsers will suffer from the problem that ESPN produced by giving us malformed input because good parsers will recognize input that's not in conformance with XML specifications. We've fixed the problem two different ways: first, by sanitizing the input, and second, by using a parser that doesn't require a certain format.

I'll support whichever route you want to go, as I think we're picking from two good options. Both require marginal performance hits, but they're client side. Optimizing client side code in this case won't result in much noticeable gain. I was looping through every character of the input, checking it for a Unicode value within an acceptable range, and building an output string as a result. This character-by-character process didn't result in noticeable performance degradation even though it was "way more inefficient" than it was before we were checking for errors. Your BeautifulSoup solution probably circumvents other as-yet-unforeseen issues that the ESPN service could cause because it's more forgiving than using XML parsers, which have to validate the code.
Reply
#60
(2015-07-20, 00:13)locomot1f Wrote: okay,

so I've gotten BS 4 for all the scraping.
also, updated the code to pull the full images for the fanart / thumbnail. so it should be a little sharper.

i've put the changes on my git so that you all can test it. if most of you seem fine with the changes, i'll put it up for a PR.

Version 1.2.3 seems to be working well for me too. All live events are in the HLS formats right now, so I'm getting the dreaded 'SMIL URL Empty' error, OTL Extra is coming up in a few minutes and it did give me the 'You're Event is about to Begin' stream, so I'd imagine that one's going to work fine. I did test a few replays, and no issues there. No issues with the Upcoming menu either.

(2015-07-20, 22:19)mrdally204 Wrote:
(2015-07-13, 23:49)MetalChris Wrote:
(2015-07-13, 21:32)mrdally204 Wrote: SMIL error on Live Beach Volleyball 2:30pm and Judo 3:00pm. Log attached

http://pastebin.com/dbUywBKP

I see you are using TWC as well. Do you have TWC cable and internet, or internet only? Are you able to watch any of the other streams, and can you watch anything on the WatchESPN website?

I totally missed this earlier. I can not watch anything as far as I can tell from the Watchespn website. I have TWC internet only. I can watch nearly everything I have tried so far, except the Pan America games. All of those have given me the SMIL missing error.

I think there's some additional authentication going on with the HLS streams that is failing for users without TV subscriptions. I've tried making some changes to the userdata.xml file, and that doesn't make any difference. I think locomot1f mentioned it might be a cookie issue, and I'm starting to agree.
Kodi Nexus on Dell Optiplex 980 Lubuntu 22.04 | Kodi Nexus on HTPC Lubuntu 20.04 | My Add-ons | Legacy Repo | Matrix Repo
>>>>> Newest MetalChris Addons: Redbox | NEWSnet | NHL Radio | Weather Unlocked
Reply
  • 1
  • 2
  • 3
  • 4(current)
  • 5
  • 6
  • 40

Logout Mark Read Team Forum Stats Members Help
ESPN 32