Cleaning up

This commit is contained in:
Zoe Roux 2020-02-08 16:38:43 +01:00
parent f5f0a8bb61
commit e670025514
2 changed files with 13 additions and 10 deletions

View File

@ -10,11 +10,11 @@ namespace Kyoo.Controllers
{ {
public class ThumbnailsManager : IThumbnailsManager public class ThumbnailsManager : IThumbnailsManager
{ {
private readonly IConfiguration config; private readonly IConfiguration _config;
public ThumbnailsManager(IConfiguration configuration) public ThumbnailsManager(IConfiguration configuration)
{ {
config = configuration; _config = configuration;
} }
public async Task<Show> Validate(Show show) public async Task<Show> Validate(Show show)
@ -74,7 +74,7 @@ namespace Kyoo.Controllers
return null; return null;
foreach (People peop in people) foreach (People peop in people)
{ {
string root = config.GetValue<string>("peoplePath"); string root = _config.GetValue<string>("peoplePath");
Directory.CreateDirectory(root); Directory.CreateDirectory(root);
string localThumb = root + "/" + peop.Slug + ".jpg"; string localThumb = root + "/" + peop.Slug + ".jpg";

View File

@ -11,17 +11,20 @@ using Kyoo.Controllers.TranscoderLink;
namespace Kyoo.Controllers namespace Kyoo.Controllers
{ {
public class BadTranscoderException : Exception {}
public class Transcoder : ITranscoder public class Transcoder : ITranscoder
{ {
private readonly string transmuxPath; private readonly string _transmuxPath;
private readonly string transcodePath; private readonly string _transcodePath;
public Transcoder(IConfiguration config) public Transcoder(IConfiguration config)
{ {
transmuxPath = config.GetValue<string>("transmuxTempPath"); _transmuxPath = config.GetValue<string>("transmuxTempPath");
transcodePath = config.GetValue<string>("transcodeTempPath"); _transcodePath = config.GetValue<string>("transcodeTempPath");
Console.WriteLine("&Api INIT (unmanaged stream size): " + TranscoderAPI.init() + ", Stream size: " + Marshal.SizeOf<Models.Watch.Stream>()); if (TranscoderAPI.init() != Marshal.SizeOf<Models.Watch.Stream>())
throw new BadTranscoderException();
} }
public async Task<Track[]> GetTrackInfo(string path) public async Task<Track[]> GetTrackInfo(string path)
@ -46,7 +49,7 @@ namespace Kyoo.Controllers
public async Task<string> Transmux(WatchItem episode) public async Task<string> Transmux(WatchItem episode)
{ {
string folder = Path.Combine(transmuxPath, episode.Link); string folder = Path.Combine(_transmuxPath, episode.Link);
string manifest = Path.Combine(folder, episode.Link + ".m3u8"); string manifest = Path.Combine(folder, episode.Link + ".m3u8");
float playableDuration = 0; float playableDuration = 0;
bool transmuxFailed = false; bool transmuxFailed = false;
@ -75,7 +78,7 @@ namespace Kyoo.Controllers
public async Task<string> Transcode(WatchItem episode) public async Task<string> Transcode(WatchItem episode)
{ {
string folder = Path.Combine(transcodePath, episode.Link); string folder = Path.Combine(_transcodePath, episode.Link);
string manifest = Path.Combine(folder, episode.Link + ".m3u8"); string manifest = Path.Combine(folder, episode.Link + ".m3u8");
float playableDuration = 0; float playableDuration = 0;
bool transmuxFailed = false; bool transmuxFailed = false;