Merge pull request #9 from jellyfin/master

nightly
pull/2160/head
artiume 4 years ago committed by GitHub
commit d4470b5709
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,128 +0,0 @@
#pragma warning disable CS1591
#pragma warning disable SA1600
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Plugins;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Tasks;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.EntryPoints
{
public class AutomaticRestartEntryPoint : IServerEntryPoint
{
private readonly IServerApplicationHost _appHost;
private readonly ILogger _logger;
private readonly ITaskManager _iTaskManager;
private readonly ISessionManager _sessionManager;
private readonly IServerConfigurationManager _config;
private readonly ILiveTvManager _liveTvManager;
private Timer _timer;
public AutomaticRestartEntryPoint(IServerApplicationHost appHost, ILogger logger, ITaskManager iTaskManager, ISessionManager sessionManager, IServerConfigurationManager config, ILiveTvManager liveTvManager)
{
_appHost = appHost;
_logger = logger;
_iTaskManager = iTaskManager;
_sessionManager = sessionManager;
_config = config;
_liveTvManager = liveTvManager;
}
public Task RunAsync()
{
if (_appHost.CanSelfRestart)
{
_appHost.HasPendingRestartChanged += _appHost_HasPendingRestartChanged;
}
return Task.CompletedTask;
}
void _appHost_HasPendingRestartChanged(object sender, EventArgs e)
{
DisposeTimer();
if (_appHost.HasPendingRestart)
{
_timer = new Timer(TimerCallback, null, TimeSpan.FromMinutes(15), TimeSpan.FromMinutes(15));
}
}
private async void TimerCallback(object state)
{
if (_config.Configuration.EnableAutomaticRestart)
{
var isIdle = await IsIdle().ConfigureAwait(false);
if (isIdle)
{
DisposeTimer();
_logger.LogInformation("Automatically restarting the system because it is idle and a restart is required.");
try
{
_appHost.Restart();
}
catch (Exception ex)
{
_logger.LogError(ex, "Error restarting server");
}
}
}
}
private async Task<bool> IsIdle()
{
if (_iTaskManager.ScheduledTasks.Any(i => i.State != TaskState.Idle))
{
return false;
}
if (_liveTvManager.Services.Count == 1)
{
try
{
var timers = await _liveTvManager.GetTimers(new TimerQuery(), CancellationToken.None).ConfigureAwait(false);
if (timers.Items.Any(i => i.Status == RecordingStatus.InProgress))
{
return false;
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Error getting timers");
}
}
var now = DateTime.UtcNow;
return !_sessionManager.Sessions.Any(i => (now - i.LastActivityDate).TotalMinutes < 30);
}
public void Dispose()
{
_appHost.HasPendingRestartChanged -= _appHost_HasPendingRestartChanged;
DisposeTimer();
}
private void DisposeTimer()
{
if (_timer != null)
{
_timer.Dispose();
_timer = null;
}
}
}
}

@ -9,7 +9,7 @@
"Channels": "القنوات",
"ChapterNameValue": "الباب {0}",
"Collections": "مجموعات",
"DeviceOfflineWithName": " قُطِع الاتصال بـ{0}",
"DeviceOfflineWithName": "تم قطع اتصال {0}",
"DeviceOnlineWithName": "{0} متصل",
"FailedLoginAttemptWithUserName": "عملية تسجيل الدخول فشلت من {0}",
"Favorites": "التفضيلات",
@ -75,8 +75,8 @@
"Songs": "الأغاني",
"StartupEmbyServerIsLoading": "سيرفر Jellyfin قيد التشغيل . الرجاء المحاولة بعد قليل.",
"SubtitleDownloadFailureForItem": "عملية إنزال الترجمة فشلت لـ{0}",
"SubtitleDownloadFailureFromForItem": "الترجمات فشلت في التحميل من {0} لـ {1}",
"SubtitlesDownloadedForItem": "تم تحميل الترجمات لـ {0}",
"SubtitleDownloadFailureFromForItem": "الترجمات فشلت في التحميل من {0} الى {1}",
"SubtitlesDownloadedForItem": "تم تحميل الترجمات الى {0}",
"Sync": "مزامنة",
"System": "النظام",
"TvShows": "البرامج التلفزيونية",
@ -88,7 +88,7 @@
"UserOfflineFromDevice": "تم قطع اتصال {0} من {1}",
"UserOnlineFromDevice": "{0} متصل عبر {1}",
"UserPasswordChangedWithName": "تم تغيير كلمة السر للمستخدم {0}",
"UserPolicyUpdatedWithName": "سياسة المستخدمين تم تحديثها لـ {0}",
"UserPolicyUpdatedWithName": "تم تحديث سياسة المستخدم {0}",
"UserStartedPlayingItemWithValues": "قام {0} ببدء تشغيل {1} على {2}",
"UserStoppedPlayingItemWithValues": "قام {0} بإيقاف تشغيل {1} على {2}",
"ValueHasBeenAddedToLibrary": "{0} تم اضافتها الى مكتبة الوسائط",

@ -0,0 +1,95 @@
{
"VersionNumber": "Bersyon {0}",
"ValueSpecialEpisodeName": "Espesyal - {0}",
"ValueHasBeenAddedToLibrary": "Naidagdag na ang {0} sa iyong media library",
"UserStoppedPlayingItemWithValues": "Natapos ni {0} ang {1} sa {2}",
"UserStartedPlayingItemWithValues": "Si {0} ay nagplaplay ng {1} sa {2}",
"UserPolicyUpdatedWithName": "Ang user policy ay naiupdate para kay {0}",
"UserPasswordChangedWithName": "Napalitan na ang password ni {0}",
"UserOnlineFromDevice": "Si {0} ay nakakonekta galing sa {1}",
"UserOfflineFromDevice": "Si {0} ay nadiskonekta galing sa {1}",
"UserLockedOutWithName": "Si {0} ay nalock out",
"UserDownloadingItemWithValues": "Nagdadownload si {0} ng {1}",
"UserDeletedWithName": "Natanggal na is user {0}",
"UserCreatedWithName": "Nagawa na si user {0}",
"User": "User",
"TvShows": "Pelikula",
"System": "Sistema",
"Sync": "Pag-sync",
"SubtitlesDownloadedForItem": "Naidownload na ang subtitles {0}",
"SubtitleDownloadFailureFromForItem": "Hindi naidownload ang subtitles {0} para sa {1}",
"StartupEmbyServerIsLoading": "Nagloload ang Jellyfin Server. Sandaling maghintay.",
"Songs": "Kanta",
"Shows": "Pelikula",
"ServerNameNeedsToBeRestarted": "Kailangan irestart ang {0}",
"ScheduledTaskStartedWithName": "Nagsimula na ang {0}",
"ScheduledTaskFailedWithName": "Hindi gumana and {0}",
"ProviderValue": "Ang provider ay {0}",
"PluginUpdatedWithName": "Naiupdate na ang {0}",
"PluginUninstalledWithName": "Naiuninstall na ang {0}",
"PluginInstalledWithName": "Nainstall na ang {0}",
"Plugin": "Plugin",
"Playlists": "Playlists",
"Photos": "Larawan",
"NotificationOptionVideoPlaybackStopped": "Huminto na ang pelikula",
"NotificationOptionVideoPlayback": "Nagsimula na ang pelikula",
"NotificationOptionUserLockedOut": "Nakalock out ang user",
"NotificationOptionTaskFailed": "Hindi gumana ang scheduled task",
"NotificationOptionServerRestartRequired": "Kailangan irestart ang server",
"NotificationOptionPluginUpdateInstalled": "Naiupdate na ang plugin",
"NotificationOptionPluginUninstalled": "Naiuninstall na ang plugin",
"NotificationOptionPluginInstalled": "Nainstall na ang plugin",
"NotificationOptionPluginError": "Hindi gumagana ang plugin",
"NotificationOptionNewLibraryContent": "May bagong content na naidagdag",
"NotificationOptionInstallationFailed": "Hindi nainstall ng mabuti",
"NotificationOptionCameraImageUploaded": "Naiupload na ang picture",
"NotificationOptionAudioPlaybackStopped": "Huminto na ang patugtog",
"NotificationOptionAudioPlayback": "Nagsimula na ang patugtog",
"NotificationOptionApplicationUpdateInstalled": "Naiupdate na ang aplikasyon",
"NotificationOptionApplicationUpdateAvailable": "May bagong update ang aplikasyon",
"NewVersionIsAvailable": "May bagong version ng Jellyfin Server na pwede idownload.",
"NameSeasonUnknown": "Hindi alam ang season",
"NameSeasonNumber": "Season {0}",
"NameInstallFailed": "Hindi nainstall ang {0}",
"MusicVideos": "Music video",
"Music": "Kanta",
"Movies": "Pelikula",
"MixedContent": "Halo-halong content",
"MessageServerConfigurationUpdated": "Naiupdate na ang server configuration",
"MessageNamedServerConfigurationUpdatedWithValue": "Naiupdate na ang server configuration section {0}",
"MessageApplicationUpdatedTo": "Ang Jellyfin Server ay naiupdate to {0}",
"MessageApplicationUpdated": "Naiupdate na ang Jellyfin Server",
"Latest": "Pinakabago",
"LabelRunningTimeValue": "Oras: {0}",
"LabelIpAddressValue": "Ang IP Address ay {0}",
"ItemRemovedWithName": "Naitanggal ang {0} sa library",
"ItemAddedWithName": "Naidagdag ang {0} sa library",
"Inherit": "Manahin",
"HeaderRecordingGroups": "Pagtatalang Grupo",
"HeaderNextUp": "Susunod",
"HeaderLiveTV": "Live TV",
"HeaderFavoriteSongs": "Paboritong Kanta",
"HeaderFavoriteShows": "Paboritong Pelikula",
"HeaderFavoriteEpisodes": "Paboritong Episodes",
"HeaderFavoriteArtists": "Paboritong Artista",
"HeaderFavoriteAlbums": "Paboritong Albums",
"HeaderContinueWatching": "Ituloy Manood",
"HeaderCameraUploads": "Camera Uploads",
"HeaderAlbumArtists": "Artista ng Album",
"Genres": "Kategorya",
"Folders": "Folders",
"Favorites": "Paborito",
"FailedLoginAttemptWithUserName": "maling login galing {0}",
"DeviceOnlineWithName": "nakakonekta si {0}",
"DeviceOfflineWithName": "nadiskonekta si {0}",
"Collections": "Koleksyon",
"ChapterNameValue": "Kabanata {0}",
"Channels": "Channel",
"CameraImageUploadedFrom": "May bagong larawan na naupload galing {0}",
"Books": "Libro",
"AuthenticationSucceededWithUserName": "{0} na patunayan",
"Artists": "Artista",
"Application": "Aplikasyon",
"AppDeviceValues": "Aplikasyon: {0}, Aparato: {1}",
"Albums": "Albums"
}

@ -485,7 +485,7 @@ namespace Jellyfin.Server
.WriteTo.Async(x => x.File(
Path.Combine(appPaths.LogDirectoryPath, "log_.log"),
rollingInterval: RollingInterval.Day,
outputTemplate: "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] [{ThreadId}] {SourceContext}:{Message}{NewLine}{Exception}"))
outputTemplate: "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message}{NewLine}{Exception}"))
.Enrich.FromLogContext()
.Enrich.WithThreadId()
.CreateLogger();

