Closed Captain-Wiggles closed 2 years ago
I realized, that Trakt is probably not updating because it is not authorized. However, i'm not sure where i should be inputting the one time pin to authorize the app i created following the steps.
Also i found the windows equivalent for "grep" to be "findstr". Listing it out for any future readers who are not familiar like myself.
Okay, so for the Trakt authorization you need to fill in the API Key and Api Secret in the config.py, have you done this already?
It's this part: TRAKT_API_CLIENT_ID = "" TRAKT_API_CLIENT_SECRET = ""
Then, once the movies and tv shows are identified the script opens the Trakt connection. As far as I remember, If it's not authorized yet, it will show an URL on the console that you have to open in your web browser. There, you have to click something like "Authorize" to authorize the script to interact with your trakt account.
After that (still in the web browser) the code should be shown. The console is waiting for you to insert that code into the console and press enter (it should also say something like "waiting for code" or something similar)
.... however, looking at your error message it seems the script has not even reached the Trakt authorization part. It fails at res = tmdbMovie.search(movie.name) This means it gets all tv shows, but for some specific movie it can't find the TMDB info and generates an error and thus nothing is sent to trakt.
What you could try: after the line "for movie in netflixHistory.movies:" ( https://github.com/jensb89/Netflix-to-Trakt-Import/blob/fb8a301c412e35a2fe0282bb4d2ebe74a6e0fa05/netflix2trakt.py#L139 ) add a print(movie) command to identify the movie that causes this problem. Would be interesting to know for a future fix :)
Alternatively: Check your log for the last message of the form: "Found movie ..." Then, manually open your csv file and search for the next movie after that one and delete the line.
If you have identified the movie, please comment it here, then I will have a look why it fails as soon as I find some time. But once you delete it from the csv file the script should run through.
I will think of a bugfix for the script to continue after such an error.
Also: Could it be that there is a blank line without any movie name in your csv file? The error "['query must be provided']" indicates the movie name might be an empty string?!
Yep, I had the client ID and secrets all edited.
I followed through everything and found the culprit. It was exactly as you said, in the .csv there were two rows with blank cells (but filled date).
I deleted those, ran the script and it ran through to the authentication portion. After authenticating, it failed at adding to Trakt.
On the csv file, I did notice that the date column only has the actual date (I.e. 2021-12-12) and no hours:minutes. I'm assuming this is the culprit. I'm guessing I can just convert the date format to "yyyy-mm-dd h:mm" via excel and it'll work. I assumed once it's imported there's no undoing so I'd like to ask if your .csv downloads included the hours:minutes before doing so. I assume there must've been a reason for you to include that specification.
# Set the datetime format of the csv file (default: %d.%m.%y for 05.02.21)
# Use %Y-%m-%d for 2021-02-05 (Canada, ...)
CSV_DATETIME_FORMAT = "%Y-%m-%d"
Traceback (most recent call last): File "C:\Program Files\Netflix-to-Trakt-Import\netflix2trakt.py", line 164, in <module> time = datetime.datetime.strptime(watchedTime + ' 20:15', config.CSV_DATETIME_FORMAT + ' %H:%M') File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\_strptime.py", line 568, in _strptime_datetime tt, fraction, gmtoff_fraction = _strptime(data_string, format) File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.2800.0_x64__qbz5n2kfra8p0\lib\_strptime.py", line 349, in _strptime raise ValueError("time data %r does not match format %r" % ValueError: time data '2022.01.07 20:15' does not match format '%Y-%m-%d %H:%M'
Great, one step closer :)
The time is not needed as it's added by the script. My Netflix csv also has no time infos.
Try setting the Datestring with . instead of -. For example ""%Y.%m.%d or similar. Internally it's converted to - signs, but maybe it's expecting a . as Input. I can look in the code later.
So I finally got a change to implement the "." change you suggested and it worked!
Thank you so much :)
This is exactly what I'm looking for, Much appreciated!
So I gave it a try and I seem to have gotten it to work partially. I updated the config.py with all the necessary information, brought in the NetflixViewingHistory.csv to the same folder then ran "netflix2trakt.py" via python.
The command window ran and listed all the found and unfound movies. I checked trakt and the found movies unfortunately didn't update. I did get the following errors at the end of the script:
File "C:\Program Files\Netflix-to-Trakt-Import\netflix2trakt.py", line 140, in
res = tmdbMovie.search(movie.name)
File "C:\Users\CaptainWiggles\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\tmdbv3api\objs\movie.py", line 222, in search
self._call(
File "C:\Users\CaptainWiggles\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\tmdbv3api\tmdb.py", line 177, in _call
raise TMDbException(json["errors"])
tmdbv3api.exceptions.TMDbException: ['query must be provided']
The Netflix2TraktImportLog.log is actually populated correctly. I've changed the config file as per the Canada comment with it being Y-M-D. Sample below:
INFO:root:Added show Chef's Table season 3 episode Ivan Orkin INFO:root:Added show School of Chocolate season 1 episode The Best in Class Is... INFO:root:No Tmdb ID found for Street Food: Asia : Season 1: Bangkok, Thailand INFO:root:Searching Headspace Guide to Meditation INFO:root:Found Tmdb ID for Headspace Guide to Meditation : Season 1: How to Get Started (TMDB ID 2551407)
No errors other than the Traceback comments I listed in the previous comment.
Next I wanted to list the not found items. I am on windows and I 'grep' is not a recognized command. would there be a work around for this?