From 26b108a823bce7203e6b86f538b31119e0df3cab Mon Sep 17 00:00:00 2001 From: reconman Date: Thu, 15 Jul 2021 09:29:00 +0200 Subject: [PATCH] Add Hama support Fixes #59 --- lib/trakt/main.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/trakt/main.go b/lib/trakt/main.go index bdf4725..bf0685b 100644 --- a/lib/trakt/main.go +++ b/lib/trakt/main.go @@ -89,14 +89,14 @@ func findEpisode(pr plexhooks.PlexResponse) Episode { re := regexp.MustCompile("tvdb://(\\d*)/(\\d*)/(\\d*)") showID = re.FindStringSubmatch(pr.Metadata.Guid) - // If Plaxt can't find with TVDB, retry with TheMovieDB + // Retry with TheMovieDB if showID == nil { re := regexp.MustCompile("themoviedb://(\\d*)/(\\d*)/(\\d*)") showID = re.FindStringSubmatch(pr.Metadata.Guid) traktService = "tmdb" } - // If Plaxt can't find with TheMovieDB either, retry with the new Plex TV agent + // Retry with the new Plex TV agent if showID == nil { var episodeID string @@ -119,6 +119,13 @@ func findEpisode(pr plexhooks.PlexResponse) Episode { return showInfo[0].Episode } + + // Retry with Hama in TVDB mode + if showID == nil { + re := regexp.MustCompile("com.plexapp.agents.hama://tvdb-(\\d*)/(\\d*)/(\\d*)") + showID = re.FindStringSubmatch(pr.Metadata.Guid) + traktService = "tvdb" + } url := fmt.Sprintf("https://api.trakt.tv/search/%s/%s?type=show", traktService, showID[1])