mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
Merge branch 'dev' of https://github.com/tidusjar/PlexRequests.Net
This commit is contained in:
commit
2aee84d36d
6 changed files with 178 additions and 164 deletions
|
@ -24,6 +24,8 @@
|
|||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using NLog;
|
||||
|
@ -85,9 +87,19 @@ namespace PlexRequests.Services.Jobs
|
|||
|
||||
// we do not want to set here...
|
||||
public int[] QueuedIds()
|
||||
{
|
||||
try
|
||||
{
|
||||
var movies = Cache.Get<CouchPotatoMovies>(CacheKeys.CouchPotatoQueued);
|
||||
return movies?.movies?.Select(x => x.info.tmdb_id).ToArray() ?? new int[] { };
|
||||
|
||||
var items = movies?.movies?.Select(x => x.info?.tmdb_id).Cast<int>().ToArray();
|
||||
return items ?? new int[] { };
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
return new int[] {};
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute(IJobExecutionContext context)
|
||||
|
|
|
@ -120,8 +120,8 @@ namespace PlexRequests.Services.Notification
|
|||
{
|
||||
var message = new MimeMessage
|
||||
{
|
||||
Body = new TextPart("plain") { Text = $"Hello! The user '{model.User}' has requested the {RequestTypeDisplay.Get(model.RequestType)?.ToLower()} '{model.Title}'! Please log in to approve this request. Request Date: {model.DateTime.ToString("f")}" },
|
||||
Subject = $"Plex Requests: New {RequestTypeDisplay.Get(model.RequestType)?.ToLower()} request for {model.Title}!"
|
||||
Body = new TextPart("plain") { Text = $"Hello! The user '{model.User}' has requested the {model.RequestType.GetString()?.ToLower()} '{model.Title}'! Please log in to approve this request. Request Date: {model.DateTime.ToString("f")}" },
|
||||
Subject = $"Plex Requests: New {model.RequestType.GetString()?.ToLower()} request for {model.Title}!"
|
||||
};
|
||||
message.From.Add(new MailboxAddress(settings.EmailSender, settings.EmailSender));
|
||||
message.To.Add(new MailboxAddress(settings.RecipientEmail, settings.RecipientEmail));
|
||||
|
|
|
@ -105,8 +105,8 @@ namespace PlexRequests.Services.Notification
|
|||
|
||||
private async Task PushNewRequestAsync(NotificationModel model, PushbulletNotificationSettings settings)
|
||||
{
|
||||
var message = $"The {RequestTypeDisplay.Get(model.RequestType)?.ToLower()} '{model.Title}' has been requested by user: {model.User}";
|
||||
var pushTitle = $"Plex Requests: The {RequestTypeDisplay.Get(model.RequestType)?.ToLower()} {model.Title} has been requested!";
|
||||
var message = $"The {model.RequestType.GetString()?.ToLower()} '{model.Title}' has been requested by user: {model.User}";
|
||||
var pushTitle = $"Plex Requests: The {model.RequestType.GetString()?.ToLower()} {model.Title} has been requested!";
|
||||
await Push(settings, message, pushTitle);
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ namespace PlexRequests.Services.Notification
|
|||
|
||||
private async Task PushNewRequestAsync(NotificationModel model, PushoverNotificationSettings settings)
|
||||
{
|
||||
var message = $"Plex Requests: The {RequestTypeDisplay.Get(model.RequestType)?.ToLower()} '{model.Title}' has been requested by user: {model.User}";
|
||||
var message = $"Plex Requests: The {model.RequestType.GetString()?.ToLower()} '{model.Title}' has been requested by user: {model.User}";
|
||||
await Push(settings, message);
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace PlexRequests.Store
|
|||
|
||||
public static class RequestTypeDisplay
|
||||
{
|
||||
public static string Get(RequestType type)
|
||||
public static string GetString(this RequestType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,10 @@
|
|||
@Html.GetNavbarUrl(Context, "/search", "Search", "search")
|
||||
@Html.GetNavbarUrl(Context, "/requests", "Requests", "plus-circle")
|
||||
@Html.GetNavbarUrl(Context, "/issues", "Issues", "exclamation", "<span id=\"issueCount\"></span>")
|
||||
|
||||
@if (Context.CurrentUser.IsAuthenticated()) // TODO replace with IsAdmin
|
||||
{
|
||||
<li><a href="https://www.paypal.me/PlexRequestsNet" target="_blank"><i class="fa fa-heart" style="color: red"></i> Donate</a></li>
|
||||
}
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
|
||||
|
@ -57,8 +60,7 @@
|
|||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="@url/admin"><i class="fa fa-cog"></i> Settings</a></li>
|
||||
<li><a href="@url/changepassword"><i class="fa fa-key"></i> Change password</a></li>
|
||||
<li class="divider"></li>
|
||||
<li><a href="https://www.paypal.me/PlexRequestsNet" target="_blank"><i class="fa fa-heart" style="color:red"></i> Donate!</a></li>
|
||||
|
||||
<li class="divider"></li>
|
||||
<li><a href="@url/logout"><i class="fa fa-sign-out"></i> Logout</a></li>
|
||||
</ul>
|
||||
|
@ -133,7 +135,7 @@
|
|||
dataType: "json",
|
||||
success: function (response) {
|
||||
if (response) {
|
||||
if(response > 0)
|
||||
if (response > 0)
|
||||
$('#issueCount').addClass("badge");
|
||||
$('#issueCount').html(+response);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue