-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #261 from Shikkanime/dev
Dev
- Loading branch information
Showing
21 changed files
with
159 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
src/main/kotlin/fr/shikkanime/converters/anime/AnimeToAnimeDtoConverter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 5 additions & 3 deletions
8
src/main/kotlin/fr/shikkanime/converters/episode/EpisodeToEpisodeDtoConverter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/kotlin/fr/shikkanime/services/caches/LanguageCacheService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package fr.shikkanime.services.caches | ||
|
||
import fr.shikkanime.utils.MapCache | ||
import org.apache.tika.language.detect.LanguageDetector | ||
|
||
class LanguageCacheService : AbstractCacheService { | ||
private val languageDetector: LanguageDetector = LanguageDetector.getDefaultLanguageDetector().loadModels() | ||
|
||
private val detectCache = MapCache<String, String>(log = false) { | ||
languageDetector.detect(it).language.lowercase() | ||
} | ||
|
||
fun detectLanguage(text: String?) = text?.let { detectCache[it] } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<#import "_navigation.ftl" as navigation /> | ||
|
||
<@navigation.display> | ||
<div class="container my-3"> | ||
<input type="text" id="search" class="form-control-lg w-100 bg-dark text-white" | ||
placeholder="Rechercher" value="<#if query??>${query}</#if>"> | ||
</div> | ||
|
||
<div class="row justify-content-center" id="result-list" style="min-height: 50vh;"> | ||
|
||
</div> | ||
|
||
<script src="/assets/js/main.js"></script> | ||
<script> | ||
<#if query??> | ||
search('${query}'); | ||
</#if> | ||
document.getElementById('search').addEventListener('input', function () { | ||
if (this.value.length > 0) { | ||
window.history.pushState({}, '', '/search?q=' + encodeURIComponent(this.value)); | ||
} else { | ||
window.history.pushState({}, '', '/search'); | ||
} | ||
search(this.value); | ||
}); | ||
async function search(query) { | ||
const trimmedQuery = query.trim(); | ||
if (trimmedQuery.length === 0) { | ||
document.getElementById('result-list').innerHTML = ''; | ||
return; | ||
} | ||
const animes = await callApi('/api/v1/animes?name=' + trimmedQuery + '&limit=12'); | ||
document.getElementById('result-list').innerHTML = animes.data.map(anime => template(anime)).join(''); | ||
} | ||
function template(anime) { | ||
return `<div class="col-md-2 col-6 mt-0"> | ||
<article x-data="{ hover: false }"> | ||
<a href="/animes/` + anime.slug + `" class="text-decoration-none text-white" @mouseenter="hover = true" | ||
@mouseleave="hover = false"> | ||
<div class="position-relative"> | ||
<img src="https://api.shikkanime.fr/v1/attachments?uuid=` + anime.uuid + `&type=image" | ||
alt="` + anime.shortName.replace("\"", "'") + ` anime image" class="img-fluid" width="480" | ||
height="720"> | ||
<span class="h6 mt-2 text-truncate-2">` + anime.shortName + `</span> | ||
<div class="bg-black bg-opacity-75 position-absolute top-0 start-0 w-100 h-100 mh-100 p-3" | ||
x-show="hover"> | ||
<div class="h6 text-truncate-2"> | ||
` + anime.name.toUpperCase() + ` | ||
</div> | ||
<hr> | ||
` + (anime.description != null ? `<div class="text-truncate-6">` + anime.description + `</div>` : ``) + ` | ||
</div> | ||
</div> | ||
</a> | ||
</article> | ||
</div>`; | ||
} | ||
</script> | ||
</@navigation.display> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters