Coder Social home page Coder Social logo

tvtimetotrakt's Introduction

TV Time to Trakt - Import Script

A Python script to import TV Time tracked episode and movie data into Trakt.TV - using data export provided by TV Time through a GDPR request.

This script was made possible by the following contributors.

Notes

  1. The script is using limited data provided from a GDPR request - so the accuracy isn't 100%. But you will be prompted to manually pick the Trakt show/movie, when it can't be determined automatically.
  2. A delay of 1 second is added between each episode/movie to ensure fair use of Trakt's API server. You can adjust this for your own import, but make sure it's at least 0.75 second to remain within the rate limit: https://trakt.docs.apiary.io/#introduction/rate-limiting
  3. Episodes which have been processed will be saved to a TinyDB file localStorage.json - when you restart the script, the program will skip those episodes which have been marked 'imported'. Processed movies are also stored in the same file.

Setup

Get your Data

TV Time's API is not open. In order to get access to your personal data, you will have to request it from TV Time's support via a GDPR request - or maybe just ask for it, whatever works, it's your data.

  1. Copy the template provided by www.datarequests.org into an email
  2. Send it to [email protected]
  3. Wait a few working days for their team to process your request
  4. Extract the data somewhere safe on your local system

Register API Access at Trakt

  1. Go to "Settings" under your profile
  2. Select "Your API Applications"
  3. Select "New Application"
  4. Provide a name into "Name" e.g. John Smith Import from TV Time
  5. Paste "urn:ietf:wg:oauth:2.0:oob" into "Redirect uri:"
  6. Click "Save App"
  7. Make note of your details to be used later.

Setup Script

Install Required Libraries

Install the following frameworks via Pip:

python -m pip install -r requirements.txt

Setup Configuration

Create a new file named config.json in the same directory of TimeToTrakt.py, using the below JSON contents (replace the values with your own).

Use forward slash or double backslash for GDPR_WORKSPACE_PATH if you encounter json.decoder.JSONDecodeError: Invalid \escape: line 4 column 31 (char 206), as seen here and here.

The movie and show data is usually in "tracking-prod-records.csv" and "tracking-prod-records-v2.csv" respectively, however please check this is where your data is actually stored.

Date format can be left as the default value unless you receive an error. If you receive an error about the time data not matching format, update this value using the docs.

{
    "CLIENT_ID": "YOUR_CLIENT_ID",
    "CLIENT_SECRET": "YOUR_CLIENT_SECRET",
    "MOVIE_DATA_PATH": "DIRECTORY_OF_YOUR_GDPR_REQUEST_MOVIE_DATA",
    "SHOW_DATA_PATH": "DIRECTORY_OF_YOUR_GDPR_REQUEST_SHOW_DATA",
    "TRAKT_USERNAME": "YOUR_TRAKT_USERNAME",
    "DATE_FORMAT": "%Y-%m-%d %H:%M:%S"
}

Once the config is in place, execute the program using python TimeToTrakt.py. The process isn't 100% automated - you will need to pop back, especially with large imports, to check if the script requires a manual user input.

tvtimetotrakt's People

Contributors

adclarky avatar baprx avatar koccs avatar l11k avatar lukearran avatar marnym avatar sintan1729 avatar tibimac avatar weirdalex03 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

tvtimetotrakt's Issues

Problem when I try to import my movies

I'm having the following error after executing the script, but just for the movies import:

2023-04-18 23:56:44 [   INFO] :: Processing movies.
Traceback (most recent call last):
  File "C:\Lhi\TvTimeToTrakt-main\TimeToTrakt.py", line 164, in <module>
    start()
  File "C:\Lhi\TvTimeToTrakt-main\TimeToTrakt.py", line 154, in start
    process_watched_movies()
  File "C:\Lhi\TvTimeToTrakt-main\TimeToTrakt.py", line 100, in process_watched_movies
    watched_list = [row["movie_name"] for row in reader if row["type"] == "watch"]
  File "C:\Lhi\TvTimeToTrakt-main\TimeToTrakt.py", line 100, in <listcomp>
    watched_list = [row["movie_name"] for row in reader if row["type"] == "watch"]
  File "C:\Users\billy\AppData\Local\Programs\Python\Python310\lib\csv.py", line 111, in __next__
    row = next(self.reader)
  File "C:\Users\billy\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 7616: character maps to <undefined>

