Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleey committed Jul 9, 2024
0 parents commit ce98e7f
Show file tree
Hide file tree
Showing 206 changed files with 174 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: GitHub Pages

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y webp librsvg2-bin
- name: Optimization
run: |
chmod +x optimize.sh
./optimize.sh -i src/tracks -h 600 -q 100 -o out
./optimize.sh -i src/artists -h 300 -q 100 -o out
./optimize.sh -i src/playlists -h 300 -q 100 -o out
- name: Deploy
run: |
sudo chown -R $(whoami):$(whoami) .
git config --global user.email "[email protected]"
git config --global user.name "$GITHUB_ACTOR"
cp -r out/* /tmp
cd /tmp
git init
git branch -M gh-pages
git add .
git commit -m "Deploy to GitHub Pages"
git remote add origin "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY"
git push -f origin gh-pages
135 changes: 135 additions & 0 deletions optimize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
#!/bin/bash

TEMP_DIR=temp
INPUT_DIR=src
OUTPUT_DIR=out

WIDTH=0
HEIGHT=300
IMAGE_QUALITY=100

while getopts "i:o:w:h:q:" opt; do
case ${opt} in
i )
INPUT_DIR=$OPTARG
;;
o )
OUTPUT_DIR=$OPTARG
;;
w )
WIDTH=$OPTARG
;;
h )
HEIGHT=$OPTARG
;;
q )
IMAGE_QUALITY=$OPTARG
;;
\? )
echo "Usage: ./optimize.sh [-i input_dir] [-o output_dir] [-w width] [-h height] [-q image_quality]"
exit 1
;;
esac
done

rm -rf "$TEMP_DIR"
mkdir -p "$OUTPUT_DIR"

mkdir "$TEMP_DIR"
cp -r "$INPUT_DIR"/* "$TEMP_DIR"

optimize_image() {
local input_file="$1"
local output_file="$2"
cwebp -q "$IMAGE_QUALITY" -m 6 -sharpness 0 -noalpha -resize "$WIDTH" "$HEIGHT" -quiet "$input_file" -o "$output_file"
}

convert_svg_to_webp() {
local input_file="$1"
local output_file="$2"
local temp_png="${output_file}.png"
rsvg-convert -o "$temp_png" "$input_file"
optimize_image "$temp_png" "$output_file"
rm "$temp_png"
}

optimize_webp() {
local input_file="$1"
local output_file="$2"
local temp_output="${output_file}.temp"

if webpmux -info "$input_file" 2>&1 | grep -q "No. of frames: 1"; then
optimize_image "$input_file" "$temp_output"
else
gif2webp -q "$IMAGE_QUALITY" "$input_file" -o "$temp_output"
fi

local original_size=$(stat -c %s "$input_file")
local new_size=$(stat -c %s "$temp_output")

if (( new_size < original_size )); then
mv "$temp_output" "$output_file"
echo "Optimized: $input_file -> $output_file (reduced size from $original_size to $new_size)"
else
rm "$temp_output"
cp "$input_file" "$output_file"
echo "Copied without change: $input_file -> $output_file"
fi
}

file_exists_in_output() {
local input_file="$1"
local filename=$(basename "$input_file")
[ -f "$OUTPUT_DIR/$filename" ]
}

process_images() {
for img in "$TEMP_DIR"/*.{jpg,jpeg,png}; do
[ -f "$img" ] || continue
filename=$(basename "$img" .${img##*.})
output_file="$OUTPUT_DIR/$filename.webp"
if ! file_exists_in_output "$output_file"; then
optimize_image "$img" "$output_file"
echo "Converted: $img -> $output_file"
fi
done
}

process_svgs() {
for svg in "$TEMP_DIR"/*.svg; do
[ -f "$svg" ] || continue
filename=$(basename "$svg" .svg)
output_file="$OUTPUT_DIR/$filename.webp"
if ! file_exists_in_output "$output_file"; then
convert_svg_to_webp "$svg" "$output_file"
echo "Converted: $svg -> $output_file"
fi
done
}

process_webps() {
for webp in "$TEMP_DIR"/*.webp; do
[ -f "$webp" ] || continue
filename=$(basename "$webp" .webp)
output_file="$OUTPUT_DIR/$filename.webp"
if ! file_exists_in_output "$output_file"; then
optimize_webp "$webp" "$output_file"
fi
done
}

process_images
process_svgs
process_webps

find "$TEMP_DIR" -type f ! -name '*.jpg' ! -name '*.jpeg' ! -name '*.png' ! -name '*.svg' -exec cp -v {} "$OUTPUT_DIR/" \;

files_count=$(find "$INPUT_DIR" -type f | wc -l)
echo "$files_count files in $INPUT_DIR"

total=$(find "$OUTPUT_DIR" -type f | wc -l)
echo "Total: $total files in $OUTPUT_DIR"

rm -rf "$TEMP_DIR"

echo "Optimization completed."
Binary file added src/artists/adele.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/akon.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/alok.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/alphaville.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/arctic_monkeys.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/avicii.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/bee_gees.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/bon_jovi.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/bruno_mars.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/bryan_adams.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/calvin_harris.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/coldplay.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/cyndi_lauper.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/ed_sheeran.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/eminem.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/europe.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/evanescence.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/george_michael.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/gotye.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/guns_n_roses.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/harry_styles.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/imagine_dragons.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/justin_bieber.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/justin_timberlake.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/keane.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/artists/legiao_urbana.jpeg
Binary file added src/artists/lewis_capaldi.jpeg
Binary file added src/artists/linkin_park.jpeg
Binary file added src/artists/lionel_richie.jpeg
Binary file added src/artists/maroon_5.jpeg
Binary file added src/artists/marshmello.jpeg
Binary file added src/artists/michael_jackson.jpeg
Binary file added src/artists/nirvana.jpeg
Binary file added src/artists/paul_young.jpeg
Binary file added src/artists/queen.jpeg
Binary file added src/artists/radiohead.jpeg
Binary file added src/artists/renato_russo.jpeg
Binary file added src/artists/rick_astley.jpeg
Binary file added src/artists/rick_james.jpeg
Binary file added src/artists/roxette.jpeg
Binary file added src/artists/sean_kingston.jpeg
Binary file added src/artists/spandau_ballet.jpeg
Binary file added src/artists/stevie_wonder.jpeg
Binary file added src/artists/survivor.jpeg
Binary file added src/artists/tears_for_fears.jpeg
Binary file added src/artists/the_beatles.jpeg
Binary file added src/artists/the_chainsmokers.jpeg
Binary file added src/artists/the_jackson_5.jpeg
Binary file added src/artists/the_jacksons.jpeg
Binary file added src/artists/the_neighbourhood.jpeg
Binary file added src/artists/the_outfield.jpeg
Binary file added src/artists/the_weeknd.jpeg
Binary file added src/artists/twenty_one_pilots.jpeg
Binary file added src/artists/usa_for_africa.jpeg
Binary file added src/playlists/nocopyrightsounds.jpg
Binary file added src/tracks/18_months.jpeg
Binary file added src/tracks/1_remastered.jpeg
Binary file added src/tracks/21.jpeg
Binary file added src/tracks/24k_magic.jpeg
Binary file added src/tracks/25.jpeg
Binary file added src/tracks/a_rush_of_blood_to_the_head.jpeg
Binary file added src/tracks/abc.jpeg
Binary file added src/tracks/after_hours.jpeg
Binary file added src/tracks/alone.jpeg
Binary file added src/tracks/am.jpeg
Binary file added src/tracks/an_evening_with_silk_sonic.jpeg
Binary file added src/tracks/anthology.jpeg
Binary file added src/tracks/appetite_for_destruction.jpeg
Binary file added src/tracks/as_quatro_estacoes.jpeg
Binary file added src/tracks/at_the_close_of_a_century.jpeg
Binary file added src/tracks/beautiful_girls.jpeg
Binary file added src/tracks/beauty_behind_the_madness.jpeg
Binary file added src/tracks/ben.jpeg
Binary file added src/tracks/billionaire_feat_bruno_mars.jpeg
Binary file added src/tracks/blurryface.jpeg
Binary file added src/tracks/cant_slow_down.jpeg
Binary file added src/tracks/changes.jpeg
Binary file added src/tracks/closer.jpeg
Binary file added src/tracks/cold_blooded_expanded_edition.jpeg
Binary file added src/tracks/cross_road.jpeg
Binary file added src/tracks/crush.jpeg
Binary file added src/tracks/dangerous.jpeg
Binary file added src/tracks/dawn_fm.jpeg
Binary file added src/tracks/deluxe.jpeg
Binary file added src/tracks/destiny.jpeg
Binary file added src/tracks/die_for_you_remix.jpeg
Binary file added src/tracks/discover_more_classic_rock.jpeg
Binary file added src/tracks/dois.jpeg
Binary file added src/tracks/dont_let_me_down.jpeg
Binary file added src/tracks/doowops__hooligans.jpeg
Binary file added src/tracks/easy_on_me.jpeg
Binary file added src/tracks/eenie_meenie_ep.jpeg
Binary file added src/tracks/evolve.jpeg
Binary file added src/tracks/fallen.jpeg
Binary file added src/tracks/fck_love_3_over_you.jpeg
Binary file added src/tracks/finesse.jpeg
Binary file added src/tracks/forever_young.jpeg
Binary file added src/tracks/ghost_stories.jpeg
Binary file added src/tracks/greatest.jpeg
Binary file added src/tracks/harrys_house.jpeg
Binary file added src/tracks/hear_me_now_feat_zeeba.jpeg
Binary file added src/tracks/heathens.jpeg
Binary file added src/tracks/help_remastered.jpeg
Binary file added src/tracks/heroes__villains.jpeg
Binary file added src/tracks/heroes_tonight.jpeg
Binary file added src/tracks/hopes_and_fears_deluxe_edition.jpeg
Binary file added src/tracks/how_can_you_mend_a_broken_heart.jpeg
Binary file added src/tracks/how_deep_is_your_love.jpeg
Binary file added src/tracks/hybrid_theory_bonus_edition.jpeg
Binary file added src/tracks/i_love_you.jpeg
Binary file added src/tracks/in_square_circle.jpeg
Binary file added src/tracks/intentions.jpeg
Binary file added src/tracks/it_will_rain.jpeg
Binary file added src/tracks/joyride_deluxe_version.jpeg
Binary file added src/tracks/justice.jpeg
Binary file added src/tracks/keep_the_faith.jpeg
Binary file added src/tracks/konvicted.jpeg
Binary file added src/tracks/legiao_urbana.jpeg
Binary file added src/tracks/legiao_urbana_v.jpeg
Binary file added src/tracks/let_it_be_remastered.jpeg
Binary file added src/tracks/look_sharp.jpeg
Binary file added src/tracks/making_mirrors.jpeg
Binary file added src/tracks/memoriesdo_not_open.jpeg
Binary file added src/tracks/meteora.jpeg
Binary file added src/tracks/minutes_to_midnight.jpeg
Binary file added src/tracks/motion.jpeg
Binary file added src/tracks/moves_like_jagger.jpeg
Binary file added src/tracks/music_and_me.jpeg
Binary file added src/tracks/my_dear_melancholy.jpeg
Binary file added src/tracks/my_world.jpeg
Binary file added src/tracks/my_world_20.jpeg
Binary file added src/tracks/mylo_xyloto.jpeg
Binary file added src/tracks/never_let_me_go.jpeg
Binary file added src/tracks/never_say_never__the_remixes.jpeg
Binary file added src/tracks/nevermind_remastered.jpeg
Binary file added src/tracks/new_jersey_deluxe_edition.jpeg
Binary file added src/tracks/night_visions.jpeg
Binary file added src/tracks/number_ones.jpeg
Binary file added src/tracks/o_descobrimento_do_brasil.jpeg
Binary file added src/tracks/off_the_wall.jpeg
Binary file added src/tracks/on__on.jpeg
Binary file added src/tracks/one_kiss_with_dua_lipa.jpeg
Binary file added src/tracks/pablo_honey.jpeg
Binary file added src/tracks/parachutes.jpeg
Binary file added src/tracks/purpose_deluxe.jpeg
Binary file added src/tracks/que_pais_e_este.jpeg
Binary file added src/tracks/recovery.jpeg
Binary file added src/tracks/rocky_iv.jpeg
Binary file added src/tracks/rule_the_world_the_greatest_hits.jpeg
Binary file added src/tracks/save_your_tears_remix.jpeg
Binary file added src/tracks/shes_so_unusual.jpeg
Binary file added src/tracks/shine.jpeg
Binary file added src/tracks/skyfall.jpeg
Binary file added src/tracks/slippery_when_wet.jpeg
Binary file added src/tracks/spirits_having_flown.jpeg
Binary file added src/tracks/starboy.jpeg
Binary file added src/tracks/stone_cold_classics.jpeg
Binary file added src/tracks/stories.jpeg
Binary file added src/tracks/super_hits.jpeg
Binary file added src/tracks/symbolism.jpeg
Binary file added src/tracks/the_marshall_mathers_lp.jpeg
Binary file added src/tracks/the_marshall_mathers_lp2_deluxe.jpeg
Binary file added src/tracks/the_twelve_inch_mixes.jpeg
Binary file added src/tracks/third_album.jpeg
Binary file added src/tracks/this_is_what_you_came_for.jpeg
Binary file added src/tracks/thriller.jpeg
Binary file added src/tracks/thriller_25_super_deluxe_edition.jpeg
Binary file added src/tracks/trench.jpeg
Binary file added src/tracks/triumph.jpeg
Binary file added src/tracks/trouble.jpeg
Binary file added src/tracks/true.jpeg
Binary file added src/tracks/true_colors.jpeg
Binary file added src/tracks/tuskegee.jpeg
Binary file added src/tracks/unorthodox_jukebox.jpeg
Binary file added src/tracks/uptown_special.jpeg
Binary file added src/tracks/v.jpeg
Binary file added src/tracks/versace_on_the_floor.jpeg
Binary file added src/tracks/viva__renato_russo.jpeg
Binary file added src/tracks/waking_up_the_neighbours.jpeg
Binary file added src/tracks/we_are_the_world.jpeg
Binary file added src/tracks/whenever_you_need_somebody.jpeg
Binary file added src/tracks/x_deluxe_edition.jpeg
Binary file added src/tracks/xscape.jpeg
Binary file added src/tracks/xy.jpeg

0 comments on commit ce98e7f

Please sign in to comment.