brucevdkooij/jinni-tools

ValueError: invalid literal

Closed this issue · 9 comments

From someone who has as many ratings on imdb as jinni, thanks for your work.

After following the instructions to fulfill dependencies, I'm having trouble running the script on Windows Vista SP2 x32:

INFO: 2011-06-06 11:57:09,615 Logging in... INFO: 2011-06-06 11:57:11,990 Exporting ratings... Traceback (most recent call last): File "main.py", line 353, in <module> main() File "main.py", line 349, in main jinni_export_ratings() File "main.py", line 168, in jinni_export_ratings ratings = jinni_parse_ratings_page(document) File "main.py", line 220, in jinni_parse_ratings_page digitRate = int(digitRate[:digitRate.find("/")]) ValueError: invalid literal for int() with base 10: ''

Hmm, I'll look into it. If I had to guess, it could have something to do with not having any ratings on Jinni. I'll verify, give me a few minutes.

Hmm, perhaps not.

If at all possible, could you save the ratings page from your browser and attach it here? Make sure you logout afterwards (or somebody could possibly fake your session).

Thanks in advance.

I have 210 ratings on Jinni, and 188 on imdb. I've attached both here: http://min.us/mvghot1

Thanks.

I see what's causing it, it's the titles that say "Likely to see" but have no numerical rating. Like "21 grams", "A Beautiful Mind" and "Blade Runner".

How did you manage to do that?

UPDATE:

Nevermind, it turns out you can give a title that "rating" if you click "Not seen it?"

This was fixed in commit c6d5ce8

c6d5ce8

Download the latest version to try again.

Thanks for the report.

Hold on, just noticed another possible non-rating "Not for me" -- didn't see it because the option is obscured for me possibly due to my browser font settings.

Alright, added some logic code to also check for the "Not for me" rating.

The "Likely to see" and "Not for me" ratings now also turn up in the Jinni ratings export. I had to rewrite the section a little bit to handle these two cases properly. However, because they also appear in the export, if you have these titles rated on IMDB, they won't be submitted to Jinni.

If you do need that to happen, let me know and I'll think up of something.

The script works great now. Thanks for the fix, Bruce. I had 188 ratings on imdb and 210 on Jinni, now up to 335 thanks to you.

I wonder if BeautifulSoup hammers jinni's servers? Hopefully that will make them finally take notice.

BeautifulSoup is just an HTML parser, but the import script does send quite a few requests. 3 requests per title: 1 for suggestion search, 1 for retrieving the title page to check the IMDB id and 1 for submitting the rating.

In your case you've likely sent close to 600 requests, another user had over 1000 titles rated in IMDB so that's some 3000 requests. I'm not entirely sure if that qualifies as a heavy load (or even falls under acceptable usage), but that's up to the admins at Jinni to decide. The requests are throttled, one request every two seconds.

Implementing this feature when you have access to internal systems (mainly the database) should be pretty easy. I'm not quite sure why they haven't implemented the feature yet even though Jinni has been around since 2008.