Does someone know a workaround? Thank you!

Error when using the script

2023-07-07 16:41:04 [ INFO] :: Processing both watched shows and movies.
Traceback (most recent call last):
File "C:\TvTimeToTrakt-main\TimeToTrakt.py", line 164, in
start()
File "C:\TvTimeToTrakt-main\TimeToTrakt.py", line 157, in start
process_watched_shows()
File "C:\TvTimeToTrakt-main\TimeToTrakt.py", line 87, in process_watched_shows
total_rows = len(list(reader))
^^^^^^^^^^^^
File "C:\Users\prophamoon\AppData\Local\Programs\Python\Python311\Lib\csv.py", line 111, in next
row = next(self.reader)
^^^^^^^^^^^^^^^^^
File "C:\Users\prophamoon\AppData\Local\Programs\Python\Python311\Lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 2817: character maps to

A video guide/better instructionfor how to run the script?

Sorry for the request, but I never used python or runned a python script.
Can you please add some detail about what to exactly? Like I installed python 3.12 from the ms store, but then how can I install the script?
A video would be perfect, but even a more detailed instruction would be perfect.

Error during script execution

I have the following error when I execute TimeToTrakt.py :

2024-03-09 23:13:11 [ INFO] :: Processing both watched shows and movies.
Traceback (most recent call last):
File "/Users/weezy/Desktop/TvTimeToTrakt-main/TimeToTrakt.py", line 164, in
start()
File "/Users/weezy/Desktop/TvTimeToTrakt-main/TimeToTrakt.py", line 157, in start
process_watched_shows()
File "/Users/weezy/Desktop/TvTimeToTrakt-main/TimeToTrakt.py", line 85, in process_watched_shows
with open(WATCHED_SHOWS_PATH, newline="") as csvfile:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/weezy/Desktop/tv-time-personal-data/seen_episode.csv'

SCR-20240309-ugyl

ValueError: time data '50663409-12-05 02:20:00' does not match format '%Y-%m-%d %H:%M:%S'

