update interval trigger
This commit is contained in:
parent
d4050fbf2c
commit
5b21ec6747
|
@ -72,6 +72,7 @@ namespace MediaBrowser.Api
|
|||
_config.Configuration.EnableUserSpecificUserViews = true;
|
||||
_config.Configuration.EnableCustomPathSubFolders = true;
|
||||
_config.Configuration.DisableXmlSavers = true;
|
||||
_config.Configuration.DisableStartupScan = true;
|
||||
_config.SaveConfiguration();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,17 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
/// </value>
|
||||
public TaskExecutionOptions TaskOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the first run delay.
|
||||
/// </summary>
|
||||
/// <value>The first run delay.</value>
|
||||
public TimeSpan FirstRunDelay { get; set; }
|
||||
|
||||
public IntervalTrigger()
|
||||
{
|
||||
FirstRunDelay = TimeSpan.FromHours(1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stars waiting for the trigger action
|
||||
/// </summary>
|
||||
|
@ -41,7 +52,7 @@ namespace MediaBrowser.Common.ScheduledTasks
|
|||
|
||||
var triggerDate = lastResult != null ?
|
||||
lastResult.EndTimeUtc.Add(Interval) :
|
||||
DateTime.UtcNow.Add(Interval);
|
||||
DateTime.UtcNow.Add(FirstRunDelay);
|
||||
|
||||
if (DateTime.UtcNow > triggerDate)
|
||||
{
|
||||
|
|
|
@ -142,7 +142,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
public virtual string Path { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
protected internal bool IsOffline { get; set; }
|
||||
public bool IsOffline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the folder containing the item.
|
||||
|
|
|
@ -547,7 +547,8 @@ namespace MediaBrowser.Dlna
|
|||
new DefaultProfile(),
|
||||
new PopcornHourProfile(),
|
||||
new VlcProfile(),
|
||||
new BubbleUpnpProfile()
|
||||
new BubbleUpnpProfile(),
|
||||
new KodiProfile()
|
||||
};
|
||||
|
||||
foreach (var item in list)
|
||||
|
|
|
@ -166,7 +166,9 @@
|
|||
<EmbeddedResource Include="Profiles\Xml\Sony Bravia %282010%29.xml" />
|
||||
<EmbeddedResource Include="Profiles\Xml\Sony Bravia %282011%29.xml" />
|
||||
<EmbeddedResource Include="Profiles\Xml\Sony Bravia %282012%29.xml" />
|
||||
<EmbeddedResource Include="Profiles\Xml\Sony Bravia %282013%29.xml" />
|
||||
<EmbeddedResource Include="Profiles\Xml\Sony Bravia %282013%29.xml">
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Profiles\Xml\Sony PlayStation 3.xml" />
|
||||
<EmbeddedResource Include="Profiles\Xml\WDTV Live.xml" />
|
||||
<EmbeddedResource Include="Profiles\Xml\Xbox 360.xml">
|
||||
|
|
97
MediaBrowser.Dlna/Profiles/KodiProfile.cs
Normal file
97
MediaBrowser.Dlna/Profiles/KodiProfile.cs
Normal file
|
@ -0,0 +1,97 @@
|
|||
using MediaBrowser.Model.Dlna;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace MediaBrowser.Dlna.Profiles
|
||||
{
|
||||
[XmlRoot("Profile")]
|
||||
public class KodiProfile : DefaultProfile
|
||||
{
|
||||
public KodiProfile()
|
||||
{
|
||||
Name = "Kodi";
|
||||
|
||||
MaxStreamingBitrate = 100000000;
|
||||
MaxStaticBitrate = 100000000;
|
||||
MusicStreamingTranscodingBitrate = 1280000;
|
||||
MusicSyncBitrate = 1280000;
|
||||
|
||||
TimelineOffsetSeconds = 5;
|
||||
|
||||
Identification = new DeviceIdentification
|
||||
{
|
||||
ModelName = "Kodi",
|
||||
|
||||
Headers = new[]
|
||||
{
|
||||
new HttpHeaderInfo {Name = "User-Agent", Value = "Kodi", Match = HeaderMatchType.Substring}
|
||||
}
|
||||
};
|
||||
|
||||
TranscodingProfiles = new[]
|
||||
{
|
||||
new TranscodingProfile
|
||||
{
|
||||
Container = "mp3",
|
||||
AudioCodec = "mp3",
|
||||
Type = DlnaProfileType.Audio
|
||||
},
|
||||
|
||||
new TranscodingProfile
|
||||
{
|
||||
Container = "ts",
|
||||
Type = DlnaProfileType.Video,
|
||||
AudioCodec = "aac",
|
||||
VideoCodec = "h264"
|
||||
},
|
||||
|
||||
new TranscodingProfile
|
||||
{
|
||||
Container = "jpeg",
|
||||
Type = DlnaProfileType.Photo
|
||||
}
|
||||
};
|
||||
|
||||
DirectPlayProfiles = new[]
|
||||
{
|
||||
new DirectPlayProfile
|
||||
{
|
||||
Container = "",
|
||||
Type = DlnaProfileType.Video
|
||||
},
|
||||
|
||||
new DirectPlayProfile
|
||||
{
|
||||
Container = "",
|
||||
Type = DlnaProfileType.Audio
|
||||
},
|
||||
|
||||
new DirectPlayProfile
|
||||
{
|
||||
Container = "",
|
||||
Type = DlnaProfileType.Photo,
|
||||
}
|
||||
};
|
||||
|
||||
ResponseProfiles = new ResponseProfile[] { };
|
||||
|
||||
ContainerProfiles = new ContainerProfile[] { };
|
||||
|
||||
CodecProfiles = new CodecProfile[] { };
|
||||
|
||||
SubtitleProfiles = new[]
|
||||
{
|
||||
new SubtitleProfile
|
||||
{
|
||||
Format = "srt",
|
||||
Method = SubtitleDeliveryMethod.External,
|
||||
},
|
||||
|
||||
new SubtitleProfile
|
||||
{
|
||||
Format = "sub",
|
||||
Method = SubtitleDeliveryMethod.External,
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -98,6 +98,12 @@ namespace MediaBrowser.Model.Configuration
|
|||
/// <value><c>true</c> if [enable localized guids]; otherwise, <c>false</c>.</value>
|
||||
public bool EnableLocalizedGuids { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [disable startup scan].
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if [disable startup scan]; otherwise, <c>false</c>.</value>
|
||||
public bool DisableStartupScan { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether [enable library metadata sub folder].
|
||||
/// </summary>
|
||||
|
|
|
@ -131,7 +131,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
|||
{
|
||||
return new ITaskTrigger[]
|
||||
{
|
||||
new DailyTrigger { TimeOfDay = TimeSpan.FromHours(3) },
|
||||
new IntervalTrigger{ Interval = TimeSpan.FromHours(8)}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ using MediaBrowser.Common.ScheduledTasks;
|
|||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
using MediaBrowser.Model.Configuration;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Server.Implementations.ScheduledTasks;
|
||||
|
@ -700,4 +701,23 @@ namespace MediaBrowser.Server.Implementations.IO
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class LibraryMonitorStartup : IServerEntryPoint
|
||||
{
|
||||
private readonly ILibraryMonitor _monitor;
|
||||
|
||||
public LibraryMonitorStartup(ILibraryMonitor monitor)
|
||||
{
|
||||
_monitor = monitor;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
_monitor.Start();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -438,8 +438,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
return lineups;
|
||||
}
|
||||
|
||||
_logger.Info("Headends on account ");
|
||||
|
||||
var options = new HttpRequestOptions()
|
||||
{
|
||||
Url = ApiUrl + "/headends?country=" + country + "&postalcode=" + location,
|
||||
|
@ -454,16 +452,13 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
using (Stream responce = await _httpClient.Get(options).ConfigureAwait(false))
|
||||
{
|
||||
var root = _jsonSerializer.DeserializeFromStream<List<ScheduleDirect.Headends>>(responce);
|
||||
_logger.Info("Lineups on account ");
|
||||
|
||||
if (root != null)
|
||||
{
|
||||
foreach (ScheduleDirect.Headends headend in root)
|
||||
{
|
||||
_logger.Info("Headend: " + headend.headend);
|
||||
foreach (ScheduleDirect.Lineup lineup in headend.lineups)
|
||||
{
|
||||
_logger.Info("Headend: " + lineup.uri);
|
||||
|
||||
lineups.Add(new NameIdPair
|
||||
{
|
||||
Name = string.IsNullOrWhiteSpace(lineup.name) ? lineup.lineup : lineup.name,
|
||||
|
@ -474,7 +469,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.Listings
|
|||
}
|
||||
else
|
||||
{
|
||||
_logger.Info("No lineups on account");
|
||||
_logger.Info("No lineups available");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
using MediaBrowser.Common.Progress;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.LiveTv;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Model.Logging;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Persistence
|
||||
{
|
||||
|
@ -17,12 +18,14 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IItemRepository _itemRepo;
|
||||
private readonly ILogger _logger;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
|
||||
public CleanDatabaseScheduledTask(ILibraryManager libraryManager, IItemRepository itemRepo, ILogger logger)
|
||||
public CleanDatabaseScheduledTask(ILibraryManager libraryManager, IItemRepository itemRepo, ILogger logger, IServerConfigurationManager config)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
_itemRepo = itemRepo;
|
||||
_logger = logger;
|
||||
_config = config;
|
||||
}
|
||||
|
||||
public string Name
|
||||
|
@ -53,7 +56,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
var itemIds = _libraryManager.GetItemIds(new InternalItemsQuery
|
||||
{
|
||||
IsCurrentSchema = false,
|
||||
Limit = 100000,
|
||||
|
||||
// These are constantly getting regenerated so don't bother with them here
|
||||
ExcludeItemTypes = new[] { typeof(LiveTvProgram).Name }
|
||||
|
@ -81,6 +83,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
progress.Report(percent * 100);
|
||||
}
|
||||
|
||||
if (!_config.Configuration.DisableStartupScan)
|
||||
{
|
||||
_config.Configuration.DisableStartupScan = true;
|
||||
_config.SaveConfiguration();
|
||||
}
|
||||
|
||||
progress.Report(100);
|
||||
}
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
private IDbCommand _deletePeopleCommand;
|
||||
private IDbCommand _savePersonCommand;
|
||||
|
||||
private const int LatestSchemaVersion = 4;
|
||||
private const int LatestSchemaVersion = 6;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
||||
|
@ -173,6 +173,9 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
_connection.AddColumn(_logger, "TypedBaseItems", "DateCreated", "DATETIME");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "DateModified", "DATETIME");
|
||||
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "ForcedSortName", "Text");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "IsOffline", "BIT");
|
||||
|
||||
PrepareStatements();
|
||||
|
||||
_mediaStreamsRepository.Initialize();
|
||||
|
@ -223,7 +226,9 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
"VoteCount",
|
||||
"DisplayMediaType",
|
||||
"DateCreated",
|
||||
"DateModified"
|
||||
"DateModified",
|
||||
"ForcedSortName",
|
||||
"IsOffline"
|
||||
};
|
||||
_saveItemCommand = _connection.CreateCommand();
|
||||
_saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (";
|
||||
|
@ -391,6 +396,9 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
_saveItemCommand.GetParameter(index++).Value = item.DateCreated;
|
||||
_saveItemCommand.GetParameter(index++).Value = item.DateModified;
|
||||
|
||||
_saveItemCommand.GetParameter(index++).Value = item.ForcedSortName;
|
||||
_saveItemCommand.GetParameter(index++).Value = item.IsOffline;
|
||||
|
||||
_saveItemCommand.Transaction = transaction;
|
||||
|
||||
_saveItemCommand.ExecuteNonQuery();
|
||||
|
@ -948,7 +956,6 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
}
|
||||
|
||||
var includeTypes = query.IncludeItemTypes.SelectMany(MapIncludeItemTypes).ToArray();
|
||||
|
||||
if (includeTypes.Length == 1)
|
||||
{
|
||||
whereClauses.Add("type=@type");
|
||||
|
@ -959,6 +966,19 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
var inClause = string.Join(",", includeTypes.Select(i => "'" + i + "'").ToArray());
|
||||
whereClauses.Add(string.Format("type in ({0})", inClause));
|
||||
}
|
||||
|
||||
var excludeTypes = query.ExcludeItemTypes.SelectMany(MapIncludeItemTypes).ToArray();
|
||||
if (excludeTypes.Length == 1)
|
||||
{
|
||||
whereClauses.Add("type<>@type");
|
||||
cmd.Parameters.Add(cmd, "@type", DbType.String).Value = excludeTypes[0];
|
||||
}
|
||||
else if (excludeTypes.Length > 1)
|
||||
{
|
||||
var inClause = string.Join(",", excludeTypes.Select(i => "'" + i + "'").ToArray());
|
||||
whereClauses.Add(string.Format("type not in ({0})", inClause));
|
||||
}
|
||||
|
||||
if (query.ChannelIds.Length == 1)
|
||||
{
|
||||
whereClauses.Add("ChannelId=@ChannelId");
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using System.Linq;
|
||||
using MediaBrowser.Common.ScheduledTasks;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Server.Implementations.Library;
|
||||
using System;
|
||||
|
@ -17,14 +19,16 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
|
|||
/// The _library manager
|
||||
/// </summary>
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IServerConfigurationManager _config;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RefreshMediaLibraryTask" /> class.
|
||||
/// </summary>
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
public RefreshMediaLibraryTask(ILibraryManager libraryManager)
|
||||
public RefreshMediaLibraryTask(ILibraryManager libraryManager, IServerConfigurationManager config)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
_config = config;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -33,12 +37,18 @@ namespace MediaBrowser.Server.Implementations.ScheduledTasks
|
|||
/// <returns>IEnumerable{BaseTaskTrigger}.</returns>
|
||||
public IEnumerable<ITaskTrigger> GetDefaultTriggers()
|
||||
{
|
||||
return new ITaskTrigger[] {
|
||||
|
||||
new StartupTrigger(),
|
||||
var list = new ITaskTrigger[] {
|
||||
|
||||
new IntervalTrigger{ Interval = TimeSpan.FromHours(8)}
|
||||
};
|
||||
|
||||
}.ToList();
|
||||
|
||||
if (!_config.Configuration.DisableStartupScan)
|
||||
{
|
||||
list.Add(new StartupTrigger());
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue
Block a user