mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 07:46:05 -07:00
Merge branch 'dev' of https://github.com/tidusjar/PlexRequests.Net.git
This commit is contained in:
commit
9d9fc3daf8
5 changed files with 287 additions and 257 deletions
|
@ -25,11 +25,20 @@
|
|||
// ************************************************************************/
|
||||
#endregion
|
||||
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PlexRequests.Core.Models
|
||||
{
|
||||
public class StatusModel
|
||||
{
|
||||
public string Version { get; set; }
|
||||
public int DBVersion {
|
||||
get
|
||||
{
|
||||
string trimStatus = new Regex("[^0-9]", RegexOptions.Compiled).Replace(Version, string.Empty).PadRight(4, '0');
|
||||
return int.Parse(trimStatus);
|
||||
}
|
||||
}
|
||||
public bool UpdateAvailable { get; set; }
|
||||
public string UpdateUri { get; set; }
|
||||
public string DownloadUri { get; set; }
|
||||
|
|
|
@ -36,13 +36,12 @@ using PlexRequests.Core.SettingModels;
|
|||
using PlexRequests.Helpers;
|
||||
using PlexRequests.Store;
|
||||
using PlexRequests.Store.Repository;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PlexRequests.Core
|
||||
{
|
||||
public class Setup
|
||||
{
|
||||
public const int SchemaVersion = 1;
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private static DbConfiguration Db { get; set; }
|
||||
public string SetupDb()
|
||||
|
@ -56,28 +55,38 @@ namespace PlexRequests.Core
|
|||
CreateDefaultSettingsPage();
|
||||
}
|
||||
|
||||
MigrateDb();
|
||||
CheckSchema();
|
||||
var version = CheckSchema();
|
||||
if (version > 0)
|
||||
{
|
||||
if (version > 1300 && version <= 1699)
|
||||
{
|
||||
MigrateDbFrom1300();
|
||||
}
|
||||
}
|
||||
|
||||
return Db.DbConnection().ConnectionString;
|
||||
}
|
||||
|
||||
public static string ConnectionString => Db.DbConnection().ConnectionString;
|
||||
|
||||
|
||||
private void CheckSchema()
|
||||
private int CheckSchema()
|
||||
{
|
||||
var checker = new StatusChecker();
|
||||
var status = checker.GetStatus();
|
||||
|
||||
var connection = Db.DbConnection();
|
||||
var schema = connection.GetSchemaVersion();
|
||||
if (schema == null)
|
||||
{
|
||||
connection.CreateSchema(); // Set the default.
|
||||
connection.CreateSchema(status.DBVersion); // Set the default.
|
||||
schema = connection.GetSchemaVersion();
|
||||
}
|
||||
|
||||
var version = schema.SchemaVersion;
|
||||
if (version == 0)
|
||||
{
|
||||
connection.UpdateSchemaVersion(SchemaVersion);
|
||||
connection.UpdateSchemaVersion(status.DBVersion);
|
||||
try
|
||||
{
|
||||
TableCreation.AlterTable(Db.DbConnection(), "RequestBlobs", "ADD COLUMN", "MusicId", false, "TEXT");
|
||||
|
@ -86,9 +95,10 @@ namespace PlexRequests.Core
|
|||
{
|
||||
Log.Error("Tried updating the schema to version 1");
|
||||
Log.Error(e);
|
||||
return -1;
|
||||
}
|
||||
return;
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
private void CreateDefaultSettingsPage()
|
||||
|
@ -105,7 +115,7 @@ namespace PlexRequests.Core
|
|||
s.SaveSettings(defaultSettings);
|
||||
}
|
||||
|
||||
private void MigrateDb() // TODO: Remove in v1.7
|
||||
private void MigrateDbFrom1300() // TODO: Remove in v1.7
|
||||
{
|
||||
|
||||
var result = new List<long>();
|
||||
|
@ -147,7 +157,7 @@ namespace PlexRequests.Core
|
|||
Issues = r.Issues,
|
||||
OtherMessage = r.OtherMessage,
|
||||
Overview = show.summary.RemoveHtml(),
|
||||
RequestedBy = r.RequestedBy,
|
||||
RequestedUsers = r.AllUsers, // should pull in the RequestedBy property and merge with RequestedUsers
|
||||
RequestedDate = r.ReleaseDate,
|
||||
Status = show.status
|
||||
};
|
||||
|
|
|
@ -80,10 +80,10 @@ namespace PlexRequests.Store
|
|||
con.Close();
|
||||
}
|
||||
|
||||
public static void CreateSchema(this IDbConnection con)
|
||||
public static void CreateSchema(this IDbConnection con, int version)
|
||||
{
|
||||
con.Open();
|
||||
con.Query("INSERT INTO DBInfo (SchemaVersion) values (0)");
|
||||
con.Query(string.Format("INSERT INTO DBInfo (SchemaVersion) values ({0})", version));
|
||||
con.Close();
|
||||
}
|
||||
|
||||
|
|
|
@ -5,283 +5,294 @@
|
|||
return opts.inverse(this);
|
||||
});
|
||||
|
||||
var searchSource = $("#search-template").html();
|
||||
var musicSource = $("#music-template").html();
|
||||
var searchTemplate = Handlebars.compile(searchSource);
|
||||
var musicTemplate = Handlebars.compile(musicSource);
|
||||
$(function () {
|
||||
|
||||
var searchTimer = 0;
|
||||
var searchSource = $("#search-template").html();
|
||||
var musicSource = $("#music-template").html();
|
||||
var searchTemplate = Handlebars.compile(searchSource);
|
||||
var musicTemplate = Handlebars.compile(musicSource);
|
||||
|
||||
// Type in movie search
|
||||
$("#movieSearchContent").on("input", function () {
|
||||
if (searchTimer) {
|
||||
clearTimeout(searchTimer);
|
||||
}
|
||||
$('#movieSearchButton').attr("class","fa fa-spinner fa-spin");
|
||||
searchTimer = setTimeout(movieSearch, 400);
|
||||
var searchTimer = 0;
|
||||
|
||||
});
|
||||
|
||||
$('#moviesComingSoon').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
moviesComingSoon();
|
||||
});
|
||||
|
||||
$('#moviesInTheaters').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
moviesInTheaters();
|
||||
});
|
||||
|
||||
// Type in TV search
|
||||
$("#tvSearchContent").on("input", function () {
|
||||
if (searchTimer) {
|
||||
clearTimeout(searchTimer);
|
||||
}
|
||||
$('#tvSearchButton').attr("class", "fa fa-spinner fa-spin");
|
||||
searchTimer = setTimeout(tvSearch, 400);
|
||||
});
|
||||
|
||||
// Click TV dropdown option
|
||||
$(document).on("click", ".dropdownTv", function (e) {
|
||||
e.preventDefault();
|
||||
var buttonId = e.target.id;
|
||||
if ($("#" + buttonId).attr('disabled')) {
|
||||
return;
|
||||
// fix for selecting a default tab
|
||||
var $tabs = $('#nav-tabs').children('li');
|
||||
if ($tabs.filter(function (li) { return $(li).hasClass('active') }).length <= 0) {
|
||||
$tabs.first().children('a:first-child').tab('show');
|
||||
}
|
||||
|
||||
$("#" + buttonId).prop("disabled", true);
|
||||
loadingButton(buttonId, "primary");
|
||||
|
||||
// Type in movie search
|
||||
$("#movieSearchContent").on("input", function () {
|
||||
if (searchTimer) {
|
||||
clearTimeout(searchTimer);
|
||||
}
|
||||
$('#movieSearchButton').attr("class", "fa fa-spinner fa-spin");
|
||||
searchTimer = setTimeout(movieSearch, 400);
|
||||
|
||||
});
|
||||
|
||||
$('#moviesComingSoon').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
moviesComingSoon();
|
||||
});
|
||||
|
||||
$('#moviesInTheaters').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
moviesInTheaters();
|
||||
});
|
||||
|
||||
// Type in TV search
|
||||
$("#tvSearchContent").on("input", function () {
|
||||
if (searchTimer) {
|
||||
clearTimeout(searchTimer);
|
||||
}
|
||||
$('#tvSearchButton').attr("class", "fa fa-spinner fa-spin");
|
||||
searchTimer = setTimeout(tvSearch, 400);
|
||||
});
|
||||
|
||||
// Click TV dropdown option
|
||||
$(document).on("click", ".dropdownTv", function (e) {
|
||||
e.preventDefault();
|
||||
var buttonId = e.target.id;
|
||||
if ($("#" + buttonId).attr('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$("#" + buttonId).prop("disabled", true);
|
||||
loadingButton(buttonId, "primary");
|
||||
|
||||
|
||||
var $form = $('#form' + buttonId);
|
||||
var data = $form.serialize();
|
||||
var seasons = $(this).attr("season-select");
|
||||
if (seasons === "2") {
|
||||
// Send over the latest
|
||||
data = data + "&seasons=latest";
|
||||
}
|
||||
if (seasons === "1") {
|
||||
// Send over the first season
|
||||
data = data + "&seasons=first";
|
||||
var $form = $('#form' + buttonId);
|
||||
var data = $form.serialize();
|
||||
var seasons = $(this).attr("season-select");
|
||||
if (seasons === "2") {
|
||||
// Send over the latest
|
||||
data = data + "&seasons=latest";
|
||||
}
|
||||
if (seasons === "1") {
|
||||
// Send over the first season
|
||||
data = data + "&seasons=first";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var type = $form.prop('method');
|
||||
var url = $form.prop('action');
|
||||
var type = $form.prop('method');
|
||||
var url = $form.prop('action');
|
||||
|
||||
sendRequestAjax(data, type, url, buttonId);
|
||||
});
|
||||
sendRequestAjax(data, type, url, buttonId);
|
||||
});
|
||||
|
||||
// Search Music
|
||||
$("#musicSearchContent").on("input", function () {
|
||||
if (searchTimer) {
|
||||
clearTimeout(searchTimer);
|
||||
}
|
||||
$('#musicSearchButton').attr("class", "fa fa-spinner fa-spin");
|
||||
searchTimer = setTimeout(musicSearch, 400);
|
||||
// Search Music
|
||||
$("#musicSearchContent").on("input", function () {
|
||||
if (searchTimer) {
|
||||
clearTimeout(searchTimer);
|
||||
}
|
||||
$('#musicSearchButton').attr("class", "fa fa-spinner fa-spin");
|
||||
searchTimer = setTimeout(musicSearch, 400);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// Click Request for movie
|
||||
$(document).on("click", ".requestMovie", function (e) {
|
||||
e.preventDefault();
|
||||
var buttonId = e.target.id;
|
||||
if ($("#" + buttonId).attr('disabled')) {
|
||||
return;
|
||||
}
|
||||
// Click Request for movie
|
||||
$(document).on("click", ".requestMovie", function (e) {
|
||||
e.preventDefault();
|
||||
var buttonId = e.target.id;
|
||||
if ($("#" + buttonId).attr('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$("#" + buttonId).prop("disabled", true);
|
||||
loadingButton(buttonId, "primary");
|
||||
$("#" + buttonId).prop("disabled", true);
|
||||
loadingButton(buttonId, "primary");
|
||||
|
||||
|
||||
var $form = $('#form' + buttonId);
|
||||
var $form = $('#form' + buttonId);
|
||||
|
||||
var type = $form.prop('method');
|
||||
var url = $form.prop('action');
|
||||
var data = $form.serialize();
|
||||
var type = $form.prop('method');
|
||||
var url = $form.prop('action');
|
||||
var data = $form.serialize();
|
||||
|
||||
sendRequestAjax(data, type, url, buttonId);
|
||||
sendRequestAjax(data, type, url, buttonId);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// Click Request for album
|
||||
$(document).on("click", ".requestAlbum", function (e) {
|
||||
e.preventDefault();
|
||||
var buttonId = e.target.id;
|
||||
if ($("#" + buttonId).attr('disabled')) {
|
||||
return;
|
||||
}
|
||||
// Click Request for album
|
||||
$(document).on("click", ".requestAlbum", function (e) {
|
||||
e.preventDefault();
|
||||
var buttonId = e.target.id;
|
||||
if ($("#" + buttonId).attr('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$("#" + buttonId).prop("disabled", true);
|
||||
loadingButton(buttonId, "primary");
|
||||
$("#" + buttonId).prop("disabled", true);
|
||||
loadingButton(buttonId, "primary");
|
||||
|
||||
|
||||
var $form = $('#form' + buttonId);
|
||||
var $form = $('#form' + buttonId);
|
||||
|
||||
var type = $form.prop('method');
|
||||
var url = $form.prop('action');
|
||||
var data = $form.serialize();
|
||||
var type = $form.prop('method');
|
||||
var url = $form.prop('action');
|
||||
var data = $form.serialize();
|
||||
|
||||
sendRequestAjax(data, type, url, buttonId);
|
||||
sendRequestAjax(data, type, url, buttonId);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
function sendRequestAjax(data, type, url, buttonId) {
|
||||
$.ajax({
|
||||
type: type,
|
||||
url: url,
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
console.log(response);
|
||||
if (response.result === true) {
|
||||
generateNotify(response.message || "Success!", "success");
|
||||
function sendRequestAjax(data, type, url, buttonId) {
|
||||
$.ajax({
|
||||
type: type,
|
||||
url: url,
|
||||
data: data,
|
||||
dataType: "json",
|
||||
success: function (response) {
|
||||
console.log(response);
|
||||
if (response.result === true) {
|
||||
generateNotify(response.message || "Success!", "success");
|
||||
|
||||
$('#' + buttonId).html("<i class='fa fa-check'></i> Requested");
|
||||
$('#' + buttonId).removeClass("btn-primary-outline");
|
||||
$('#' + buttonId).removeAttr("data-toggle");
|
||||
$('#' + buttonId).addClass("btn-success-outline");
|
||||
} else {
|
||||
generateNotify(response.message, "warning");
|
||||
$('#' + buttonId).html("<i class='fa fa-plus'></i> Request");
|
||||
$('#' + buttonId).attr("data-toggle", "dropdown");
|
||||
$("#" + buttonId).removeAttr("disabled");
|
||||
$('#' + buttonId).html("<i class='fa fa-check'></i> Requested");
|
||||
$('#' + buttonId).removeClass("btn-primary-outline");
|
||||
$('#' + buttonId).removeAttr("data-toggle");
|
||||
$('#' + buttonId).addClass("btn-success-outline");
|
||||
} else {
|
||||
generateNotify(response.message, "warning");
|
||||
$('#' + buttonId).html("<i class='fa fa-plus'></i> Request");
|
||||
$('#' + buttonId).attr("data-toggle", "dropdown");
|
||||
$("#" + buttonId).removeAttr("disabled");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
generateNotify("Something went wrong!", "danger");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function movieSearch() {
|
||||
var query = $("#movieSearchContent").val();
|
||||
getMovies("/search/movie/" + query);
|
||||
}
|
||||
function movieSearch() {
|
||||
var query = $("#movieSearchContent").val();
|
||||
getMovies("/search/movie/" + query);
|
||||
}
|
||||
|
||||
function moviesComingSoon() {
|
||||
getMovies("/search/movie/upcoming");
|
||||
}
|
||||
function moviesComingSoon() {
|
||||
getMovies("/search/movie/upcoming");
|
||||
}
|
||||
|
||||
function moviesInTheaters() {
|
||||
getMovies("/search/movie/playing");
|
||||
}
|
||||
function moviesInTheaters() {
|
||||
getMovies("/search/movie/playing");
|
||||
}
|
||||
|
||||
function getMovies(url) {
|
||||
$("#movieList").html("");
|
||||
function getMovies(url) {
|
||||
$("#movieList").html("");
|
||||
|
||||
|
||||
$.ajax(url).success(function (results) {
|
||||
if (results.length > 0) {
|
||||
results.forEach(function(result) {
|
||||
var context = buildMovieContext(result);
|
||||
$.ajax(url).success(function (results) {
|
||||
if (results.length > 0) {
|
||||
results.forEach(function (result) {
|
||||
var context = buildMovieContext(result);
|
||||
|
||||
var html = searchTemplate(context);
|
||||
$("#movieList").append(html);
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#movieList").html(noResultsHtml);
|
||||
}
|
||||
$('#movieSearchButton').attr("class","fa fa-search");
|
||||
});
|
||||
};
|
||||
|
||||
function tvSearch() {
|
||||
var query = $("#tvSearchContent").val();
|
||||
getTvShows("/search/tv/" + query);
|
||||
}
|
||||
|
||||
function getTvShows(url) {
|
||||
$("#tvList").html("");
|
||||
|
||||
$.ajax(url).success(function (results) {
|
||||
if (results.length > 0) {
|
||||
results.forEach(function(result) {
|
||||
var context = buildTvShowContext(result);
|
||||
var html = searchTemplate(context);
|
||||
$("#tvList").append(html);
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#tvList").html(noResultsHtml);
|
||||
}
|
||||
$('#tvSearchButton').attr("class", "fa fa-search");
|
||||
});
|
||||
};
|
||||
|
||||
function musicSearch() {
|
||||
var query = $("#musicSearchContent").val();
|
||||
getMusic("/search/music/" + query);
|
||||
}
|
||||
|
||||
function getMusic(url) {
|
||||
$("#musicList").html("");
|
||||
|
||||
$.ajax(url).success(function (results) {
|
||||
if (results.length > 0) {
|
||||
results.forEach(function (result) {
|
||||
var context = buildMusicContext(result);
|
||||
|
||||
var html = musicTemplate(context);
|
||||
$("#musicList").append(html);
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#musicList").html(noResultsMusic);
|
||||
}
|
||||
$('#musicSearchButton').attr("class", "fa fa-search");
|
||||
});
|
||||
};
|
||||
|
||||
function buildMovieContext(result) {
|
||||
var date = new Date(result.releaseDate);
|
||||
var year = date.getFullYear();
|
||||
var context = {
|
||||
posterPath: result.posterPath,
|
||||
id: result.id,
|
||||
title: result.title,
|
||||
overview: result.overview,
|
||||
voteCount: result.voteCount,
|
||||
voteAverage: result.voteAverage,
|
||||
year: year,
|
||||
type: "movie",
|
||||
imdb: result.imdbId
|
||||
var html = searchTemplate(context);
|
||||
$("#movieList").append(html);
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#movieList").html(noResultsHtml);
|
||||
}
|
||||
$('#movieSearchButton').attr("class", "fa fa-search");
|
||||
});
|
||||
};
|
||||
|
||||
return context;
|
||||
}
|
||||
function tvSearch() {
|
||||
var query = $("#tvSearchContent").val();
|
||||
getTvShows("/search/tv/" + query);
|
||||
}
|
||||
|
||||
function buildTvShowContext(result) {
|
||||
var date = new Date(result.firstAired);
|
||||
var year = date.getFullYear();
|
||||
var context = {
|
||||
posterPath: result.banner,
|
||||
id: result.id,
|
||||
title: result.seriesName,
|
||||
overview: result.overview,
|
||||
year: year,
|
||||
type: "tv",
|
||||
imdb: result.imdbId
|
||||
};
|
||||
return context;
|
||||
}
|
||||
function getTvShows(url) {
|
||||
$("#tvList").html("");
|
||||
|
||||
function buildMusicContext(result) {
|
||||
|
||||
var context = {
|
||||
id: result.id,
|
||||
title: result.title,
|
||||
overview: result.overview,
|
||||
year: result.releaseDate,
|
||||
type: "album",
|
||||
trackCount: result.trackCount,
|
||||
coverArtUrl: result.coverArtUrl,
|
||||
artist: result.artist,
|
||||
releaseType: result.releaseType,
|
||||
country: result.country
|
||||
$.ajax(url).success(function (results) {
|
||||
if (results.length > 0) {
|
||||
results.forEach(function (result) {
|
||||
var context = buildTvShowContext(result);
|
||||
var html = searchTemplate(context);
|
||||
$("#tvList").append(html);
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#tvList").html(noResultsHtml);
|
||||
}
|
||||
$('#tvSearchButton').attr("class", "fa fa-search");
|
||||
});
|
||||
};
|
||||
|
||||
return context;
|
||||
}
|
||||
function musicSearch() {
|
||||
var query = $("#musicSearchContent").val();
|
||||
getMusic("/search/music/" + query);
|
||||
}
|
||||
|
||||
function getMusic(url) {
|
||||
$("#musicList").html("");
|
||||
|
||||
$.ajax(url).success(function (results) {
|
||||
if (results.length > 0) {
|
||||
results.forEach(function (result) {
|
||||
var context = buildMusicContext(result);
|
||||
|
||||
var html = musicTemplate(context);
|
||||
$("#musicList").append(html);
|
||||
});
|
||||
}
|
||||
else {
|
||||
$("#musicList").html(noResultsMusic);
|
||||
}
|
||||
$('#musicSearchButton').attr("class", "fa fa-search");
|
||||
});
|
||||
};
|
||||
|
||||
function buildMovieContext(result) {
|
||||
var date = new Date(result.releaseDate);
|
||||
var year = date.getFullYear();
|
||||
var context = {
|
||||
posterPath: result.posterPath,
|
||||
id: result.id,
|
||||
title: result.title,
|
||||
overview: result.overview,
|
||||
voteCount: result.voteCount,
|
||||
voteAverage: result.voteAverage,
|
||||
year: year,
|
||||
type: "movie",
|
||||
imdb: result.imdbId
|
||||
};
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
function buildTvShowContext(result) {
|
||||
var date = new Date(result.firstAired);
|
||||
var year = date.getFullYear();
|
||||
var context = {
|
||||
posterPath: result.banner,
|
||||
id: result.id,
|
||||
title: result.seriesName,
|
||||
overview: result.overview,
|
||||
year: year,
|
||||
type: "tv",
|
||||
imdb: result.imdbId
|
||||
};
|
||||
return context;
|
||||
}
|
||||
|
||||
function buildMusicContext(result) {
|
||||
|
||||
var context = {
|
||||
id: result.id,
|
||||
title: result.title,
|
||||
overview: result.overview,
|
||||
year: result.releaseDate,
|
||||
type: "album",
|
||||
trackCount: result.trackCount,
|
||||
coverArtUrl: result.coverArtUrl,
|
||||
artist: result.artist,
|
||||
releaseType: result.releaseType,
|
||||
country: result.country
|
||||
};
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -282,7 +282,7 @@ namespace PlexRequests.UI.Modules
|
|||
var notificationModel = new NotificationModel
|
||||
{
|
||||
Title = model.Title,
|
||||
User = model.RequestedBy,
|
||||
User = Username,
|
||||
DateTime = DateTime.Now,
|
||||
NotificationType = NotificationType.NewRequest
|
||||
};
|
||||
|
@ -307,7 +307,7 @@ namespace PlexRequests.UI.Modules
|
|||
var notificationModel = new NotificationModel
|
||||
{
|
||||
Title = model.Title,
|
||||
User = model.RequestedBy,
|
||||
User = Username,
|
||||
DateTime = DateTime.Now,
|
||||
NotificationType = NotificationType.NewRequest
|
||||
};
|
||||
|
@ -322,7 +322,7 @@ namespace PlexRequests.UI.Modules
|
|||
Log.Debug("Adding movie to database requests");
|
||||
var id = RequestService.AddRequest(model);
|
||||
|
||||
var notificationModel = new NotificationModel { Title = model.Title, User = model.RequestedBy, DateTime = DateTime.Now, NotificationType = NotificationType.NewRequest };
|
||||
var notificationModel = new NotificationModel { Title = model.Title, User = Username, DateTime = DateTime.Now, NotificationType = NotificationType.NewRequest };
|
||||
NotificationService.Publish(notificationModel);
|
||||
|
||||
return Response.AsJson(new JsonResponseModel { Result = true, Message = $"{fullMovieName} was successfully added!" });
|
||||
|
@ -427,7 +427,7 @@ namespace PlexRequests.UI.Modules
|
|||
model.Approved = true;
|
||||
Log.Debug("Adding tv to database requests (No approval required & Sonarr)");
|
||||
RequestService.AddRequest(model);
|
||||
var notify1 = new NotificationModel { Title = model.Title, User = model.RequestedBy, DateTime = DateTime.Now, NotificationType = NotificationType.NewRequest };
|
||||
var notify1 = new NotificationModel { Title = model.Title, User = Username, DateTime = DateTime.Now, NotificationType = NotificationType.NewRequest };
|
||||
NotificationService.Publish(notify1);
|
||||
|
||||
return Response.AsJson(new JsonResponseModel { Result = true, Message = $"{fullShowName} was successfully added!" });
|
||||
|
@ -448,7 +448,7 @@ namespace PlexRequests.UI.Modules
|
|||
Log.Debug("Adding tv to database requests (No approval required & SickRage)");
|
||||
RequestService.AddRequest(model);
|
||||
|
||||
var notify2 = new NotificationModel { Title = model.Title, User = model.RequestedBy, DateTime = DateTime.Now, NotificationType = NotificationType.NewRequest };
|
||||
var notify2 = new NotificationModel { Title = model.Title, User = Username, DateTime = DateTime.Now, NotificationType = NotificationType.NewRequest };
|
||||
NotificationService.Publish(notify2);
|
||||
|
||||
return Response.AsJson(new JsonResponseModel { Result = true, Message = $"{fullShowName} was successfully added!" });
|
||||
|
@ -462,7 +462,7 @@ namespace PlexRequests.UI.Modules
|
|||
|
||||
RequestService.AddRequest(model);
|
||||
|
||||
var notificationModel = new NotificationModel { Title = model.Title, User = model.RequestedBy, DateTime = DateTime.Now, NotificationType = NotificationType.NewRequest };
|
||||
var notificationModel = new NotificationModel { Title = model.Title, User = Username, DateTime = DateTime.Now, NotificationType = NotificationType.NewRequest };
|
||||
NotificationService.Publish(notificationModel);
|
||||
|
||||
return Response.AsJson(new JsonResponseModel { Result = true, Message = $"{fullShowName} was successfully added!" });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue