diff --git a/Pages/Dashboard.cshtml b/Pages/Dashboard.cshtml
index 3541df0..29c5f31 100644
--- a/Pages/Dashboard.cshtml
+++ b/Pages/Dashboard.cshtml
@@ -61,15 +61,23 @@ else {
diff --git a/README.md b/README.md
index 6d1181d..a09619c 100644
--- a/README.md
+++ b/README.md
@@ -67,7 +67,7 @@ User=rtmpdash
Group=rtmpdash
WorkingDirectory=/opt/rtmpdash
Environment=ASPNETCORE_URLS='http://*:60001'
-Environment=ASPNETCORE_ENVIRONMENT=Production
+Environment=ASPNETCORE_ENVIRONMENT=Development
ExecStart=/usr/bin/dotnet watch run --no-launch-profile
Type=simple
TimeoutStopSec=20
diff --git a/StreamUtils.cs b/StreamUtils.cs
index d38aa4f..63d9d8d 100644
--- a/StreamUtils.cs
+++ b/StreamUtils.cs
@@ -2,6 +2,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Xml.Serialization;
+using RTMPDash.DataModels;
namespace RTMPDash {
public static class StreamUtils {
@@ -11,6 +12,31 @@ namespace RTMPDash {
.Server.Applications.First(p => p.Name == "ingress")
.MethodLive.Streams.Any(p => p.Name == user);
+ public static bool IsLive(string user, string target) => GetStatsObject()
+ .Server.Applications.First(p => p.Name == "ingress")
+ .MethodLive.Streams
+ .Any(p => p.Name == user
+ && p.Clients.Any(c => c.Address
+ == target
+ .Replace("rtmp://", "")));
+
+ public static long GetClientTime(string user) => long.Parse(GetStatsObject()
+ .Server.Applications.First(p => p.Name == "ingress")
+ .MethodLive.Streams.First(p => p.Name == user)
+ .Time);
+
+ public static int CountLiveRestreams(string user) {
+ var db = new AppDb.DbConn();
+ var dbUser = db.Users.First(p => p.Username == user);
+ var stats = GetStatsObject();
+ return dbUser.RestreamTargets.Split(",")
+ .Count(target => stats.Server.Applications.First(p => p.Name == "ingress")
+ .MethodLive.Streams
+ .Any(p => p.Name == user
+ && p.Clients.Any(c => c.Address
+ == target.Replace("rtmp://", ""))));
+ }
+
public static List ListLiveUsers() => GetStatsObject()
.Server.Applications.First(p => p.Name == "ingress")
.MethodLive.Streams.Select(p => p.Name)