2024-06-09 00:58:21 [INFO] :: 'The Wire Season 3, Episode 10' marked as seen
Traceback (most recent call last):
  File "C:\TvTimeToTrakt-main\TimeToTrakt.py", line 170, in <module>
    start()
  File "C:\TvTimeToTrakt-main\TimeToTrakt.py", line 155, in start
    process_watched_shows(WATCHED_SHOWS_PATH)
  File "C:\TvTimeToTrakt-main\TimeToTrakt.py", line 98, in process_watched_shows
    tv_time_show = TVTimeTVShow(row)
                   ^^^^^^^^^^^^^^^^^
  File "C:\TvTimeToTrakt-main\searcher.py", line 108, in __init__
    super().__init__(row["series_name"], row["created_at"])
  File "C:\TvTimeToTrakt-main\searcher.py", line 101, in __init__
    self.date_watched = datetime.strptime(
                        ^^^^^^^^^^^^^^^^^^
  File "C:\Users\1\AppData\Local\Programs\Python\Python312\Lib\_strptime.py", line 554, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\1\AppData\Local\Programs\Python\Python312\Lib\_strptime.py", line 333, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '50663409-12-05 02:20:00' does not match format '%Y-%m-%d %H:%M:%S'

This is on the latest commit you just made. Script was working fine for the most part.

Invalid \escape: line 4 column 31 (char 206)

Hello,

I am getting the following error message:

C:\Users\USERNAME\Downloads\TvTimeToTrakt-main>python TimeToTrakt.py
Traceback (most recent call last):
File "C:\Users\USERNAME\Downloads\TvTimeToTrakt-main\TimeToTrakt.py", line 65, in
config = get_configuration()
^^^^^^^^^^^^^^^^^^^
File "C:\Users\USERNAME\Downloads\TvTimeToTrakt-main\TimeToTrakt.py", line 47, in get_configuration
data = json.load(f)
^^^^^^^^^^^^
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python312\Lib\json_init_.py", line 293, in load
return loads(fp.read(),
^^^^^^^^^^^^^^^^
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python312\Lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\USERNAME\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Invalid \escape: line 4 column 31 (char 206)

ValueError: year 0 is out of range when importing Movies

Traceback (most recent call last):
  File "/mnt/c/users/sanjeev/desktop/trakt/TvTimeToTrakt/TimeToTrakt.py", line 166, in <module>
    start()
  File "/mnt/c/users/sanjeev/desktop/trakt/TvTimeToTrakt/TimeToTrakt.py", line 156, in start
    process_watched_movies()
  File "/mnt/c/users/sanjeev/desktop/trakt/TvTimeToTrakt/TimeToTrakt.py", line 110, in process_watched_movies
    movie = TVTimeMovie(row)
  File "/mnt/c/users/sanjeev/desktop/trakt/TvTimeToTrakt/searcher.py", line 147, in __init__
    release_date = datetime.strptime(
  File "/usr/lib/python3.10/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/lib/python3.10/_strptime.py", line 534, in _strptime
    julian = datetime_date(year, month, day).toordinal() - \
ValueError: year 0 is out of range

record that's triggering the exception

,08c1f0a2-581f-476c-bbd8-643a7426635f,follow,follow-08c1f0a2-581f-476c-bbd8-643a7426635f-0,3.695118e+07,,2020-01-18 01:16:12,2020-01-18 01:16:12,,,movie,,Avengers: Endgame,,0000-12-31 20:06:12,,,0,,,,,,,,,,,,

There're multiple entries like this, it would be great if you can replace the 0 with current date time or something

Error while running the file

C:\Users\Administrator\Desktop\TvTimeToTrakt-main>python TimeToTrakt.py
Traceback (most recent call last):
  File "C:\Users\Administrator\Desktop\TvTimeToTrakt-main\TimeToTrakt.py", line 65, in <module>
    config = getConfiguration()
  File "C:\Users\Administrator\Desktop\TvTimeToTrakt-main\TimeToTrakt.py", line 53, in getConfiguration
    data = json.load(f)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 353, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Invalid \escape: line 4 column 31 (char 206)

C:\Users\Administrator\Desktop\TvTimeToTrakt-main>

Adding wrong show despite choosing the correct one

This happens on Peacemaker and Hawkeye (afaik). Here's the terminal output.

>> What do you want to do?
    1) Import Watch History from TV Time
Enter your menu selection: 1
INFO - MANUAL INPUT REQUIRED: The TV Time data for Show 'Peacemaker' (Season 1, Episode 1) has 4 matching Trakt shows with the same name.
    (1) Peacemaker - 2022 - 1 Season(s) - More Info: https://trakt.tv/shows/peacemaker-2022
    (2) Peacemaker - 2020 - 1 Season(s) - More Info: https://trakt.tv/shows/peacemaker-2020
    (3) Peacemakers - 2003 - 1 Season(s) - More Info: https://trakt.tv/shows/peacemakers
    (4) Peacemakers - 2017 - 1 Season(s) - More Info: https://trakt.tv/shows/peacemakers-2017
Please make a selection from above (or enter SKIP):1
2022-09-16 15:08:18 [   INFO] :: (1/8) - Processing 'Peacemaker' Season 1 / Episode 1
2022-09-16 15:08:21 [   INFO] :: (2/8) - Processing 'Peacemaker' Season 1 / Episode 2
2022-09-16 15:08:23 [   INFO] :: (3/8) - Processing 'Peacemaker' Season 1 / Episode 3
2022-09-16 15:08:25 [   INFO] :: (4/8) - Processing 'Peacemaker' Season 1 / Episode 4
2022-09-16 15:08:27 [   INFO] :: (5/8) - Processing 'Peacemaker' Season 1 / Episode 5
2022-09-16 15:08:30 [   INFO] :: (6/8) - Processing 'Peacemaker' Season 1 / Episode 6
2022-09-16 15:08:32 [   INFO] :: (7/8) - Processing 'Peacemaker' Season 1 / Episode 7
2022-09-16 15:08:34 [   INFO] :: (8/8) - Processing 'Peacemaker' Season 1 / Episode 8

The result is

image

And for Hawkeye, it says processing 2021 but...

>> What do you want to do?
    1) Import Watch History from TV Time
Enter your menu selection: 1
2022-09-16 15:19:31 [   INFO] :: (1/6) - Processing 'Hawkeye (2021)' Season 1 / Episode 1
2022-09-16 15:19:38 [   INFO] :: (2/6) - Processing 'Hawkeye (2021)' Season 1 / Episode 2
2022-09-16 15:19:41 [   INFO] :: (3/6) - Processing 'Hawkeye (2021)' Season 1 / Episode 3
2022-09-16 15:19:45 [   INFO] :: (4/6) - Processing 'Hawkeye (2021)' Season 1 / Episode 4
2022-09-16 15:19:48 [   INFO] :: (5/6) - Processing 'Hawkeye (2021)' Season 1 / Episode 5
2022-09-16 15:19:51 [   INFO] :: (6/6) - Processing 'Hawkeye (2021)' Season 1 / Episode 6

image

Error using the script on GDPR data received on 20 June 2024

Getting an error while using 'Import Watch History for TV Shows from TV Time'.

└─$ python TimeToTrakt.py
>> What do you want to do?
    1) Import Watch History for TV Shows from TV Time
    2) Import Watched Movies from TV Time
    3) Do both 1 and 2 (default)
    4) Exit
