thoroughly check sponsorblock segments

This commit is contained in:
Adam R Grey 2023-04-06 16:00:15 -04:00
parent 2baaa4b1ef
commit 3816c29612
2 changed files with 28 additions and 1 deletions

View File

@ -323,7 +323,18 @@ namespace ttrss_co_client
} }
else else
{ {
return new Tuple<bool, string>(true, "status other than 404"); try
{
var segments = JsonConvert.DeserializeObject<IEnumerable<sponsorblock.Segment>>(await sponsorblockcheck.Content.ReadAsStringAsync());
if(segments.Count() > 1)
{
return new Tuple<bool, string>(true, $"{segments.Count()} segments");
}
else
{
return new Tuple<bool, string>(false, $"no segments");
}
}
} }
} }
} }

16
sponosrblock/Segment.cs Normal file
View File

@ -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; }
}
}