Add image script to Makefile

This commit is contained in:
Charles Ewert 2019-10-05 00:53:40 -04:00
parent c0278bd9aa
commit 94ee7fd9f0
3 changed files with 34 additions and 38 deletions

View File

@ -20,7 +20,7 @@ ZIP_EXCLUDE= -x rooibos/**\* -x xml/* -x artwork/* -x \*.pkg -x storeassets\* -x
include app.mk
test: prep_staging prep_tests remove install
test: get_images prep_staging prep_tests remove install
echo "Running tests"
deploy: prep_staging remove install
deploy: get_images prep_staging remove install

33
app.mk
View File

@ -41,6 +41,11 @@ IMPORTCLEANUP = $(foreach f,$(IMPORTS),$(APPSOURCEDIR)/$f.brs)
GITCOMMIT = $(shell git rev-parse --short HEAD)
BUILDDATE = $(shell date -u | awk '{ print $$2,$$3,$$6,$$4 }')
BRANDING_ROOT = https://raw.githubusercontent.com/jellyfin/jellyfin-ux/master/branding/SVG
ICON_SOURCE = icon-transparent.svg
BANNER_SOURCE = banner-dark.svg
OUTPUT_DIR = ./images
ifdef ROKU_DEV_PASSWORD
USERPASS = rokudev:$(ROKU_DEV_PASSWORD)
else
@ -149,7 +154,7 @@ prep_tests:
cp -r $(SOURCEREL)/tests/source/* $(STAGINGREL)/source/tests/;\
./node_modules/.bin/rooibos-cli i tests/.rooibosrc.json
install: prep_staging package home
install: get_images prep_staging package home
@echo "Installing $(APPNAME) to host $(ROKU_DEV_TARGET)"
@$(CURLCMD) --user $(USERPASS) --digest -F "mysubmit=Install" -F "archive=@$(ZIPREL)/$(APPNAME).zip" -F "passwd=" http://$(ROKU_DEV_TARGET)/plugin_install | grep "<font color" | sed "s/<font color=\"red\">//" | sed "s[</font>[["
@ -162,6 +167,32 @@ remove:
curl -s -S -F "mysubmit=Delete" -F "archive=" -F "passwd=" http://$(ROKU_DEV_TARGET)/plugin_install | grep "<font color" | sed "s/<font color=\"red\">//" | sed "s[</font>[[" ; \
fi
get_images:
@if [ ! -d $(OUTPUT_DIR) ]; \
then \
mkdir -p $(OUTPUT_DIR); \
echo "Creating images folder"; \
fi
@if [ -e $(ICON_SOURCE) ]; \
then \
echo "Images are already downloaded"; \
else \
echo "Downloading images from $(BRANDING_ROOT)"; \
wget $(BRANDING_ROOT)/$(ICON_SOURCE) > /dev/null ; \
wget $(BRANDING_ROOT)/$(BANNER_SOURCE) > /dev/null ; \
echo "Finished downloading images"; \
fi
@convert -background "#000b25" -gravity center -scale 535x400 -extent 540x405 $(BANNER_SOURCE) $(OUTPUT_DIR)/channel-poster_fhd.png
@convert -background "#000b25" -gravity center -scale 275x205 -extent 280x210 $(BANNER_SOURCE) $(OUTPUT_DIR)/channel-poster_hd.png
@convert -background "#000b25" -gravity center -scale 182x135 -extent 187x140 $(BANNER_SOURCE) $(OUTPUT_DIR)/channel-poster_sd.png
@convert -background none -gravity center -scale 1000x48 -extent 180x48 $(BANNER_SOURCE) $(OUTPUT_DIR)/logo.png
@convert -background "#000b25" -gravity center -scale 540x540 -extent 1920x1080 $(BANNER_SOURCE) $(OUTPUT_DIR)/splash-screen_fhd.jpg
@convert -background "#000b25" -gravity center -scale 360x360 -extent 1280x720 $(BANNER_SOURCE) $(OUTPUT_DIR)/splash-screen_hd.jpg
@convert -background "#000b25" -gravity center -scale 240x240 -extent 720x480 $(BANNER_SOURCE) $(OUTPUT_DIR)/splash-screen_sd.jpg
screenshot:
SCREENSHOT_TIME=`date "+%s"`; \
curl -m 1 -o screenshot.jpg --user $(USERPASS) --digest "http://$(ROKU_DEV_TARGET)/pkgs/dev.jpg?time=$$SCREENSHOT_TIME" -H 'Accept: image/png,image/*;q=0.8,*/*;q=0.5' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate'

View File

@ -1,35 +0,0 @@
#!/bin/bash
BRANDING_ROOT=https://raw.githubusercontent.com/jellyfin/jellyfin-ux/master/branding/SVG
ICON_SOURCE=icon-transparent.svg
BANNER_SOURCE=banner-dark.svg
OUTPUT_DIR=./images
[ ! -d $OUTPUT_DIR ] && mkdir -p $OUTPUT_DIR
# Don't need to keep re-downloading things we already have
if [ ! -e $ICON_SOURCE ]; then
wget $BRANDING_ROOT/$ICON_SOURCE > /dev/null
wget $BRANDING_ROOT/$BANNER_SOURCE > /dev/null
fi
# Channel Posters
convert -background "#000b25" -gravity center -scale 535x400 -extent 540x405 $BANNER_SOURCE $OUTPUT_DIR/channel-poster_fhd.png
convert -background "#000b25" -gravity center -scale 275x205 -extent 280x210 $BANNER_SOURCE $OUTPUT_DIR/channel-poster_hd.png
convert -background "#000b25" -gravity center -scale 182x135 -extent 187x140 $BANNER_SOURCE $OUTPUT_DIR/channel-poster_sd.png
# Overhang icon
convert -background none -gravity center -scale 1000x48 -extent 180x48 $BANNER_SOURCE $OUTPUT_DIR/logo.png
# Splash screens
convert -background "#000b25" -gravity center -scale 540x540 -extent 1920x1080 $BANNER_SOURCE $OUTPUT_DIR/splash-screen_fhd.jpg
convert -background "#000b25" -gravity center -scale 360x360 -extent 1280x720 $BANNER_SOURCE $OUTPUT_DIR/splash-screen_hd.jpg
convert -background "#000b25" -gravity center -scale 240x240 -extent 720x480 $BANNER_SOURCE $OUTPUT_DIR/splash-screen_sd.jpg
# Figure out when we want to clean up after ourselves
if [ "$skip" = "true" ]; then
rm $ICON_SOURCE
rm $BANNER_SOURCE
fi