@@ -81,9 +81,6 @@ def execute(self, collage_id: str) -> ShowMissingResponse:
8181 missing_groups = []
8282 )
8383
84- # Get the base URL from config for links
85- base_url = self ._get_base_url (site )
86-
8784 # Fetch details for each missing group
8885 missing_groups = []
8986 for group_id in sorted (missing_group_ids ):
@@ -92,7 +89,7 @@ def execute(self, collage_id: str) -> ShowMissingResponse:
9289 if torrent_group :
9390 artists = torrent_group .artists if torrent_group .artists else ["Unknown Artist" ]
9491 album_name = torrent_group .album_name or "Unknown Album"
95- torrent_url = f" { base_url } /torrents.php?id= { group_id } "
92+ torrent_url = self . gazelle_api . get_torrent_group_url ( str ( group_id ))
9693
9794 missing_groups .append (MissingGroupInfo (
9895 group_id = group_id ,
@@ -106,7 +103,7 @@ def execute(self, collage_id: str) -> ShowMissingResponse:
106103 group_id = group_id ,
107104 artist_names = ["Unknown Artist" ],
108105 album_name = "Details not available" ,
109- torrent_url = f" { base_url } /torrents.php?id= { group_id } "
106+ torrent_url = self . gazelle_api . get_torrent_group_url ( str ( group_id ))
110107 ))
111108 except Exception as e : # pylint: disable=W0718
112109 logger .warning ("Failed to fetch details for group %s: %s" , group_id , e )
@@ -115,7 +112,7 @@ def execute(self, collage_id: str) -> ShowMissingResponse:
115112 group_id = group_id ,
116113 artist_names = ["Unknown Artist" ],
117114 album_name = "Error fetching details" ,
118- torrent_url = f" { base_url } /torrents.php?id= { group_id } "
115+ torrent_url = self . gazelle_api . get_torrent_group_url ( str ( group_id ))
119116 ))
120117
121118 return ShowMissingResponse (
@@ -124,17 +121,3 @@ def execute(self, collage_id: str) -> ShowMissingResponse:
124121 site = site ,
125122 missing_groups = missing_groups
126123 )
127-
128- def _get_base_url (self , site : str ) -> str :
129- """Get the base URL for the site from config."""
130- try :
131- # pylint: disable=C0415
132- from red_plex .infrastructure .config .config import load_config
133- config_data = load_config ()
134- site_config = config_data .site_configurations .get (site .upper ())
135- if site_config :
136- return site_config .base_url .rstrip ('/' )
137- return f"https://{ site } .example.com" # fallback
138- except Exception as e : # pylint: disable=W0718
139- logger .warning ("Failed to load config for URL construction: %s" , e )
140- return f"https://{ site } .example.com" # fallback
0 commit comments