Indetation formatting and unnecessary usings cleanup
This commit is contained in:
@@ -6,52 +6,52 @@ using YoutubeExplode;
|
||||
|
||||
namespace YouTube.Resources
|
||||
{
|
||||
public class CaptionsResource : Google.Apis.YouTube.v3.CaptionsResource
|
||||
{
|
||||
IClientService Service { get; }
|
||||
public CaptionsResource(IClientService service) : base(service) =>
|
||||
Service = service;
|
||||
public class CaptionsResource : Google.Apis.YouTube.v3.CaptionsResource
|
||||
{
|
||||
IClientService Service { get; }
|
||||
public CaptionsResource(IClientService service) : base(service) =>
|
||||
Service = service;
|
||||
|
||||
public LoadRequest Load(ClosedCaptionInfo captionInfo) =>
|
||||
new LoadRequest(Service, captionInfo);
|
||||
public LoadRequest Load(ClosedCaptionInfo captionInfo) =>
|
||||
new LoadRequest(Service, captionInfo);
|
||||
|
||||
public class LoadRequest
|
||||
{
|
||||
public ClosedCaptionInfo CaptionInfo { get; set; }
|
||||
IClientService Service { get; set; }
|
||||
public class LoadRequest
|
||||
{
|
||||
public ClosedCaptionInfo CaptionInfo { get; set; }
|
||||
IClientService Service { get; set; }
|
||||
|
||||
public LoadRequest(IClientService service, ClosedCaptionInfo captionInfo)
|
||||
{
|
||||
CaptionInfo = captionInfo;
|
||||
Service = service;
|
||||
}
|
||||
public LoadRequest(IClientService service, ClosedCaptionInfo captionInfo)
|
||||
{
|
||||
CaptionInfo = captionInfo;
|
||||
Service = service;
|
||||
}
|
||||
|
||||
public async Task<ClosedCaptionTrack> ExecuteAsync()
|
||||
{
|
||||
YoutubeClient client = new YoutubeClient(Service.HttpClient);
|
||||
var response = await client.GetClosedCaptionTrackAsync(CaptionInfo.TrackInfo);
|
||||
List<ClosedCaptionTrack.ClosedCaption> captions = new List<ClosedCaptionTrack.ClosedCaption>();
|
||||
foreach (var i in response.Captions)
|
||||
captions.Add(new ClosedCaptionTrack.ClosedCaption
|
||||
{
|
||||
Offset = i.Offset,
|
||||
Duration = i.Duration,
|
||||
Content = i.Text
|
||||
});
|
||||
public async Task<ClosedCaptionTrack> ExecuteAsync()
|
||||
{
|
||||
YoutubeClient client = new YoutubeClient(Service.HttpClient);
|
||||
var response = await client.GetClosedCaptionTrackAsync(CaptionInfo.TrackInfo);
|
||||
List<ClosedCaptionTrack.ClosedCaption> captions = new List<ClosedCaptionTrack.ClosedCaption>();
|
||||
foreach (var i in response.Captions)
|
||||
captions.Add(new ClosedCaptionTrack.ClosedCaption
|
||||
{
|
||||
Offset = i.Offset,
|
||||
Duration = i.Duration,
|
||||
Content = i.Text
|
||||
});
|
||||
|
||||
return new ClosedCaptionTrack
|
||||
{
|
||||
Info = CaptionInfo,
|
||||
Captions = captions.AsReadOnly()
|
||||
};
|
||||
}
|
||||
return new ClosedCaptionTrack
|
||||
{
|
||||
Info = CaptionInfo,
|
||||
Captions = captions.AsReadOnly()
|
||||
};
|
||||
}
|
||||
|
||||
public ClosedCaptionTrack Execute()
|
||||
{
|
||||
Task<ClosedCaptionTrack> task = ExecuteAsync();
|
||||
task.Wait();
|
||||
return task.Result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public ClosedCaptionTrack Execute()
|
||||
{
|
||||
Task<ClosedCaptionTrack> task = ExecuteAsync();
|
||||
task.Wait();
|
||||
return task.Result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user