mirror of
				https://github.com/zoriya/Kyoo.git
				synced 2025-11-02 18:47:11 -05:00 
			
		
		
		
	Adding custom extensions for provider's logo
This commit is contained in:
		
							parent
							
								
									9b6aa68472
								
							
						
					
					
						commit
						a620cc1818
					
				@ -12,7 +12,7 @@
 | 
				
			|||||||
		<Company>SDG</Company>
 | 
							<Company>SDG</Company>
 | 
				
			||||||
		<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
 | 
							<PackageLicenseExpression>GPL-3.0-or-later</PackageLicenseExpression>
 | 
				
			||||||
		<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
 | 
							<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
 | 
				
			||||||
		<PackageVersion>1.0.24</PackageVersion>
 | 
							<PackageVersion>1.0.25</PackageVersion>
 | 
				
			||||||
		<IncludeSymbols>true</IncludeSymbols>
 | 
							<IncludeSymbols>true</IncludeSymbols>
 | 
				
			||||||
		<SymbolPackageFormat>snupkg</SymbolPackageFormat>
 | 
							<SymbolPackageFormat>snupkg</SymbolPackageFormat>
 | 
				
			||||||
		<LangVersion>default</LangVersion>
 | 
							<LangVersion>default</LangVersion>
 | 
				
			||||||
 | 
				
			|||||||
@ -9,7 +9,7 @@ namespace Kyoo.Models
 | 
				
			|||||||
		public string Slug { get; set; }
 | 
							public string Slug { get; set; }
 | 
				
			||||||
		public string Name { get; set; }
 | 
							public string Name { get; set; }
 | 
				
			||||||
		[SerializeAs("{HOST}/api/providers/{Slug}/logo")] public string Logo { get; set; }
 | 
							[SerializeAs("{HOST}/api/providers/{Slug}/logo")] public string Logo { get; set; }
 | 
				
			||||||
		
 | 
							[SerializeIgnore] public string LogoExtension { get; set; }
 | 
				
			||||||
		[LoadableRelation] public virtual ICollection<Library> Libraries { get; set; }
 | 
							[LoadableRelation] public virtual ICollection<Library> Libraries { get; set; }
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
#if ENABLE_INTERNAL_LINKS
 | 
					#if ENABLE_INTERNAL_LINKS
 | 
				
			||||||
 | 
				
			|||||||
@ -142,16 +142,16 @@ namespace Kyoo.Controllers
 | 
				
			|||||||
			if (people == null)
 | 
								if (people == null)
 | 
				
			||||||
				throw new ArgumentNullException(nameof(people));
 | 
									throw new ArgumentNullException(nameof(people));
 | 
				
			||||||
			string thumbPath = Path.GetFullPath(Path.Combine(_peoplePath, $"{people.Slug}.jpg"));
 | 
								string thumbPath = Path.GetFullPath(Path.Combine(_peoplePath, $"{people.Slug}.jpg"));
 | 
				
			||||||
			if (!thumbPath.StartsWith(_peoplePath))
 | 
								return Task.FromResult(thumbPath.StartsWith(_peoplePath) ? thumbPath : null);
 | 
				
			||||||
				return Task.FromResult<string>(null);
 | 
					 | 
				
			||||||
			return Task.FromResult(thumbPath);
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public Task<string> GetProviderLogo(ProviderID provider)
 | 
							public Task<string> GetProviderLogo(ProviderID provider)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if (provider == null)
 | 
								if (provider == null)
 | 
				
			||||||
				throw new ArgumentNullException(nameof(provider));
 | 
									throw new ArgumentNullException(nameof(provider));
 | 
				
			||||||
			string thumbPath = Path.GetFullPath(Path.Combine(_providerPath, $"{provider.Slug}.png"));
 | 
								// TODO add a image's type on the provider to allow svg here.
 | 
				
			||||||
 | 
								// TODO fix trailer display.
 | 
				
			||||||
 | 
								string thumbPath = Path.GetFullPath(Path.Combine(_providerPath, $"{provider.Slug}.{provider.LogoExtension}"));
 | 
				
			||||||
			return Task.FromResult(thumbPath.StartsWith(_providerPath) ? thumbPath : null);
 | 
								return Task.FromResult(thumbPath.StartsWith(_providerPath) ? thumbPath : null);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user