From 4ba409960364ee44a5acf49386fb3233dd67cd6c Mon Sep 17 00:00:00 2001 From: Alex Gonzales Date: Fri, 2 Oct 2020 16:01:32 -0500 Subject: [PATCH] More cleanup, bump the major version for semver reasons (and also because the implementation pretty fundamentally changed) --- .../Configuration/PluginConfiguration.cs | 19 +++++++++++++++++-- .../Configuration/configPage.html | 14 ++++---------- .../Jellyfin.Plugin.Streamlink.csproj | 4 ++-- build.yaml | 2 +- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/Jellyfin.Plugin.Streamlink/Configuration/PluginConfiguration.cs b/Jellyfin.Plugin.Streamlink/Configuration/PluginConfiguration.cs index 7ae4e35..c190fbc 100644 --- a/Jellyfin.Plugin.Streamlink/Configuration/PluginConfiguration.cs +++ b/Jellyfin.Plugin.Streamlink/Configuration/PluginConfiguration.cs @@ -1,5 +1,6 @@ using System.Globalization; using System.Collections.Generic; +using System.Diagnostics; using MediaBrowser.Model.Plugins; using MediaBrowser.Model.Dto; @@ -32,17 +33,31 @@ public PluginConfiguration() public class ChannelConfig { public string Name { get; set; } - public string Image { get; set; } public string Url { get; set; } public string Id { get => Url.GetMD5().ToString("N", CultureInfo.InvariantCulture); } + public virtual bool IsLive() + { + // This function does work, but each stream costs uses a few seconds to check + // so it currently isn't called when loading the dashboard. + var proc = new Process(); + proc.StartInfo.FileName = Jellyfin.Plugin.Streamlink.Plugin.Instance.Configuration.StreamlinkPath; + proc.StartInfo.UseShellExecute = false; + proc.StartInfo.RedirectStandardOutput = true; + proc.StartInfo.ArgumentList.Add("--quiet"); + proc.StartInfo.ArgumentList.Add("--stream-url"); + proc.StartInfo.ArgumentList.Add(Url); + proc.Start(); + proc.WaitForExit(); + return proc.ExitCode == 0; + } + public virtual ChannelItemInfo CreateChannelItemInfo() { return new ChannelItemInfo { Name = Name, - ImageUrl = Image, Id = Id, Type = ChannelItemType.Media, ContentType = ChannelMediaContentType.Clip, diff --git a/Jellyfin.Plugin.Streamlink/Configuration/configPage.html b/Jellyfin.Plugin.Streamlink/Configuration/configPage.html index beab544..1e12c9f 100644 --- a/Jellyfin.Plugin.Streamlink/Configuration/configPage.html +++ b/Jellyfin.Plugin.Streamlink/Configuration/configPage.html @@ -35,8 +35,7 @@

Streamlink Streams

@@ -50,14 +49,11 @@

Add Stream

- +
- +
-