From b35051463b6241bae93e5d50c0a2a1fe06da5e2f Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 6 Feb 2017 01:05:34 -0500 Subject: [PATCH 01/22] restore features --- .../LiveTv/EmbyTV/EncodedRecorder.cs | 2 - .../Encoder/EncodingHelper.cs | 50 +++++++++---------- 2 files changed, 25 insertions(+), 27 deletions(-) diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs index 1f739b3c6..68126f926 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs @@ -155,8 +155,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV var durationParam = " -t " + _mediaEncoder.GetTimeParameter(duration.Ticks); var inputModifiers = "-fflags +genpts -async 1 -vsync -1"; var mapArgs = string.Equals(OutputFormat, "mkv", StringComparison.OrdinalIgnoreCase) ? "-map 0" : "-sn"; - // temporary - mapArgs = "-sn"; var commandLineArgs = "-i \"{0}\"{4} " + mapArgs + " {2} -map_metadata -1 -threads 0 {3} -y \"{1}\""; long startTimeTicks = 0; diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs index 83057dba4..ed9552964 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs @@ -1486,33 +1486,33 @@ namespace MediaBrowser.MediaEncoding.Encoder //inputModifier += " -noaccurate_seek"; } - //if (!string.IsNullOrWhiteSpace(state.InputContainer)) - //{ - // var inputFormat = GetInputFormat(state.InputContainer); - // if (!string.IsNullOrWhiteSpace(inputFormat)) - // { - // inputModifier += " -f " + inputFormat; - // } - //} + if (!string.IsNullOrWhiteSpace(state.InputContainer)) + { + var inputFormat = GetInputFormat(state.InputContainer); + if (!string.IsNullOrWhiteSpace(inputFormat)) + { + inputModifier += " -f " + inputFormat; + } + } - //if (state.RunTimeTicks.HasValue) - //{ - // foreach (var stream in state.MediaSource.MediaStreams) - // { - // if (!stream.IsExternal && stream.Type != MediaStreamType.Subtitle) - // { - // if (!string.IsNullOrWhiteSpace(stream.Codec) && stream.Index != -1) - // { - // var decoder = GetDecoderFromCodec(stream.Codec); + if (state.RunTimeTicks.HasValue) + { + foreach (var stream in state.MediaSource.MediaStreams) + { + if (!stream.IsExternal && stream.Type != MediaStreamType.Subtitle) + { + if (!string.IsNullOrWhiteSpace(stream.Codec) && stream.Index != -1) + { + var decoder = GetDecoderFromCodec(stream.Codec); - // if (!string.IsNullOrWhiteSpace(decoder)) - // { - // inputModifier += " -codec:" + stream.Index.ToString(_usCulture) + " " + decoder; - // } - // } - // } - // } - //} + if (!string.IsNullOrWhiteSpace(decoder)) + { + inputModifier += " -codec:" + stream.Index.ToString(_usCulture) + " " + decoder; + } + } + } + } + } } return inputModifier; From 4704d22944f24fd1ab5a312e3d7b1b02be838a10 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 6 Feb 2017 01:51:02 -0500 Subject: [PATCH 02/22] version bump --- SharedVersion.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index 16c597910..b63f7d15e 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,4 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.1.*")] -//[assembly: AssemblyVersion("3.1.259")] +[assembly: AssemblyVersion("3.2.0.100")] From 730dd523c07a06105b8e0f597c782f1dd5d80a7e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 6 Feb 2017 01:52:21 -0500 Subject: [PATCH 03/22] fix merge conflict --- SharedVersion.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index 05eb1febb..b63f7d15e 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,4 +1,3 @@ using System.Reflection; -//[assembly: AssemblyVersion("3.1.*")] -[assembly: AssemblyVersion("3.1.295")] +[assembly: AssemblyVersion("3.2.0.100")] From d2d287bd283a6a2c4bd97ae3e2700b74d4437c18 Mon Sep 17 00:00:00 2001 From: Luke Date: Mon, 6 Feb 2017 13:45:24 -0500 Subject: [PATCH 04/22] update mac project --- .../Emby.Server.Mac.csproj | 828 +----------------- 1 file changed, 6 insertions(+), 822 deletions(-) diff --git a/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj b/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj index 85c7533a7..7f3baf0c0 100644 --- a/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj +++ b/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj @@ -576,39 +576,12 @@ Resources\dashboard-ui\wizarduser.html - - Resources\dashboard-ui\bower_components\Sortable\.bower.json - - - Resources\dashboard-ui\bower_components\Sortable\.editorconfig - - - Resources\dashboard-ui\bower_components\Sortable\.gitignore - - - Resources\dashboard-ui\bower_components\Sortable\.jshintrc - - - Resources\dashboard-ui\bower_components\Sortable\CONTRIBUTING.md - - - Resources\dashboard-ui\bower_components\Sortable\Gruntfile.js - - - Resources\dashboard-ui\bower_components\Sortable\README.md - Resources\dashboard-ui\bower_components\Sortable\Sortable.html Resources\dashboard-ui\bower_components\Sortable\Sortable.min.js - - Resources\dashboard-ui\bower_components\Sortable\bower.json - - - Resources\dashboard-ui\bower_components\Sortable\component.json - Resources\dashboard-ui\bower_components\Sortable\index.html @@ -621,30 +594,12 @@ Resources\dashboard-ui\bower_components\Sortable\ng-sortable.js - - Resources\dashboard-ui\bower_components\Sortable\package.json - Resources\dashboard-ui\bower_components\Sortable\react-sortable-mixin.js - - Resources\dashboard-ui\bower_components\Swiper\.bower.json - - - Resources\dashboard-ui\bower_components\Swiper\CHANGELOG.md - Resources\dashboard-ui\bower_components\Swiper\LICENSE - - Resources\dashboard-ui\bower_components\Swiper\README.md - - - Resources\dashboard-ui\bower_components\Swiper\bower.json - - - Resources\dashboard-ui\bower_components\Swiper\component.json - Resources\dashboard-ui\bower_components\Swiper\gulpfile.js @@ -657,261 +612,24 @@ Resources\dashboard-ui\bower_components\Swiper\dist\js\swiper.min.js - - Resources\dashboard-ui\bower_components\cryptojslib\.bower.json - - - Resources\dashboard-ui\bower_components\cryptojslib\.gitattributes - - - Resources\dashboard-ui\bower_components\cryptojslib\.gitignore - - - Resources\dashboard-ui\bower_components\cryptojslib\README.md - - - Resources\dashboard-ui\bower_components\cryptojslib\bower.json - - - Resources\dashboard-ui\bower_components\cryptojslib\copyright.txt - - - Resources\dashboard-ui\bower_components\cryptojslib\push.bat - - - Resources\dashboard-ui\bower_components\cryptojslib\status.bat - - - Resources\dashboard-ui\bower_components\cryptojslib\components\aes-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\aes.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\cipher-core-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\cipher-core.js - Resources\dashboard-ui\bower_components\cryptojslib\components\core-min.js - - Resources\dashboard-ui\bower_components\cryptojslib\components\core.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\enc-base64-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\enc-base64.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\enc-utf16-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\enc-utf16.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\evpkdf-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\evpkdf.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\format-hex-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\format-hex.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\hmac-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\hmac.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\lib-typedarrays-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\lib-typedarrays.js - Resources\dashboard-ui\bower_components\cryptojslib\components\md5-min.js - - Resources\dashboard-ui\bower_components\cryptojslib\components\md5.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\mode-cfb-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\mode-cfb.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\mode-ctr-gladman-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\mode-ctr-gladman.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\mode-ctr-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\mode-ctr.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\mode-ecb-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\mode-ecb.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\mode-ofb-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\mode-ofb.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\pad-ansix923-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\pad-ansix923.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\pad-iso10126-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\pad-iso10126.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\pad-iso97971-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\pad-iso97971.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\pad-nopadding-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\pad-nopadding.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\pad-zeropadding-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\pad-zeropadding.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\pbkdf2-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\pbkdf2.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\rabbit-legacy-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\rabbit-legacy.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\rabbit-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\rabbit.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\rc4-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\rc4.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\ripemd160-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\ripemd160.js - Resources\dashboard-ui\bower_components\cryptojslib\components\sha1-min.js - - Resources\dashboard-ui\bower_components\cryptojslib\components\sha1.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\sha224-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\sha224.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\sha256-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\sha256.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\sha3-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\sha3.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\sha384-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\sha384.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\sha512-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\sha512.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\tripledes-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\tripledes.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\x64-core-min.js - - - Resources\dashboard-ui\bower_components\cryptojslib\components\x64-core.js - - - Resources\dashboard-ui\bower_components\document-register-element\.bower.json - - - Resources\dashboard-ui\bower_components\document-register-element\LICENSE.txt - - - Resources\dashboard-ui\bower_components\document-register-element\README.md - - - Resources\dashboard-ui\bower_components\document-register-element\RESOURCES.md - Resources\dashboard-ui\bower_components\document-register-element\basic.html - - Resources\dashboard-ui\bower_components\document-register-element\bower.json - Resources\dashboard-ui\bower_components\document-register-element\testrunner.js Resources\dashboard-ui\bower_components\document-register-element\build\document-register-element.js - - Resources\dashboard-ui\bower_components\emby-apiclient\.bower.json - - - Resources\dashboard-ui\bower_components\emby-apiclient\LICENSE.md - - - Resources\dashboard-ui\bower_components\emby-apiclient\README.md - Resources\dashboard-ui\bower_components\emby-apiclient\apiclient.js @@ -927,9 +645,6 @@ Resources\dashboard-ui\bower_components\emby-apiclient\appstorage-memory.js - - Resources\dashboard-ui\bower_components\emby-apiclient\bower.json - Resources\dashboard-ui\bower_components\emby-apiclient\cameraroll.js @@ -996,21 +711,9 @@ Resources\dashboard-ui\bower_components\emby-apiclient\sync\userrepository.js - - Resources\dashboard-ui\bower_components\emby-webcomponents\.bower.json - - - Resources\dashboard-ui\bower_components\emby-webcomponents\LICENSE.md - - - Resources\dashboard-ui\bower_components\emby-webcomponents\README.md - Resources\dashboard-ui\bower_components\emby-webcomponents\appsettings.js - - Resources\dashboard-ui\bower_components\emby-webcomponents\bower.json - Resources\dashboard-ui\bower_components\emby-webcomponents\browser.js @@ -1041,6 +744,9 @@ Resources\dashboard-ui\bower_components\emby-webcomponents\filesystem.js + + Resources\dashboard-ui\bower_components\emby-webcomponents\flexstyles.css + Resources\dashboard-ui\bower_components\emby-webcomponents\focusmanager.js @@ -1467,9 +1173,6 @@ Resources\dashboard-ui\bower_components\emby-webcomponents\multiselect\multiselect.js - - Resources\dashboard-ui\bower_components\emby-webcomponents\native-promise-only\README.md - Resources\dashboard-ui\bower_components\emby-webcomponents\native-promise-only\test_adapter.js @@ -1488,6 +1191,9 @@ Resources\dashboard-ui\bower_components\emby-webcomponents\pagejs\page.js + + Resources\dashboard-ui\bower_components\emby-webcomponents\playback\autoplaydetect.js + Resources\dashboard-ui\bower_components\emby-webcomponents\playback\nowplayinghelper.js @@ -1608,9 +1314,6 @@ Resources\dashboard-ui\bower_components\emby-webcomponents\sharing\social-share-kit-1.0.10\LICENSE - - Resources\dashboard-ui\bower_components\emby-webcomponents\sharing\social-share-kit-1.0.10\README.md - Resources\dashboard-ui\bower_components\emby-webcomponents\sharing\social-share-kit-1.0.10\dist\css\social-share-kit.css @@ -1806,9 +1509,6 @@ Resources\dashboard-ui\bower_components\emby-webcomponents\viewmanager\viewmanager.js - - Resources\dashboard-ui\bower_components\emby-webcomponents\voice\Readme.md - Resources\dashboard-ui\bower_components\emby-webcomponents\voice\grammarprocessor.js @@ -1860,48 +1560,15 @@ Resources\dashboard-ui\bower_components\emby-webcomponents\youtubeplayer\style.css - - Resources\dashboard-ui\bower_components\fetch\.bower.json - Resources\dashboard-ui\bower_components\fetch\LICENSE - - Resources\dashboard-ui\bower_components\fetch\bower.json - Resources\dashboard-ui\bower_components\fetch\fetch.js - - Resources\dashboard-ui\bower_components\font-roboto\.bower.json - - - Resources\dashboard-ui\bower_components\font-roboto\README.md - - - Resources\dashboard-ui\bower_components\font-roboto\bower.json - Resources\dashboard-ui\bower_components\font-roboto\roboto.html - - Resources\dashboard-ui\bower_components\hammerjs\.bower.json - - - Resources\dashboard-ui\bower_components\hammerjs\CHANGELOG.md - - - Resources\dashboard-ui\bower_components\hammerjs\CONTRIBUTING.md - - - Resources\dashboard-ui\bower_components\hammerjs\LICENSE.md - - - Resources\dashboard-ui\bower_components\hammerjs\README.md - - - Resources\dashboard-ui\bower_components\hammerjs\bower.json - Resources\dashboard-ui\bower_components\hammerjs\changelog.js @@ -1911,27 +1578,9 @@ Resources\dashboard-ui\bower_components\hammerjs\hammer.min.js - - Resources\dashboard-ui\bower_components\hammerjs\hammer.min.js.map - - - Resources\dashboard-ui\bower_components\hammerjs\hammer.min.map - - - Resources\dashboard-ui\bower_components\headroomjs\.bower.json - Resources\dashboard-ui\bower_components\headroomjs\LICENSE - - Resources\dashboard-ui\bower_components\headroomjs\README.md - - - Resources\dashboard-ui\bower_components\headroomjs\bower.json - - - Resources\dashboard-ui\bower_components\headroomjs\package.json - Resources\dashboard-ui\bower_components\headroomjs\dist\angular.headroom.js @@ -1950,75 +1599,18 @@ Resources\dashboard-ui\bower_components\headroomjs\dist\jQuery.headroom.min.js - - Resources\dashboard-ui\bower_components\hlsjs\.bower.json - - - Resources\dashboard-ui\bower_components\hlsjs\API.md - - - Resources\dashboard-ui\bower_components\hlsjs\CONTRIBUTING.md - - - Resources\dashboard-ui\bower_components\hlsjs\ISSUE_TEMPLATE.md - Resources\dashboard-ui\bower_components\hlsjs\LICENSE - - Resources\dashboard-ui\bower_components\hlsjs\README.md - - - Resources\dashboard-ui\bower_components\hlsjs\bower.json - - - Resources\dashboard-ui\bower_components\hlsjs\design.md - Resources\dashboard-ui\bower_components\hlsjs\hls.js.sublime-project - - Resources\dashboard-ui\bower_components\hlsjs\package.json - Resources\dashboard-ui\bower_components\hlsjs\dist\hls.min.js - - Resources\dashboard-ui\bower_components\howlerjs\.bower.json - - - Resources\dashboard-ui\bower_components\howlerjs\CHANGELOG.md - - - Resources\dashboard-ui\bower_components\howlerjs\LICENSE.md - - - Resources\dashboard-ui\bower_components\howlerjs\README.md - - - Resources\dashboard-ui\bower_components\howlerjs\bower.json - Resources\dashboard-ui\bower_components\howlerjs\howler.min.js - - Resources\dashboard-ui\bower_components\howlerjs\package.json - - - Resources\dashboard-ui\bower_components\jquery\.bower.json - - - Resources\dashboard-ui\bower_components\jquery\AUTHORS.txt - - - Resources\dashboard-ui\bower_components\jquery\LICENSE.txt - - - Resources\dashboard-ui\bower_components\jquery\README.md - - - Resources\dashboard-ui\bower_components\jquery\bower.json - Resources\dashboard-ui\bower_components\jquery\dist\core.js @@ -2028,240 +1620,15 @@ Resources\dashboard-ui\bower_components\jquery\dist\jquery.min.js - - Resources\dashboard-ui\bower_components\jquery\dist\jquery.min.map - Resources\dashboard-ui\bower_components\jquery\dist\jquery.slim.js Resources\dashboard-ui\bower_components\jquery\dist\jquery.slim.min.js - - Resources\dashboard-ui\bower_components\jquery\dist\jquery.slim.min.map - - - Resources\dashboard-ui\bower_components\jquery\external\sizzle\LICENSE.txt - - - Resources\dashboard-ui\bower_components\jquery\external\sizzle\dist\sizzle.js - - - Resources\dashboard-ui\bower_components\jquery\external\sizzle\dist\sizzle.min.js - - - Resources\dashboard-ui\bower_components\jquery\external\sizzle\dist\sizzle.min.map - - - Resources\dashboard-ui\bower_components\jquery\src\.eslintrc.json - - - Resources\dashboard-ui\bower_components\jquery\src\ajax.js - - - Resources\dashboard-ui\bower_components\jquery\src\attributes.js - - - Resources\dashboard-ui\bower_components\jquery\src\callbacks.js - - - Resources\dashboard-ui\bower_components\jquery\src\core.js - - - Resources\dashboard-ui\bower_components\jquery\src\css.js - - - Resources\dashboard-ui\bower_components\jquery\src\data.js - - - Resources\dashboard-ui\bower_components\jquery\src\deferred.js - - - Resources\dashboard-ui\bower_components\jquery\src\deprecated.js - - - Resources\dashboard-ui\bower_components\jquery\src\dimensions.js - - - Resources\dashboard-ui\bower_components\jquery\src\effects.js - - - Resources\dashboard-ui\bower_components\jquery\src\event.js - - - Resources\dashboard-ui\bower_components\jquery\src\jquery.js - - - Resources\dashboard-ui\bower_components\jquery\src\manipulation.js - - - Resources\dashboard-ui\bower_components\jquery\src\offset.js - - - Resources\dashboard-ui\bower_components\jquery\src\queue.js - - - Resources\dashboard-ui\bower_components\jquery\src\selector-native.js - - - Resources\dashboard-ui\bower_components\jquery\src\selector-sizzle.js - - - Resources\dashboard-ui\bower_components\jquery\src\selector.js - - - Resources\dashboard-ui\bower_components\jquery\src\serialize.js - - - Resources\dashboard-ui\bower_components\jquery\src\traversing.js - - - Resources\dashboard-ui\bower_components\jquery\src\wrap.js - - - Resources\dashboard-ui\bower_components\jquery\src\ajax\jsonp.js - - - Resources\dashboard-ui\bower_components\jquery\src\ajax\load.js - - - Resources\dashboard-ui\bower_components\jquery\src\ajax\parseXML.js - - - Resources\dashboard-ui\bower_components\jquery\src\ajax\script.js - - - Resources\dashboard-ui\bower_components\jquery\src\ajax\xhr.js - - - Resources\dashboard-ui\bower_components\jquery\src\attributes\attr.js - - - Resources\dashboard-ui\bower_components\jquery\src\attributes\classes.js - - - Resources\dashboard-ui\bower_components\jquery\src\attributes\prop.js - - - Resources\dashboard-ui\bower_components\jquery\src\attributes\support.js - - - Resources\dashboard-ui\bower_components\jquery\src\attributes\val.js - - - Resources\dashboard-ui\bower_components\jquery\src\core\DOMEval.js - - - Resources\dashboard-ui\bower_components\jquery\src\core\access.js - - - Resources\dashboard-ui\bower_components\jquery\src\core\init.js - - - Resources\dashboard-ui\bower_components\jquery\src\core\parseHTML.js - - - Resources\dashboard-ui\bower_components\jquery\src\core\ready-no-deferred.js - - - Resources\dashboard-ui\bower_components\jquery\src\core\ready.js - - - Resources\dashboard-ui\bower_components\jquery\src\core\readyException.js - - - Resources\dashboard-ui\bower_components\jquery\src\core\stripAndCollapse.js - - - Resources\dashboard-ui\bower_components\jquery\src\core\support.js - - - Resources\dashboard-ui\bower_components\jquery\src\css\addGetHookIf.js - - - Resources\dashboard-ui\bower_components\jquery\src\css\adjustCSS.js - - - Resources\dashboard-ui\bower_components\jquery\src\css\curCSS.js - - - Resources\dashboard-ui\bower_components\jquery\src\css\hiddenVisibleSelectors.js - - - Resources\dashboard-ui\bower_components\jquery\src\css\showHide.js - - - Resources\dashboard-ui\bower_components\jquery\src\css\support.js - - - Resources\dashboard-ui\bower_components\jquery\src\data\Data.js - - - Resources\dashboard-ui\bower_components\jquery\src\deferred\exceptionHook.js - - - Resources\dashboard-ui\bower_components\jquery\src\effects\Tween.js - - - Resources\dashboard-ui\bower_components\jquery\src\effects\animatedSelector.js - - - Resources\dashboard-ui\bower_components\jquery\src\event\ajax.js - - - Resources\dashboard-ui\bower_components\jquery\src\event\alias.js - - - Resources\dashboard-ui\bower_components\jquery\src\event\focusin.js - - - Resources\dashboard-ui\bower_components\jquery\src\event\support.js - - - Resources\dashboard-ui\bower_components\jquery\src\event\trigger.js - - - Resources\dashboard-ui\bower_components\jquery\src\exports\amd.js - - - Resources\dashboard-ui\bower_components\jquery\src\exports\global.js - - - Resources\dashboard-ui\bower_components\jquery\src\manipulation\_evalUrl.js - - - Resources\dashboard-ui\bower_components\jquery\src\manipulation\buildFragment.js - - - Resources\dashboard-ui\bower_components\jquery\src\manipulation\getAll.js - - - Resources\dashboard-ui\bower_components\jquery\src\manipulation\setGlobalEval.js - - - Resources\dashboard-ui\bower_components\jquery\src\manipulation\support.js - - - Resources\dashboard-ui\bower_components\jquery\src\manipulation\wrapMap.js - - - Resources\dashboard-ui\bower_components\jquery\src\queue\delay.js - - - Resources\dashboard-ui\bower_components\jquery\src\traversing\findFilter.js - - - Resources\dashboard-ui\bower_components\jstree\.bower.json - Resources\dashboard-ui\bower_components\jstree\LICENSE-MIT - - Resources\dashboard-ui\bower_components\jstree\bower.json - - - Resources\dashboard-ui\bower_components\jstree\composer.json - Resources\dashboard-ui\bower_components\jstree\dist\jstree.js @@ -2298,195 +1665,36 @@ Resources\dashboard-ui\bower_components\jstree\dist\themes\default-dark\throbber.gif - - Resources\dashboard-ui\bower_components\jstree\src\intro.js - - - Resources\dashboard-ui\bower_components\jstree\src\jstree.checkbox.js - - - Resources\dashboard-ui\bower_components\jstree\src\jstree.contextmenu.js - - - Resources\dashboard-ui\bower_components\jstree\src\jstree.dnd.js - - - Resources\dashboard-ui\bower_components\jstree\src\jstree.js - - - Resources\dashboard-ui\bower_components\jstree\src\jstree.massload.js - - - Resources\dashboard-ui\bower_components\jstree\src\jstree.search.js - - - Resources\dashboard-ui\bower_components\jstree\src\jstree.sort.js - - - Resources\dashboard-ui\bower_components\jstree\src\jstree.state.js - - - Resources\dashboard-ui\bower_components\jstree\src\jstree.types.js - - - Resources\dashboard-ui\bower_components\jstree\src\jstree.unique.js - - - Resources\dashboard-ui\bower_components\jstree\src\jstree.wholerow.js - - - Resources\dashboard-ui\bower_components\jstree\src\misc.js - - - Resources\dashboard-ui\bower_components\jstree\src\outro.js - - - Resources\dashboard-ui\bower_components\jstree\src\sample.js - - - Resources\dashboard-ui\bower_components\jstree\src\vakata-jstree.js - - - Resources\dashboard-ui\bower_components\jstree\src\themes\base.less - - - Resources\dashboard-ui\bower_components\jstree\src\themes\main.less - - - Resources\dashboard-ui\bower_components\jstree\src\themes\mixins.less - - - Resources\dashboard-ui\bower_components\jstree\src\themes\responsive.less - - - Resources\dashboard-ui\bower_components\jstree\src\themes\default\32px.png - - - Resources\dashboard-ui\bower_components\jstree\src\themes\default\40px.png - - - Resources\dashboard-ui\bower_components\jstree\src\themes\default\style.css - - - Resources\dashboard-ui\bower_components\jstree\src\themes\default\style.less - - - Resources\dashboard-ui\bower_components\jstree\src\themes\default\throbber.gif - - - Resources\dashboard-ui\bower_components\jstree\src\themes\default-dark\32px.png - - - Resources\dashboard-ui\bower_components\jstree\src\themes\default-dark\40px.png - - - Resources\dashboard-ui\bower_components\jstree\src\themes\default-dark\style.css - - - Resources\dashboard-ui\bower_components\jstree\src\themes\default-dark\style.less - - - Resources\dashboard-ui\bower_components\jstree\src\themes\default-dark\throbber.gif - - - Resources\dashboard-ui\bower_components\libjass\.bower.json - - - Resources\dashboard-ui\bower_components\libjass\CHANGELOG.md - Resources\dashboard-ui\bower_components\libjass\LICENSE - - Resources\dashboard-ui\bower_components\libjass\README.md - Resources\dashboard-ui\bower_components\libjass\libjass.css Resources\dashboard-ui\bower_components\libjass\libjass.min.js - - Resources\dashboard-ui\bower_components\libjass\package.json - - - Resources\dashboard-ui\bower_components\query-string\.bower.json - - - Resources\dashboard-ui\bower_components\query-string\.editorconfig - - - Resources\dashboard-ui\bower_components\query-string\.gitattributes - - - Resources\dashboard-ui\bower_components\query-string\.gitignore - - - Resources\dashboard-ui\bower_components\query-string\.jshintrc - - - Resources\dashboard-ui\bower_components\query-string\.travis.yml - Resources\dashboard-ui\bower_components\query-string\index.js Resources\dashboard-ui\bower_components\query-string\license - - Resources\dashboard-ui\bower_components\query-string\package.json - - - Resources\dashboard-ui\bower_components\query-string\readme.md - Resources\dashboard-ui\bower_components\query-string\test.js - - Resources\dashboard-ui\bower_components\query-string\test\extract.js - - - Resources\dashboard-ui\bower_components\query-string\test\parse.js - - - Resources\dashboard-ui\bower_components\query-string\test\stringify.js - - - Resources\dashboard-ui\bower_components\requirejs\.bower.json - Resources\dashboard-ui\bower_components\requirejs\LICENSE - - Resources\dashboard-ui\bower_components\requirejs\README.md - - - Resources\dashboard-ui\bower_components\requirejs\bower.json - Resources\dashboard-ui\bower_components\requirejs\require.js - - Resources\dashboard-ui\bower_components\vibrant\.bower.json - - - Resources\dashboard-ui\bower_components\vibrant\LICENSE.md - - - Resources\dashboard-ui\bower_components\vibrant\README.md - - - Resources\dashboard-ui\bower_components\vibrant\bower.json - Resources\dashboard-ui\bower_components\vibrant\gulpfile.coffee Resources\dashboard-ui\bower_components\vibrant\index.html - - Resources\dashboard-ui\bower_components\vibrant\package.json - Resources\dashboard-ui\bower_components\vibrant\style.css @@ -2499,21 +1707,9 @@ Resources\dashboard-ui\bower_components\vibrant\dist\vibrant.min.js - - Resources\dashboard-ui\bower_components\web-animations-js\.bower.json - Resources\dashboard-ui\bower_components\web-animations-js\COPYING - - Resources\dashboard-ui\bower_components\web-animations-js\History.md - - - Resources\dashboard-ui\bower_components\web-animations-js\README.md - - - Resources\dashboard-ui\bower_components\web-animations-js\bower.json - Resources\dashboard-ui\bower_components\web-animations-js\web-animations-next-lite.min.js @@ -2526,18 +1722,6 @@ Resources\dashboard-ui\bower_components\web-animations-js\web-animations.min.js - - Resources\dashboard-ui\bower_components\webcomponentsjs\.bower.json - - - Resources\dashboard-ui\bower_components\webcomponentsjs\README.md - - - Resources\dashboard-ui\bower_components\webcomponentsjs\bower.json - - - Resources\dashboard-ui\bower_components\webcomponentsjs\package.json - Resources\dashboard-ui\bower_components\webcomponentsjs\webcomponents-lite.min.js From e0d5f7d158cbf8683452474e3afb4d808978b8a2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 7 Feb 2017 02:33:24 -0500 Subject: [PATCH 05/22] reduce device discovery traffic --- Emby.Dlna/Ssdp/DeviceDiscovery.cs | 46 +---- .../Api/DashboardService.cs | 109 +++++------ .../Api/PackageCreator.cs | 50 ++--- RSSDP/SsdpDeviceLocatorBase.cs | 173 ++++++------------ 4 files changed, 131 insertions(+), 247 deletions(-) diff --git a/Emby.Dlna/Ssdp/DeviceDiscovery.cs b/Emby.Dlna/Ssdp/DeviceDiscovery.cs index 7852669c9..bd5ad31c2 100644 --- a/Emby.Dlna/Ssdp/DeviceDiscovery.cs +++ b/Emby.Dlna/Ssdp/DeviceDiscovery.cs @@ -19,13 +19,12 @@ using Rssdp.Infrastructure; namespace Emby.Dlna.Ssdp { - public class DeviceDiscovery : IDeviceDiscovery, IDisposable + public class DeviceDiscovery : IDeviceDiscovery { private bool _disposed; private readonly ILogger _logger; private readonly IServerConfigurationManager _config; - private readonly CancellationTokenSource _tokenSource; public event EventHandler> DeviceDiscovered; public event EventHandler> DeviceLeft; @@ -37,8 +36,6 @@ namespace Emby.Dlna.Ssdp public DeviceDiscovery(ILogger logger, IServerConfigurationManager config, ISocketFactory socketFactory, ITimerFactory timerFactory) { - _tokenSource = new CancellationTokenSource(); - _logger = logger; _config = config; _socketFactory = socketFactory; @@ -59,39 +56,10 @@ namespace Emby.Dlna.Ssdp _deviceLocator.DeviceAvailable += deviceLocator_DeviceAvailable; _deviceLocator.DeviceUnavailable += _DeviceLocator_DeviceUnavailable; - // Perform a search so we don't have to wait for devices to broadcast notifications - // again to get any results right away (notifications are broadcast periodically). - StartAsyncSearch(); - } + var dueTime = TimeSpan.FromSeconds(5); + var interval = TimeSpan.FromSeconds(_config.GetDlnaConfiguration().ClientDiscoveryIntervalSeconds); - private void StartAsyncSearch() - { - Task.Factory.StartNew(async (o) => - { - while (!_tokenSource.IsCancellationRequested) - { - try - { - // Enable listening for notifications (optional) - _deviceLocator.StartListeningForNotifications(); - - await _deviceLocator.SearchAsync(_tokenSource.Token).ConfigureAwait(false); - - var delay = _config.GetDlnaConfiguration().ClientDiscoveryIntervalSeconds * 1000; - - await Task.Delay(delay, _tokenSource.Token).ConfigureAwait(false); - } - catch (OperationCanceledException) - { - - } - catch (Exception ex) - { - _logger.ErrorException("Error searching for devices", ex); - } - } - - }, CancellationToken.None, TaskCreationOptions.LongRunning); + _deviceLocator.RestartBroadcastTimer(dueTime, interval); } // Process each found device in the event handler @@ -141,7 +109,11 @@ namespace Emby.Dlna.Ssdp if (!_disposed) { _disposed = true; - _tokenSource.Cancel(); + if (_deviceLocator != null) + { + _deviceLocator.Dispose(); + _deviceLocator = null; + } } } } diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index 91c23f871..c6cdeb354 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -139,6 +139,23 @@ namespace MediaBrowser.WebDashboard.Api _memoryStreamFactory = memoryStreamFactory; } + /// + /// Gets the dashboard UI path. + /// + /// The dashboard UI path. + public string DashboardUIPath + { + get + { + if (!string.IsNullOrEmpty(_serverConfigurationManager.Configuration.DashboardSourcePath)) + { + return _serverConfigurationManager.Configuration.DashboardSourcePath; + } + + return Path.Combine(_serverConfigurationManager.ApplicationPaths.ApplicationResourcesPath, "dashboard-ui"); + } + } + public object Get(GetFavIcon request) { return Get(new GetDashboardResource @@ -176,7 +193,7 @@ namespace MediaBrowser.WebDashboard.Api if (plugin != null && stream != null) { - return _resultFactory.GetStaticResult(Request, plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator().ModifyHtml("dummy.html", stream, null, _appHost.ApplicationVersion.ToString(), null)); + return _resultFactory.GetStaticResult(Request, plugin.Version.ToString().GetMD5(), null, null, MimeTypes.GetMimeType("page.html"), () => GetPackageCreator(DashboardUIPath).ModifyHtml("dummy.html", stream, null, _appHost.ApplicationVersion.ToString(), null)); } throw new ResourceNotFoundException(); @@ -274,9 +291,11 @@ namespace MediaBrowser.WebDashboard.Api path = path.Replace("bower_components" + _appHost.ApplicationVersion, "bower_components", StringComparison.OrdinalIgnoreCase); var contentType = MimeTypes.GetMimeType(path); + var basePath = DashboardUIPath; // Bounce them to the startup wizard if it hasn't been completed yet - if (!_serverConfigurationManager.Configuration.IsStartupWizardCompleted && path.IndexOf("wizard", StringComparison.OrdinalIgnoreCase) == -1 && GetPackageCreator().IsCoreHtml(path)) + if (!_serverConfigurationManager.Configuration.IsStartupWizardCompleted && + path.IndexOf("wizard", StringComparison.OrdinalIgnoreCase) == -1 && GetPackageCreator(basePath).IsCoreHtml(path)) { // But don't redirect if an html import is being requested. if (path.IndexOf("bower_components", StringComparison.OrdinalIgnoreCase) == -1) @@ -296,7 +315,7 @@ namespace MediaBrowser.WebDashboard.Api !contentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase) && !contentType.StartsWith("font/", StringComparison.OrdinalIgnoreCase)) { - var stream = await GetResourceStream(path, localizationCulture).ConfigureAwait(false); + var stream = await GetResourceStream(basePath, path, localizationCulture).ConfigureAwait(false); return _resultFactory.GetResult(stream, contentType); } @@ -311,7 +330,7 @@ namespace MediaBrowser.WebDashboard.Api var cacheKey = (_appHost.ApplicationVersion + (localizationCulture ?? string.Empty) + path).GetMD5(); - return await _resultFactory.GetStaticResult(Request, cacheKey, null, cacheDuration, contentType, () => GetResourceStream(path, localizationCulture)).ConfigureAwait(false); + return await _resultFactory.GetStaticResult(Request, cacheKey, null, cacheDuration, contentType, () => GetResourceStream(basePath, path, localizationCulture)).ConfigureAwait(false); } private string GetLocalizationCulture() @@ -322,86 +341,72 @@ namespace MediaBrowser.WebDashboard.Api /// /// Gets the resource stream. /// - /// The path. - /// The localization culture. - /// Task{Stream}. - private Task GetResourceStream(string path, string localizationCulture) + private Task GetResourceStream(string basePath, string virtualPath, string localizationCulture) { - return GetPackageCreator() - .GetResource(path, null, localizationCulture, _appHost.ApplicationVersion.ToString()); + return GetPackageCreator(basePath) + .GetResource(virtualPath, null, localizationCulture, _appHost.ApplicationVersion.ToString()); } - private PackageCreator GetPackageCreator() + private PackageCreator GetPackageCreator(string basePath) { - return new PackageCreator(_fileSystem, _logger, _serverConfigurationManager, _memoryStreamFactory); + return new PackageCreator(basePath, _fileSystem, _logger, _serverConfigurationManager, _memoryStreamFactory); } public async Task Get(GetDashboardPackage request) { var mode = request.Mode; - var path = !string.IsNullOrWhiteSpace(mode) ? - Path.Combine(_serverConfigurationManager.ApplicationPaths.ProgramDataPath, "webclient-dump") + var inputPath = string.IsNullOrWhiteSpace(mode) ? + DashboardUIPath + : "C:\\dev\\emby-web-mobile-master\\dist"; + + var targetPath = !string.IsNullOrWhiteSpace(mode) ? + inputPath : "C:\\dev\\emby-web-mobile\\src"; - try + var packageCreator = GetPackageCreator(inputPath); + + if (!string.Equals(inputPath, targetPath, StringComparison.OrdinalIgnoreCase)) { - _fileSystem.DeleteDirectory(path, true); + try + { + _fileSystem.DeleteDirectory(targetPath, true); + } + catch (IOException) + { + + } + + CopyDirectory(inputPath, targetPath); } - catch (IOException) - { - - } - - var creator = GetPackageCreator(); - - CopyDirectory(creator.DashboardUIPath, path); string culture = null; var appVersion = _appHost.ApplicationVersion.ToString(); - // Try to trim the output size a bit - var bowerPath = Path.Combine(path, "bower_components"); - - if (!string.IsNullOrWhiteSpace(mode)) - { - // Delete things that are unneeded in an attempt to keep the output as trim as possible - - DeleteFoldersByName(Path.Combine(bowerPath, "emby-webcomponents", "fonts"), "roboto"); - _fileSystem.DeleteDirectory(Path.Combine(path, "css", "images", "tour"), true); - } - - await DumpHtml(creator.DashboardUIPath, path, mode, culture, appVersion); + await DumpHtml(packageCreator, inputPath, targetPath, mode, culture, appVersion); return ""; } - private void DeleteFoldersByName(string path, string name) - { - var directories = _fileSystem.GetDirectories(path, true) - .Where(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase)) - .ToList(); - - foreach (var directory in directories) - { - _fileSystem.DeleteDirectory(directory.FullName, true); - } - } - - private async Task DumpHtml(string source, string destination, string mode, string culture, string appVersion) + private async Task DumpHtml(PackageCreator packageCreator, string source, string destination, string mode, string culture, string appVersion) { foreach (var file in _fileSystem.GetFiles(source)) { var filename = file.Name; - await DumpFile(filename, Path.Combine(destination, filename), mode, culture, appVersion).ConfigureAwait(false); + if (!string.Equals(file.Extension, ".html", StringComparison.OrdinalIgnoreCase)) + { + continue; + } + + await DumpFile(packageCreator, filename, Path.Combine(destination, filename), mode, culture, appVersion).ConfigureAwait(false); } } - private async Task DumpFile(string resourceVirtualPath, string destinationFilePath, string mode, string culture, string appVersion) + private async Task DumpFile(PackageCreator packageCreator, string resourceVirtualPath, string destinationFilePath, string mode, string culture, string appVersion) { - using (var stream = await GetPackageCreator().GetResource(resourceVirtualPath, mode, culture, appVersion).ConfigureAwait(false)) + using (var stream = await packageCreator.GetResource(resourceVirtualPath, mode, culture, appVersion).ConfigureAwait(false)) { using (var fs = _fileSystem.GetFileStream(destinationFilePath, FileOpenMode.Create, FileAccessMode.Write, FileShareMode.Read)) { diff --git a/MediaBrowser.WebDashboard/Api/PackageCreator.cs b/MediaBrowser.WebDashboard/Api/PackageCreator.cs index 453f46edd..f124b6e4b 100644 --- a/MediaBrowser.WebDashboard/Api/PackageCreator.cs +++ b/MediaBrowser.WebDashboard/Api/PackageCreator.cs @@ -19,31 +19,33 @@ namespace MediaBrowser.WebDashboard.Api private readonly ILogger _logger; private readonly IServerConfigurationManager _config; private readonly IMemoryStreamFactory _memoryStreamFactory; + private readonly string _basePath; - public PackageCreator(IFileSystem fileSystem, ILogger logger, IServerConfigurationManager config, IMemoryStreamFactory memoryStreamFactory) + public PackageCreator(string basePath, IFileSystem fileSystem, ILogger logger, IServerConfigurationManager config, IMemoryStreamFactory memoryStreamFactory) { _fileSystem = fileSystem; _logger = logger; _config = config; _memoryStreamFactory = memoryStreamFactory; + _basePath = basePath; } - public async Task GetResource(string path, + public async Task GetResource(string virtualPath, string mode, string localizationCulture, string appVersion) { - var resourceStream = GetRawResourceStream(path); + var resourceStream = GetRawResourceStream(virtualPath); if (resourceStream != null) { // Don't apply any caching for html pages // jQuery ajax doesn't seem to handle if-modified-since correctly - if (IsFormat(path, "html")) + if (IsFormat(virtualPath, "html")) { - if (IsCoreHtml(path)) + if (IsCoreHtml(virtualPath)) { - resourceStream = await ModifyHtml(path, resourceStream, mode, appVersion, localizationCulture).ConfigureAwait(false); + resourceStream = await ModifyHtml(virtualPath, resourceStream, mode, appVersion, localizationCulture).ConfigureAwait(false); } } } @@ -62,33 +64,13 @@ namespace MediaBrowser.WebDashboard.Api return Path.GetExtension(path).EndsWith(format, StringComparison.OrdinalIgnoreCase); } - /// - /// Gets the dashboard UI path. - /// - /// The dashboard UI path. - public string DashboardUIPath - { - get - { - if (!string.IsNullOrEmpty(_config.Configuration.DashboardSourcePath)) - { - return _config.Configuration.DashboardSourcePath; - } - - return Path.Combine(_config.ApplicationPaths.ApplicationResourcesPath, "dashboard-ui"); - } - } - /// /// Gets the dashboard resource path. /// - /// The virtual path. /// System.String. private string GetDashboardResourcePath(string virtualPath) { - var rootPath = DashboardUIPath; - - var fullPath = Path.Combine(rootPath, virtualPath.Replace('/', _fileSystem.DirectorySeparatorChar)); + var fullPath = Path.Combine(_basePath, virtualPath.Replace('/', _fileSystem.DirectorySeparatorChar)); try { @@ -100,7 +82,7 @@ namespace MediaBrowser.WebDashboard.Api } // Don't allow file system access outside of the source folder - if (!_fileSystem.ContainsSubPath(rootPath, fullPath)) + if (!_fileSystem.ContainsSubPath(_basePath, fullPath)) { throw new SecurityException("Access denied"); } @@ -118,10 +100,8 @@ namespace MediaBrowser.WebDashboard.Api path = GetDashboardResourcePath(path); var parent = Path.GetDirectoryName(path); - var basePath = DashboardUIPath; - - return string.Equals(basePath, parent, StringComparison.OrdinalIgnoreCase) || - string.Equals(Path.Combine(basePath, "voice"), parent, StringComparison.OrdinalIgnoreCase); + return string.Equals(_basePath, parent, StringComparison.OrdinalIgnoreCase) || + string.Equals(Path.Combine(_basePath, "voice"), parent, StringComparison.OrdinalIgnoreCase); } /// @@ -319,11 +299,9 @@ namespace MediaBrowser.WebDashboard.Api /// /// Gets the raw resource stream. /// - /// The path. - /// Task{Stream}. - private Stream GetRawResourceStream(string path) + private Stream GetRawResourceStream(string virtualPath) { - return _fileSystem.GetFileStream(GetDashboardResourcePath(path), FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, true); + return _fileSystem.GetFileStream(GetDashboardResourcePath(virtualPath), FileOpenMode.Open, FileAccessMode.Read, FileShareMode.ReadWrite, true); } } diff --git a/RSSDP/SsdpDeviceLocatorBase.cs b/RSSDP/SsdpDeviceLocatorBase.cs index 4f5eae616..1adb95cdf 100644 --- a/RSSDP/SsdpDeviceLocatorBase.cs +++ b/RSSDP/SsdpDeviceLocatorBase.cs @@ -24,11 +24,9 @@ namespace Rssdp.Infrastructure private List _Devices; private ISsdpCommunicationsServer _CommunicationsServer; - private IList _SearchResults; - private object _SearchResultsSynchroniser; - - private ITimer _ExpireCachedDevicesTimer; + private ITimer _BroadcastTimer; private ITimerFactory _timerFactory; + private object _timerLock = new object(); private static readonly TimeSpan DefaultSearchWaitTime = TimeSpan.FromSeconds(4); private static readonly TimeSpan OneSecond = TimeSpan.FromSeconds(1); @@ -48,7 +46,6 @@ namespace Rssdp.Infrastructure _timerFactory = timerFactory; _CommunicationsServer.ResponseReceived += CommsServer_ResponseReceived; - _SearchResultsSynchroniser = new object(); _Devices = new List(); } @@ -92,11 +89,52 @@ namespace Rssdp.Infrastructure #region Search Overloads + public void RestartBroadcastTimer(TimeSpan dueTime, TimeSpan period) + { + lock (_timerLock) + { + if (_BroadcastTimer == null) + { + _BroadcastTimer = _timerFactory.Create(OnBroadcastTimerCallback, null, dueTime, period); + } + else + { + _BroadcastTimer.Change(dueTime, period); + } + } + } + + public void DisposeBroadcastTimer() + { + lock (_timerLock) + { + if (_BroadcastTimer != null) + { + _BroadcastTimer.Dispose(); + _BroadcastTimer = null; + } + } + } + + private async void OnBroadcastTimerCallback(object state) + { + StartListeningForNotifications(); + RemoveExpiredDevicesFromCache(); + + try + { + await SearchAsync(CancellationToken.None).ConfigureAwait(false); + } + catch (Exception ex) + { + + } + } + /// /// Performs a search for all devices using the default search timeout. /// - /// A task whose result is an of instances, representing all found devices. - public Task> SearchAsync(CancellationToken cancellationToken) + private Task SearchAsync(CancellationToken cancellationToken) { return SearchAsync(SsdpConstants.SsdpDiscoverAllSTHeader, DefaultSearchWaitTime, cancellationToken); } @@ -111,8 +149,7 @@ namespace Rssdp.Infrastructure /// Device typeFully qualified device type starting with urn: i.e urn:schemas-upnp-org:Basic:1 /// /// - /// A task whose result is an of instances, representing all found devices. - public Task> SearchAsync(string searchTarget) + private Task SearchAsync(string searchTarget) { return SearchAsync(searchTarget, DefaultSearchWaitTime, CancellationToken.None); } @@ -121,13 +158,12 @@ namespace Rssdp.Infrastructure /// Performs a search for all devices using the specified search timeout. /// /// The amount of time to wait for network responses to the search request. Longer values will likely return more devices, but increase search time. A value between 1 and 5 seconds is recommended by the UPnP 1.1 specification, this method requires the value be greater 1 second if it is not zero. Specify TimeSpan.Zero to return only devices already in the cache. - /// A task whose result is an of instances, representing all found devices. - public Task> SearchAsync(TimeSpan searchWaitTime) + private Task SearchAsync(TimeSpan searchWaitTime) { return SearchAsync(SsdpConstants.SsdpDiscoverAllSTHeader, searchWaitTime, CancellationToken.None); } - public async Task> SearchAsync(string searchTarget, TimeSpan searchWaitTime, CancellationToken cancellationToken) + private Task SearchAsync(string searchTarget, TimeSpan searchWaitTime, CancellationToken cancellationToken) { if (searchTarget == null) throw new ArgumentNullException("searchTarget"); if (searchTarget.Length == 0) throw new ArgumentException("searchTarget cannot be an empty string.", "searchTarget"); @@ -136,48 +172,7 @@ namespace Rssdp.Infrastructure ThrowIfDisposed(); - if (_SearchResults != null) throw new InvalidOperationException("Search already in progress. Only one search at a time is allowed."); - _SearchResults = new List(); - - // If searchWaitTime == 0 then we are only going to report unexpired cached items, not actually do a search. - if (searchWaitTime > TimeSpan.Zero) - await BroadcastDiscoverMessage(searchTarget, SearchTimeToMXValue(searchWaitTime), cancellationToken).ConfigureAwait(false); - - lock (_SearchResultsSynchroniser) - { - foreach (var device in GetUnexpiredDevices().Where(NotificationTypeMatchesFilter)) - { - DeviceFound(device, false, null); - } - } - - if (searchWaitTime != TimeSpan.Zero) - await Task.Delay(searchWaitTime, cancellationToken).ConfigureAwait(false); - - IEnumerable retVal = null; - - try - { - lock (_SearchResultsSynchroniser) - { - retVal = _SearchResults; - _SearchResults = null; - } - - RemoveExpiredDevicesFromCache(); - } - finally - { - var server = _CommunicationsServer; - try - { - if (server != null) // In case we were disposed while searching. - server.StopListeningForResponses(); - } - catch (ObjectDisposedException) { } - } - - return retVal; + return BroadcastDiscoverMessage(searchTarget, SearchTimeToMXValue(searchWaitTime), cancellationToken); } #endregion @@ -287,9 +282,7 @@ namespace Rssdp.Infrastructure if (disposing) { - var timer = _ExpireCachedDevicesTimer; - if (timer != null) - timer.Dispose(); + DisposeBroadcastTimer(); var commsServer = _CommunicationsServer; _CommunicationsServer = null; @@ -332,40 +325,9 @@ namespace Rssdp.Infrastructure private void DeviceFound(DiscoveredSsdpDevice device, bool isNewDevice, IpAddressInfo localIpAddress) { - // Don't raise the event if we've already done it for a cached - // version of this device, and the cached version isn't - // "significantly" different, i.e location and cachelifetime - // haven't changed. - var raiseEvent = false; - if (!NotificationTypeMatchesFilter(device)) return; - lock (_SearchResultsSynchroniser) - { - if (_SearchResults != null) - { - var existingDevice = FindExistingDeviceNotification(_SearchResults, device.NotificationType, device.Usn); - if (existingDevice == null) - { - _SearchResults.Add(device); - raiseEvent = true; - } - else - { - if (existingDevice.DescriptionLocation != device.DescriptionLocation || existingDevice.CacheLifetime != device.CacheLifetime) - { - _SearchResults.Remove(existingDevice); - _SearchResults.Add(device); - raiseEvent = true; - } - } - } - else - raiseEvent = true; - } - - if (raiseEvent) - OnDeviceAvailable(device, isNewDevice, localIpAddress); + OnDeviceAvailable(device, isNewDevice, localIpAddress); } private bool NotificationTypeMatchesFilter(DiscoveredSsdpDevice device) @@ -450,8 +412,6 @@ namespace Rssdp.Infrastructure }; AddOrUpdateDiscoveredDevice(device, localIpAddress); - - ResetExpireCachedDevicesTimer(); } } @@ -477,26 +437,9 @@ namespace Rssdp.Infrastructure if (NotificationTypeMatchesFilter(deadDevice)) OnDeviceUnavailable(deadDevice, false); } - - ResetExpireCachedDevicesTimer(); } } - private void ResetExpireCachedDevicesTimer() - { - if (IsDisposed) return; - - if (_ExpireCachedDevicesTimer == null) - _ExpireCachedDevicesTimer = _timerFactory.Create(this.ExpireCachedDevices, null, System.Threading.Timeout.Infinite, System.Threading.Timeout.Infinite); - - _ExpireCachedDevicesTimer.Change(60000, System.Threading.Timeout.Infinite); - } - - private void ExpireCachedDevices(object state) - { - RemoveExpiredDevicesFromCache(); - } - #region Header/Message Processing Utilities private static string GetFirstHeaderStringValue(string headerName, HttpResponseMessage message) @@ -624,20 +567,6 @@ namespace Rssdp.Infrastructure if (existingDevices != null && existingDevices.Any()) { - lock (_SearchResultsSynchroniser) - { - if (_SearchResults != null) - { - var resultsToRemove = (from result in _SearchResults where result.Usn == deviceUsn select result).ToArray(); - foreach (var result in resultsToRemove) - { - if (this.IsDisposed) return true; - - _SearchResults.Remove(result); - } - } - } - foreach (var removedDevice in existingDevices) { if (NotificationTypeMatchesFilter(removedDevice)) From 55d82df3848d29f537278a7117b7926fa074754e Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 7 Feb 2017 03:23:45 -0500 Subject: [PATCH 06/22] restore bsd messages --- .../EnvironmentInfo/EnvironmentInfo.cs | 2 +- MediaBrowser.Model/System/IEnvironmentInfo.cs | 3 ++- MediaBrowser.Server.Mono/Program.cs | 13 +++++++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs b/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs index dcc974413..5da1ae2dc 100644 --- a/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs +++ b/Emby.Common.Implementations/EnvironmentInfo/EnvironmentInfo.cs @@ -12,7 +12,7 @@ namespace Emby.Common.Implementations.EnvironmentInfo public MediaBrowser.Model.System.Architecture? CustomArchitecture { get; set; } public MediaBrowser.Model.System.OperatingSystem? CustomOperatingSystem { get; set; } - public MediaBrowser.Model.System.OperatingSystem OperatingSystem + public virtual MediaBrowser.Model.System.OperatingSystem OperatingSystem { get { diff --git a/MediaBrowser.Model/System/IEnvironmentInfo.cs b/MediaBrowser.Model/System/IEnvironmentInfo.cs index abe39fa03..2c57df97c 100644 --- a/MediaBrowser.Model/System/IEnvironmentInfo.cs +++ b/MediaBrowser.Model/System/IEnvironmentInfo.cs @@ -17,6 +17,7 @@ namespace MediaBrowser.Model.System { Windows, Linux, - OSX + OSX, + BSD } } diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs index 8100dec8d..4790378a9 100644 --- a/MediaBrowser.Server.Mono/Program.cs +++ b/MediaBrowser.Server.Mono/Program.cs @@ -319,5 +319,18 @@ namespace MediaBrowser.Server.Mono { return Syscall.getuid().ToString(CultureInfo.InvariantCulture); } + + public override Model.System.OperatingSystem OperatingSystem + { + get + { + if (IsBsd) + { + return Model.System.OperatingSystem.BSD; + } + + return base.OperatingSystem; + } + } } } From fbb1bb319c87303c9604ee6cb35af01abd895552 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 7 Feb 2017 13:33:15 -0500 Subject: [PATCH 07/22] update wdtv live dlna profile --- Emby.Dlna/Profiles/WdtvLiveProfile.cs | 3 +-- Emby.Dlna/Profiles/Xml/WDTV Live.xml | 2 +- Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs | 7 ------- Emby.Server.Implementations/LiveTv/LiveTvManager.cs | 1 - .../LiveTv/LiveTvMediaSourceProvider.cs | 1 + MediaBrowser.Model/Entities/MetadataProviders.cs | 4 ---- MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs | 2 +- MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs | 8 -------- 8 files changed, 4 insertions(+), 24 deletions(-) diff --git a/Emby.Dlna/Profiles/WdtvLiveProfile.cs b/Emby.Dlna/Profiles/WdtvLiveProfile.cs index 6cef2d965..756882592 100644 --- a/Emby.Dlna/Profiles/WdtvLiveProfile.cs +++ b/Emby.Dlna/Profiles/WdtvLiveProfile.cs @@ -125,8 +125,7 @@ namespace Emby.Dlna.Profiles new DirectPlayProfile { - Container = "flac", - AudioCodec = "flac", + Container = "flac,ac3", Type = DlnaProfileType.Audio }, diff --git a/Emby.Dlna/Profiles/Xml/WDTV Live.xml b/Emby.Dlna/Profiles/Xml/WDTV Live.xml index 1cf3ef597..775d25302 100644 --- a/Emby.Dlna/Profiles/Xml/WDTV Live.xml +++ b/Emby.Dlna/Profiles/Xml/WDTV Live.xml @@ -45,7 +45,7 @@ - + diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 89ef87c8e..1ec5dd1d5 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -2092,13 +2092,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV writer.WriteElementString("credits", person); } - var rt = item.GetProviderId(MetadataProviders.RottenTomatoes); - - if (!string.IsNullOrEmpty(rt)) - { - writer.WriteElementString("rottentomatoesid", rt); - } - var tmdbCollection = item.GetProviderId(MetadataProviders.TmdbCollection); if (!string.IsNullOrEmpty(tmdbCollection)) diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index e59a8f93c..613a30b1d 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -365,7 +365,6 @@ namespace Emby.Server.Implementations.LiveTv } } - _logger.Info("Live stream info: {0}", _jsonSerializer.SerializeToString(info)); Normalize(info, service, isVideo); return new Tuple(info, directStreamProvider); diff --git a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs index dd95660c7..747e0fdd3 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs @@ -154,6 +154,7 @@ namespace Emby.Server.Implementations.LiveTv _logger.ErrorException("Error probing live tv stream", ex); } + _logger.Info("Live stream info: {0}", _jsonSerializer.SerializeToString(stream)); return new Tuple(stream, directStreamProvider); } diff --git a/MediaBrowser.Model/Entities/MetadataProviders.cs b/MediaBrowser.Model/Entities/MetadataProviders.cs index 1e7bde934..efd4339d5 100644 --- a/MediaBrowser.Model/Entities/MetadataProviders.cs +++ b/MediaBrowser.Model/Entities/MetadataProviders.cs @@ -24,10 +24,6 @@ namespace MediaBrowser.Model.Entities /// Tvcom = 5, /// - /// The rotten tomatoes - /// - RottenTomatoes = 6, - /// /// Tmdb Collection Id /// TmdbCollection = 7, diff --git a/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs b/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs index 3f969b609..96eab63cd 100644 --- a/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs +++ b/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs @@ -142,7 +142,7 @@ namespace MediaBrowser.Providers.Music if (fileInfo.Exists) { - if ((DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(fileInfo)).TotalDays <= 7) + if ((DateTime.UtcNow - _fileSystem.GetLastWriteTimeUtc(fileInfo)).TotalDays <= 3) { return _cachedTask; } diff --git a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs index 4f7715874..5a1c7bf13 100644 --- a/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/BaseNfoSaver.cs @@ -579,14 +579,6 @@ namespace MediaBrowser.XbmcMetadata.Savers writer.WriteElementString("website", item.HomePageUrl); } - var rt = item.GetProviderId(MetadataProviders.RottenTomatoes); - - if (!string.IsNullOrEmpty(rt)) - { - writer.WriteElementString("rottentomatoesid", rt); - writtenProviderIds.Add(MetadataProviders.RottenTomatoes.ToString()); - } - var tmdbCollection = item.GetProviderId(MetadataProviders.TmdbCollection); if (!string.IsNullOrEmpty(tmdbCollection)) From 64b56005280a7b19690ce480ef2daf240ffac032 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 7 Feb 2017 13:36:12 -0500 Subject: [PATCH 08/22] 3.2.0.101 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index b63f7d15e..69a718c63 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.0.100")] +[assembly: AssemblyVersion("3.2.0.101")] From 8deb423883cf8a6dcf3588a7707693f14ac6a166 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 8 Feb 2017 13:50:33 -0500 Subject: [PATCH 09/22] restore config settings for now --- .../Library/LibraryManager.cs | 12 +++++++++++ .../Resolvers/Audio/MusicArtistResolver.cs | 21 +++++++++---------- MediaBrowser.Common/Net/HttpRequestOptions.cs | 1 + .../Encoder/MediaEncoder.cs | 5 ----- .../Configuration/ServerConfiguration.cs | 12 +++++++++++ 5 files changed, 35 insertions(+), 16 deletions(-) diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.cs index de3a1664e..616c6c1a2 100644 --- a/Emby.Server.Implementations/Library/LibraryManager.cs +++ b/Emby.Server.Implementations/Library/LibraryManager.cs @@ -2627,6 +2627,18 @@ namespace Emby.Server.Implementations.Library } } + foreach (var map in ConfigurationManager.Configuration.PathSubstitutions) + { + if (!string.IsNullOrWhiteSpace(map.From)) + { + var substitutionResult = SubstitutePathInternal(path, map.From, map.To); + if (substitutionResult.Item2) + { + return substitutionResult.Item1; + } + } + } + return path; } diff --git a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs index 6cf201990..2971405b9 100644 --- a/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs +++ b/Emby.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs @@ -74,21 +74,20 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio return new MusicArtist(); } - return null; - //if (_config.Configuration.EnableSimpleArtistDetection) - //{ - // return null; - //} + if (_config.Configuration.EnableSimpleArtistDetection) + { + return null; + } - //// Avoid mis-identifying top folders - //if (args.Parent.IsRoot) return null; + // Avoid mis-identifying top folders + if (args.Parent.IsRoot) return null; - //var directoryService = args.DirectoryService; + var directoryService = args.DirectoryService; - //var albumResolver = new MusicAlbumResolver(_logger, _fileSystem, _libraryManager); + var albumResolver = new MusicAlbumResolver(_logger, _fileSystem, _libraryManager); - //// If we contain an album assume we are an artist folder - //return args.FileSystemChildren.Where(i => i.IsDirectory).Any(i => albumResolver.IsMusicAlbum(i.FullName, directoryService, args.GetLibraryOptions())) ? new MusicArtist() : null; + // If we contain an album assume we are an artist folder + return args.FileSystemChildren.Where(i => i.IsDirectory).Any(i => albumResolver.IsMusicAlbum(i.FullName, directoryService, args.GetLibraryOptions())) ? new MusicArtist() : null; } } diff --git a/MediaBrowser.Common/Net/HttpRequestOptions.cs b/MediaBrowser.Common/Net/HttpRequestOptions.cs index e1ecd6595..4a894e662 100644 --- a/MediaBrowser.Common/Net/HttpRequestOptions.cs +++ b/MediaBrowser.Common/Net/HttpRequestOptions.cs @@ -100,6 +100,7 @@ namespace MediaBrowser.Common.Net public int TimeoutMs { get; set; } public bool PreferIpv4 { get; set; } + public bool EnableDefaultUserAgent { get; set; } private string GetHeaderValue(string name) { diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index ee3482a70..e7737b6a6 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -725,11 +725,6 @@ namespace MediaBrowser.MediaEncoding.Encoder if (video.Protocol != MediaProtocol.File) { - // If it's mpeg based, assume true - if ((videoStream.Codec ?? string.Empty).IndexOf("mpeg", StringComparison.OrdinalIgnoreCase) != -1) - { - return true; - } return false; } diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index f9df776df..c2b1e3c89 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -192,6 +192,10 @@ namespace MediaBrowser.Model.Configuration public bool EnableExternalContentInSuggestions { get; set; } public int ImageExtractionTimeoutMs { get; set; } + + public PathSubstitution[] PathSubstitutions { get; set; } + public bool EnableSimpleArtistDetection { get; set; } + /// /// Initializes a new instance of the class. /// @@ -202,6 +206,8 @@ namespace MediaBrowser.Model.Configuration Migrations = new string[] { }; ImageExtractionTimeoutMs = 0; EnableLocalizedGuids = true; + PathSubstitutions = new PathSubstitution[] { }; + EnableSimpleArtistDetection = true; DisplaySpecialsWithinSeasons = true; EnableExternalContentInSuggestions = true; @@ -563,4 +569,10 @@ namespace MediaBrowser.Model.Configuration }; } } + + public class PathSubstitution + { + public string From { get; set; } + public string To { get; set; } + } } \ No newline at end of file From b67a106b5e533f786a2261901730b2c72842770c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 8 Feb 2017 13:50:50 -0500 Subject: [PATCH 10/22] attach user agent to omdb requests --- .../HttpClientManager/HttpClientManager.cs | 25 +++++++++++++++---- MediaBrowser.Providers/Omdb/OmdbProvider.cs | 3 ++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs b/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs index 06af5af53..0abcaadb1 100644 --- a/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -18,6 +18,7 @@ using System.Threading; using System.Threading.Tasks; using Emby.Common.Implementations.HttpClientManager; using MediaBrowser.Model.IO; +using MediaBrowser.Common; namespace Emby.Common.Implementations.HttpClientManager { @@ -43,6 +44,7 @@ namespace Emby.Common.Implementations.HttpClientManager private readonly IFileSystem _fileSystem; private readonly IMemoryStreamFactory _memoryStreamProvider; + private readonly IApplicationHost _appHost; /// /// Initializes a new instance of the class. @@ -257,6 +259,8 @@ namespace Emby.Common.Implementations.HttpClientManager private void AddRequestHeaders(HttpWebRequest request, HttpRequestOptions options) { + var hasUserAgent = false; + foreach (var header in options.RequestHeaders.ToList()) { if (string.Equals(header.Key, "Accept", StringComparison.OrdinalIgnoreCase)) @@ -265,11 +269,8 @@ namespace Emby.Common.Implementations.HttpClientManager } else if (string.Equals(header.Key, "User-Agent", StringComparison.OrdinalIgnoreCase)) { -#if NET46 - request.UserAgent = header.Value; -#elif NETSTANDARD1_6 - request.Headers["User-Agent"] = header.Value; -#endif + SetUserAgent(request, header.Value); + hasUserAgent = true; } else { @@ -280,6 +281,20 @@ namespace Emby.Common.Implementations.HttpClientManager #endif } } + + if (!hasUserAgent && options.EnableDefaultUserAgent) + { + SetUserAgent(request, _appHost.Name + "/" + _appHost.ApplicationVersion.ToString()); + } + } + + private void SetUserAgent(HttpWebRequest request, string userAgent) + { +#if NET46 + request.UserAgent = userAgent; +#elif NETSTANDARD1_6 + request.Headers["User-Agent"] = userAgent; +#endif } /// diff --git a/MediaBrowser.Providers/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Omdb/OmdbProvider.cs index 07b35c45a..b42dd34b2 100644 --- a/MediaBrowser.Providers/Omdb/OmdbProvider.cs +++ b/MediaBrowser.Providers/Omdb/OmdbProvider.cs @@ -347,7 +347,8 @@ namespace MediaBrowser.Providers.Omdb Url = url, ResourcePool = ResourcePool, CancellationToken = cancellationToken, - BufferContent = true + BufferContent = true, + EnableDefaultUserAgent = true }); } From aba4933a5c7d80df44f546f1b9ae722a674e27ce Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 8 Feb 2017 14:52:21 -0500 Subject: [PATCH 11/22] restore config setting --- MediaBrowser.Api/StartupWizardService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.cs index f5fd94d0e..e010f122c 100644 --- a/MediaBrowser.Api/StartupWizardService.cs +++ b/MediaBrowser.Api/StartupWizardService.cs @@ -119,6 +119,7 @@ namespace MediaBrowser.Api config.SkipDeserializationForAudio = true; config.EnableSeriesPresentationUniqueKey = true; config.EnableLocalizedGuids = true; + config.EnableSimpleArtistDetection = true; } public void Post(UpdateStartupConfiguration request) From 4941aa4d14f2a901890f91966c50f96308bb03ec Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 8 Feb 2017 14:59:49 -0500 Subject: [PATCH 12/22] assume interlaced for external plugins --- .../LiveTv/EmbyTV/EmbyTV.cs | 2 +- .../LiveTv/LiveStreamHelper.cs | 14 +++++++++++++- .../LiveTv/LiveTvManager.cs | 14 ++++++++++---- .../LiveTv/LiveTvMediaSourceProvider.cs | 4 +++- MediaBrowser.Controller/LiveTv/ILiveTvManager.cs | 2 +- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 1ec5dd1d5..fe114d224 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -1163,7 +1163,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV }; var isAudio = false; - await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, cancellationToken).ConfigureAwait(false); + await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, false, cancellationToken).ConfigureAwait(false); return new List { diff --git a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs index 0313e6fde..2ee6869f6 100644 --- a/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs +++ b/Emby.Server.Implementations/LiveTv/LiveStreamHelper.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; namespace Emby.Server.Implementations.LiveTv @@ -21,7 +22,7 @@ namespace Emby.Server.Implementations.LiveTv _logger = logger; } - public async Task AddMediaInfoWithProbe(MediaSourceInfo mediaSource, bool isAudio, CancellationToken cancellationToken) + public async Task AddMediaInfoWithProbe(MediaSourceInfo mediaSource, bool isAudio, bool assumeInterlaced, CancellationToken cancellationToken) { var originalRuntime = mediaSource.RunTimeTicks; @@ -95,6 +96,17 @@ namespace Emby.Server.Implementations.LiveTv videoStream.IsAVC = null; } + if (assumeInterlaced) + { + foreach (var mediaStream in mediaSource.MediaStreams) + { + if (mediaStream.Type == MediaStreamType.Video) + { + mediaStream.IsInterlaced = true; + } + } + } + // Try to estimate this mediaSource.InferTotalBitrate(true); } diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index 613a30b1d..e30280967 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -246,9 +246,9 @@ namespace Emby.Server.Implementations.LiveTv return info.Item1; } - public async Task> GetChannelStream(string id, string mediaSourceId, CancellationToken cancellationToken) + public Task> GetChannelStream(string id, string mediaSourceId, CancellationToken cancellationToken) { - return await GetLiveStream(id, mediaSourceId, true, cancellationToken).ConfigureAwait(false); + return GetLiveStream(id, mediaSourceId, true, cancellationToken); } private string GetItemExternalId(BaseItem item) @@ -308,7 +308,7 @@ namespace Emby.Server.Implementations.LiveTv return _services.FirstOrDefault(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase)); } - private async Task> GetLiveStream(string id, string mediaSourceId, bool isChannel, CancellationToken cancellationToken) + private async Task> GetLiveStream(string id, string mediaSourceId, bool isChannel, CancellationToken cancellationToken) { if (string.Equals(id, mediaSourceId, StringComparison.OrdinalIgnoreCase)) { @@ -319,6 +319,7 @@ namespace Emby.Server.Implementations.LiveTv bool isVideo; ILiveTvService service; IDirectStreamProvider directStreamProvider = null; + var assumeInterlaced = false; if (isChannel) { @@ -367,7 +368,12 @@ namespace Emby.Server.Implementations.LiveTv Normalize(info, service, isVideo); - return new Tuple(info, directStreamProvider); + if (!(service is EmbyTV.EmbyTV)) + { + assumeInterlaced = true; + } + + return new Tuple(info, directStreamProvider, assumeInterlaced); } private void Normalize(MediaSourceInfo mediaSource, ILiveTvService service, bool isVideo) diff --git a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs index 747e0fdd3..e25e28484 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvMediaSourceProvider.cs @@ -126,12 +126,14 @@ namespace Emby.Server.Implementations.LiveTv var keys = openToken.Split(new[] { StreamIdDelimeter }, 3); var mediaSourceId = keys.Length >= 3 ? keys[2] : null; IDirectStreamProvider directStreamProvider = null; + var assumeInterlaced = false; if (string.Equals(keys[0], typeof(LiveTvChannel).Name, StringComparison.OrdinalIgnoreCase)) { var info = await _liveTvManager.GetChannelStream(keys[1], mediaSourceId, cancellationToken).ConfigureAwait(false); stream = info.Item1; directStreamProvider = info.Item2; + assumeInterlaced = info.Item3; } else { @@ -146,7 +148,7 @@ namespace Emby.Server.Implementations.LiveTv } else { - await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, cancellationToken).ConfigureAwait(false); + await new LiveStreamHelper(_mediaEncoder, _logger).AddMediaInfoWithProbe(stream, isAudio, assumeInterlaced, cancellationToken).ConfigureAwait(false); } } catch (Exception ex) diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index 08e4956ad..a908d2d3f 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -157,7 +157,7 @@ namespace MediaBrowser.Controller.LiveTv /// The media source identifier. /// The cancellation token. /// Task{StreamResponseInfo}. - Task> GetChannelStream(string id, string mediaSourceId, CancellationToken cancellationToken); + Task> GetChannelStream(string id, string mediaSourceId, CancellationToken cancellationToken); /// /// Gets the program. From 2fa03c19d48fca865f108895f28b7fb436b9edf4 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 8 Feb 2017 15:00:11 -0500 Subject: [PATCH 13/22] 3.2.0.102 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index 69a718c63..794165849 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.0.101")] +[assembly: AssemblyVersion("3.2.0.102")] From 1e28de1098d65f48e9a766fdc4963f04d6611bda Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 8 Feb 2017 16:29:08 -0500 Subject: [PATCH 14/22] update channel mapping --- .../LiveTv/EmbyTV/EmbyTV.cs | 16 ++++++++++------ MediaBrowser.Api/LiveTv/LiveTvService.cs | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index fe114d224..cd5fd0c8c 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -469,16 +469,20 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV public ChannelInfo GetEpgChannelFromTunerChannel(List mappings, ChannelInfo tunerChannel, List epgChannels) { - if (!string.IsNullOrWhiteSpace(tunerChannel.TunerChannelId)) - { - var tunerChannelId = GetMappedChannel(tunerChannel.TunerChannelId, mappings); + var tunerChannelId = string.IsNullOrWhiteSpace(tunerChannel.TunerChannelId) + ? tunerChannel.Id + : tunerChannel.TunerChannelId; - if (string.IsNullOrWhiteSpace(tunerChannelId)) + if (!string.IsNullOrWhiteSpace(tunerChannelId)) + { + var mappedTunerChannelId = GetMappedChannel(tunerChannelId, mappings); + + if (string.IsNullOrWhiteSpace(mappedTunerChannelId)) { - tunerChannelId = tunerChannel.TunerChannelId; + mappedTunerChannelId = tunerChannelId; } - var channel = epgChannels.FirstOrDefault(i => string.Equals(tunerChannelId, i.Id, StringComparison.OrdinalIgnoreCase)); + var channel = epgChannels.FirstOrDefault(i => string.Equals(mappedTunerChannelId, i.Id, StringComparison.OrdinalIgnoreCase)); if (channel != null) { diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index 04983553b..909fc0623 100644 --- a/MediaBrowser.Api/LiveTv/LiveTvService.cs +++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs @@ -791,7 +791,7 @@ namespace MediaBrowser.Api.LiveTv ProviderChannels = providerChannels.Select(i => new NameIdPair { Name = i.Name, - Id = i.TunerChannelId + Id = string.IsNullOrWhiteSpace(i.TunerChannelId) ? i.Id : i.TunerChannelId }).ToList(), From d6b4b5eeb080d67c1b10e4572af59a5e292e9aa0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 8 Feb 2017 16:31:19 -0500 Subject: [PATCH 15/22] 3.2.0.103 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index 794165849..f674ad453 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.0.102")] +[assembly: AssemblyVersion("3.2.0.103")] From f1cfd3cffb6ba6af91badb717ee204dce682d793 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 8 Feb 2017 22:58:04 -0500 Subject: [PATCH 16/22] add schedules direct error handling --- .../BaseApplicationHost.cs | 26 ++++++++++++- .../HttpClientManager/HttpClientManager.cs | 13 ++----- .../LiveTv/Listings/SchedulesDirect.cs | 38 ++++++++++++++----- 3 files changed, 57 insertions(+), 20 deletions(-) diff --git a/Emby.Common.Implementations/BaseApplicationHost.cs b/Emby.Common.Implementations/BaseApplicationHost.cs index 87b97863b..147a43fa1 100644 --- a/Emby.Common.Implementations/BaseApplicationHost.cs +++ b/Emby.Common.Implementations/BaseApplicationHost.cs @@ -527,7 +527,7 @@ return null; RegisterSingleInstance(FileSystemManager); - HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, LogManager.GetLogger("HttpClient"), FileSystemManager, MemoryStreamFactory); + HttpClient = new HttpClientManager.HttpClientManager(ApplicationPaths, LogManager.GetLogger("HttpClient"), FileSystemManager, MemoryStreamFactory, GetDefaultUserAgent); RegisterSingleInstance(HttpClient); RegisterSingleInstance(NetworkManager); @@ -549,6 +549,30 @@ return null; return Task.FromResult(true); } + private string GetDefaultUserAgent() + { + var name = FormatAttribute(Name); + + return name + "/" + ApplicationVersion.ToString(); + } + + private string FormatAttribute(string str) + { + var arr = str.ToCharArray(); + + arr = Array.FindAll(arr, (c => (char.IsLetterOrDigit(c) + || char.IsWhiteSpace(c)))); + + var result = new string(arr); + + if (string.IsNullOrWhiteSpace(result)) + { + result = "Emby"; + } + + return result; + } + /// /// Gets a list of types within an assembly /// This will handle situations that would normally throw an exception - such as a type within the assembly that depends on some other non-existant reference diff --git a/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs b/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs index 0abcaadb1..737cdcc7d 100644 --- a/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -44,18 +44,12 @@ namespace Emby.Common.Implementations.HttpClientManager private readonly IFileSystem _fileSystem; private readonly IMemoryStreamFactory _memoryStreamProvider; - private readonly IApplicationHost _appHost; + private readonly Func _defaultUserAgentFn; /// /// Initializes a new instance of the class. /// - /// The app paths. - /// The logger. - /// The file system. - /// appPaths - /// or - /// logger - public HttpClientManager(IApplicationPaths appPaths, ILogger logger, IFileSystem fileSystem, IMemoryStreamFactory memoryStreamProvider) + public HttpClientManager(IApplicationPaths appPaths, ILogger logger, IFileSystem fileSystem, IMemoryStreamFactory memoryStreamProvider, Func defaultUserAgentFn) { if (appPaths == null) { @@ -70,6 +64,7 @@ namespace Emby.Common.Implementations.HttpClientManager _fileSystem = fileSystem; _memoryStreamProvider = memoryStreamProvider; _appPaths = appPaths; + _defaultUserAgentFn = defaultUserAgentFn; #if NET46 // http://stackoverflow.com/questions/566437/http-post-returns-the-error-417-expectation-failed-c @@ -284,7 +279,7 @@ namespace Emby.Common.Implementations.HttpClientManager if (!hasUserAgent && options.EnableDefaultUserAgent) { - SetUserAgent(request, _appHost.Name + "/" + _appHost.ApplicationVersion.ToString()); + SetUserAgent(request, _defaultUserAgentFn()); } } diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index 1b7a1c8c6..0d7a26553 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -152,7 +152,11 @@ namespace Emby.Server.Implementations.LiveTv.Listings responseString); var programDict = programDetails.ToDictionary(p => p.programID, y => y); - var images = await GetImageForPrograms(info, programDetails.Where(p => p.hasImageArtwork).Select(p => p.programID).ToList(), cancellationToken); + var programIdsWithImages = + programDetails.Where(p => p.hasImageArtwork).Select(p => p.programID) + .ToList(); + + var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken); var schedules = dailySchedules.SelectMany(d => d.programs); foreach (ScheduleDirect.Program schedule in schedules) @@ -439,13 +443,20 @@ namespace Emby.Server.Implementations.LiveTv.Listings List programIds, CancellationToken cancellationToken) { + if (programIds.Count == 0) + { + return new List(); + } + var imageIdString = "["; foreach (var i in programIds) { - if (!imageIdString.Contains(i.Substring(0, 10))) + var imageId = i.Substring(0, 10); + + if (!imageIdString.Contains(imageId)) { - imageIdString += "\"" + i.Substring(0, 10) + "\","; + imageIdString += "\"" + imageId + "\","; } } @@ -461,14 +472,21 @@ namespace Emby.Server.Implementations.LiveTv.Listings // The data can be large so give it some extra time TimeoutMs = 60000 }; - List images; - using (var innerResponse2 = await Post(httpOptions, true, info).ConfigureAwait(false)) - { - images = _jsonSerializer.DeserializeFromStream>( - innerResponse2.Content); - } - return images; + try + { + using (var innerResponse2 = await Post(httpOptions, true, info).ConfigureAwait(false)) + { + return _jsonSerializer.DeserializeFromStream>( + innerResponse2.Content); + } + } + catch (Exception ex) + { + _logger.ErrorException("Error getting image info from schedules direct", ex); + + return new List(); + } } public async Task> GetHeadends(ListingsProviderInfo info, string country, string location, CancellationToken cancellationToken) From 1879999fd3f42861e8dfd4bf190ed3c0d0d510b7 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 8 Feb 2017 22:58:25 -0500 Subject: [PATCH 17/22] 3.2.0.104 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index f674ad453..705c32691 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.0.103")] +[assembly: AssemblyVersion("3.2.0.104")] From 6405f6c0c74ac689c7817d74aaa58f548d29b84d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 9 Feb 2017 18:25:10 -0500 Subject: [PATCH 18/22] update xmltv parsing --- .../HttpClientManager/HttpClientManager.cs | 19 +++++++++++++------ .../Emby.Server.Implementations.csproj | 4 ++-- Emby.Server.Implementations/packages.config | 2 +- MediaBrowser.Providers/Omdb/OmdbProvider.cs | 14 +++++++++----- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs b/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs index 737cdcc7d..23f33f06c 100644 --- a/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs +++ b/Emby.Common.Implementations/HttpClientManager/HttpClientManager.cs @@ -458,15 +458,22 @@ namespace Emby.Common.Implementations.HttpClientManager !string.IsNullOrEmpty(options.RequestContent) || string.Equals(httpMethod, "post", StringComparison.OrdinalIgnoreCase)) { - var bytes = options.RequestContentBytes ?? - Encoding.UTF8.GetBytes(options.RequestContent ?? string.Empty); + try + { + var bytes = options.RequestContentBytes ?? + Encoding.UTF8.GetBytes(options.RequestContent ?? string.Empty); - httpWebRequest.ContentType = options.RequestContentType ?? "application/x-www-form-urlencoded"; + httpWebRequest.ContentType = options.RequestContentType ?? "application/x-www-form-urlencoded"; #if NET46 - httpWebRequest.ContentLength = bytes.Length; -#endif - (await httpWebRequest.GetRequestStreamAsync().ConfigureAwait(false)).Write(bytes, 0, bytes.Length); + httpWebRequest.ContentLength = bytes.Length; +#endif + (await httpWebRequest.GetRequestStreamAsync().ConfigureAwait(false)).Write(bytes, 0, bytes.Length); + } + catch (Exception ex) + { + throw new HttpException(ex.Message) { IsTimedOut = true }; + } } if (options.ResourcePool != null) diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index 195d24b21..a1bd67f1f 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -309,8 +309,8 @@ {4f26d5d8-a7b0-42b3-ba42-7cb7d245934e} SocketHttpListener.Portable - - ..\packages\Emby.XmlTv.1.0.5\lib\portable-net45+win8\Emby.XmlTv.dll + + ..\packages\Emby.XmlTv.1.0.6\lib\portable-net45+win8\Emby.XmlTv.dll True diff --git a/Emby.Server.Implementations/packages.config b/Emby.Server.Implementations/packages.config index 5249577e6..3c82e979b 100644 --- a/Emby.Server.Implementations/packages.config +++ b/Emby.Server.Implementations/packages.config @@ -1,6 +1,6 @@  - + diff --git a/MediaBrowser.Providers/Omdb/OmdbProvider.cs b/MediaBrowser.Providers/Omdb/OmdbProvider.cs index b42dd34b2..fdd334e6e 100644 --- a/MediaBrowser.Providers/Omdb/OmdbProvider.cs +++ b/MediaBrowser.Providers/Omdb/OmdbProvider.cs @@ -385,10 +385,11 @@ namespace MediaBrowser.Providers.Omdb { T item = itemResult.Item; + var isConfiguredForEnglish = IsConfiguredForEnglish(item); + // Grab series genres because imdb data is better than tvdb. Leave movies alone // But only do it if english is the preferred language because this data will not be localized - if (ShouldFetchGenres(item) && - !string.IsNullOrWhiteSpace(result.Genre)) + if (isConfiguredForEnglish && !string.IsNullOrWhiteSpace(result.Genre)) { item.Genres.Clear(); @@ -418,8 +419,11 @@ namespace MediaBrowser.Providers.Omdb hasAwards.AwardSummary = WebUtility.HtmlDecode(result.Awards); } - // Imdb plots are usually pretty short - item.Overview = result.Plot; + if (isConfiguredForEnglish) + { + // Omdb is currently english only, so for other languages skip this and let secondary providers fill it in + item.Overview = result.Plot; + } //if (!string.IsNullOrWhiteSpace(result.Director)) //{ @@ -462,7 +466,7 @@ namespace MediaBrowser.Providers.Omdb //} } - private bool ShouldFetchGenres(BaseItem item) + private bool IsConfiguredForEnglish(BaseItem item) { var lang = item.GetPreferredMetadataLanguage(); From 35415d6a504ae8e2f066b2e0e4b1a94745c95bf3 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 9 Feb 2017 18:59:27 -0500 Subject: [PATCH 19/22] add error handling --- .../LiveTv/EmbyTV/EncodedRecorder.cs | 1 + .../LiveTv/ProgramImageProvider.cs | 15 +++--- .../Encoder/EncodingHelper.cs | 50 +++++++++---------- 3 files changed, 35 insertions(+), 31 deletions(-) diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs index 68126f926..9a8282250 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EncodedRecorder.cs @@ -155,6 +155,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV var durationParam = " -t " + _mediaEncoder.GetTimeParameter(duration.Ticks); var inputModifiers = "-fflags +genpts -async 1 -vsync -1"; var mapArgs = string.Equals(OutputFormat, "mkv", StringComparison.OrdinalIgnoreCase) ? "-map 0" : "-sn"; + mapArgs = "-sn"; var commandLineArgs = "-i \"{0}\"{4} " + mapArgs + " {2} -map_metadata -1 -threads 0 {3} -y \"{1}\""; long startTimeTicks = 0; diff --git a/Emby.Server.Implementations/LiveTv/ProgramImageProvider.cs b/Emby.Server.Implementations/LiveTv/ProgramImageProvider.cs index 5a0389b16..5cff88a67 100644 --- a/Emby.Server.Implementations/LiveTv/ProgramImageProvider.cs +++ b/Emby.Server.Implementations/LiveTv/ProgramImageProvider.cs @@ -50,13 +50,16 @@ namespace Emby.Server.Implementations.LiveTv { var channel = _liveTvManager.GetInternalChannel(liveTvItem.ChannelId); - var response = await service.GetProgramImageAsync(GetItemExternalId(liveTvItem), GetItemExternalId(channel), cancellationToken).ConfigureAwait(false); - - if (response != null) + if (channel != null) { - imageResponse.HasImage = true; - imageResponse.Stream = response.Stream; - imageResponse.Format = response.Format; + var response = await service.GetProgramImageAsync(GetItemExternalId(liveTvItem), GetItemExternalId(channel), cancellationToken).ConfigureAwait(false); + + if (response != null) + { + imageResponse.HasImage = true; + imageResponse.Stream = response.Stream; + imageResponse.Format = response.Format; + } } } catch (NotImplementedException) diff --git a/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs b/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs index ed9552964..83057dba4 100644 --- a/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs +++ b/MediaBrowser.MediaEncoding/Encoder/EncodingHelper.cs @@ -1486,33 +1486,33 @@ namespace MediaBrowser.MediaEncoding.Encoder //inputModifier += " -noaccurate_seek"; } - if (!string.IsNullOrWhiteSpace(state.InputContainer)) - { - var inputFormat = GetInputFormat(state.InputContainer); - if (!string.IsNullOrWhiteSpace(inputFormat)) - { - inputModifier += " -f " + inputFormat; - } - } + //if (!string.IsNullOrWhiteSpace(state.InputContainer)) + //{ + // var inputFormat = GetInputFormat(state.InputContainer); + // if (!string.IsNullOrWhiteSpace(inputFormat)) + // { + // inputModifier += " -f " + inputFormat; + // } + //} - if (state.RunTimeTicks.HasValue) - { - foreach (var stream in state.MediaSource.MediaStreams) - { - if (!stream.IsExternal && stream.Type != MediaStreamType.Subtitle) - { - if (!string.IsNullOrWhiteSpace(stream.Codec) && stream.Index != -1) - { - var decoder = GetDecoderFromCodec(stream.Codec); + //if (state.RunTimeTicks.HasValue) + //{ + // foreach (var stream in state.MediaSource.MediaStreams) + // { + // if (!stream.IsExternal && stream.Type != MediaStreamType.Subtitle) + // { + // if (!string.IsNullOrWhiteSpace(stream.Codec) && stream.Index != -1) + // { + // var decoder = GetDecoderFromCodec(stream.Codec); - if (!string.IsNullOrWhiteSpace(decoder)) - { - inputModifier += " -codec:" + stream.Index.ToString(_usCulture) + " " + decoder; - } - } - } - } - } + // if (!string.IsNullOrWhiteSpace(decoder)) + // { + // inputModifier += " -codec:" + stream.Index.ToString(_usCulture) + " " + decoder; + // } + // } + // } + // } + //} } return inputModifier; From 9a59d1224190abd618abba4c87d3a7b5a04c6eb0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 9 Feb 2017 19:15:07 -0500 Subject: [PATCH 20/22] update channel image urls --- Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index cd5fd0c8c..bbb060203 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -423,6 +423,11 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV { tunerChannel.Name = epgChannel.Name; } + if (!string.IsNullOrWhiteSpace(epgChannel.ImageUrl)) + { + tunerChannel.ImageUrl = epgChannel.ImageUrl; + tunerChannel.HasImage = true; + } } } } From 4bc2a77df188d72cbf5416cccf5ff33d9d075560 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 9 Feb 2017 19:15:50 -0500 Subject: [PATCH 21/22] 3.2.1.100 --- SharedVersion.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SharedVersion.cs b/SharedVersion.cs index 705c32691..7a98bd22e 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.0.104")] +[assembly: AssemblyVersion("3.2.1.100")] From 9800463e596c7d730761dd6110b78ab1e813a672 Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 9 Feb 2017 19:36:55 -0500 Subject: [PATCH 22/22] update mac project --- MediaBrowser.Server.Mac/Emby.Server.Mac.csproj | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj b/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj index 7f3baf0c0..f7f084917 100644 --- a/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj +++ b/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj @@ -1569,15 +1569,6 @@ Resources\dashboard-ui\bower_components\font-roboto\roboto.html - - Resources\dashboard-ui\bower_components\hammerjs\changelog.js - - - Resources\dashboard-ui\bower_components\hammerjs\hammer.js - - - Resources\dashboard-ui\bower_components\hammerjs\hammer.min.js - Resources\dashboard-ui\bower_components\headroomjs\LICENSE @@ -1917,6 +1908,9 @@ Resources\dashboard-ui\css\images\logo.png + + Resources\dashboard-ui\css\images\logoblack.png + Resources\dashboard-ui\css\images\mblogoicon.png