Protuhj / myvideobuzz

MyVideoBuzz
MIT License
58 stars 9 forks source link

runtime error &hf3. playlist display crashes app when showing playlist page containing some videos #106

Closed youvegottabecrazy closed 8 years ago

youvegottabecrazy commented 8 years ago

"Interface not a member of BrightScript Component (runtime error &hf3) in pkg:/source/video.brs(782)"

When displaying some playlist pages the whole app crashes. I use VB frequently & do a bunch of automated playlist generation & shuffling, so I have to think that this is new, otherwise I'm sure I'd have noticed it earlier. The app needs to be restarted to recover from the error.

stack trace from the console: http://pastebin.com/msGMF0gS

I isolated three videos for which this is a problem. Add one of these to any playlist, try to display that playlist page, boom, crash. Take the video out, no crash.

A4EV45zUllk, 9OyWSIOwZDs, yt-PW3WhGgw

(Note: I'm not personally crazy, I just find crazy stuff entertaining.)

Here is some API data for each of those videos, nothing jumps out at me as being out of the ordinary.

http://pastebin.com/H3At85uE

Protuhj commented 8 years ago

It looks like one of the fields I'm trying to fetch doesn't exist for those videos, I'll take a look when I get home, unless you can attach a text file with the individual video API details. (I can't view pastebin at work).

youvegottabecrazy commented 8 years ago

OK, it looks like jsonVideoItem.statistics.likeCount is unpopulated on problem videos. The API isn't returning 0. It's returning nothing.

Problem video:

   u'statistics': {u'commentCount': u'0',
                     u'favoriteCount': u'0',
                     u'viewCount': u'205'},

Non-problem video:

         u'statistics': {u'commentCount': u'0',
                         u'dislikeCount': u'0',
                         u'favoriteCount': u'0',
                         u'likeCount': u'0',
                         u'viewCount': u'38'},
youvegottabecrazy commented 8 years ago

last line: 782: if (jsonVideoItem.statistics.likeCount.Toint() > 0) then

BrightScript Debugger> ? jsonVideoItem.statistics viewCount: 54

BrightScript Debugger> ? jsonVideoItem.statistics.likeCount invalid

Protuhj commented 8 years ago

ok -- if you want to modify your code until I can push an official release, you can replace that if statement like so:

    if (jsonVideoItem.statistics.likeCount <> invalid AND jsonVideoItem.statistics.dislikeCount <> invalid AND jsonVideoItem.statistics.likeCount.Toint() > 0) then
        video["Rating"]         = Int(jsonVideoItem.statistics.likeCount.ToFloat() / (jsonVideoItem.statistics.likeCount.ToFloat() + jsonVideoItem.statistics.dislikeCount.ToFloat()) * 100)
    else
        video["Rating"] = 0
    end if
youvegottabecrazy commented 8 years ago

Ha, I've been threatening to learn to make a Roku app. I might as well use this as a catalyst.

I just noticed that one of my playlists that was crashing yesterday is no longer crashing. So either the offending video(s) got some likes, or the omission of those stats was a temporary youtube glitch/mistake. I haven't investigated yet, but I'll update here when I do.

Thank you!

youvegottabecrazy commented 8 years ago

OK, so I've got a playlist with ~400 items on it. Yesterday, 7 of them were returning no data for likes and dislikes. Now, none of them are. It seems unlikely that all 7 of these videos picked up a like since I last checked. So I'm thinking this was an error on YouTube's side & that they've fixed the problem.

Protuhj commented 8 years ago

It may have been a problem with their API, but I'll add the check regardless..

Protuhj commented 8 years ago

Thanks for all the info, by the way!

Protuhj commented 8 years ago

This should be fixed in 2.0. Build 002.