Compare commits
5 Commits
release/1.
...
release/2.
Author | SHA1 | Date | |
---|---|---|---|
501e81c2c5 | |||
c8e3c1b9f5 | |||
0b818452b0 | |||
f190d3b5af | |||
babd41055f |
@@ -5,6 +5,7 @@ pipeline:
|
|||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
- 2.0
|
- 2.0
|
||||||
|
- 2.0.1
|
||||||
secrets: [ docker_username, docker_password ]
|
secrets: [ docker_username, docker_password ]
|
||||||
debug: true
|
debug: true
|
||||||
when:
|
when:
|
||||||
|
@@ -12,8 +12,9 @@ There are more features than just changing the URL:
|
|||||||
|
|
||||||
- Resorting of the channel list
|
- Resorting of the channel list
|
||||||
- Enable or disable a channel
|
- Enable or disable a channel
|
||||||
- Override the channel number -> better EPG Detection support in plex
|
- Enable or disable multiple channels at once
|
||||||
- Override the channel name -> better EPG Detection support in plex
|
- Override the channel number -> better EPG Detection support in plex / emby
|
||||||
|
- Override the channel name -> better EPG Detection support in plex / emby
|
||||||
|
|
||||||
This is licensed under GPLv2. See License file.
|
This is licensed under GPLv2. See License file.
|
||||||
|
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.2.0" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.2.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@@ -6,9 +6,9 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.4" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.4" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.3" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@@ -12,9 +12,9 @@ namespace Tv7Playlist.Controllers
|
|||||||
{
|
{
|
||||||
public class HomeController : Controller
|
public class HomeController : Controller
|
||||||
{
|
{
|
||||||
|
private readonly IAppConfig _appConfig;
|
||||||
private readonly PlaylistContext _playlistContext;
|
private readonly PlaylistContext _playlistContext;
|
||||||
private readonly IPlaylistSynchronizer _playlistSynchronizer;
|
private readonly IPlaylistSynchronizer _playlistSynchronizer;
|
||||||
private readonly IAppConfig _appConfig;
|
|
||||||
|
|
||||||
public HomeController(PlaylistContext playlistContext, IPlaylistSynchronizer playlistSynchronizer, IAppConfig appConfig)
|
public HomeController(PlaylistContext playlistContext, IPlaylistSynchronizer playlistSynchronizer, IAppConfig appConfig)
|
||||||
{
|
{
|
||||||
@@ -26,12 +26,29 @@ namespace Tv7Playlist.Controllers
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
public async Task<IActionResult> Index()
|
public async Task<IActionResult> Index()
|
||||||
{
|
{
|
||||||
var playlistEntries = await _playlistContext.PlaylistEntries.AsNoTracking().OrderBy(e => e.Position).ToListAsync();
|
var playlistEntries = await _playlistContext.PlaylistEntries.AsNoTracking().OrderBy(e => e.Position)
|
||||||
|
.Select(e => new PlaylistEntryModel(e)).ToListAsync();
|
||||||
var model = new HomeModel(playlistEntries);
|
var model = new HomeModel(playlistEntries);
|
||||||
|
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IActionResult> DisableSelectedEntries([FromForm] HomeModel model)
|
||||||
|
{
|
||||||
|
if (ModelState.IsValid) await UpdateEnabledForItems(model, false);
|
||||||
|
|
||||||
|
return Redirect("/");
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<IActionResult> EnableSelectedEntries([FromForm] HomeModel model)
|
||||||
|
{
|
||||||
|
if (ModelState.IsValid) await UpdateEnabledForItems(model, true);
|
||||||
|
|
||||||
|
return Redirect("/");
|
||||||
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
public IActionResult Error()
|
public IActionResult Error()
|
||||||
@@ -57,5 +74,20 @@ namespace Tv7Playlist.Controllers
|
|||||||
|
|
||||||
return RedirectToAction("Index", "Home");
|
return RedirectToAction("Index", "Home");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task UpdateEnabledForItems(HomeModel model, bool isEnabled)
|
||||||
|
{
|
||||||
|
if (model == null) throw new ArgumentNullException(nameof(model));
|
||||||
|
var idsToUpdate = model.PlaylistEntries.Where(e => e.Selected).Select(e => e.Id);
|
||||||
|
foreach (var id in idsToUpdate)
|
||||||
|
{
|
||||||
|
var entry = await _playlistContext.PlaylistEntries.FindAsync(id);
|
||||||
|
if (entry == null) continue;
|
||||||
|
|
||||||
|
entry.IsEnabled = isEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
await _playlistContext.SaveChangesAsync();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,16 +1,19 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Tv7Playlist.Data;
|
|
||||||
|
|
||||||
namespace Tv7Playlist.Models
|
namespace Tv7Playlist.Models
|
||||||
{
|
{
|
||||||
public class HomeModel
|
public class HomeModel
|
||||||
{
|
{
|
||||||
public HomeModel(List<PlaylistEntry> playlistEntries)
|
public HomeModel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public HomeModel(List<PlaylistEntryModel> playlistEntries)
|
||||||
{
|
{
|
||||||
PlaylistEntries = playlistEntries ?? throw new ArgumentNullException(nameof(playlistEntries));
|
PlaylistEntries = playlistEntries ?? throw new ArgumentNullException(nameof(playlistEntries));
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PlaylistEntry> PlaylistEntries { get; }
|
public List<PlaylistEntryModel> PlaylistEntries { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
24
Tv7Playlist/Models/PlaylistEntryModel.cs
Normal file
24
Tv7Playlist/Models/PlaylistEntryModel.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using Tv7Playlist.Data;
|
||||||
|
|
||||||
|
namespace Tv7Playlist.Models
|
||||||
|
{
|
||||||
|
public class PlaylistEntryModel
|
||||||
|
{
|
||||||
|
public PlaylistEntryModel()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlaylistEntryModel(PlaylistEntry entry)
|
||||||
|
{
|
||||||
|
Entry = entry ?? throw new ArgumentNullException(nameof(entry));
|
||||||
|
Id = entry.Id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
|
public PlaylistEntry Entry { get; set; }
|
||||||
|
|
||||||
|
public bool Selected { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@@ -3,14 +3,15 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||||
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
|
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
|
||||||
|
<LangVersion>latest</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.App" />
|
<PackageReference Include="Microsoft.AspNetCore.App" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
|
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
@@ -3,11 +3,21 @@
|
|||||||
ViewData["Title"] = "TV7 Playlist";
|
ViewData["Title"] = "TV7 Playlist";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col col-4">
|
||||||
|
<button class="btn btn-warning" asp-action="DisableSelectedEntries" asp-controller="Home">Disable selected</button>
|
||||||
|
<button class="btn btn-info" asp-action="EnableSelectedEntries" asp-controller="Home">Enable selected</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col col-12">
|
<div class="col col-12">
|
||||||
<table class="table table-hover table-striped">
|
<table class="table table-hover table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th>Selected</th>
|
||||||
|
<th>Single Action</th>
|
||||||
<th>Number Import</th>
|
<th>Number Import</th>
|
||||||
<th>Number Export</th>
|
<th>Number Export</th>
|
||||||
<th>Position</th>
|
<th>Position</th>
|
||||||
@@ -22,37 +32,43 @@
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
@{
|
@{
|
||||||
foreach (var channel in Model.PlaylistEntries)
|
for (var i = 0; i < Model.PlaylistEntries.Count; i++)
|
||||||
{
|
{
|
||||||
|
@Html.HiddenFor(m => m.PlaylistEntries[i].Id)
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a class="btn btn-secondary" asp-area="" asp-controller="PlaylistEntry" asp-action="Edit" asp-route-id="@channel.Id">Edit</a>
|
<input asp-for="PlaylistEntries[i].Selected" type="checkbox" />
|
||||||
<a class="btn btn-danger" asp-area="" asp-controller="PlaylistEntry" asp-action="Delete" asp-route-id="@channel.Id">Delete</a>
|
</td>
|
||||||
|
<td>
|
||||||
|
<a class="btn btn-secondary" asp-area="" asp-controller="PlaylistEntry" asp-action="Edit" asp-route-id="@Model.PlaylistEntries[i].Id">Edit</a>
|
||||||
|
<a class="btn btn-danger" asp-area="" asp-controller="PlaylistEntry" asp-action="Delete" asp-route-id="@Model.PlaylistEntries[i].Id">Delete</a>
|
||||||
@{
|
@{
|
||||||
if (channel.IsEnabled)
|
if (Model.PlaylistEntries[i].Entry.IsEnabled)
|
||||||
{
|
{
|
||||||
<a class="btn btn-warning" asp-area="" asp-controller="PlaylistEntry" asp-action="ToggleEnabled" asp-route-id="@channel.Id">Disable</a>
|
<a class="btn btn-warning" asp-area="" asp-controller="PlaylistEntry" asp-action="ToggleEnabled" asp-route-id="@Model.PlaylistEntries[i].Id">Disable</a>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<a class="btn btn-info" asp-area="" asp-controller="PlaylistEntry" asp-action="ToggleEnabled" asp-route-id="@channel.Id">Enable</a>
|
<a class="btn btn-info" asp-area="" asp-controller="PlaylistEntry" asp-action="ToggleEnabled" asp-route-id="@Model.PlaylistEntries[i].Id">Enable</a>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</td>
|
</td>
|
||||||
<td>@channel.ChannelNumberImport</td>
|
<td>@Model.PlaylistEntries[i].Entry.ChannelNumberImport</td>
|
||||||
<td>@channel.ChannelNumberExport</td>
|
<td>@Model.PlaylistEntries[i].Entry.ChannelNumberExport</td>
|
||||||
<td>@channel.Position</td>
|
<td>@Model.PlaylistEntries[i].Entry.Position</td>
|
||||||
<td>@channel.Name</td>
|
<td>@Model.PlaylistEntries[i].Entry.Name</td>
|
||||||
<td>@channel.EpgMatchName</td>
|
<td>@Model.PlaylistEntries[i].Entry.EpgMatchName</td>
|
||||||
<td class="text-center">@Html.Raw(channel.IsEnabled ? "<span class=\"text-primary\">Enabled</span>" : "<span class=\"text-danger\">Disabled</span>")</td>
|
<td class="text-center">@Html.Raw(Model.PlaylistEntries[i].Entry.IsEnabled ? "<span class=\"text-primary\">Enabled</span>" : "<span class=\"text-danger\">Disabled</span>")</td>
|
||||||
<td class="text-center">@Html.Raw(channel.IsAvailable ? "<span class=\"text-primary\">yes</span>" : "<span class=\"text-danger\">no</span>")</td>
|
<td class="text-center">@Html.Raw(Model.PlaylistEntries[i].Entry.IsAvailable ? "<span class=\"text-primary\">yes</span>" : "<span class=\"text-danger\">no</span>")</td>
|
||||||
<td>@channel.UrlProxy</td>
|
<td>@Model.PlaylistEntries[i].Entry.UrlProxy</td>
|
||||||
<td>@channel.UrlOriginal</td>
|
<td>@Model.PlaylistEntries[i].Entry.UrlOriginal</td>
|
||||||
<td>@channel.Created.ToString("g")</td>
|
<td>@Model.PlaylistEntries[i].Entry.Created.ToString("g")</td>
|
||||||
<td>@channel.Modified.ToString("g")</td>
|
<td>@Model.PlaylistEntries[i].Entry.Modified.ToString("g")</td>
|
||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</form>
|
Reference in New Issue
Block a user