Skip to content

Commit

Permalink
edit story.json when convert jpg to png
Browse files Browse the repository at this point in the history
  • Loading branch information
Franck ALARY committed Nov 11, 2023
1 parent d66c64e commit f66f7b4
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
###########################################################

TARGET=Telmi Story Teller
VERSION=0.2.3
VERSION=0.2.4

###########################################################

Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

# Telmi - An open source story teller and MP3 player for Miyoo Mini

Telmi OS is an open source story teller and MP3 player for Miyoo Mini and Miyoo Mini Plus.
The story teller is compatible with stories exported from STUdio (v1 format).
TelmiOS is an open source story teller and lite MP3 player for Miyoo Mini and Miyoo Mini Plus.
TelmiOS is for children 3~4 years old and older.

The story teller is compatible with stories exported from [STUdio](https://github.com/marian-m12l/studio) (v1 format).

## Installation

### Download the installation files

- [Download the latest version of Telmi](https://github.com/DantSu/Telmi-story-teller/releases/download/0.2.3/TelmiOS_v0.2.3.zip)
- [Download the latest version of Telmi](https://github.com/DantSu/Telmi-story-teller/releases/download/0.2.4/TelmiOS_v0.2.4.zip)

### Format your SD card as FAT32 (not exFAT!)

Expand Down Expand Up @@ -44,9 +46,9 @@ Make sure you choose: `For use with all systems and devices (FAT)`

Chrome already has a tool to format an SD card. Insert the card into your Chromebook, right-click it and click **Format Device**, make sure `FAT32` is selected under **Format** and click or tap **Erase & Format**.

### Unzip TelmiOS_v0.2.3.zip
### Unzip TelmiOS_v0.2.4.zip

Put the content of `TelmiOS_v0.2.3.zip` at the root of the SD card.
Put the content of `TelmiOS_v0.2.4.zip` at the root of the SD card.

### Power on your Miyoo

Expand All @@ -56,7 +58,7 @@ Insert the SD card in your Miyoo. Press the power button and the installation wi

# Story teller

Export stories from STUdio (v1 format). Unzip stories in `/Stories` folder in micro SD card.
Export stories from [STUdio](https://github.com/marian-m12l/studio) (v1 format). Unzip stories in `/Stories` folder in micro SD card.

# Music

Expand Down
8 changes: 4 additions & 4 deletions src/bootScreen/bootScreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ int main(int argc, char *argv[])

if (argc > 1 && strcmp(argv[1], "End") == 0) {
background = loadImage("Screen_Off");
}
else if (argc > 1 && strcmp(argv[1], "lowBat") == 0) {
} else if (argc > 1 && strcmp(argv[1], "lowBat") == 0) {
background = loadImage("lowBat");
show_version = false;
}
else {
} else if (argc > 1 && strcmp(argv[1], "convertingFiles") == 0) {
background = loadImage("convertingFiles");
} else {
background = loadImage("bootScreen");
}

Expand Down
Binary file added src/bootScreen/res/convertingFiles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 1 addition & 18 deletions src/storyTeller/sdl_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void video_audio_init(void)
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO);
IMG_Init(IMG_INIT_PNG);
TTF_Init();
if(Mix_OpenAudio(44000, 32784, 2, 2048) < 0) {
if(Mix_OpenAudio(44100, 32784, 2, 2048) < 0) {
Mix_Volume(-1, MIX_MAX_VOLUME);
Mix_VolumeMusic(MIX_MAX_VOLUME);
}
Expand All @@ -62,25 +62,8 @@ void video_audio_quit(void)
SDL_Quit();
}

void video_checkFilename(char *filename)
{
int length = strlen(filename);
if(strcmp((char *)filename + length - 4, ".jpg") == 0 || strcmp((char *)filename + length - 4, ".JPG") == 0) {
filename[length - 3] = 'p';
filename[length - 2] = 'n';
filename[length - 1] = 'g';
} else if (strcmp((char *)filename + length - 5, ".jpeg") == 0 || strcmp((char *)filename + length - 5, ".JPEG") == 0) {
filename[length - 4] = 'p';
filename[length - 3] = 'n';
filename[length - 2] = 'g';
filename[length - 1] = '\0';
}
}

void video_displayImage(const char *dir, char *name)
{
video_checkFilename(name);

char image_path[STR_MAX * 2];
sprintf(image_path, "%s%s", dir, name);
SDL_Surface *image = IMG_Load(image_path);
Expand Down
11 changes: 9 additions & 2 deletions static/build/.tmp_update/runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,15 @@ main() {
fi

cd $sysdir
bootScreen "Boot"
bootScreen "convertingFiles"

# Init
rm /tmp/.offOrder 2> /dev/null
HOME=/mnt/SDCARD/StoryTeller/

storyteller_jpg2png

bootScreen "Boot"
# start_networking
sleep 1
rm -rf /tmp/is_booting
Expand All @@ -69,13 +70,19 @@ storyteller_jpg2png() {
continue
fi

hasconvertedjpg=false
for file in "$directory"/assets/*.jpg "$directory"/assets/*.jpeg "$directory"/assets/*.JPG "$directory"/assets/*.JPEG; do
if [ ! -f "$file" ]; then
continue
fi
jpg2png "$file" 320 240
jpg2png "$file" 480 360
rm -f "$file" 2> /dev/null
hasconvertedjpg=true
done

if $hasconvertedjpg; then
sed -i 's/\.\(jpg\|jpeg\)"/\.png"/gI' "$directory"/story.json
fi
done
}

Expand Down

0 comments on commit f66f7b4

Please sign in to comment.