Skip to content

Added support for csv file dir path & added watch time to logging #71

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions TimeToTrakt.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,18 @@ def get_configuration() -> Config:

config = get_configuration()

# Check if the user has provided the folder path or file paths
if config.movie_path == config.show_path and os.path.isdir(config.movie_path):
config.movie_path = os.path.join(config.movie_path, "tracking-prod-records.csv")
config.show_path = os.path.join(config.show_path, "tracking-prod-records-v2.csv")

for path in (config.movie_path, config.show_path):
if not os.path.isfile(path):
logging.error(
"Oops! The files provided do not exist on the local system. Please ensure the paths provided are to the specific files and not the folder they are in, and try again."
)
break

WATCHED_SHOWS_PATH = config.show_path
WATCHED_MOVIES_PATH = config.movie_path

Expand Down
4 changes: 2 additions & 2 deletions processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def _process(self, tv_time_show: TVTimeTVShow, trakt_show: TraktItem, progress:
syncedEpisodesTable.insert({"episodeId": tv_time_show.episode_id})
logging.info(
f"'{tv_time_show.name} Season {tv_time_show.season_number},"
f" Episode {tv_time_show.episode_number}' marked as seen"
f" Episode {tv_time_show.episode_number}' marked as seen at {tv_time_show.date_watched.strftime('%Y-%m-%d %H:%M:%S')}"
)

def _handle_index_error(self, tv_time_show: TVTimeTVShow, trakt_show: TraktTVShow, progress: str) -> None:
Expand Down Expand Up @@ -214,7 +214,7 @@ def _process(self, tv_time_movie: TVTimeMovie, trakt_movie: TraktMovie, progress
syncedMoviesTable.insert(
{"movie_name": tv_time_movie.name, "type": "watched"}
)
logging.info(f"'{tv_time_movie.name}' marked as seen")
logging.info(f"'{tv_time_movie.name}' marked as seen at {tv_time_movie.date_watched.strftime('%Y-%m-%d %H:%M:%S')}")
elif len(movies_in_watchlist) == 0:
trakt_movie.add_to_watchlist()
# Add the episode to the local database as imported, so it can be skipped,
Expand Down