Ver Fonte

[video] Fix youtube redirects

Colin Powell há 3 meses atrás
pai
commit
a9499f0463

+ 6 - 0
vrobbler/apps/scrobbles/models.py

@@ -680,6 +680,12 @@ class Scrobble(TimeStampedModel):
             logger.info(f"Redirecting to {self.media_obj.url}")
             redirect_url = self.media_obj.get_read_url()
 
+        if (
+            self.media_type == self.MediaType.VIDEO
+            and self.media_obj.youtube_id
+        ):
+            redirect_url = self.media_obj.youtube_link
+
         return redirect_url
 
     @property

+ 1 - 1
vrobbler/apps/videos/models.py

@@ -263,7 +263,7 @@ class Video(ScrobblableMixin):
     @property
     def youtube_link(self) -> str:
         if self.youtube_id:
-            return YOUTUBE_BASE_URL + self.youtube_id
+            return f"https://www.youtube.com/watch?v={self.youtube_id}"
         return ""
 
     @property

+ 2 - 2
vrobbler/apps/videos/views.py

@@ -29,8 +29,8 @@ class SeriesDetailView(LoginRequiredMixin, generic.DetailView):
             user_id
         ).next_imdb_id
         if self.object.is_episode_playing(user_id):
-            next_episode_id = None
-        context_data["next_episode_id"] = next_episode_id
+            next_episode_id = ""
+        context_data["next_episode_id"] = "tt" + next_episode_id
         return context_data