Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 04-13-2025, 10:21 AM   #1
druss67
Connoisseur
druss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notes
 
Posts: 79
Karma: 24492
Join Date: Jul 2013
Location: France
Device: Kindle 4, PBk Lux 2, PBk Lux 3, K Aura, K Libra H2O, K Libra2
Dictionnary download

Do you know if it is possible to donwload a file from the web to a local folder on my Kobo?
I would like to download the dictionary loacted on that address: https://github.com/BoboTiG/ebook-rea...html-fr-fr.zip to /.kobo/custom-dict

Perhaps from nickel menu, I tried this but the browser is blocked.
menu_item : main : Dictionnary : nickel_browser : https://github.com/BoboTiG/ebook-rea...html-fr-fr.zip

Any idea ?

Thanks,
Druss67
druss67 is offline   Reply With Quote
Old 04-17-2025, 02:53 PM   #2
druss67
Connoisseur
druss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notesdruss67 can name that song in three notes
 
Posts: 79
Karma: 24492
Join Date: Jul 2013
Location: France
Device: Kindle 4, PBk Lux 2, PBk Lux 3, K Aura, K Libra H2O, K Libra2
I found a solution with the help of an AI.

Code:
#!/bin/sh

# === Variables ===
DEST_DIR="/mnt/onboard/.kobo/custom-dict"
URL="https://github.com/BoboTiG/ebook-reader-dict/releases/download/fr/dicthtml-fr-fr.zip"
ZIP_NAME="dicthtml-fr-fr.zip"
TMP_ZIP="${ZIP_NAME}.new"

# === Préparation ===
mkdir -p "$DEST_DIR"
cd "$DEST_DIR" || {
    echo "❌ Impossible d'accéder à $DEST_DIR" >&2
    exit 1
}

# Taille actuelle (0 si fichier absent)
old_size=$(stat -c%s "$ZIP_NAME" 2>/dev/null || echo 0)
echo "ℹ️  Taille actuelle du dictionnaire : ${old_size} octets"

# === Téléchargement dans un .new ===
echo "ℹ️  Téléchargement de la nouvelle version pour comparaison…"
if command -v wget >/dev/null 2>&1; then
    wget -q -O "$TMP_ZIP" "$URL" || {
        echo "❌ Erreur lors du téléchargement via wget" >&2
        exit 1
    }
elif command -v curl >/dev/null 2>&1; then
    curl -L -s -o "$TMP_ZIP" "$URL" || {
        echo "❌ Erreur lors du téléchargement via curl" >&2
        exit 1
    }
else
    echo "❌ Ni wget ni curl trouvés" >&2
    exit 1
fi

# Taille du nouveau fichier
new_size=$(stat -c%s "$TMP_ZIP" 2>/dev/null || echo 0)
echo "ℹ️  Taille récupérée : ${new_size} octets"

# === Comparaison et remplacement conditionnel ===
if [ "$new_size" -eq "$old_size" ]; then
    echo "ℹ️  Le dictionnaire est déjà à jour. Aucune action effectuée."
    rm -f "$TMP_ZIP"
else
    mv -f "$TMP_ZIP" "$ZIP_NAME"
    echo "✅ Dictionnaire mis à jour : $ZIP_NAME (${new_size} octets)."
fi

# === Notification finale ===
echo "🔔 Opération terminée."

exit 0
the command is launched from NickelMenu with this command:
Code:
menu_item :main   :MàJ Dico              :cmd_spawn      :sh /mnt/onboard/.adds/kfmon/scripts/update_dict.sh
If you want another language, update the variables.

BR
Druss67
druss67 is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Japanese Furigana and dictionnary search. Simboubou Kobo Reader 4 02-12-2025 04:33 AM
Closing the dictionnary h68 Viewer 7 02-13-2024 12:04 PM
Dictionnary built in ebook Bid ePub 1 06-26-2020 12:06 PM
English to French dictionnary oldbear KOReader 1 03-08-2020 06:04 AM
Dictionnary mode and suspend maxime Kobo Reader 0 12-26-2012 05:46 PM


All times are GMT -4. The time now is 12:39 AM.


MobileRead.com is a privately owned, operated and funded community.