Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Add Hama support #60

Merged
merged 1 commit into from
Sep 8, 2021
Merged
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
11 changes: 9 additions & 2 deletions lib/trakt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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])

Expand Down