Skip to content

Commit

Permalink
make: revamp
Browse files Browse the repository at this point in the history
* rewrite it in a single, more standard makefile
* forward most commands to npm
* support parallel use
* get rid of load-time auth check and trust user
* rework targets
  * `prep_commit` -> `format`, `lint`
  * `dev`, `beta`, `release` -> `build-dev`, `build-prod`, `build-tests`
  * `prep_staging`, `package`: rm
* update devguide accordingly

Fixes: #1401
  • Loading branch information
tharvik committed Oct 4, 2023
1 parent 9e378e7 commit 89b68c7
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 240 deletions.
13 changes: 7 additions & 6 deletions DEVGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ cd jellyfin-roku
Install Dependencies:

```bash
sudo apt-get install npm
npm install
```

Expand Down Expand Up @@ -86,16 +87,16 @@ Example:
Install Necessary Packages

```bash
sudo apt-get install wget make zip
sudo apt-get install make
```

Build the package

```bash
make dev
make
```

This will create a zip in `out/apps/Jellyfin_Roku-dev.zip`. Login to your Roku's device in your browser and upload the zip file then run install.
This will create a zip in `out/jellyfin-roku.zip`. Login to your Roku's device in your browser and upload the zip file then run install.

## Method 3: Direct load to Roku Device

Expand All @@ -113,7 +114,7 @@ Normally you would have to open up your browser and upload a .zip file containin
### Install Necessary Packages

```bash
sudo apt-get install wget make zip
sudo apt-get install make curl
```

### Deploy
Expand Down Expand Up @@ -167,7 +168,7 @@ sudo apt-get install nodejs npm
Before committing your code, please run:

```bash
make prep_commit
make format lint
```

This will format your code and run the CI checks locally to ensure you will pass the CI tests.
Expand All @@ -179,7 +180,7 @@ This repo already contains all necessary images for the app. This script only ne
Install necessary packages:

```bash
sudo apt-get install imagemagick
sudo apt-get install curl imagemagick
```

Download and convert images:
Expand Down
108 changes: 89 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,98 @@

#########################################################################
# Makefile Usage:
##########################################################################
# Need curl and npm in your $PATH
# If you want to get_images, you'll also need convert from ImageMagick
#
# 1) Make sure that you have the curl command line executable in your path
# 2) Set the variable ROKU_DEV_TARGET in your environment to the IP
# address of your Roku box. (e.g. export ROKU_DEV_TARGET=192.168.1.1.
# Set in your this variable in your shell startup (e.g. .bashrc)
# 3) and set up the ROKU_DEV_PASSWORD environment variable, too
# If you want to connect to a Roku box
# * set ROKU_DEV_TARGET to its IP
# If you want to add/remove Jellyfin from it, also
# * set ROKU_DEV_PASSWORD to its password
##########################################################################

APPNAME = Jellyfin_Roku
VERSION = 1.6.6
VERSION := 1.6.6

## development

node_modules/: package-lock.json; npm ci

.PHONY: build-dev build-prod build-tests
.NOTPARALLEL: build-dev build-prod build-tests # output to the same file
build-dev: node_modules/; npm run build
build-prod: node_modules/; npm run build-prod
build-tests: node_modules/; npm run build-tests

# default to build-dev if file doesn't exist
out/jellyfin-roku.zip:; $(MAKE) build-dev

.PHONY: format
format: node_modules/; npm run format

.PHONY: lint
lint: node_modules/
npm run check-formatting
npm run lint
npm run lint-json
npm run lint-markdown
npm run lint-spelling
npm run validate

## roku box

CURL_CMD ?= curl --show-error

ifdef ROKU_DEV_TARGET

.PHONY: home
home:
$(CURL_CMD) -XPOST http://$(ROKU_DEV_TARGET):8060/keypress/home
sleep 2 # wait for roku reaction


ifdef ROKU_DEV_PASSWORD

CURL_LOGGED_CMD := $(CURL_CMD) --user rokudev:$(ROKU_DEV_PASSWORD) --digest

EXTRACT_ERROR_CMD := grep "<font color" | sed "s/<font color=\"red\">//" | sed "s[</font>[["
.PHONY: install remove
install: out/jellyfin-roku.zip home
$(CURL_LOGGED_CMD) -F "mysubmit=Install" -F "archive=@$<" -F "passwd=" http://$(ROKU_DEV_TARGET)/plugin_install | $(EXTRACT_ERROR_CMD)
remove:
$(CURL_LOGGED_CMD) -F "mysubmit=Delete" -F "archive=" -F "passwd=" http://$(ROKU_DEV_TARGET)/plugin_install | $(EXTRACT_ERROR_CMD)

.PHONY: screenshot
screenshot:
$(CURL_LOGGED_CMD) -o screenshot.jpg "http://$(ROKU_DEV_TARGET)/pkgs/dev.jpg"

.PHONY: deploy
.NOTPARALLEL: deploy
deploy: lint remove install

endif # ROKU_DEV_PASSWORD

endif # ROKU_DEV_TARGET

ZIP_EXCLUDE= -x xml/* -x artwork/* -x \*.pkg -x storeassets\* -x keys\* -x \*/.\* -x *.git* -x *.DS* -x *.pkg* -x dist/**\* -x out/**\*
## sync branding

include app.mk
CONVERT_CMD ?= convert -gravity center
CONVERT_BLUEBG_CMD := $(CONVERT_CMD) -background "\#000b25"
BANNER := images/banner-dark.svg
ICON := images/icon-transparent.svg

dev:
$(MAKE) BUILD='dev' package
images/:; mkdir $@

beta:
$(MAKE) BUILD='beta' package
.PHONY: redo # force rerun
$(BANNER) $(ICON): images/ redo
$(CURL_CMD) https://raw.githubusercontent.com/jellyfin/jellyfin-ux/master/branding/SVG/$(@F) > $@

release:
$(MAKE) BUILD='release' package
images/logo.png: $(BANNER); $(CONVERT_CMD) -background none -scale 1000x48 -extent 180x48 $< $@
images/channel-poster_fhd.png: $(BANNER); $(CONVERT_BLUEBG_CMD) -scale 535x400 -extent 540x405 $< $@
images/channel-poster_hd.png: $(BANNER); $(CONVERT_BLUEBG_CMD) -scale 275x205 -extent 336x210 $< $@
images/channel-poster_sd.png: $(BANNER); $(CONVERT_BLUEBG_CMD) -scale 182x135 -extent 246x140 $< $@
images/splash-screen_fhd.jpg: $(BANNER); $(CONVERT_BLUEBG_CMD) -scale 540x540 -extent 1920x1080 $< $@
images/splash-screen_hd.jpg: $(BANNER); $(CONVERT_BLUEBG_CMD) -scale 360x360 -extent 1280x720 $< $@
images/splash-screen_sd.jpg: $(BANNER); $(CONVERT_BLUEBG_CMD) -scale 240x240 -extent 720x480 $< $@

deploy: prep_staging remove install
.PHONY: get_images
get_images: $(ICON)
get_images: images/logo.png
get_images: images/channel-poster_fhd.png images/channel-poster_hd.png images/channel-poster_sd.png
get_images: images/splash-screen_fhd.jpg images/splash-screen_hd.jpg images/splash-screen_sd.jpg
215 changes: 0 additions & 215 deletions app.mk

This file was deleted.

0 comments on commit 89b68c7

Please sign in to comment.