Skip to content

Commit

Permalink
feat: remove calendar
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziedelth committed Sep 14, 2024
1 parent 4f030b0 commit 89dc9c9
Show file tree
Hide file tree
Showing 11 changed files with 20 additions and 385 deletions.
2 changes: 0 additions & 2 deletions src/main/kotlin/fr/shikkanime/Application.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ fun main() {
JobManager.scheduleJob("0 0 0 * * ?", DeleteOldMetricsJob::class.java)
// Every day at 3pm
JobManager.scheduleJob("0 0 15 * * ?", FetchOldEpisodesJob::class.java)
// Every day at 9am
JobManager.scheduleJob("0 0 9 * * ?", FetchCalendarJob::class.java)
JobManager.start()

Constant.injector.getInstance(DiscordSocialNetwork::class.java).login()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ enum class ConfigPropertyKey(val key: String) {
ANIME_EPISODES_SIZE_LIMIT("anime_episodes_size_limit"),
DISNEY_PLUS_AUTHORIZATION("disney_plus_authorization"),
DISNEY_PLUS_REFRESH_TOKEN("disney_plus_refresh_token"),
TRANSLATE_CALENDAR("translate_calendar"),
LAST_FETCH_OLD_EPISODES("last_fetch_old_episodes"),
FETCH_OLD_EPISODES_RANGE("fetch_old_episodes_range"),
FETCH_OLD_EPISODES_LIMIT("fetch_old_episodes_limit"),
Expand Down
308 changes: 0 additions & 308 deletions src/main/kotlin/fr/shikkanime/jobs/FetchCalendarJob.kt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class CrunchyrollPlatform :
)
}

fun getNumberAndEpisodeType(episode: CrunchyrollWrapper.Episode): Pair<Int, EpisodeType> {
private fun getNumberAndEpisodeType(episode: CrunchyrollWrapper.Episode): Pair<Int, EpisodeType> {
var number = episode.number ?: -1
val specialEpisodeRegex = "SP(\\d*)".toRegex()

Expand Down
31 changes: 2 additions & 29 deletions src/main/kotlin/fr/shikkanime/services/ImageService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ object ImageService {
return Color(redAverage.toInt(), greenAverage.toInt(), blueAverage.toInt())
}

fun makeRoundedCorner(image: BufferedImage, cornerRadius: Int): BufferedImage {
private fun makeRoundedCorner(image: BufferedImage, cornerRadius: Int): BufferedImage {
return BufferedImage(image.width, image.height, BufferedImage.TYPE_INT_ARGB).apply {
createGraphics().apply {
composite = AlphaComposite.Src
Expand All @@ -411,7 +411,7 @@ object ImageService {
}
}

fun Graphics2D.setRenderingHints() {
private fun Graphics2D.setRenderingHints() {
setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR)
setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY)
setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB)
Expand Down Expand Up @@ -652,31 +652,4 @@ object ImageService {
graphics.dispose()
return finalImage
}

fun Graphics2D.drawStringRect(
text: String,
x: Int,
y: Int,
marginX: Int,
marginY: Int,
borderWidth: Int = 2,
backgroundColor: Color = Color(0x000),
) {
val fontMetrics = fontMetrics
val textWidth = fontMetrics.stringWidth(text)
val textHeight = fontMetrics.height

fillRoundRect(x, y, textWidth + marginX, textHeight + marginY, 10, 10)
color = backgroundColor
fillRoundRect(
x + borderWidth,
y + borderWidth,
textWidth + marginX - (borderWidth * 2),
textHeight + marginY - (borderWidth * 2),
10,
10
)
color = Color.WHITE
drawString(text, x + marginX / 2, y + (marginY / 2) + textHeight - 5)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,4 @@ abstract class AbstractSocialNetwork {
"${Constant.baseUrl}/animes/${episodeDto.mapping.anime.slug}/season-${episodeDto.mapping.season}/${episodeDto.mapping.episodeType.slug}-${episodeDto.mapping.number}?utm_campaign=episode_post&utm_medium=social&utm_source=${utmSource()}&utm_content=${episodeDto.uuid}"

abstract fun sendEpisodeRelease(episodeDto: EpisodeVariantDto, mediaImage: ByteArray?)

open fun sendCalendar(message: String, calendarImage: ByteArray) {
// Default implementation
}
}
Loading

0 comments on commit 89dc9c9

Please sign in to comment.