diff --git a/Ombi.Api.Interfaces/IRadarrApi.cs b/Ombi.Api.Interfaces/IRadarrApi.cs index f1b015d31..fc20c8d43 100644 --- a/Ombi.Api.Interfaces/IRadarrApi.cs +++ b/Ombi.Api.Interfaces/IRadarrApi.cs @@ -8,7 +8,7 @@ namespace Ombi.Api.Interfaces public interface IRadarrApi { RadarrAddMovie AddMovie(int tmdbId, string title, int year, int qualityId, string rootPath, string apiKey, Uri baseUrl, bool searchNow = false); - List GetMovies(string apiKey, Uri baseUrl); + RadarrMovieContainer GetMovies(string apiKey, Uri baseUrl); List GetProfiles(string apiKey, Uri baseUrl); SystemStatus SystemStatus(string apiKey, Uri baseUrl); List GetRootFolders(string apiKey, Uri baseUrl); diff --git a/Ombi.Api.Models/Ombi.Api.Models.csproj b/Ombi.Api.Models/Ombi.Api.Models.csproj index eb3297999..addec5fa1 100644 --- a/Ombi.Api.Models/Ombi.Api.Models.csproj +++ b/Ombi.Api.Models/Ombi.Api.Models.csproj @@ -112,6 +112,7 @@ + diff --git a/Ombi.Api.Models/Radarr/RadarrMovieContainer.cs b/Ombi.Api.Models/Radarr/RadarrMovieContainer.cs new file mode 100644 index 000000000..fea472db7 --- /dev/null +++ b/Ombi.Api.Models/Radarr/RadarrMovieContainer.cs @@ -0,0 +1,41 @@ +#region Copyright +// /************************************************************************ +// Copyright (c) 2017 Jamie Rees +// File: RadarrMovieContainer.cs +// Created By: Jamie Rees +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// ************************************************************************/ +#endregion + +using System.Collections.Generic; + +namespace Ombi.Api.Models.Radarr +{ + public class RadarrMovieContainer + { + public int page { get; set; } + public int pageSize { get; set; } + public string sortKey { get; set; } + public string sortDirection { get; set; } + public int totalRecords { get; set; } + public List records { get; set; } + } +} \ No newline at end of file diff --git a/Ombi.Api.Models/Tv/TVMazeShow.cs b/Ombi.Api.Models/Tv/TVMazeShow.cs index 03aa39ce5..29f21a18a 100644 --- a/Ombi.Api.Models/Tv/TVMazeShow.cs +++ b/Ombi.Api.Models/Tv/TVMazeShow.cs @@ -15,7 +15,7 @@ namespace Ombi.Api.Models.Tv public string language { get; set; } public List genres { get; set; } public string status { get; set; } - public int runtime { get; set; } + public double runtime { get; set; } public string premiered { get; set; } public Schedule schedule { get; set; } public Rating rating { get; set; } diff --git a/Ombi.Api/RadarrApi.cs b/Ombi.Api/RadarrApi.cs index 1840f40a0..9d5a34e9a 100644 --- a/Ombi.Api/RadarrApi.cs +++ b/Ombi.Api/RadarrApi.cs @@ -152,7 +152,7 @@ namespace Ombi.Api } - public List GetMovies(string apiKey, Uri baseUrl) + public RadarrMovieContainer GetMovies(string apiKey, Uri baseUrl) { var request = new RestRequest { Resource = "/api/movie", Method = Method.GET }; request.AddHeader("X-Api-Key", apiKey); @@ -165,7 +165,7 @@ namespace Ombi.Api var obj = policy.Execute(() => Api.Execute(request, baseUrl)); - return JsonConvert.DeserializeObject>(obj.Content); + return JsonConvert.DeserializeObject(obj.Content); } } } \ No newline at end of file diff --git a/Ombi.Core/Users/IUserHelper.cs b/Ombi.Core/Users/IUserHelper.cs index 8f0cbfa01..2b5c9be69 100644 --- a/Ombi.Core/Users/IUserHelper.cs +++ b/Ombi.Core/Users/IUserHelper.cs @@ -8,5 +8,6 @@ namespace Ombi.Core.Users IEnumerable GetUsers(); IEnumerable GetUsersWithPermission(Permissions permission); IEnumerable GetUsersWithFeature(Features feature); + UserHelperModel GetUser(string username); } } \ No newline at end of file diff --git a/Ombi.Core/Users/UserHelper.cs b/Ombi.Core/Users/UserHelper.cs index ae3174de1..ccb211a05 100644 --- a/Ombi.Core/Users/UserHelper.cs +++ b/Ombi.Core/Users/UserHelper.cs @@ -51,6 +51,49 @@ namespace Ombi.Core.Users private ISecurityExtensions Security { get; } private IExternalUserRepository EmbyUserRepository { get; } + public UserHelperModel GetUser(string username) + { + var localUsers = LocalUserRepository.GetUserByUsername(username); + if (localUsers != null) + { + var props = ByteConverterHelper.ReturnObject(localUsers.UserProperties); + return new UserHelperModel + { + Type = UserType.LocalUser, + Username = localUsers.UserName, + UserAlias = props.UserAlias, + EmailAddress = props.EmailAddress, + Permissions = (Permissions) localUsers.Permissions + }; + } + + var plexUsers = PlexUserRepository.GetUserByUsername(username); + if (plexUsers != null) + { + return new UserHelperModel + { + Type = UserType.PlexUser, + Username = plexUsers.Username, + UserAlias = plexUsers.UserAlias, + EmailAddress = plexUsers.EmailAddress, + Permissions = (Permissions)plexUsers.Permissions + }; + } + + var embyUsers = EmbyUserRepository.GetUserByUsername(username); + if (embyUsers != null) + { + return new UserHelperModel + { + Type = UserType.EmbyUser, + Username = embyUsers.Username, + UserAlias = embyUsers.UserAlias, + EmailAddress = embyUsers.EmailAddress, + Permissions = (Permissions)embyUsers.Permissions + }; + } + return null; + } public IEnumerable GetUsers() { diff --git a/Ombi.Helpers/StringHasher.cs b/Ombi.Helpers/StringHasher.cs index 40228616c..64f089172 100644 --- a/Ombi.Helpers/StringHasher.cs +++ b/Ombi.Helpers/StringHasher.cs @@ -35,6 +35,10 @@ namespace Ombi.Helpers { public static string CalcuateMd5Hash(string input) { + if (string.IsNullOrEmpty(input)) + { + return string.Empty; + } using (var md5 = MD5.Create()) { var inputBytes = Encoding.UTF8.GetBytes(input); diff --git a/Ombi.Services/Jobs/PlexContentCacher.cs b/Ombi.Services/Jobs/PlexContentCacher.cs index 041374c6b..f370b7b36 100644 --- a/Ombi.Services/Jobs/PlexContentCacher.cs +++ b/Ombi.Services/Jobs/PlexContentCacher.cs @@ -264,7 +264,7 @@ namespace Ombi.Services.Jobs return media; }); - if (item == null) + if (item == null && !string.IsNullOrEmpty(m.ItemId)) { // Doesn't exist, insert it PlexContent.Insert(new PlexContent @@ -305,7 +305,7 @@ namespace Ombi.Services.Jobs return media; }); - if (item == null) + if (item == null && !string.IsNullOrEmpty(t.ItemId)) { PlexContent.Insert(new PlexContent { diff --git a/Ombi.Services/Jobs/RadarrCacher.cs b/Ombi.Services/Jobs/RadarrCacher.cs index fc7338ecf..e781c997f 100644 --- a/Ombi.Services/Jobs/RadarrCacher.cs +++ b/Ombi.Services/Jobs/RadarrCacher.cs @@ -67,12 +67,16 @@ namespace Ombi.Services.Jobs if (movies != null) { var movieIds = new List(); - foreach (var m in movies) + foreach (var m in movies.records) { if (m.tmdbId > 0) { movieIds.Add(m.tmdbId); } + else + { + Log.Error("TMDBId is not > 0 for movie {0}", m.title); + } } //var movieIds = movies.Select(x => x.tmdbId).ToList(); Cache.Set(CacheKeys.RadarrMovies, movieIds, CacheKeys.TimeFrameMinutes.SchedulerCaching); diff --git a/Ombi.UI/Content/base.css b/Ombi.UI/Content/base.css index 4232dbf6e..3a7711cc9 100644 --- a/Ombi.UI/Content/base.css +++ b/Ombi.UI/Content/base.css @@ -544,3 +544,13 @@ label { width: 100%; height: 5px; } +.navbar-brand { + float: left; + padding: 4.5px 15px; + font-size: 19px; + line-height: 21px; + height: 40px; } + +.gravatar { + border-radius: 1em; } + diff --git a/Ombi.UI/Content/base.min.css b/Ombi.UI/Content/base.min.css index f8b174325..5bdf7006c 100644 --- a/Ombi.UI/Content/base.min.css +++ b/Ombi.UI/Content/base.min.css @@ -1 +1 @@ -@media(min-width:768px){.row{position:relative;}.bottom-align-text{position:absolute;bottom:0;right:0;}.landing-block .media{max-width:450px;}}@media(max-width:48em){.home{padding-top:1rem;}}@media(min-width:48em){.home{padding-top:4rem;}}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#fff;}hr{border:1px dashed #777;}.btn{border-radius:.25rem !important;}.btn-group-separated .btn,.btn-group-separated .btn+.btn{margin-left:3px;}.multiSelect{background-color:#4e5d6c;}.form-control-custom{background-color:#4e5d6c !important;color:#fff !important;border-radius:0;box-shadow:0 0 0 !important;}h1{font-size:3.5rem !important;font-weight:600 !important;}.request-title{margin-top:0 !important;font-size:1.9rem !important;}p{font-size:1.1rem !important;}label{display:inline-block !important;margin-bottom:.5rem !important;font-size:16px !important;}.small-label{display:inline-block !important;margin-bottom:.5rem !important;font-size:11px !important;}.small-checkbox{min-height:0 !important;}.round-checkbox{border-radius:8px;}.nav-tabs>li{font-size:13px;line-height:21px;}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{background:#4e5d6c;}.nav-tabs>li>a>.fa{padding:3px 5px 3px 3px;}.nav-tabs>li.nav-tab-right{float:right;}.nav-tabs>li.nav-tab-right a{margin-right:0;margin-left:2px;}.nav-tabs>li.nav-tab-icononly .fa{padding:3px;}.navbar .nav a .fa,.dropdown-menu a .fa{font-size:130%;top:1px;position:relative;display:inline-block;margin-right:5px;}.dropdown-menu a .fa{top:2px;}.btn-danger-outline{color:#d9534f !important;background-color:transparent;background-image:none;border-color:#d9534f !important;}.btn-danger-outline:focus,.btn-danger-outline.focus,.btn-danger-outline:active,.btn-danger-outline.active,.btn-danger-outline:hover,.open>.btn-danger-outline.dropdown-toggle{color:#fff !important;background-color:#d9534f !important;border-color:#d9534f !important;}.btn-primary-outline{color:#ff761b !important;background-color:transparent;background-image:none;border-color:#ff761b !important;}.btn-primary-outline:focus,.btn-primary-outline.focus,.btn-primary-outline:active,.btn-primary-outline.active,.btn-primary-outline:hover,.open>.btn-primary-outline.dropdown-toggle{color:#fff !important;background-color:#df691a !important;border-color:#df691a !important;}.btn-info-outline{color:#5bc0de !important;background-color:transparent;background-image:none;border-color:#5bc0de !important;}.btn-info-outline:focus,.btn-info-outline.focus,.btn-info-outline:active,.btn-info-outline.active,.btn-info-outline:hover,.open>.btn-info-outline.dropdown-toggle{color:#fff !important;background-color:#5bc0de !important;border-color:#5bc0de !important;}.btn-warning-outline{color:#f0ad4e !important;background-color:transparent;background-image:none;border-color:#f0ad4e !important;}.btn-warning-outline:focus,.btn-warning-outline.focus,.btn-warning-outline:active,.btn-warning-outline.active,.btn-warning-outline:hover,.open>.btn-warning-outline.dropdown-toggle{color:#fff !important;background-color:#f0ad4e !important;border-color:#f0ad4e !important;}.btn-success-outline{color:#5cb85c !important;background-color:transparent;background-image:none;border-color:#5cb85c !important;}.btn-success-outline:focus,.btn-success-outline.focus,.btn-success-outline:active,.btn-success-outline.active,.btn-success-outline:hover,.open>.btn-success-outline.dropdown-toggle{color:#fff !important;background-color:#5cb85c !important;border-color:#5cb85c !important;}#movieList .mix{display:none;}#tvList .mix{display:none;}.scroll-top-wrapper{position:fixed;opacity:0;visibility:hidden;overflow:hidden;text-align:center;z-index:99999999;background-color:#4e5d6c;color:#eee;width:50px;height:48px;line-height:48px;right:30px;bottom:30px;padding-top:2px;border-top-left-radius:10px;border-top-right-radius:10px;border-bottom-right-radius:10px;border-bottom-left-radius:10px;-webkit-transition:all .5s ease-in-out;-moz-transition:all .5s ease-in-out;-ms-transition:all .5s ease-in-out;-o-transition:all .5s ease-in-out;transition:all .5s ease-in-out;}.scroll-top-wrapper:hover{background-color:#637689;}.scroll-top-wrapper.show{visibility:visible;cursor:pointer;opacity:1;}.scroll-top-wrapper i.fa{line-height:inherit;}.no-search-results{text-align:center;}.no-search-results .no-search-results-icon{font-size:10em;color:#4e5d6c;}.no-search-results .no-search-results-text{margin:20px 0;color:#ccc;}.form-control-search{padding:13px 105px 13px 16px;height:100%;}.form-control-withbuttons{padding-right:105px;}.input-group-addon .btn-group{position:absolute;right:45px;z-index:3;top:10px;box-shadow:0 0 0;}.input-group-addon .btn-group .btn{border:1px solid rgba(255,255,255,.7) !important;padding:3px 12px;color:rgba(255,255,255,.7) !important;}.btn-split .btn{border-radius:0 !important;}.btn-split .btn:not(.dropdown-toggle){border-radius:.25rem 0 0 .25rem !important;}.btn-split .btn.dropdown-toggle{border-radius:0 .25rem .25rem 0 !important;padding:12px 8px;}#updateAvailable{background-color:#df691a;text-align:center;font-size:15px;padding:3px 0;}#cacherRunning{background-color:#4e5d6c;text-align:center;font-size:15px;padding:3px 0;}.checkbox label{display:inline-block;cursor:pointer;position:relative;padding-left:25px;margin-right:15px;font-size:13px;margin-bottom:10px;}.checkbox label:before{content:"";display:inline-block;width:18px;height:18px;margin-right:10px;position:absolute;left:0;bottom:1px;border:2px solid #eee;border-radius:3px;}.checkbox input[type=checkbox]{display:none;}.checkbox input[type=checkbox]:checked+label:before{content:"✓";font-size:13px;color:#fafafa;text-align:center;line-height:13px;}.small-checkbox label{display:inline-block;cursor:pointer;position:relative;padding-left:25px;margin-right:15px;font-size:13px;margin-bottom:10px;}.small-checkbox label:before{content:"";display:inline-block;width:18px;height:18px;margin-right:10px;position:absolute;left:0;bottom:1px;border:2px solid #eee;border-radius:8px;min-height:0 !important;}.small-checkbox input[type=checkbox]{display:none;}.small-checkbox input[type=checkbox]:checked+label:before{content:"✓";font-size:13px;color:#fafafa;text-align:center;line-height:13px;}.small-checkbox label{min-height:0 !important;padding-left:20px;margin-bottom:0;font-weight:normal;cursor:pointer;}.input-group-sm{padding-top:2px;padding-bottom:2px;}.tab-pane .form-horizontal .form-group{margin-right:15px;margin-left:15px;}.bootstrap-datetimepicker-widget.dropdown-menu{background-color:#4e5d6c;}.bootstrap-datetimepicker-widget.dropdown-menu.bottom:after{border-bottom:6px solid #4e5d6c !important;}.bootstrap-datetimepicker-widget table td.active,.bootstrap-datetimepicker-widget table td.active:hover{color:#fff !important;}.landing-header{display:block;margin:60px auto;}.landing-block{background:#2f2f2f !important;padding:5px;}.landing-block .media{margin:30px auto;max-width:450px;}.landing-block .media .media-left{display:inline-block;float:left;width:70px;}.landing-block .media .media-left i.fa{font-size:3em;}.landing-title{font-weight:bold;}.checkbox-custom{margin-top:0 !important;margin-bottom:0 !important;}.tooltip_templates{display:none;}.shadow{-moz-box-shadow:3px 3px 5px 6px #191919;-webkit-box-shadow:3px 3px 5px 6px #191919;box-shadow:3px 3px 5px 6px #191919;}.img-circle{border-radius:50%;}#wrapper{padding-left:0;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease;}#wrapper.toggled{padding-right:250px;}#sidebar-wrapper{z-index:1000;position:fixed;right:250px;width:0;height:100%;margin-right:-250px;overflow-y:auto;background:#4e5d6c;padding-left:0;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease;}#wrapper.toggled #sidebar-wrapper{width:500px;}#page-content-wrapper{width:100%;position:absolute;padding:15px;}#wrapper.toggled #page-content-wrapper{position:absolute;margin-left:-250px;}.sidebar-nav{position:absolute;top:0;width:500px;margin:0;padding-left:0;list-style:none;}.sidebar-nav li{text-indent:20px;line-height:40px;}.sidebar-nav li a{display:block;text-decoration:none;color:#999;}.sidebar-nav li a:hover{text-decoration:none;color:#fff;background:rgba(255,255,255,.2);}.sidebar-nav li a:active,.sidebar-nav li a:focus{text-decoration:none;}.sidebar-nav>.sidebar-brand{height:65px;font-size:18px;line-height:60px;}.sidebar-nav>.sidebar-brand a{color:#999;}.sidebar-nav>.sidebar-brand a:hover{color:#fff;background:none;}@media(min-width:768px){#wrapper{padding-right:250px;}#wrapper.toggled{padding-right:0;}#sidebar-wrapper{width:500px;}#wrapper.toggled #sidebar-wrapper{width:0;}#page-content-wrapper{padding:20px;position:relative;}#wrapper.toggled #page-content-wrapper{position:relative;margin-right:0;}}#lightbox{background-color:#808080;filter:alpha(opacity=50);opacity:.5;-moz-opacity:.5;top:0;left:0;z-index:20;height:100%;width:100%;background-repeat:no-repeat;background-position:center;position:absolute;}.list-group-item-dropdown{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#3e3e3e;border:1px solid transparent;}.wizard-heading{text-align:center;}.wizard-img{width:300px;display:block !important;margin:0 auto !important;}.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;}.pace-inactive{display:none;}.pace .pace-progress{background:#df691a;position:fixed;z-index:2000;top:0;right:100%;width:100%;height:5px;} \ No newline at end of file +@media(min-width:768px){.row{position:relative;}.bottom-align-text{position:absolute;bottom:0;right:0;}.landing-block .media{max-width:450px;}}@media(max-width:48em){.home{padding-top:1rem;}}@media(min-width:48em){.home{padding-top:4rem;}}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#fff;}hr{border:1px dashed #777;}.btn{border-radius:.25rem !important;}.btn-group-separated .btn,.btn-group-separated .btn+.btn{margin-left:3px;}.multiSelect{background-color:#4e5d6c;}.form-control-custom{background-color:#4e5d6c !important;color:#fff !important;border-radius:0;box-shadow:0 0 0 !important;}h1{font-size:3.5rem !important;font-weight:600 !important;}.request-title{margin-top:0 !important;font-size:1.9rem !important;}p{font-size:1.1rem !important;}label{display:inline-block !important;margin-bottom:.5rem !important;font-size:16px !important;}.small-label{display:inline-block !important;margin-bottom:.5rem !important;font-size:11px !important;}.small-checkbox{min-height:0 !important;}.round-checkbox{border-radius:8px;}.nav-tabs>li{font-size:13px;line-height:21px;}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{background:#4e5d6c;}.nav-tabs>li>a>.fa{padding:3px 5px 3px 3px;}.nav-tabs>li.nav-tab-right{float:right;}.nav-tabs>li.nav-tab-right a{margin-right:0;margin-left:2px;}.nav-tabs>li.nav-tab-icononly .fa{padding:3px;}.navbar .nav a .fa,.dropdown-menu a .fa{font-size:130%;top:1px;position:relative;display:inline-block;margin-right:5px;}.dropdown-menu a .fa{top:2px;}.btn-danger-outline{color:#d9534f !important;background-color:transparent;background-image:none;border-color:#d9534f !important;}.btn-danger-outline:focus,.btn-danger-outline.focus,.btn-danger-outline:active,.btn-danger-outline.active,.btn-danger-outline:hover,.open>.btn-danger-outline.dropdown-toggle{color:#fff !important;background-color:#d9534f !important;border-color:#d9534f !important;}.btn-primary-outline{color:#ff761b !important;background-color:transparent;background-image:none;border-color:#ff761b !important;}.btn-primary-outline:focus,.btn-primary-outline.focus,.btn-primary-outline:active,.btn-primary-outline.active,.btn-primary-outline:hover,.open>.btn-primary-outline.dropdown-toggle{color:#fff !important;background-color:#df691a !important;border-color:#df691a !important;}.btn-info-outline{color:#5bc0de !important;background-color:transparent;background-image:none;border-color:#5bc0de !important;}.btn-info-outline:focus,.btn-info-outline.focus,.btn-info-outline:active,.btn-info-outline.active,.btn-info-outline:hover,.open>.btn-info-outline.dropdown-toggle{color:#fff !important;background-color:#5bc0de !important;border-color:#5bc0de !important;}.btn-warning-outline{color:#f0ad4e !important;background-color:transparent;background-image:none;border-color:#f0ad4e !important;}.btn-warning-outline:focus,.btn-warning-outline.focus,.btn-warning-outline:active,.btn-warning-outline.active,.btn-warning-outline:hover,.open>.btn-warning-outline.dropdown-toggle{color:#fff !important;background-color:#f0ad4e !important;border-color:#f0ad4e !important;}.btn-success-outline{color:#5cb85c !important;background-color:transparent;background-image:none;border-color:#5cb85c !important;}.btn-success-outline:focus,.btn-success-outline.focus,.btn-success-outline:active,.btn-success-outline.active,.btn-success-outline:hover,.open>.btn-success-outline.dropdown-toggle{color:#fff !important;background-color:#5cb85c !important;border-color:#5cb85c !important;}#movieList .mix{display:none;}#tvList .mix{display:none;}.scroll-top-wrapper{position:fixed;opacity:0;visibility:hidden;overflow:hidden;text-align:center;z-index:99999999;background-color:#4e5d6c;color:#eee;width:50px;height:48px;line-height:48px;right:30px;bottom:30px;padding-top:2px;border-top-left-radius:10px;border-top-right-radius:10px;border-bottom-right-radius:10px;border-bottom-left-radius:10px;-webkit-transition:all .5s ease-in-out;-moz-transition:all .5s ease-in-out;-ms-transition:all .5s ease-in-out;-o-transition:all .5s ease-in-out;transition:all .5s ease-in-out;}.scroll-top-wrapper:hover{background-color:#637689;}.scroll-top-wrapper.show{visibility:visible;cursor:pointer;opacity:1;}.scroll-top-wrapper i.fa{line-height:inherit;}.no-search-results{text-align:center;}.no-search-results .no-search-results-icon{font-size:10em;color:#4e5d6c;}.no-search-results .no-search-results-text{margin:20px 0;color:#ccc;}.form-control-search{padding:13px 105px 13px 16px;height:100%;}.form-control-withbuttons{padding-right:105px;}.input-group-addon .btn-group{position:absolute;right:45px;z-index:3;top:10px;box-shadow:0 0 0;}.input-group-addon .btn-group .btn{border:1px solid rgba(255,255,255,.7) !important;padding:3px 12px;color:rgba(255,255,255,.7) !important;}.btn-split .btn{border-radius:0 !important;}.btn-split .btn:not(.dropdown-toggle){border-radius:.25rem 0 0 .25rem !important;}.btn-split .btn.dropdown-toggle{border-radius:0 .25rem .25rem 0 !important;padding:12px 8px;}#updateAvailable{background-color:#df691a;text-align:center;font-size:15px;padding:3px 0;}#cacherRunning{background-color:#4e5d6c;text-align:center;font-size:15px;padding:3px 0;}.checkbox label{display:inline-block;cursor:pointer;position:relative;padding-left:25px;margin-right:15px;font-size:13px;margin-bottom:10px;}.checkbox label:before{content:"";display:inline-block;width:18px;height:18px;margin-right:10px;position:absolute;left:0;bottom:1px;border:2px solid #eee;border-radius:3px;}.checkbox input[type=checkbox]{display:none;}.checkbox input[type=checkbox]:checked+label:before{content:"✓";font-size:13px;color:#fafafa;text-align:center;line-height:13px;}.small-checkbox label{display:inline-block;cursor:pointer;position:relative;padding-left:25px;margin-right:15px;font-size:13px;margin-bottom:10px;}.small-checkbox label:before{content:"";display:inline-block;width:18px;height:18px;margin-right:10px;position:absolute;left:0;bottom:1px;border:2px solid #eee;border-radius:8px;min-height:0 !important;}.small-checkbox input[type=checkbox]{display:none;}.small-checkbox input[type=checkbox]:checked+label:before{content:"✓";font-size:13px;color:#fafafa;text-align:center;line-height:13px;}.small-checkbox label{min-height:0 !important;padding-left:20px;margin-bottom:0;font-weight:normal;cursor:pointer;}.input-group-sm{padding-top:2px;padding-bottom:2px;}.tab-pane .form-horizontal .form-group{margin-right:15px;margin-left:15px;}.bootstrap-datetimepicker-widget.dropdown-menu{background-color:#4e5d6c;}.bootstrap-datetimepicker-widget.dropdown-menu.bottom:after{border-bottom:6px solid #4e5d6c !important;}.bootstrap-datetimepicker-widget table td.active,.bootstrap-datetimepicker-widget table td.active:hover{color:#fff !important;}.landing-header{display:block;margin:60px auto;}.landing-block{background:#2f2f2f !important;padding:5px;}.landing-block .media{margin:30px auto;max-width:450px;}.landing-block .media .media-left{display:inline-block;float:left;width:70px;}.landing-block .media .media-left i.fa{font-size:3em;}.landing-title{font-weight:bold;}.checkbox-custom{margin-top:0 !important;margin-bottom:0 !important;}.tooltip_templates{display:none;}.shadow{-moz-box-shadow:3px 3px 5px 6px #191919;-webkit-box-shadow:3px 3px 5px 6px #191919;box-shadow:3px 3px 5px 6px #191919;}.img-circle{border-radius:50%;}#wrapper{padding-left:0;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease;}#wrapper.toggled{padding-right:250px;}#sidebar-wrapper{z-index:1000;position:fixed;right:250px;width:0;height:100%;margin-right:-250px;overflow-y:auto;background:#4e5d6c;padding-left:0;-webkit-transition:all .5s ease;-moz-transition:all .5s ease;-o-transition:all .5s ease;transition:all .5s ease;}#wrapper.toggled #sidebar-wrapper{width:500px;}#page-content-wrapper{width:100%;position:absolute;padding:15px;}#wrapper.toggled #page-content-wrapper{position:absolute;margin-left:-250px;}.sidebar-nav{position:absolute;top:0;width:500px;margin:0;padding-left:0;list-style:none;}.sidebar-nav li{text-indent:20px;line-height:40px;}.sidebar-nav li a{display:block;text-decoration:none;color:#999;}.sidebar-nav li a:hover{text-decoration:none;color:#fff;background:rgba(255,255,255,.2);}.sidebar-nav li a:active,.sidebar-nav li a:focus{text-decoration:none;}.sidebar-nav>.sidebar-brand{height:65px;font-size:18px;line-height:60px;}.sidebar-nav>.sidebar-brand a{color:#999;}.sidebar-nav>.sidebar-brand a:hover{color:#fff;background:none;}@media(min-width:768px){#wrapper{padding-right:250px;}#wrapper.toggled{padding-right:0;}#sidebar-wrapper{width:500px;}#wrapper.toggled #sidebar-wrapper{width:0;}#page-content-wrapper{padding:20px;position:relative;}#wrapper.toggled #page-content-wrapper{position:relative;margin-right:0;}}#lightbox{background-color:#808080;filter:alpha(opacity=50);opacity:.5;-moz-opacity:.5;top:0;left:0;z-index:20;height:100%;width:100%;background-repeat:no-repeat;background-position:center;position:absolute;}.list-group-item-dropdown{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#3e3e3e;border:1px solid transparent;}.wizard-heading{text-align:center;}.wizard-img{width:300px;display:block !important;margin:0 auto !important;}.pace{-webkit-pointer-events:none;pointer-events:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;}.pace-inactive{display:none;}.pace .pace-progress{background:#df691a;position:fixed;z-index:2000;top:0;right:100%;width:100%;height:5px;}.navbar-brand{float:left;padding:4.5px 15px;font-size:19px;line-height:21px;height:40px;}.gravatar{border-radius:1em;} \ No newline at end of file diff --git a/Ombi.UI/Content/base.scss b/Ombi.UI/Content/base.scss index 69c9c5aec..b36df011c 100644 --- a/Ombi.UI/Content/base.scss +++ b/Ombi.UI/Content/base.scss @@ -673,4 +673,16 @@ $border-radius: 10px; right: 100%; width: 100%; height: 5px; -} \ No newline at end of file +} + +.navbar-brand { + float: left; + padding: 4.5px 15px; + font-size: 19px; + line-height: 21px; + height: 40px; +} + +.gravatar{ + border-radius:1em; +} diff --git a/Ombi.UI/Modules/ApiDocsModule.cs b/Ombi.UI/Modules/Api/ApiDocsModule.cs similarity index 100% rename from Ombi.UI/Modules/ApiDocsModule.cs rename to Ombi.UI/Modules/Api/ApiDocsModule.cs diff --git a/Ombi.UI/Modules/ApiRequestMetadataModule.cs b/Ombi.UI/Modules/Api/ApiRequestMetadataModule.cs similarity index 100% rename from Ombi.UI/Modules/ApiRequestMetadataModule.cs rename to Ombi.UI/Modules/Api/ApiRequestMetadataModule.cs diff --git a/Ombi.UI/Modules/ApiRequestModule.cs b/Ombi.UI/Modules/Api/ApiRequestModule.cs similarity index 100% rename from Ombi.UI/Modules/ApiRequestModule.cs rename to Ombi.UI/Modules/Api/ApiRequestModule.cs diff --git a/Ombi.UI/Modules/ApiSettingsMetadataModule.cs b/Ombi.UI/Modules/Api/ApiSettingsMetadataModule.cs similarity index 100% rename from Ombi.UI/Modules/ApiSettingsMetadataModule.cs rename to Ombi.UI/Modules/Api/ApiSettingsMetadataModule.cs diff --git a/Ombi.UI/Modules/ApiSettingsModule.cs b/Ombi.UI/Modules/Api/ApiSettingsModule.cs similarity index 100% rename from Ombi.UI/Modules/ApiSettingsModule.cs rename to Ombi.UI/Modules/Api/ApiSettingsModule.cs diff --git a/Ombi.UI/Modules/ApiUserMetadataModule.cs b/Ombi.UI/Modules/Api/ApiUserMetadataModule.cs similarity index 100% rename from Ombi.UI/Modules/ApiUserMetadataModule.cs rename to Ombi.UI/Modules/Api/ApiUserMetadataModule.cs diff --git a/Ombi.UI/Modules/ApiUserModule.cs b/Ombi.UI/Modules/Api/ApiUserModule.cs similarity index 100% rename from Ombi.UI/Modules/ApiUserModule.cs rename to Ombi.UI/Modules/Api/ApiUserModule.cs diff --git a/Ombi.UI/Modules/BaseApiModule.cs b/Ombi.UI/Modules/Api/BaseApiModule.cs similarity index 100% rename from Ombi.UI/Modules/BaseApiModule.cs rename to Ombi.UI/Modules/Api/BaseApiModule.cs diff --git a/Ombi.UI/Modules/LayoutModule.cs b/Ombi.UI/Modules/LayoutModule.cs index 7c784a715..16b6f93e2 100644 --- a/Ombi.UI/Modules/LayoutModule.cs +++ b/Ombi.UI/Modules/LayoutModule.cs @@ -29,10 +29,12 @@ using System; using System.Linq; using System.Threading.Tasks; using Nancy; +using Nancy.Responses; using NLog; using Ombi.Core; using Ombi.Core.SettingModels; using Ombi.Core.StatusChecker; +using Ombi.Core.Users; using Ombi.Helpers; using Ombi.Services.Interfaces; using Ombi.Services.Jobs; @@ -43,14 +45,16 @@ namespace Ombi.UI.Modules { public class LayoutModule : BaseAuthModule { - public LayoutModule(ICacheProvider provider, ISettingsService pr, ISettingsService settings, IJobRecord rec, ISecurityExtensions security) : base("layout", pr, security) + public LayoutModule(ICacheProvider provider, ISettingsService pr, ISettingsService settings, IJobRecord rec, ISecurityExtensions security, IUserHelper helper) : base("layout", pr, security) { Cache = provider; SystemSettings = settings; Job = rec; + UserHelper = helper; Get["/", true] = async (x,ct) => await CheckLatestVersion(); Get["/cacher", true] = async (x,ct) => await CacherRunning(); + Get["/gravatar"] = x => GetGravatarImage(); } private ICacheProvider Cache { get; } @@ -58,6 +62,7 @@ namespace Ombi.UI.Modules private static Logger Log = LogManager.GetCurrentClassLogger(); private ISettingsService SystemSettings { get; } private IJobRecord Job { get; } + private IUserHelper UserHelper { get; } private async Task CheckLatestVersion() { @@ -116,5 +121,31 @@ namespace Ombi.UI.Modules return Response.AsJson(new { CurrentlyRunning = false, IsAdmin }); } } + + private Response GetGravatarImage() + { + if (LoggedIn) + { + var user = UserHelper.GetUser(Username); + var hashed = StringHasher.CalcuateMd5Hash(user.EmailAddress); + if (string.IsNullOrEmpty(hashed)) + { + return Response.AsJson(new JsonResponseModel + { + Result = false + }); + } + return + Response.AsJson(new JsonResponseModel + { + Result = true, + Message = $"https://www.gravatar.com/avatar/{hashed}" + }); + } + else + { + return Response.AsJson(new JsonResponseModel {Result = false}); + } + } } } \ No newline at end of file diff --git a/Ombi.UI/Modules/RequestsModule.cs b/Ombi.UI/Modules/RequestsModule.cs index ae6c7778d..cf14ea26f 100644 --- a/Ombi.UI/Modules/RequestsModule.cs +++ b/Ombi.UI/Modules/RequestsModule.cs @@ -33,6 +33,7 @@ using Nancy; using Nancy.Responses.Negotiation; using NLog; using Ombi.Api.Interfaces; +using Ombi.Api.Models.Sonarr; using Ombi.Core; using Ombi.Core.Models; using Ombi.Core.SettingModels; @@ -104,7 +105,8 @@ namespace Ombi.UI.Modules Post["/changeavailability", true] = async (x, ct) => await ChangeRequestAvailability((int)Request.Form.Id, (bool)Request.Form.Available); - Post["/changeRootFolder", true] = async (x, ct) => await ChangeRootFolder((int) Request.Form.requestId, (int) Request.Form.rootFolderId); + Post["/changeRootFoldertv", true] = async (x, ct) => await ChangeRootFolder(RequestType.TvShow, (int)Request.Form.requestId, (int)Request.Form.rootFolderId); + Post["/changeRootFoldermovie", true] = async (x, ct) => await ChangeRootFolder(RequestType.Movie, (int)Request.Form.requestId, (int)Request.Form.rootFolderId); Get["/UpdateFilters", true] = async (x, ct) => await GetFilterAndSortSettings(); } @@ -171,7 +173,7 @@ namespace Ombi.UI.Modules if (result != null) { qualities = - result.list.Select(x => new QualityModel {Id = x._id, Name = x.label}).ToList(); + result.list.Select(x => new QualityModel { Id = x._id, Name = x.label }).ToList(); } } catch (Exception e) @@ -188,7 +190,7 @@ namespace Ombi.UI.Modules rootFolders = rootFoldersResult.Select( - x => new RootFolderModel {Id = x.id.ToString(), Path = x.path, FreeSpace = x.freespace}) + x => new RootFolderModel { Id = x.id.ToString(), Path = x.path, FreeSpace = x.freespace }) .ToList(); var result = await Cache.GetOrSetAsync(CacheKeys.RadarrQualityProfiles, async () => @@ -204,7 +206,7 @@ namespace Ombi.UI.Modules } } - + var canManageRequest = Security.HasAnyPermissions(User, Permissions.Administrator, Permissions.ManageRequests); var viewModel = dbMovies.Select(movie => new RequestViewModel { @@ -265,14 +267,14 @@ namespace Ombi.UI.Modules }); qualities = result.Select(x => new QualityModel { Id = x.id.ToString(), Name = x.name }).ToList(); - - var rootFoldersResult =await Cache.GetOrSetAsync(CacheKeys.SonarrRootFolders, async () => - { - return await Task.Run(() => SonarrApi.GetRootFolders(sonarrSettings.ApiKey, sonarrSettings.FullUri)); - }); - - rootFolders = rootFoldersResult.Select(x => new RootFolderModel { Id = x.id.ToString(), Path = x.path, FreeSpace = x.freespace}).ToList(); - } + + var rootFoldersResult = await Cache.GetOrSetAsync(CacheKeys.SonarrRootFolders, async () => + { + return await Task.Run(() => SonarrApi.GetRootFolders(sonarrSettings.ApiKey, sonarrSettings.FullUri)); + }); + + rootFolders = rootFoldersResult.Select(x => new RootFolderModel { Id = x.id.ToString(), Path = x.path, FreeSpace = x.freespace }).ToList(); + } else { var sickRageSettings = await SickRageSettings.GetSettingsAsync(); @@ -318,7 +320,7 @@ namespace Ombi.UI.Modules TvSeriesRequestType = tv.SeasonsRequested, Qualities = qualities.ToArray(), Episodes = tv.Episodes.ToArray(), - RootFolders = rootFolders.ToArray(), + RootFolders = rootFolders.ToArray(), HasRootFolders = rootFolders.Any(), CurrentRootPath = sonarrSettings.Enabled ? GetRootPath(tv.RootFolderSelected, sonarrSettings).Result : null }).ToList(); @@ -555,11 +557,21 @@ namespace Ombi.UI.Modules return Response.AsJson(vm); } - private async Task ChangeRootFolder(int id, int rootFolderId) + private async Task ChangeRootFolder(RequestType type, int id, int rootFolderId) { - // Get all root folders - var settings = await SonarrSettings.GetSettingsAsync(); - var rootFolders = SonarrApi.GetRootFolders(settings.ApiKey, settings.FullUri); + var rootFolders = new List(); + if (type == RequestType.TvShow) + { + // Get all root folders + var settings = await SonarrSettings.GetSettingsAsync(); + rootFolders = SonarrApi.GetRootFolders(settings.ApiKey, settings.FullUri); + } + else + { + + var settings = await Radarr.GetSettingsAsync(); + rootFolders = RadarrApi.GetRootFolders(settings.ApiKey, settings.FullUri); + } // Get Request var allRequests = await Service.GetAllAsync(); @@ -567,7 +579,7 @@ namespace Ombi.UI.Modules if (request == null) { - return Response.AsJson(new JsonResponseModel {Result = false}); + return Response.AsJson(new JsonResponseModel { Result = false }); } foreach (var folder in rootFolders) @@ -581,7 +593,7 @@ namespace Ombi.UI.Modules await Service.UpdateRequestAsync(request); - return Response.AsJson(new JsonResponseModel {Result = true}); - } - } + return Response.AsJson(new JsonResponseModel { Result = true }); + } + } } diff --git a/Ombi.UI/Ombi.UI.csproj b/Ombi.UI/Ombi.UI.csproj index 927eef315..ea07ce214 100644 --- a/Ombi.UI/Ombi.UI.csproj +++ b/Ombi.UI/Ombi.UI.csproj @@ -266,13 +266,13 @@ - - - - - - - + + + + + + + @@ -641,7 +641,7 @@ Always - + diff --git a/Ombi.UI/Views/Requests/Index.cshtml b/Ombi.UI/Views/Requests/Index.cshtml index 710339fe4..d6637530f 100644 --- a/Ombi.UI/Views/Requests/Index.cshtml +++ b/Ombi.UI/Views/Requests/Index.cshtml @@ -281,7 +281,7 @@ -
+ {{#if_eq hasRootFolders true}}
diff --git a/Ombi.UI/Views/Shared/Partial/_LayoutScripts.cshtml b/Ombi.UI/Views/Shared/Partial/_LayoutScripts.cshtml index 8159339f7..daf4ccd05 100644 --- a/Ombi.UI/Views/Shared/Partial/_LayoutScripts.cshtml +++ b/Ombi.UI/Views/Shared/Partial/_LayoutScripts.cshtml @@ -26,6 +26,23 @@ console.log(e); } }); + + + + var gravatarUrl = createBaseUrl(base, 'layout/gravatar'); + $.ajax({ + url: gravatarUrl, + success: function (result) { + if (result.result) { + $('#gravatarImg').html("\"\""); + } + }, + error: function (xhr, status, error) { + console.log("error " + error); + } + }); + + // End Check for update checkCacheInProgress(); diff --git a/Ombi.UI/Views/Shared/Partial/_Navbar.cshtml b/Ombi.UI/Views/Shared/Partial/_Navbar.cshtml index e6f08774f..ae4901113 100644 --- a/Ombi.UI/Views/Shared/Partial/_Navbar.cshtml +++ b/Ombi.UI/Views/Shared/Partial/_Navbar.cshtml @@ -52,6 +52,9 @@
@@ -129,7 +132,7 @@ var donationText = $("#donationText"); donateLink.attr("href", result.url); if (result.message) { - donationText.text(result.message); + donationText.text(result.message); } } }, @@ -138,6 +141,8 @@ $("#customDonate").hide(); } }); + +