Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script tries to sync Video Games from IMDB #104

Open
1 task done
dpan opened this issue Aug 18, 2024 · 8 comments · Fixed by #110 or #112
Open
1 task done

Script tries to sync Video Games from IMDB #104

dpan opened this issue Aug 18, 2024 · 8 comments · Fixed by #110 or #112

Comments

@dpan
Copy link

dpan commented Aug 18, 2024

Is there already an issue for your problem?

  • I have checked older issues, open and closed

Bug Description

If you rate video games in IMDB the script will try to sync them to Trakt on every execution without providing any error (like "not found"). The expected behavior would be to ignore video games in the first place.

Environment

OS: Windows 11

Screenshots

No response

@RileyXX
Copy link
Owner

RileyXX commented Aug 18, 2024

Thanks for reporting this. I see the issue you're having. I'll look into this soon when I have some time and provide a fix for it in a future patch.

@dpan
Copy link
Author

dpan commented Dec 13, 2024

Thanks for the update, it eliminated many of the errors but the issue doesn't look totally fixed. I still see games from IMDB trying to be ranked in trackt and failing. For example, It still tries to rate Read Dead Redemption 2 (tt6161168) Also, the version shows as 2.9.5, instead of 1.9.5?

@RileyXX
Copy link
Owner

RileyXX commented Dec 14, 2024

Thanks for noting the version number that was an oversight on my part.

I did some tests with Read Dead Redemption 2 (tt6161168). I wasn't able to reproduce the same behavior in v2.9.5. However, I did make some changes to this portion of the code which could fix the problem you're having.

python -m pip install IMDBTraktSyncer --upgrade

Give v3.0.1 a try and let me know. If you're still having issues, provide me with a portion of your .csv ratings and .csv watchlist exports from this page https://www.imdb.com/exports/ and make sure it includes the items you're having issues with. That will help me better understand where the issue is. Thanks

@dpan
Copy link
Author

dpan commented Dec 17, 2024

troubleshooting.csv
Attaching a pruned version of the csv. Furiosa (Movie) and Half Life 2 (Game) work as expected and I added them for refrence. Star Wars (Game), Read Dead Redemption 2 (Game) and Kung Fury (Short Movie) fail. Kung Fury exists on Trakt. All errors are "Failed to rate movie...", tested with v3.0.3. I hope this helps.

@RileyXX
Copy link
Owner

RileyXX commented Dec 17, 2024

Thanks for the csv file. Nothing looks out of the ordinary there. I tested those items from my end and couldn't get the same behavior on 3.0.3. I'm thinking there could be an issue with your install. There might be multiple versions of IMDBTraktSyncer installed on separate python versions.

Just to clarify some things:

  1. Do you know if you have multiple python versions installed?
  2. Are you running off a pip install?
  3. You upgraded with python -m pip install IMDBTraktSyncer --upgrade?
  4. You can check if you have other python versions here C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python. If you have more than one folder that would indicate multiple python installs.
  5. When you run IMDBTraktSyncer, you're running just with the command IMDBTraktSyncer correct?
  6. When running the script do you see Starting WebDriver... or Starting webdriver...? (case sensitive) I'm curious because the string Starting webdriver... was used in older versions v2.9.5 and below. This would be an easy tell if an older version was being run.
  7. When you run pip show IMDBTraktSyncer and python -m pip show IMDBTraktSyncer (seperately) do they show the latest version (3.0.3)

Appreciate your patience with this.

@dpan
Copy link
Author

dpan commented Dec 18, 2024

I'm on a Mac, running latest macos. I also have Python3 installed only, and had to create a symlink to python to work around the error introduced in the previous version (I was getting the exact same errors before).

 1. I only have Python 3
 2, 3. Yes, python3 -m pip etc etc
 4. I'm on a mac, but yes single version
 5. Yes, just IMDBTraktSyncer 
 6. I'm seeing "WebDriver" (btw, better to show the actual version there)
 7. Both pip commands show 3.0.3

The problem is likely Python 3?

@RileyXX
Copy link
Owner

RileyXX commented Dec 18, 2024

I'm on a Mac, running latest macos. I also have Python3 installed only, and had to create a symlink to python to work around the error introduced in the previous version (I was getting the exact same errors before).

 1. I only have Python 3
 2, 3. Yes, python3 -m pip etc etc
 4. I'm on a mac, but yes single version
 5. Yes, just IMDBTraktSyncer 
 6. I'm seeing "WebDriver" (btw, better to show the actual version there)
 7. Both pip commands show 3.0.3

Thanks for that info.

The problem is likely Python 3?

It's possible. It's hard for me to troubleshoot this since I'm unable to replicate it from my end. There could be an issue with different python versions parsing the csv file in different ways.

Here's something else you could try. In imdbData.py file, open it in a text editor, find the lines media_type = row[header_index['Title Type']] (there should be 2 separate instances, replace them both with row[header_index['Title Type']].strip().lower().title(). If certain python versions are parsing the Title Type column differently this should help.
e.g.

                    title = row[header_index['Title']]
                    year = row[header_index['Year']]
                    imdb_id = row[header_index['Const']]
                    date_added = row[header_index['Created']]
                    media_type = row[header_index['Title Type']].strip().lower().title()

In the same imdbData.py file, You could also try adding the line time.sleep(5) above the lines # Delete csv files (2 separate instances). This would ensure there is enough time given to finish processing csv data in case there is something inconsistent happening here.
e.g.

        time.sleep(5)
        # Delete csv files
        for file in os.listdir(directory):
            if file.endswith('.csv'):
                os.remove(os.path.join(directory, file))

One more thing you could try, in the same imdbData.py file in text editor, replace the lines (2 instances) elif media_type in ["Movie", "TV Special", "TV Movie", "TV Short", "Video"]: with elif media_type == "Movie" or media_type == "TV Special" or media_type == "TV Movie" or media_type == "TV Short" or media_type == "Video":. This would eliminate any potential logic misinterpretation on different python versions.
e.g.

                for row in reader:
                    title = row[header_index['Title']]
                    year = row[header_index['Year']]
                    imdb_id = row[header_index['Const']]
                    date_added = row[header_index['Created']]
                    media_type = row[header_index['Title Type']]
                    # Convert date format
                    date_added = datetime.strptime(date_added, '%Y-%m-%d').strftime('%Y-%m-%dT%H:%M:%S.000Z')
                    if media_type == "TV Series" or media_type == "TV Mini Series":
                        media_type = "show"
                    elif media_type == "TV Episode":
                        media_type = "episode"
                    elif media_type == "Movie" or media_type == "TV Special" or media_type == "TV Movie" or media_type == "TV Short" or media_type == "Video":
                        media_type = "movie"
                    else:
                        media_type = "unknown"

                    if media_type != "unknown":
                        imdb_watchlist.append({
                            'Title': title,
                            'Year': year,
                            'IMDB_ID': imdb_id,
                            'Date_Added': date_added,
                            'Type': media_type
                        })

Give those solutions a try and let me know if it changes anything. If any of those solutions work in your case, I can add a patch for it.

@dpan
Copy link
Author

dpan commented Jan 31, 2025

Sorry for not replying earlier, this issue seems to be resolved in the latest versions so I guess we can close this ticket.
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment