mirror of
				https://github.com/zoriya/Kyoo.git
				synced 2025-11-03 19:17:16 -05:00 
			
		
		
		
	Merge branch 'master' of https://github.com/AnonymusRaccoon/Kyoo into aur
This commit is contained in:
		
						commit
						a34d0af8ea
					
				@ -2,6 +2,7 @@
 | 
				
			|||||||
using Kyoo.Models;
 | 
					using Kyoo.Models;
 | 
				
			||||||
using Microsoft.AspNetCore.Mvc;
 | 
					using Microsoft.AspNetCore.Mvc;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.IO;
 | 
				
			||||||
using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
using Kyoo.CommonApi;
 | 
					using Kyoo.CommonApi;
 | 
				
			||||||
@ -163,5 +164,20 @@ namespace Kyoo.Api
 | 
				
			|||||||
				return BadRequest(new {Error = ex.Message});
 | 
									return BadRequest(new {Error = ex.Message});
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							[HttpGet("{showSlug}-s{seasonNumber:int}e{episodeNumber:int}/thumb")]
 | 
				
			||||||
 | 
							[Authorize(Policy="Read")]
 | 
				
			||||||
 | 
							public async Task<IActionResult> GetThumb(string showSlug, int seasonNumber, int episodeNumber)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								string path = (await _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber))?.Path;
 | 
				
			||||||
 | 
								if (path == null)
 | 
				
			||||||
 | 
									return NotFound();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								string thumb = Path.ChangeExtension(path, "jpg");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (System.IO.File.Exists(thumb))
 | 
				
			||||||
 | 
									return new PhysicalFileResult(Path.GetFullPath(thumb), "image/jpg");
 | 
				
			||||||
 | 
								return NotFound();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
using System;
 | 
					using System;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using System.Linq;
 | 
					using System.IO;
 | 
				
			||||||
using System.Threading.Tasks;
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
using Kyoo.CommonApi;
 | 
					using Kyoo.CommonApi;
 | 
				
			||||||
using Kyoo.Controllers;
 | 
					using Kyoo.Controllers;
 | 
				
			||||||
@ -17,11 +17,13 @@ namespace Kyoo.Api
 | 
				
			|||||||
	public class PeopleApi : CrudApi<People>
 | 
						public class PeopleApi : CrudApi<People>
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		private readonly ILibraryManager _libraryManager;
 | 
							private readonly ILibraryManager _libraryManager;
 | 
				
			||||||
 | 
							private readonly string _peoplePath;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public PeopleApi(ILibraryManager libraryManager, IConfiguration configuration) 
 | 
							public PeopleApi(ILibraryManager libraryManager, IConfiguration configuration) 
 | 
				
			||||||
			: base(libraryManager.PeopleRepository, configuration)
 | 
								: base(libraryManager.PeopleRepository, configuration)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			_libraryManager = libraryManager;
 | 
								_libraryManager = libraryManager;
 | 
				
			||||||
 | 
								_peoplePath = configuration.GetValue<string>("peoplePath");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		[HttpGet("{id:int}/role")]
 | 
							[HttpGet("{id:int}/role")]
 | 
				
			||||||
@ -89,5 +91,16 @@ namespace Kyoo.Api
 | 
				
			|||||||
				return BadRequest(new {Error = ex.Message});
 | 
									return BadRequest(new {Error = ex.Message});
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							[HttpGet("{slug}/poster")]
 | 
				
			||||||
 | 
							[Authorize(Policy="Read")]
 | 
				
			||||||
 | 
							public IActionResult GetPeopleIcon(string slug)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								string thumbPath = Path.Combine(_peoplePath, slug + ".jpg");
 | 
				
			||||||
 | 
								if (!System.IO.File.Exists(thumbPath))
 | 
				
			||||||
 | 
									return NotFound();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								return new PhysicalFileResult(Path.GetFullPath(thumbPath), "image/jpg");
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -447,5 +447,50 @@ namespace Kyoo.Api
 | 
				
			|||||||
			_provider.TryGetContentType(path, out string contentType);
 | 
								_provider.TryGetContentType(path, out string contentType);
 | 
				
			||||||
			return PhysicalFile(fontPath, contentType ?? "application/x-font-ttf");
 | 
								return PhysicalFile(fontPath, contentType ?? "application/x-font-ttf");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							[HttpGet("{slug}/poster")]
 | 
				
			||||||
 | 
							[Authorize(Policy = "Read")]
 | 
				
			||||||
 | 
							public async Task<ActionResult> GetPoster(string slug)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								string path = (await _libraryManager.GetShow(slug))?.Path;
 | 
				
			||||||
 | 
								if (path == null)
 | 
				
			||||||
 | 
									return NotFound();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								string poster = Path.Combine(path, "poster.jpg");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (System.IO.File.Exists(poster))
 | 
				
			||||||
 | 
									return new PhysicalFileResult(Path.GetFullPath(poster), "image/jpg");
 | 
				
			||||||
 | 
								return NotFound();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							[HttpGet("{slug}/logo")]
 | 
				
			||||||
 | 
							[Authorize(Policy="Read")]
 | 
				
			||||||
 | 
							public async Task<IActionResult> GetLogo(string slug)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								string path = (await _libraryManager.GetShow(slug))?.Path;
 | 
				
			||||||
 | 
								if (path == null)
 | 
				
			||||||
 | 
									return NotFound();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								string logo = Path.Combine(path, "logo.png");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (System.IO.File.Exists(logo))
 | 
				
			||||||
 | 
									return new PhysicalFileResult(Path.GetFullPath(logo), "image/png");
 | 
				
			||||||
 | 
								return NotFound();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							[HttpGet("{slug}/backdrop")]
 | 
				
			||||||
 | 
							[Authorize(Policy="Read")]
 | 
				
			||||||
 | 
							public async Task<IActionResult> GetBackdrop(string slug)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								string path = (await _libraryManager.GetShow(slug))?.Path;
 | 
				
			||||||
 | 
								if (path == null)
 | 
				
			||||||
 | 
									return NotFound();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								string thumb = Path.Combine(path, "backdrop.jpg");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (System.IO.File.Exists(thumb))
 | 
				
			||||||
 | 
									return new PhysicalFileResult(Path.GetFullPath(thumb), "image/jpg");
 | 
				
			||||||
 | 
								return NotFound();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -41,8 +41,8 @@ namespace Kyoo.Api
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		[HttpGet("{showSlug}-s{seasonNumber}e{episodeNumber}")]
 | 
							[HttpGet("{showSlug}-s{seasonNumber:int}e{episodeNumber:int}")]
 | 
				
			||||||
		[HttpGet("direct/{showSlug}-s{seasonNumber}e{episodeNumber}")]
 | 
							[HttpGet("direct/{showSlug}-s{seasonNumber:int}e{episodeNumber:int}")]
 | 
				
			||||||
		[Authorize(Policy="Play")]
 | 
							[Authorize(Policy="Play")]
 | 
				
			||||||
		public async Task<IActionResult> DirectEpisode(string showSlug, int seasonNumber, int episodeNumber)
 | 
							public async Task<IActionResult> DirectEpisode(string showSlug, int seasonNumber, int episodeNumber)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@ -68,7 +68,7 @@ namespace Kyoo.Api
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		[HttpGet("transmux/{showSlug}-s{seasonNumber}e{episodeNumber}")]
 | 
							[HttpGet("transmux/{showSlug}-s{seasonNumber:int}e{episodeNumber:int}/master.m3u8")]
 | 
				
			||||||
		[Authorize(Policy="Play")]
 | 
							[Authorize(Policy="Play")]
 | 
				
			||||||
		public async Task<IActionResult> TransmuxEpisode(string showSlug, int seasonNumber, int episodeNumber)
 | 
							public async Task<IActionResult> TransmuxEpisode(string showSlug, int seasonNumber, int episodeNumber)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@ -84,7 +84,7 @@ namespace Kyoo.Api
 | 
				
			|||||||
			return PhysicalFile(path, "application/x-mpegurl", true);
 | 
								return PhysicalFile(path, "application/x-mpegurl", true);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		[HttpGet("transmux/{movieSlug}")]
 | 
							[HttpGet("transmux/{movieSlug}/master.m3u8")]
 | 
				
			||||||
		[Authorize(Policy="Play")]
 | 
							[Authorize(Policy="Play")]
 | 
				
			||||||
		public async Task<IActionResult> TransmuxMovie(string movieSlug)
 | 
							public async Task<IActionResult> TransmuxMovie(string movieSlug)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@ -98,7 +98,7 @@ namespace Kyoo.Api
 | 
				
			|||||||
			return PhysicalFile(path, "application/x-mpegurl", true);
 | 
								return PhysicalFile(path, "application/x-mpegurl", true);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		[HttpGet("transcode/{showSlug}-s{seasonNumber}e{episodeNumber}")]
 | 
							[HttpGet("transcode/{showSlug}-s{seasonNumber:int}e{episodeNumber:int}/master.m3u8")]
 | 
				
			||||||
		[Authorize(Policy="Play")]
 | 
							[Authorize(Policy="Play")]
 | 
				
			||||||
		public async Task<IActionResult> TranscodeEpisode(string showSlug, int seasonNumber, int episodeNumber)
 | 
							public async Task<IActionResult> TranscodeEpisode(string showSlug, int seasonNumber, int episodeNumber)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@ -114,7 +114,7 @@ namespace Kyoo.Api
 | 
				
			|||||||
			return PhysicalFile(path, "application/x-mpegurl", true);
 | 
								return PhysicalFile(path, "application/x-mpegurl", true);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		[HttpGet("transcode/{movieSlug}")]
 | 
							[HttpGet("transcode/{movieSlug}/master.m3u8")]
 | 
				
			||||||
		[Authorize(Policy="Play")]
 | 
							[Authorize(Policy="Play")]
 | 
				
			||||||
		public async Task<IActionResult> TranscodeMovie(string movieSlug)
 | 
							public async Task<IActionResult> TranscodeMovie(string movieSlug)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@ -129,7 +129,7 @@ namespace Kyoo.Api
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		[HttpGet("transmux/{episodeLink}/segment/{chunk}")]
 | 
							[HttpGet("transmux/{episodeLink}/segments/{chunk}")]
 | 
				
			||||||
		[Authorize(Policy="Play")]
 | 
							[Authorize(Policy="Play")]
 | 
				
			||||||
		public IActionResult GetTransmuxedChunk(string episodeLink, string chunk)
 | 
							public IActionResult GetTransmuxedChunk(string episodeLink, string chunk)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@ -138,7 +138,7 @@ namespace Kyoo.Api
 | 
				
			|||||||
			return PhysicalFile(path, "video/MP2T");
 | 
								return PhysicalFile(path, "video/MP2T");
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		[HttpGet("transcode/{episodeLink}/segment/{chunk}")]
 | 
							[HttpGet("transcode/{episodeLink}/segments/{chunk}")]
 | 
				
			||||||
		[Authorize(Policy="Play")]
 | 
							[Authorize(Policy="Play")]
 | 
				
			||||||
		public IActionResult GetTranscodedChunk(string episodeLink, string chunk)
 | 
							public IActionResult GetTranscodedChunk(string episodeLink, string chunk)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
				
			|||||||
@ -17,7 +17,7 @@ namespace Kyoo.Api
 | 
				
			|||||||
			_libraryManager = libraryManager;
 | 
								_libraryManager = libraryManager;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		[HttpGet("{showSlug}-s{seasonNumber}e{episodeNumber}")]
 | 
							[HttpGet("{showSlug}-s{seasonNumber:int}e{episodeNumber:int}")]
 | 
				
			||||||
		[Authorize(Policy="Read")]
 | 
							[Authorize(Policy="Read")]
 | 
				
			||||||
		public async Task<ActionResult<WatchItem>> GetWatchItem(string showSlug, int seasonNumber, int episodeNumber)
 | 
							public async Task<ActionResult<WatchItem>> GetWatchItem(string showSlug, int seasonNumber, int episodeNumber)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
				
			|||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit 459766717070ee420c933923727c1e9816b7ddd6
 | 
					Subproject commit ec79821a71ba0db650b850f7c04c5f93abcb68b0
 | 
				
			||||||
@ -1 +1 @@
 | 
				
			|||||||
Subproject commit e242eb5f19fcf2c4b10aed5bd96072dd498f9476
 | 
					Subproject commit 2d15a6cea98639e286083c96443f56a354ed2002
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user