add multi-episode shuffle playout order (#987)

This commit is contained in:
Jason Dove
2022-10-09 10:49:07 -05:00
committed by GitHub
parent 6f892bea6b
commit f5aa2fcac8
17 changed files with 431 additions and 5 deletions
@@ -28,6 +28,12 @@ public class ResourceExtractorService : IHostedService
"_default.ass.sbntxt",
FileSystemLayout.MusicVideoCreditsTemplatesFolder,
cancellationToken);
await ExtractScriptResource(
assembly,
"_threePartEpisodes.lua",
FileSystemLayout.MultiEpisodeShuffleTemplatesFolder,
cancellationToken);
}
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
@@ -71,4 +77,18 @@ public class ResourceExtractorService : IHostedService
await resource.CopyToAsync(fs, cancellationToken);
}
}
private static async Task ExtractScriptResource(
Assembly assembly,
string name,
string targetFolder,
CancellationToken cancellationToken)
{
await using Stream resource = assembly.GetManifestResourceStream($"ErsatzTV.Resources.Scripts.{name}");
if (resource != null)
{
await using FileStream fs = File.Create(Path.Combine(targetFolder, name));
await resource.CopyToAsync(fs, cancellationToken);
}
}
}