Skip to content

Commit e9cbb63

Browse files
committed
added feature for seasons
1 parent 91b388b commit e9cbb63

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

Jellyfin.Plugin.DisableUserData/DisableUserDataActionFilter.cs

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -166,33 +166,30 @@ private bool DisabledForRecentlyAdded(
166166
return false;
167167
}
168168

169-
private void DisableUserData(ActionExecutingContext context)
170-
{
171-
context.ActionArguments["enableUserData"] = false;
172-
}
173-
174169
// Disables UserData for /Shows/{id}/Seasons endpoint
175-
private bool DisabledForSeasonsEndpoint(PluginConfiguration config, ActionExecutingContext context, HttpRequest request)
170+
private bool DisabledForSeasonsEndpoint(
171+
PluginConfiguration config,
172+
ActionExecutingContext context,
173+
HttpRequest request)
176174
{
177175
if (!config.DisableOnSeasons)
178176
{
179177
return false;
180178
}
181179

182-
// Match /Shows/{id}/Seasons (case-insensitive)
183-
var path = request.Path.ToString();
184-
if (path != null)
180+
if (request.Path.ToString().EndsWith("/Seasons", StringComparison.InvariantCultureIgnoreCase))
185181
{
186-
var segments = path.TrimEnd('/').Split('/');
187-
if (segments.Length >= 3 && segments[^2].Equals("Shows", StringComparison.InvariantCultureIgnoreCase)
188-
&& segments[^1].Equals("Seasons", StringComparison.InvariantCultureIgnoreCase))
189-
{
190-
DisableUserData(context);
191-
_logger.LogInformation("Disabling UserData for Seasons endpoint at path {Path}", request.Path);
192-
return true;
193-
}
182+
DisableUserData(context);
183+
_logger.LogInformation("Disabling UserData for Seasons at path {Path}", request.Path);
184+
return true;
194185
}
186+
195187
return false;
196188
}
197189

190+
private void DisableUserData(ActionExecutingContext context)
191+
{
192+
context.ActionArguments["enableUserData"] = false;
193+
}
194+
198195
}

0 commit comments

Comments
 (0)