Send rating to trakt
from os import PathLike
from plextraktsync.console import print
+from plextraktsync.factory import factory
def read_csv(file: PathLike):
@@ -43,5 +44,10 @@ def from_csv(row):
def imdb_import(input: PathLike):
+ trakt = factory.trakt_api()
+
for r in read_csv(input):
- print(f"Importing [blue]{r.type} {r.imdb}[/]: {r.title} ({r.year}), rated {r.rating} at {r.rate_date}")
+ print(f"Importing [blue]{r.type} {r.imdb}[/]: {r.title} ({r.year}), rated at {r.rate_date}")
+ m = trakt.search_by_id(r.imdb, "imdb", r.type)
+ print(f"Rating {m} with {r.rating}")
+ trakt.rate(m, r.rating)
