Skip to content
This repository has been archived by the owner on Jul 5, 2021. It is now read-only.

Commit

Permalink
More cleanup, bump the major version for semver reasons (and also bec…
Browse files Browse the repository at this point in the history
…ause the implementation pretty fundamentally changed)
  • Loading branch information
Musi13 committed Oct 2, 2020
1 parent 72c9062 commit 4ba4099
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
19 changes: 17 additions & 2 deletions Jellyfin.Plugin.Streamlink/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Globalization;
using System.Collections.Generic;
using System.Diagnostics;

using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Dto;
Expand Down Expand Up @@ -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,
Expand Down
14 changes: 4 additions & 10 deletions Jellyfin.Plugin.Streamlink/Configuration/configPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
<div style="display: flex; align-items: center;margin: 1em 0;">
<h1 style="margin:0;">Streamlink Streams</h1>
<button is="emby-button" type="button" class="raised btnAdd submit mini" style="margin-left:1em;" title="Add" onclick="StreamlinkConfigurationPage.addStreamPopup();">
<i class="md-icon">add</i>
<span>Add</span>
<span>Add Stream</span>
</button>
</div>
<div class="streamList paperList">
Expand All @@ -50,14 +49,11 @@ <h3>Add Stream</h3>
</div>
<div data-role="content">
<div class="inputContainer">
<input is="emby-input" type="text" id="name" label="Name" />
<input is="emby-input" type="text" autocomplete="off" id="name" label="Name" />
</div>
<div class="inputContainer">
<input is="emby-input" type="url" id="url" label="Url:" />
<input is="emby-input" type="url" autocomplete="off" id="url" label="Url:" />
</div>
<!-- <div class="inputContainer">
<input is="emby-input" type="text" id="Image" label="Image url:" />
</div> -->
<p>
<button is="emby-button" type="submit" class="raised button-submit block" data-icon="check" data-mini="true">
<span>Add</span>
Expand Down Expand Up @@ -156,6 +152,7 @@ <h3>Add Stream</h3>
addStreamPopup: function () {
var page = $.mobile.activePage;
$('#name', page).val("").focus();
$('#url', page).val("").focus();
$('#streamPopup', page).removeClass('hide');
$('#name', page).focus();
},
Expand All @@ -167,9 +164,7 @@ <h3>Add Stream</h3>

var newEntry = true;
var name = $('#name', page).val();
// var image = $('#Image', page).val();
var url = $('#url', page).val();
// var type = $('#Type', page).val();
var userId = Dashboard.getCurrentUserId();

if (StreamlinkConfigurationPage.config.Channels.length > 0) {
Expand All @@ -185,7 +180,6 @@ <h3>Add Stream</h3>
var conf = {};

conf.Name = name;
// conf.Image = image;
conf.Url = url;
StreamlinkConfigurationPage.config.Channels.push(conf);
}
Expand Down
4 changes: 2 additions & 2 deletions Jellyfin.Plugin.Streamlink/Jellyfin.Plugin.Streamlink.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>Jellyfin.Plugin.Streamlink</RootNamespace>
<AssemblyVersion>1.0.1</AssemblyVersion>
<FileVersion>1.0.1</FileVersion>
<AssemblyVersion>2.0.0</AssemblyVersion>
<FileVersion>2.0.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion build.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: "jellyfin-plugin-streamlink"
guid: "87c22ffb-736c-41aa-8a2d-95d46977bb26"
version: "1.0.1"
version: "2.0.0"
targetAbi: "10.6.0.0"
owner: "jellyfin"
nicename: "Streamlink"
Expand Down

0 comments on commit 4ba4099

Please sign in to comment.