Skip to content

Commit 3013fcf

Browse files
committed
feat: expose part number to plugins and display it on the episode number in the playlist item title
1 parent f3bc104 commit 3013fcf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Shoko.Server/Services/GeneratedPlaylistService.cs

+7-1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ private static string GetEpisodeEntry(UriBuilder uri, IShokoSeries series, IShok
136136
var episodeNumber = episode.Type is EpisodeType.Episode
137137
? episode.EpisodeNumber.ToString()
138138
: $"{episode.Type.ToString()[0]}{episode.EpisodeNumber}";
139+
var episodePartNumber = totalParts > 1 ? $".{part}" : string.Empty;
139140
var queryString = HttpUtility.ParseQueryString(string.Empty);
140141
queryString.Add("shokoVersion", Utils.GetApplicationVersion());
141142

@@ -149,10 +150,15 @@ private static string GetEpisodeEntry(UriBuilder uri, IShokoSeries series, IShok
149150
queryString.Add("episodeName", episode.PreferredTitle);
150151
queryString.Add("epNo", episodeNumber);
151152
queryString.Add("epCount", series.EpisodeCounts.Episodes.ToString());
153+
if (totalParts > 1)
154+
{
155+
queryString.Add("epNoPart", part.ToString());
156+
queryString.Add("epNoPartCount", totalParts.ToString());
157+
}
152158
queryString.Add("restricted", series.Restricted ? "true" : "false");
153159

154160
uri.Path = $"{(uri.Path.Length > 1 ? uri.Path + "/" : "/")}api/v3/File/{video.ID}/Stream";
155161
uri.Query = queryString.ToString();
156-
return $"#EXTINF:-1,{series.PreferredTitle} - {episodeNumber} - {episode.PreferredTitle}{parts}\n{uri}\n";
162+
return $"#EXTINF:-1,{series.PreferredTitle} - {episodeNumber}{episodePartNumber} - {episode.PreferredTitle}{parts}\n{uri}\n";
157163
}
158164
}

0 commit comments

Comments
 (0)