Skip to content
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Tautulli > Settings > Notification Agents > New Script > Script Arguments:

Select:
Playback Start
Arguments: ---action startScrobble --userId {user_id} --progress {progress_percent} <movie>--tmdbId {themoviedb_id}</movie> <episode>--tvdbId {thetvdb_id} --season {season_num} --episode {episode_num}</episode>
Arguments: --action startScrobble --userId {user_id} --progress {progress_percent} <movie>--tmdbId {themoviedb_id}</movie> <episode>--tvdbId {thetvdb_id} --season {season_num} --episode {episode_num}</episode>

Playback Stop
Arguments: --action pauseScrobble --userId {user_id} --progress {progress_percent} <movie>--tmdbId {themoviedb_id}</movie> <episode>--tvdbId {thetvdb_id} --season {season_num} --episode {episode_num}</episode>
Expand Down
9 changes: 6 additions & 3 deletions trakt_syncer.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def __init__(self, user_id, action, tvdb_id=None, season=None, episode=None, pro
self.action = action
self.traktClient = TraktClient(config)

if season is not None and episode is not None and progress is not None:
if tvdb_id is not None and season is not None and episode is not None and progress is not None:
self.show = TraktShow(tvdb_id)
self.episode = TraktEpisode(season, episode, progress, self.show)
elif tmdbId is not None and progress is not None:
Expand Down Expand Up @@ -226,13 +226,16 @@ def on_token_refreshed(self, authorization):
help='Progress inside the episode.')

parser.add_argument('--tmdbId', type=str,
help='TMDB ID for a movie or a show (for shows only, needs to be combined with season and episode parameters).')
help='TMDB ID for a movie')

parser.add_argument('--tvdbId', type=str,
help='TVDB ID for a show, needs to be combined with season and episode parameters.')

opts = parser.parse_args()

app = Application(opts.userId,
opts.action,
opts.tmdbId if hasattr(opts, 'tmdbId') and hasattr(opts, "episode") else None,
opts.tvdbId if hasattr(opts, 'tvdbId') else None,
opts.season if hasattr(opts, 'season') else None,
opts.episode if hasattr(opts, 'episode') else None,
opts.progress if hasattr(opts, 'progress') else None,
Expand Down
6 changes: 3 additions & 3 deletions utils/trakt_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def authenticate(self):
def startScrobble(self, episode: TraktEpisode = None, show: TraktShow = None, movie: TraktMovie = None):
if show is not None:
if episode is not None:
print("Send Start Scrobble %s - S%sE%s to Trakt.tv" % (show.tmdb_id, episode.season_num, episode.episode_num))
print("Send Start Scrobble %s - S%sE%s to Trakt.tv" % (show.tvdb_id, episode.season_num, episode.episode_num))
status_code, data = self.traktApiClient.post(
TRAKT_API_URL + "scrobble/start",
{
Expand Down Expand Up @@ -110,7 +110,7 @@ def startScrobble(self, episode: TraktEpisode = None, show: TraktShow = None, mo
def pauseScrobble(self, episode: TraktEpisode = None, show: TraktShow = None, movie: TraktMovie = None):
if show is not None:
if episode is not None:
print("Send Pause Scrobble %s - S%sE%s to Trakt.tv" % (show.tmdb_id, episode.season_num, episode.episode_num))
print("Send Pause Scrobble %s - S%sE%s to Trakt.tv" % (show.tvdb_id, episode.season_num, episode.episode_num))
#TODO: call the trakt api with the access token
# Trakt['scrobble'].pause(
# show=show.generateTraktDict(),
Expand Down Expand Up @@ -164,7 +164,7 @@ def pauseScrobble(self, episode: TraktEpisode = None, show: TraktShow = None, mo
def stopScrobble(self, episode: TraktEpisode = None, show: TraktShow = None, movie: TraktMovie = None):
if show is not None:
if episode is not None:
print("Send Stop Scrobble %s - S%sE%s to Trakt.tv" % (show.tmdb_id, episode.season_num, episode.episode_num))
print("Send Stop Scrobble %s - S%sE%s to Trakt.tv" % (show.tvdb_id, episode.season_num, episode.episode_num))
#TODO: call the trakt api with the access token
# Trakt['scrobble'].stop(
# show=show.generateTraktDict(),
Expand Down
2 changes: 1 addition & 1 deletion utils/trakt_episode.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ def generateEpisodeTraktDict(self) -> dict:
def generateShowTraktDict(self) -> dict:
return {
'ids': {
'tmdb': self.show.tmdb_id,
'tvdb': self.show.tvdb_id,
}
}
4 changes: 2 additions & 2 deletions utils/trakt_show.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

class TraktShow(TraktItem):
def __init__(self, m: int):
self.tmdb_id = m
self.tvdb_id = m

def generateEpisodeTraktDict(self) -> dict:
return {
'ids': {
'tvdb': self.tmdb_id,
'tvdb': self.tvdb_id,
}
}