@ -20,7 +20,7 @@
"retainedFileCountLimit": 3,
"rollOnFileSizeLimit": true,
"fileSizeLimitBytes": 100000000,
"outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] [{ThreadId}] {SourceContext}:{Message}{NewLine}{Exception}"
"outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz}] [{Level:u3}] [{ThreadId}] {SourceContext}: {Message}{NewLine}{Exception}"
}
}
]

@ -60,14 +60,7 @@ namespace MediaBrowser.Controller.Entities
PresetViews = query.PresetViews
});
var itemsArray = result;
var totalCount = itemsArray.Length;
return new QueryResult<BaseItem>
{
TotalRecordCount = totalCount,
Items = itemsArray //TODO Fix The co-variant conversion between Folder[] and BaseItem[], this can generate runtime issues.
};
return UserViewBuilder.SortAndPage(result, null, query, LibraryManager, true);
}
public override int GetChildCount(User user)

@ -159,7 +159,6 @@ namespace MediaBrowser.Model.Configuration
public MetadataOptions[] MetadataOptions { get; set; }
public bool EnableAutomaticRestart { get; set; }
public bool SkipDeserializationForBasicTypes { get; set; }
public string ServerName { get; set; }
@ -249,7 +248,6 @@ namespace MediaBrowser.Model.Configuration
EnableDashboardResponseCaching = true;
EnableCaseSensitiveItemIds = true;
EnableAutomaticRestart = true;
AutoRunWebApp = true;
EnableRemoteAccess = true;

