This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace StreamCinemaLib.API;
|
||||
@@ -9,7 +10,35 @@ public class StreamVideo
|
||||
public int height { get; set; } // vertical resolution in pixels
|
||||
public string codec { get; set; } // ie. AVC
|
||||
public double? aspect { get; set; } // aspect ratio, ie. 1.778
|
||||
public string? hdr { get; set; } // ie. Dolby Vision / SMPTE ST 2086
|
||||
[JsonPropertyName("hdr")]
|
||||
public JsonElement? hdr_raw_donotuse { get; set; } // ie. Dolby Vision / SMPTE ST 2086
|
||||
[JsonIgnore()]
|
||||
public bool hasHdr
|
||||
{
|
||||
get
|
||||
{
|
||||
if (hdr_raw_donotuse == null)
|
||||
return false;
|
||||
|
||||
switch (hdr_raw_donotuse.Value.ValueKind) {
|
||||
case JsonValueKind.True: return true;
|
||||
case JsonValueKind.False: return false;
|
||||
case JsonValueKind.String: return true;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
[JsonIgnore()]
|
||||
public string? hdrQuality // ie. Dolby Vision / SMPTE ST 2086
|
||||
{
|
||||
get
|
||||
{
|
||||
return hdr_raw_donotuse != null && hdr_raw_donotuse.Value.ValueKind == JsonValueKind.String
|
||||
? hdr_raw_donotuse.Value.GetString()
|
||||
: null;
|
||||
}
|
||||
}
|
||||
|
||||
[JsonPropertyName("3d")]
|
||||
public bool is3d { get; set; }
|
||||
public double? duration { get; set; } // in seconds
|
||||
|
||||
@@ -58,7 +58,8 @@ public class StreamsPage : BasicLayout
|
||||
{
|
||||
StreamVideo a = i.video.First();
|
||||
string is3D = a.is3d ? " (3D)" : "";
|
||||
w.WriteLine($"<div class=\"video-channel\">{a.width}x{a.height} {a.codec}{is3D} {Math.Round((a.duration ?? 0) / 60)} min {a.hdr}</div>");
|
||||
string hdr = a.hasHdr ? (" HDR" + (a.hdrQuality != null ? "[" + a.hdrQuality + "]" : "")) : "";
|
||||
w.WriteLine($"<div class=\"video-channel\">{a.width}x{a.height} {a.codec}{is3D} {Math.Round((a.duration ?? 0) / 60)} min{HttpUtility.HtmlEncode(hdr)}</div>");
|
||||
}
|
||||
|
||||
if (i.audio != null && i.audio.Count != 0)
|
||||
|
||||
Reference in New Issue
Block a user