mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
fixes #687 - Enable/disable live tv per user
This commit is contained in:
parent
2977a55b1b
commit
8e7b97db52
@ -309,6 +309,11 @@ namespace MediaBrowser.Api.LiveTv
|
|||||||
StatusMessage = activeServiceInfo == null ? null : activeServiceInfo.StatusMessage
|
StatusMessage = activeServiceInfo == null ? null : activeServiceInfo.StatusMessage
|
||||||
};
|
};
|
||||||
|
|
||||||
|
info.EnabledUsers = _userManager.Users
|
||||||
|
.Where(i => i.Configuration.EnableLiveTvAccess && info.IsEnabled)
|
||||||
|
.Select(i => i.Id.ToString("N"))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
return ToOptimizedResult(info);
|
return ToOptimizedResult(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,5 +197,13 @@ namespace MediaBrowser.Controller.LiveTv
|
|||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
Task RecordLiveStream(string id, CancellationToken cancellationToken);
|
Task RecordLiveStream(string id, CancellationToken cancellationToken);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the tuner.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="id">The identifier.</param>
|
||||||
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
|
/// <returns>Task.</returns>
|
||||||
|
Task ResetTuner(string id, CancellationToken cancellationToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,7 @@ namespace MediaBrowser.Model.Configuration
|
|||||||
public bool BlockUnratedBooks { get; set; }
|
public bool BlockUnratedBooks { get; set; }
|
||||||
|
|
||||||
public bool EnableLiveTvManagement { get; set; }
|
public bool EnableLiveTvManagement { get; set; }
|
||||||
|
public bool EnableLiveTvAccess { get; set; }
|
||||||
|
|
||||||
public bool EnableMediaPlayback { get; set; }
|
public bool EnableMediaPlayback { get; set; }
|
||||||
|
|
||||||
@ -82,6 +83,7 @@ namespace MediaBrowser.Model.Configuration
|
|||||||
|
|
||||||
EnableLiveTvManagement = true;
|
EnableLiveTvManagement = true;
|
||||||
EnableMediaPlayback = true;
|
EnableMediaPlayback = true;
|
||||||
|
EnableLiveTvAccess = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace MediaBrowser.Model.FileOrganization
|
namespace MediaBrowser.Model.FileOrganization
|
||||||
{
|
{
|
||||||
@ -81,6 +82,17 @@ namespace MediaBrowser.Model.FileOrganization
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The type.</value>
|
/// <value>The type.</value>
|
||||||
public FileOrganizerType Type { get; set; }
|
public FileOrganizerType Type { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the duplicate paths.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The duplicate paths.</value>
|
||||||
|
public List<string> DuplicatePaths { get; set; }
|
||||||
|
|
||||||
|
public FileOrganizationResult()
|
||||||
|
{
|
||||||
|
DuplicatePaths = new List<string>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum FileSortingStatus
|
public enum FileSortingStatus
|
||||||
|
@ -80,6 +80,12 @@ namespace MediaBrowser.Model.LiveTv
|
|||||||
/// <value><c>true</c> if this instance is enabled; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this instance is enabled; otherwise, <c>false</c>.</value>
|
||||||
public bool IsEnabled { get; set; }
|
public bool IsEnabled { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the enabled users.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The enabled users.</value>
|
||||||
|
public List<string> EnabledUsers { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the status.
|
/// Gets or sets the status.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -95,6 +101,7 @@ namespace MediaBrowser.Model.LiveTv
|
|||||||
public LiveTvInfo()
|
public LiveTvInfo()
|
||||||
{
|
{
|
||||||
Services = new List<LiveTvServiceInfo>();
|
Services = new List<LiveTvServiceInfo>();
|
||||||
|
EnabledUsers = new List<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,6 +162,7 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
|||||||
{
|
{
|
||||||
result.Status = FileSortingStatus.SkippedExisting;
|
result.Status = FileSortingStatus.SkippedExisting;
|
||||||
result.StatusMessage = string.Empty;
|
result.StatusMessage = string.Empty;
|
||||||
|
result.DuplicatePaths = otherDuplicatePaths;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ using System.Collections.Generic;
|
|||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
@ -48,8 +49,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
|
|
||||||
string[] queries = {
|
string[] queries = {
|
||||||
|
|
||||||
"create table if not exists organizationresults (ResultId GUID PRIMARY KEY, OriginalPath TEXT, TargetPath TEXT, OrganizationDate datetime, Status TEXT, OrganizationType TEXT, StatusMessage TEXT, ExtractedName TEXT, ExtractedYear int null, ExtractedSeasonNumber int null, ExtractedEpisodeNumber int null, ExtractedEndingEpisodeNumber int null)",
|
"create table if not exists OrganizerResults (ResultId GUID PRIMARY KEY, OriginalPath TEXT, TargetPath TEXT, OrganizationDate datetime, Status TEXT, OrganizationType TEXT, StatusMessage TEXT, ExtractedName TEXT, ExtractedYear int null, ExtractedSeasonNumber int null, ExtractedEpisodeNumber int null, ExtractedEndingEpisodeNumber, DuplicatePaths TEXT int null)",
|
||||||
"create index if not exists idx_organizationresults on organizationresults(ResultId)",
|
"create index if not exists idx_OrganizerResults on OrganizerResults(ResultId)",
|
||||||
|
|
||||||
//pragmas
|
//pragmas
|
||||||
"pragma temp_store = memory",
|
"pragma temp_store = memory",
|
||||||
@ -67,7 +68,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
private void PrepareStatements()
|
private void PrepareStatements()
|
||||||
{
|
{
|
||||||
_saveResultCommand = _connection.CreateCommand();
|
_saveResultCommand = _connection.CreateCommand();
|
||||||
_saveResultCommand.CommandText = "replace into organizationresults (ResultId, OriginalPath, TargetPath, OrganizationDate, Status, OrganizationType, StatusMessage, ExtractedName, ExtractedYear, ExtractedSeasonNumber, ExtractedEpisodeNumber, ExtractedEndingEpisodeNumber) values (@ResultId, @OriginalPath, @TargetPath, @OrganizationDate, @Status, @OrganizationType, @StatusMessage, @ExtractedName, @ExtractedYear, @ExtractedSeasonNumber, @ExtractedEpisodeNumber, @ExtractedEndingEpisodeNumber)";
|
_saveResultCommand.CommandText = "replace into OrganizerResults (ResultId, OriginalPath, TargetPath, OrganizationDate, Status, OrganizationType, StatusMessage, ExtractedName, ExtractedYear, ExtractedSeasonNumber, ExtractedEpisodeNumber, ExtractedEndingEpisodeNumber, DuplicatePaths) values (@ResultId, @OriginalPath, @TargetPath, @OrganizationDate, @Status, @OrganizationType, @StatusMessage, @ExtractedName, @ExtractedYear, @ExtractedSeasonNumber, @ExtractedEpisodeNumber, @ExtractedEndingEpisodeNumber, @DuplicatePaths)";
|
||||||
|
|
||||||
_saveResultCommand.Parameters.Add(_saveResultCommand, "@ResultId");
|
_saveResultCommand.Parameters.Add(_saveResultCommand, "@ResultId");
|
||||||
_saveResultCommand.Parameters.Add(_saveResultCommand, "@OriginalPath");
|
_saveResultCommand.Parameters.Add(_saveResultCommand, "@OriginalPath");
|
||||||
@ -81,14 +82,15 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
_saveResultCommand.Parameters.Add(_saveResultCommand, "@ExtractedSeasonNumber");
|
_saveResultCommand.Parameters.Add(_saveResultCommand, "@ExtractedSeasonNumber");
|
||||||
_saveResultCommand.Parameters.Add(_saveResultCommand, "@ExtractedEpisodeNumber");
|
_saveResultCommand.Parameters.Add(_saveResultCommand, "@ExtractedEpisodeNumber");
|
||||||
_saveResultCommand.Parameters.Add(_saveResultCommand, "@ExtractedEndingEpisodeNumber");
|
_saveResultCommand.Parameters.Add(_saveResultCommand, "@ExtractedEndingEpisodeNumber");
|
||||||
|
_saveResultCommand.Parameters.Add(_saveResultCommand, "@DuplicatePaths");
|
||||||
|
|
||||||
_deleteResultCommand = _connection.CreateCommand();
|
_deleteResultCommand = _connection.CreateCommand();
|
||||||
_deleteResultCommand.CommandText = "delete from organizationresults where ResultId = @ResultId";
|
_deleteResultCommand.CommandText = "delete from OrganizerResults where ResultId = @ResultId";
|
||||||
|
|
||||||
_deleteResultCommand.Parameters.Add(_saveResultCommand, "@ResultId");
|
_deleteResultCommand.Parameters.Add(_saveResultCommand, "@ResultId");
|
||||||
|
|
||||||
_deleteAllCommand = _connection.CreateCommand();
|
_deleteAllCommand = _connection.CreateCommand();
|
||||||
_deleteAllCommand.CommandText = "delete from organizationresults";
|
_deleteAllCommand.CommandText = "delete from OrganizerResults";
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task SaveResult(FileOrganizationResult result, CancellationToken cancellationToken)
|
public async Task SaveResult(FileOrganizationResult result, CancellationToken cancellationToken)
|
||||||
@ -120,6 +122,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
_saveResultCommand.GetParameter(9).Value = result.ExtractedSeasonNumber;
|
_saveResultCommand.GetParameter(9).Value = result.ExtractedSeasonNumber;
|
||||||
_saveResultCommand.GetParameter(10).Value = result.ExtractedEpisodeNumber;
|
_saveResultCommand.GetParameter(10).Value = result.ExtractedEpisodeNumber;
|
||||||
_saveResultCommand.GetParameter(11).Value = result.ExtractedEndingEpisodeNumber;
|
_saveResultCommand.GetParameter(11).Value = result.ExtractedEndingEpisodeNumber;
|
||||||
|
_saveResultCommand.GetParameter(12).Value = string.Join("|", result.DuplicatePaths.ToArray());
|
||||||
|
|
||||||
_saveResultCommand.Transaction = transaction;
|
_saveResultCommand.Transaction = transaction;
|
||||||
|
|
||||||
@ -268,11 +271,11 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
|
|
||||||
using (var cmd = _connection.CreateCommand())
|
using (var cmd = _connection.CreateCommand())
|
||||||
{
|
{
|
||||||
cmd.CommandText = "SELECT ResultId, OriginalPath, TargetPath, OrganizationDate, Status, OrganizationType, StatusMessage, ExtractedName, ExtractedYear, ExtractedSeasonNumber, ExtractedEpisodeNumber, ExtractedEndingEpisodeNumber from organizationresults";
|
cmd.CommandText = "SELECT ResultId, OriginalPath, TargetPath, OrganizationDate, Status, OrganizationType, StatusMessage, ExtractedName, ExtractedYear, ExtractedSeasonNumber, ExtractedEpisodeNumber, ExtractedEndingEpisodeNumber, DuplicatePaths from OrganizerResults";
|
||||||
|
|
||||||
if (query.StartIndex.HasValue && query.StartIndex.Value > 0)
|
if (query.StartIndex.HasValue && query.StartIndex.Value > 0)
|
||||||
{
|
{
|
||||||
cmd.CommandText += string.Format(" WHERE ResultId NOT IN (SELECT ResultId FROM organizationresults ORDER BY OrganizationDate desc LIMIT {0})",
|
cmd.CommandText += string.Format(" WHERE ResultId NOT IN (SELECT ResultId FROM OrganizerResults ORDER BY OrganizationDate desc LIMIT {0})",
|
||||||
query.StartIndex.Value.ToString(_usCulture));
|
query.StartIndex.Value.ToString(_usCulture));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +286,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
cmd.CommandText += " LIMIT " + query.Limit.Value.ToString(_usCulture);
|
cmd.CommandText += " LIMIT " + query.Limit.Value.ToString(_usCulture);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd.CommandText += "; select count (ResultId) from organizationresults";
|
cmd.CommandText += "; select count (ResultId) from OrganizerResults";
|
||||||
|
|
||||||
var list = new List<FileOrganizationResult>();
|
var list = new List<FileOrganizationResult>();
|
||||||
var count = 0;
|
var count = 0;
|
||||||
@ -320,7 +323,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
|
|
||||||
using (var cmd = _connection.CreateCommand())
|
using (var cmd = _connection.CreateCommand())
|
||||||
{
|
{
|
||||||
cmd.CommandText = "select ResultId, OriginalPath, TargetPath, OrganizationDate, Status, OrganizationType, StatusMessage, ExtractedName, ExtractedYear, ExtractedSeasonNumber, ExtractedEpisodeNumber, ExtractedEndingEpisodeNumber from organizationresults where ResultId=@Id";
|
cmd.CommandText = "select ResultId, OriginalPath, TargetPath, OrganizationDate, Status, OrganizationType, StatusMessage, ExtractedName, ExtractedYear, ExtractedSeasonNumber, ExtractedEpisodeNumber, ExtractedEndingEpisodeNumber, DuplicatePaths from OrganizerResults where ResultId=@Id";
|
||||||
|
|
||||||
cmd.Parameters.Add(cmd, "@Id", DbType.Guid).Value = guid;
|
cmd.Parameters.Add(cmd, "@Id", DbType.Guid).Value = guid;
|
||||||
|
|
||||||
@ -389,6 +392,11 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||||||
result.ExtractedEndingEpisodeNumber = reader.GetInt32(11);
|
result.ExtractedEndingEpisodeNumber = reader.GetInt32(11);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!reader.IsDBNull(12))
|
||||||
|
{
|
||||||
|
result.DuplicatePaths = reader.GetString(12).Split('|').Where(i => !string.IsNullOrEmpty(i)).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user