<commit_before>package eu.kanade.tachiyomi.data.track.anilist

import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.data.database.models.Track
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.data.track.model.TrackSearch
import uy.kohesive.injekt.injectLazy
import java.text.SimpleDateFormat
import java.util.*

data class ALManga(
        val id: Int,
        val title_romaji: String,
        val image_url_lge: String,
        val description: String,
        val type: String,
        val publishing_status: String,
        val start_date_fuzzy: String,
        val total_chapters: Int) {

    fun toTrack() = TrackSearch.create(TrackManager.ANILIST).apply {
        remote_id = this@ALManga.id
        title = title_romaji
        total_chapters = this@ALManga.total_chapters
        cover_url = image_url_lge
        summary = description
        tracking_url = AnilistApi.mangaUrl(remote_id)
        publishing_status = this@ALManga.publishing_status
        publishing_type = type
        if (!start_date_fuzzy.isNullOrBlank()) {
            start_date = try {
                val inputDf = SimpleDateFormat("yyyyMMdd", Locale.US)
                val outputDf = SimpleDateFormat("yyyy-MM-dd", Locale.US)
                val date = inputDf.parse(BuildConfig.BUILD_TIME)
                outputDf.format(date)
            } catch (e: Exception) {
                start_date_fuzzy.orEmpty()
            }
        }

    }
}

data class ALUserManga(
        val id: Int,
        val list_status: String,
        val score_raw: Int,
        val chapters_read: Int,
        val manga: ALManga) {

    fun toTrack() = Track.create(TrackManager.ANILIST).apply {
        remote_id = manga.id
        status = toTrackStatus()
        score = score_raw.toFloat()
        last_chapter_read = chapters_read
    }

    fun toTrackStatus() = when (list_status) {
        "reading" -> Anilist.READING
        "completed" -> Anilist.COMPLETED<commit_msg>Anilist search fix (#1289)<commit_after>package eu.kanade.tachiyomi.data.track.anilist

import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.data.database.models.Track
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.getOrDefault
import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.data.track.model.TrackSearch
import uy.kohesive.injekt.injectLazy
import java.text.SimpleDateFormat
import java.util.*

data class ALManga(
        val id: Int,
        val title_romaji: String,
        val image_url_lge: String,
        val description: String?,
        val type: String,
        val publishing_status: String,
        val start_date_fuzzy: String,
        val total_chapters: Int) {

    fun toTrack() = TrackSearch.create(TrackManager.ANILIST).apply {
        remote_id = this@ALManga.id
        title = title_romaji
        total_chapters = this@ALManga.total_chapters
        cover_url = image_url_lge
        summary = description ?: ""
        tracking_url = AnilistApi.mangaUrl(remote_id)
        publishing_status = this@ALManga.publishing_status
        publishing_type = type
        if (!start_date_fuzzy.isNullOrBlank()) {
            start_date = try {
                val inputDf = SimpleDateFormat("yyyyMMdd", Locale.US)
                val outputDf = SimpleDateFormat("yyyy-MM-dd", Locale.US)
                val date = inputDf.parse(BuildConfig.BUILD_TIME)
                outputDf.format(date)
            } catch (e: Exception) {
                start_date_fuzzy.orEmpty()
            }
        }
    }
}

data class ALUserManga(
        val id: Int,
        val list_status: String,
        val score_raw: Int,
        val chapters_read: Int,
        val manga: ALManga) {

    fun toTrack() = Track.create(TrackManager.ANILIST).apply {
        remote_id = manga.id
        status = toTrackStatus()
        score = score_raw.toFloat()
        last_chapter_read = chapters_read
    }

    fun toTrackStatus() = when (list_status) {
        "reading" -> Anilist.READING
        "completed" -> Anilist.COMPLETED
{'fraction_non_alphanumeric': 0.0885207100591716, 'fraction_numerical': 0.0009467455621301775, 'mean_word_length': 2.512884455527847, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4443388', 'n_tokens_mistral': 1360, 'n_tokens_neox': 1322, 'n_words': 248}