From 3816c29612ef7b67c56a9cffcac4b866087bc014 Mon Sep 17 00:00:00 2001 From: Adam R Grey Date: Thu, 6 Apr 2023 16:00:15 -0400 Subject: [PATCH] thoroughly check sponsorblock segments --- Program.cs | 13 ++++++++++++- sponosrblock/Segment.cs | 16 ++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 sponosrblock/Segment.cs diff --git a/Program.cs b/Program.cs index 2bbe845..c98c21f 100644 --- a/Program.cs +++ b/Program.cs @@ -323,7 +323,18 @@ namespace ttrss_co_client } else { - return new Tuple(true, "status other than 404"); + try + { + var segments = JsonConvert.DeserializeObject>(await sponsorblockcheck.Content.ReadAsStringAsync()); + if(segments.Count() > 1) + { + return new Tuple(true, $"{segments.Count()} segments"); + } + else + { + return new Tuple(false, $"no segments"); + } + } } } } diff --git a/sponosrblock/Segment.cs b/sponosrblock/Segment.cs new file mode 100644 index 0000000..bab8f76 --- /dev/null +++ b/sponosrblock/Segment.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; + +namespace ttrss_co_client.sponsorblock +{ + public class Segment + { + public string category { get; set; } + public string actionType { get; set; } + public double[] segment { get; set; } //start time, end time + public string UUID { get; set; } + public double videoDuration { get; set; } //yes, this is repeated in each segment + public int locked { get; set; } + public int votes { get; set; } + public string description { get; set; } + } +} \ No newline at end of file