Enter your menu selection: 1
Please go here and authorize, [removed]
Paste the Code returned here: [removed]
2024-06-22 07:49:07 [INFO] :: Processing watched shows.
Traceback (most recent call last):
  File "/home/kali/Documents/TVTime/TvTimeToTrakt/TimeToTrakt.py", line 170, in <module>
    start()
  File "/home/kali/Documents/TVTime/TvTimeToTrakt/TimeToTrakt.py", line 154, in start
    process_watched_shows(SHOWS_AND_MOVIES_PATH)
  File "/home/kali/Documents/TVTime/TvTimeToTrakt/TimeToTrakt.py", line 94, in process_watched_shows
    if row["episode_number"] == "":  # if not an episode entry
KeyError: 'episode_number'

image

Also getting an error while using the 'Import Watched Movies from TV Time' option.


2024-06-22 07:52:07 [INFO] :: (17.91%) - Processing 'Bullet Train'
2024-06-22 07:52:07 [WARNING] :: Bullet Train already in watchlist
Traceback (most recent call last):
  File "/home/kali/Documents/TVTime/TvTimeToTrakt/TimeToTrakt.py", line 170, in <module>
    start()
  File "/home/kali/Documents/TVTime/TvTimeToTrakt/TimeToTrakt.py", line 159, in start
    process_watched_movies()
  File "/home/kali/Documents/TVTime/TvTimeToTrakt/TimeToTrakt.py", line 112, in process_watched_movies
    movie = TVTimeMovie(row)
  File "/home/kali/Documents/TVTime/TvTimeToTrakt/searcher.py", line 149, in __init__
    release_date = datetime.strptime(
  File "/usr/lib/python3.10/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/usr/lib/python3.10/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '' does not match format '%Y-%m-%d %H:%M:%S'

image

FileNotFoundError: No such file or directory: 'tv-time-personal-data/seen_episode.csv

2024-04-16 09:00:17 [INFO] :: Processing both watched shows and movies.
Traceback (most recent call last):
  File "/mnt/c/users/sanjeev/desktop/trakt/TvTimeToTrakt/TimeToTrakt.py", line 166, in <module>
    start()
  File "/mnt/c/users/sanjeev/desktop/trakt/TvTimeToTrakt/TimeToTrakt.py", line 159, in start
    process_watched_shows()
  File "/mnt/c/users/sanjeev/desktop/trakt/TvTimeToTrakt/TimeToTrakt.py", line 87, in process_watched_shows
    with open(WATCHED_SHOWS_PATH, newline="", encoding="UTF-8") as csvfile:
FileNotFoundError: [Errno 2] No such file or directory: '../tv-time-personal-data/seen_episode.csv'

I dont have that file, but user_tv_show_data is there, which contains similar data. Is there any chance they changed the file name?

I thought so, and replaced the file name. then this happened

2024-04-16 09:02:28 [INFO] :: Processing watched shows.
Traceback (most recent call last):
  File "/mnt/c/users/sanjeev/desktop/trakt/TvTimeToTrakt/TimeToTrakt.py", line 166, in <module>
    start()
  File "/mnt/c/users/sanjeev/desktop/trakt/TvTimeToTrakt/TimeToTrakt.py", line 152, in start
    process_watched_shows()
  File "/mnt/c/users/sanjeev/desktop/trakt/TvTimeToTrakt/TimeToTrakt.py", line 95, in process_watched_shows
    tv_time_show = TVTimeTVShow(row)
  File "/mnt/c/users/sanjeev/desktop/trakt/TvTimeToTrakt/searcher.py", line 108, in __init__
    super().__init__(row["tv_show_name"], row["updated_at"])
KeyError: 'updated_at'

which is already an open issue #48

"Episode does not exist in Trakt!", but it does

Script worked great for most of my episodes and I'd like to thank all the contributors very much.
But for the other I've run into a weird problem where the script tells me an episode does not exist in Trakt.tv and provides a valid link for that episode.
I've modified a logging setup to log all those warnings into a file and this is what I got, maybe you'll manage to find a connection, if there is one.
trakt.log

Error while running the script

Thank you for creating this useful tool. I tried using it and got this error:

What do you want to do?
1) Import Watch History from TV Time
Enter your menu selection: 1
Traceback (most recent call last):
File "/home/mr_4braham/transfer/TimeToTrakt.py", line 452, in
start()
File "/home/mr_4braham/transfer/TimeToTrakt.py", line 440, in start
processWatchedShows()
File "/home/mr_4braham/transfer/TimeToTrakt.py", line 330, in processWatchedShows
tvShowDateWatchedConverted = datetime.strptime(
File "/usr/lib/python3.9/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "/usr/lib/python3.9/_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data 'episode_season_number' does not match format '%Y-%m-%d %H:%M:%S'

ImportError: cannot import name 'init' from 'trakt'

I'm getting the following error when I run TimeToTrackt.py

Traceback (most recent call last):
  File "C:\Users\....\TvTimeToTrakt-main\TimeToTrakt.py", line 10, in <module>
    from trakt import init
ImportError: cannot import name 'init' from 'trakt' (C:\Users\....\Python\Python310\lib\site-packages\trakt\__init__.py)

Error when importing is done "UnicodeDecodeError: 'charmap' codec can't decode byte 0x81"

None of the shows I had to choose the correct version was marked. Was that supposed to happen after it finished with everything? Is this error why that never happened?

...
2023-11-30 06:49:55 [   INFO] :: (99.92%) - Processing 'Twisted Metal' Season 1 / Episode 8
2023-11-30 06:49:55 [   INFO] :: 'Twisted Metal Season 1, Episode 8' marked as seen
2023-11-30 06:49:56 [   INFO] :: (99.95%) - Processing 'Twisted Metal' Season 1 / Episode 9
2023-11-30 06:49:57 [   INFO] :: 'Twisted Metal Season 1, Episode 9' marked as seen
2023-11-30 06:49:58 [   INFO] :: (99.97%) - Processing 'Twisted Metal' Season 1 / Episode 10
2023-11-30 06:49:59 [   INFO] :: 'Twisted Metal Season 1, Episode 10' marked as seen
Traceback (most recent call last):
  File "C:\Users\u\Downloads\tvtime import\TvTimeToTrakt-main\TvTimeToTrakt-main\TimeToTrakt.py", line 164, in <module>
    start()
  File "C:\Users\u\Downloads\tvtime import\TvTimeToTrakt-main\TvTimeToTrakt-main\TimeToTrakt.py", line 158, in start
    process_watched_movies()
  File "C:\Users\u\Downloads\tvtime import\TvTimeToTrakt-main\TvTimeToTrakt-main\TimeToTrakt.py", line 100, in process_watched_movies
    watched_list = [row["movie_name"] for row in reader if row["type"] == "watch"]
  File "C:\Users\u\Downloads\tvtime import\TvTimeToTrakt-main\TvTimeToTrakt-main\TimeToTrakt.py", line 100, in <listcomp>
    watched_list = [row["movie_name"] for row in reader if row["type"] == "watch"]
  File "C:\Users\u\AppData\Local\Programs\Python\Python310\lib\csv.py", line 111, in __next__
    row = next(self.reader)
  File "C:\Users\u\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 5008: character maps to <undefined>

Manual input shows when multiple available not added at all

I noticed this issue where the script seems to be lagging since it's not outputting anything. After a while it started to log again but it jumped quite in the percentage so I assumed something went wrong. Checked my TV Time csv and looked on the rows where it "lagged" and it turns out it was always on the shows I had to manually input which one to import.

I dug a bit in the code and it seems there is an error in searcher.py line 204. It checks if skip_show is None instead of False. I'm not sure if this is because of my python version (I'm using 3.9.5) and if in newer version False is considered None (I know C++ does this, but don't recall python having it like this). skip_show is False for those shows so I'm presumming this is a coding error. I changed it on my side and now all my show synced with no problem.

Thanks for making this script you've saved me!

JSON decode error

Hello,

I am getting the following error:

2024-02-02 12:28:29 [ INFO] :: Processing both watched shows and movies.
2024-02-02 12:28:31 [WARNING] :: (0.00%) - A JSON decode error occurred whilst processing TVSHOWNAMEISHERE This might occur when the server is down and has produced a HTML document instead of JSON. The script will wait 60 seconds before trying again.

Please advise?

Error line 4

Hello,

After running the script command, I got that:

line 4, in
from trakt import *
ModuleNotFoundError: No module named 'trakt'

Script Update?

Hello,

I found your script a couple weeks ago. Just got my data from TV Time today. Fired up this script and am getting errors like it’s too outdated for my Python install (3.8.6 on macOS). Could you possibly assist with this? Thank you!
Screenshot 2024-01-11 at 20 40 46

Wrong order in CSV file

Hi, Thanks for this amazing script! Just to let you know that TV Time probably changed the order of the columns in which the watched episodes are saved. I noticed when I got a date parsing error for the Tweet ID column.

Now the correct row number should be as following in line 317:
`

        tvShowName = row[6]
        
        # Ignore the header row
        if tvShowName != "tv_show_name":
            # Get the TV Time Episode Id
            tvShowEpisodeId = row[1]
            # Get the TV Time Season Number
            tvShowSeasonNo = row[7]
            # Get the TV Time Episode Number
            tvShowEpisodeNo = row[8]
            # Get the date which the show was marked 'watched' in TV Time
            tvShowDateWatched = row[4]
            # Parse the watched date value into a Python type
            tvShowDateWatchedConverted = datetime.strptime(
                tvShowDateWatched, '%Y-%m-%d %H:%M:%S')`

pytrakt.json not found

Hi mate,

First, thanks for the work, definitely useful.

I have an issue with pytrakt.json :
FileNotFoundError: [Errno 2] No such file or directory: 'pytrakt.json'

I look at the py code, and indeed, line 39 you're calling it : with open(f"{Path.home()}/.pytrakt.json") as f:

I tried to create it manually, but I don't know what to put in.
I also put my config.json inside pytrakt.json, but nothing better.

Any ideas please ?

Error executing the script

Hi,

I'm having the following error after executing the script:

Traceback (most recent call last):
  File "/home/filipe/TvTimeToTrakt-main/TimeToTrakt.py", line 65, in <module>
    config = getConfiguration()
  File "/home/filipe/TvTimeToTrakt-main/TimeToTrakt.py", line 53, in getConfiguration
    data = json.load(f)
  File "/usr/lib/python3.9/json/__init__.py", line 293, in load
    return loads(fp.read(),
  File "/usr/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 5 column 23 (char 264)

Thank you

error popped up while running the script

the following error happened:

File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data '' does not match format '%Y-%m-%d %H:%M:%S'

I suggest editing the TimeToTrakt.py as follows:

            # Get the TV Time Episode Id
            tvShowEpisodeId = row[2]
            # Get the TV Time Season Number
            tvShowSeasonNo = row[4]
            # Get the TV Time Episode Number
            tvShowEpisodeNo = row[5]
            # Get the date which the show was marked 'watched' in TV Time
            tvShowDateWatched = row[6]
            # Parse the watched date value into a Python type
            tvShowDateWatchedConverted = datetime.strptime(
                tvShowDateWatched, '%Y-%m-%d %H:%M:%S')

Feature: Delay choosing between shows until the end

I am importing around 10,000 episodes, and have to frequently check back to see the status of the import, and it's literally taken me 48 hours and I'm at 5000 because I can't always be checking the terminal. Is it possible to make it so that the decisions for which show corresponds with the one in TV Time are delayed until the end. Any show that requires manual input to solve, skip, and once everything else is done, do the last 200 or whatever that require manual complex sorting.

I'm not sure if this repo is even active, but if this feature isn't taken up by a developer, I'll probably submit a pr myself for this.

Error when importing movies without release date

First off, thanks so much for this project! It was a lifesaver!

When importing movies from Tv Time, such as John Wick Chapter 5, which have no release date as of yet or Extraction (which was curiously left blank even though it came out almost 3 years ago), the data in tracking-prod-records.csv column release_date is left blank which results in the following error

Traceback (most recent call last):
  File "C:\Users\noahv\Documents\TvTimeToTrakt\TimeToTrakt.py", line 164, in <module> 
    start()
  File "C:\Users\noahv\Documents\TvTimeToTrakt\TimeToTrakt.py", line 154, in start    
    process_watched_movies()
  File "C:\Users\noahv\Documents\TvTimeToTrakt\TimeToTrakt.py", line 108, in process_watched_movies
  File "C:\Users\noahv\Documents\TvTimeToTrakt\searcher.py", line 147, in __init__
    release_date = datetime.strptime(
                   ^^^^^^^^^^^^^^^^^^
  File "C:\Users\noahv\AppData\Local\Programs\Python\Python311\Lib\_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\noahv\AppData\Local\Programs\Python\Python311\Lib\_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data '' does not match format '%Y-%m-%d %H:%M:%S'

Adding a release date to that column resolves the issue, as well as removing the entry all together and adding it manually into Trakt

Unable to find trakt.core

Hi, I get the error on run for line nine:

import trakt.core

Traceback (most recent call last):
  File "c:\tvtimetotrakt\timetotrakt.py", line 9, in <module>
    import trakt.core
ModuleNotFoundError: No module named 'trakt'

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.