@ -210,10 +210,7 @@ namespace MediaBrowser.Model.Dto
{
if (currentStream.Type == MediaStreamType.Audio && currentStream.IsDefault)
{
if (currentStream.Index != stream.Index)
{
return true;
}
return currentStream.Index != stream.Index;
}
}

@ -26,7 +26,7 @@ rm -rf ${web_build_dir}
version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )"
# Build archives
dotnet publish --configuration Release --self-contained --runtime linux-x64 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
dotnet publish Jellyfin.Server --configuration Release --self-contained --runtime linux-x64 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
tar -cvzf /jellyfin_${version}.portable.tar.gz -C /dist jellyfin_${version}
rm -rf /dist/jellyfin_${version}

@ -26,7 +26,7 @@ rm -rf ${web_build_dir}
version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )"
# Build archives
dotnet publish --configuration Release --self-contained --runtime osx-x64 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
dotnet publish Jellyfin.Server --configuration Release --self-contained --runtime osx-x64 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
tar -cvzf /jellyfin_${version}.portable.tar.gz -C /dist jellyfin_${version}
rm -rf /dist/jellyfin_${version}

@ -26,7 +26,7 @@ rm -rf ${web_build_dir}
version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )"
# Build archives
dotnet publish --configuration Release --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none"
dotnet publish Jellyfin.Server --configuration Release --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none"
tar -cvzf /jellyfin_${version}.portable.tar.gz -C /dist jellyfin_${version}
rm -rf /dist/jellyfin_${version}

@ -32,7 +32,7 @@ rm -rf ${web_build_dir}
version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )"
# Build binary
dotnet publish --configuration Release --self-contained --runtime win-x64 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
dotnet publish Jellyfin.Server --configuration Release --self-contained --runtime win-x64 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
# Prepare addins
addin_build_dir="$( mktemp -d )"

@ -32,7 +32,7 @@ rm -rf ${web_build_dir}
version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )"
# Build binary
dotnet publish --configuration Release --self-contained --runtime win-x86 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
dotnet publish Jellyfin.Server --configuration Release --self-contained --runtime win-x86 --output /dist/jellyfin_${version}/ "-p:GenerateDocumentationFile=false;DebugSymbols=false;DebugType=none;UseAppHost=true"
# Prepare addins
addin_build_dir="$( mktemp -d )"

Loading…
Cancel
Save