xbgmsharp / trakt

Import CSV to Trakt.tv list and Export Trakt.tv list into CSV
GNU General Public License v3.0
285 stars 47 forks source link

Can't export episode history #46

Closed binarytalents closed 2 years ago

binarytalents commented 2 years ago

I can't seem to download the episodes history.

I always end up with this output.

Found 39629 Item-Count CSV output file: export_eps_01.csv Traceback (most recent call last): File "./export_trakt.py", line 591, in main() File "./export_trakt.py", line 512, in main write_csv(options, export_csv) File "./export_trakt.py", line 159, in write_csv mycsv = csv.DictWriter(fp, fieldnames=list(results[0].keys()), quoting=csv.QUOTE_ALL) IndexError: list index out of range

jacroe commented 2 years ago

I deleted my previous comment since it was 1) premature because I 2) was way off.

The real reason this error occurs is because if you try to export it by only running ./export_trakt.py -t episodes, it defaults the format to be IMDB. That combination of export type being episodes and format type being imdb doesn't exist in the decision tree of the export columns builder. And I'm not sure what strategy @xbgmsharp will want to use to account for that.

if you run ./export_trakt.py --verbose -t episodes -f tmdb, it actually exports fine and with the appropriate season and episode number columns.

xbgmsharp commented 2 years ago

I confirm the issue. However the imdb entry exist in the episodes api query but not always present. Anyhow the decision tree only export episode data by format tmdb or tvdb. The bug is because there is no data to write in the CVS. Updated the code to force tmdb by default for episodes query.