Initial commit of auto-adding torrent system
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using AnimeAnnouncer.Cache;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace AnimeAnnouncer.Web.Pages;
|
||||
@@ -95,6 +96,25 @@ public class IndexModel : PageModel
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IActionResult> OnPostDownloadAsync(int showId)
|
||||
{
|
||||
if (_tmdbCache == null)
|
||||
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
||||
|
||||
try
|
||||
{
|
||||
if (!await _tmdbCache.SetDownload(showId, true))
|
||||
_logger.LogWarning("Download requested for show {ShowID}, which is not in the airing list", showId);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Failed to flag show {ShowID} for download", showId);
|
||||
}
|
||||
|
||||
// Post/redirect/get, landing back on the row that was clicked.
|
||||
return RedirectToPage(null, null, null, $"show-{showId}");
|
||||
}
|
||||
|
||||
public class ShowImage
|
||||
{
|
||||
public required string Url { get; set; }
|
||||
@@ -112,6 +132,7 @@ public class IndexModel : PageModel
|
||||
|
||||
public string Title => AiringSoon.Title;
|
||||
public int ShowID => AiringSoon.ShowID;
|
||||
public bool Download => AiringSoon.Download;
|
||||
public DateTime? EffectiveLastAirDate => AiringSoon.LastAirDate ?? CachedDetails?.LastAirDate;
|
||||
public int LatestEpisodeNumber => AiringSoon.LatestEpisodeNumber > 0
|
||||
? AiringSoon.LatestEpisodeNumber
|
||||
|
||||
Reference in New Issue
Block a user