Browse Source

Implement trakt episode links using the implementation from Series.cs

The code is the same as `MediaBrowser.Controller/Entities/TV/Series.cs`, using the imdbID to generate Trakt links.
The trakt url for episodes is `https://trakt.tv/episodes/{0}`.
adavier 3 years ago
parent
commit
9574d13059
1 changed files with 18 additions and 0 deletions
  1. 18 0
      MediaBrowser.Controller/Entities/TV/Episode.cs

+ 18 - 0
MediaBrowser.Controller/Entities/TV/Episode.cs

@@ -11,6 +11,7 @@ using Jellyfin.Data.Enums;
 using MediaBrowser.Controller.Providers;
 using MediaBrowser.Controller.Providers;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.Entities;
 using MediaBrowser.Model.IO;
 using MediaBrowser.Model.IO;
+using MediaBrowser.Model.Providers;
 using Microsoft.Extensions.Logging;
 using Microsoft.Extensions.Logging;
 
 
 namespace MediaBrowser.Controller.Entities.TV
 namespace MediaBrowser.Controller.Entities.TV
@@ -336,5 +337,22 @@ namespace MediaBrowser.Controller.Entities.TV
 
 
             return hasChanges;
             return hasChanges;
         }
         }
+
+        public override List<ExternalUrl> GetRelatedUrls()
+        {
+            var list = base.GetRelatedUrls();
+
+            var imdbId = this.GetProviderId(MetadataProvider.Imdb);
+            if (!string.IsNullOrEmpty(imdbId))
+            {
+                list.Add(new ExternalUrl
+                {
+                    Name = "Trakt",
+                    Url = string.Format(CultureInfo.InvariantCulture, "https://trakt.tv/episodes/{0}", imdbId)
+                });
+            }
+
+            return list;
+        }
     }
     }
 }
 }