From 86c4b3e79271517d355b1e7def372afebd564e36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Janou=C5=A1ek?= Date: Sat, 26 Nov 2016 18:11:02 +0100 Subject: [PATCH] Port to Nuvola SDK MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jiří Janoušek --- .gitignore | 2 + CHANGELOG.md | 1 + Makefile | 115 ----------------------------------------------- README.md | 20 ++------- configure | 3 ++ metadata.in.json | 22 +++++++++ metadata.json | 15 ------- svg-convert.sh | 67 --------------------------- svg-optimize.sh | 53 ---------------------- 9 files changed, 31 insertions(+), 267 deletions(-) delete mode 100644 Makefile create mode 100755 configure create mode 100644 metadata.in.json delete mode 100644 metadata.json delete mode 100755 svg-convert.sh delete mode 100755 svg-optimize.sh diff --git a/.gitignore b/.gitignore index 30af5fe..1294fc3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ icons +Makefile +metadata.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d6ff1f..45b45a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Changelog * Fixed parsing of the track title and the artist. * Album art is fetched and displayed. Requires Nuvola Player 3.1 because of restricted access to the images. + * Ported to Nuvola SDK. 1.2 - September 28, 2016 ---------------- diff --git a/Makefile b/Makefile deleted file mode 100644 index a1cbf3e..0000000 --- a/Makefile +++ /dev/null @@ -1,115 +0,0 @@ -# Copyright 2014-2016 Jiří Janoušek -# Copyright 2016 Patrick Burroughs (Celti) -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# Service integration id -APP_ID = siriusxm -# Default installation destination -DEST ?= $(HOME)/.local/share/nuvolaplayer3/web_apps -# Files to be installed -INSTALL_FILES = metadata.json integrate.js -LICENSES = LICENSE-BSD.txt LICENSE-CC-BY.txt -# Icon set -SOURCE_ICON ?= icons/icon.svg -SOURCE_ICON_XS ?= icons/icon-xs.svg -SOURCE_ICON_SM ?= icons/icon-sm.svg -ICON_SIZES ?= 16 22 24 32 48 64 128 256 -ICONS_DIR ?= icons -PNG_ICONS = $(foreach size,$(ICON_SIZES),$(ICONS_DIR)/$(size).png) -SCALABLE_ICON = $(ICONS_DIR)/scalable.svg - -# Show help -help: - @echo "make build - build files (graphics, etc.)" - @echo "make clean - clean source directory" - @echo "make install - install to user's local directory (~/.local)" - @echo "make install DEST=/path - install to '/path' directory" - @echo "make uninstall - uninstall from user's local directory (~/.local)" - -# Build icons -build: $(PNG_ICONS) $(SCALABLE_ICON) - -# Create icons dir -$(ICONS_DIR): - mkdir -p $@ - -# Optimize SVG icons -$(ICONS_DIR)/%.svg: src/%.svg | $(ICONS_DIR) - ./svg-optimize.sh $< $@ - -# Generate icon 16 -$(ICONS_DIR)/16.png: $(SOURCE_ICON_XS) | $(ICONS_DIR) - ./svg-convert.sh $< 16 $@ - -# Generate icon 22 -$(ICONS_DIR)/22.png : $(SOURCE_ICON_XS) | $(ICONS_DIR) - ./svg-convert.sh $< 22 $@ - -# Generate icon 24 -$(ICONS_DIR)/24.png : $(SOURCE_ICON_XS) | $(ICONS_DIR) - ./svg-convert.sh $< 24 $@ - -# Generate icon 32 -$(ICONS_DIR)/32.png : $(SOURCE_ICON_SM) | $(ICONS_DIR) - ./svg-convert.sh $< 32 $@ - -# Generate icon 48 -$(ICONS_DIR)/48.png : $(SOURCE_ICON_SM) | $(ICONS_DIR) - ./svg-convert.sh $< 48 $@ - -# Generate icons 64 128 256 -$(ICONS_DIR)/%.png : $(SOURCE_ICON) | $(ICONS_DIR) - ./svg-convert.sh $< $* $@ - -# Copy scalable icon -$(SCALABLE_ICON) : $(SOURCE_ICON) | $(ICONS_DIR) - cp $< $@ - -# Clean built files -clean: - rm -rf icons - -# Install files -install: $(LICENSES) $(INSTALL_FILES) $(PNG_ICONS) $(SCALABLE_ICON) - # Install data - install -vCd $(DEST)/$(APP_ID)/$(ICONS_DIR) - install -vC -t $(DEST)/$(APP_ID) $(LICENSES) $(INSTALL_FILES) - install -vC -t $(DEST)/$(APP_ID)/$(ICONS_DIR) $(PNG_ICONS) $(SCALABLE_ICON) - - # Create symlinks to icons - mkdir -pv $(DEST)/../../icons/hicolor/scalable/apps || true - ln -s -f -v -T ../../../../nuvolaplayer3/web_apps/$(APP_ID)/$(SCALABLE_ICON) \ - $(DEST)/../../icons/hicolor/scalable/apps/nuvolaplayer3_$(APP_ID).svg; - for size in $(ICON_SIZES); do \ - mkdir -pv $(DEST)/../../icons/hicolor/$${size}x$${size}/apps || true ; \ - ln -s -f -v -T ../../../../nuvolaplayer3/web_apps/$(APP_ID)/$(ICONS_DIR)/$$size.png \ - $(DEST)/../../icons/hicolor/$${size}x$${size}/apps/nuvolaplayer3_$(APP_ID).png; \ - done - - -# Uninstall files -uninstall: - rm -fv $(DEST)/../../icons/hicolor/scalable/apps/nuvolaplayer3_$(APP_ID).svg - for size in $(ICON_SIZES); do \ - rm -fv $(DEST)/../../icons/hicolor/$${size}x$${size}/apps/nuvolaplayer3_$(APP_ID).png; \ - done - rm -rfv $(DEST)/$(APP_ID) diff --git a/README.md b/README.md index d57c374..82a96b9 100644 --- a/README.md +++ b/README.md @@ -9,30 +9,16 @@ Support Report bugs and issues at . -Dependencies ------------- - - * GNU Make - * SVG optimizer: [Scour](https://github.com/codedread/scour) - * SVG converter: Lasem, librsvg, GraphicsMagick, ImageMagick - Installation ------------ - * Execute ``make help`` to get help. - * Execute ``make build`` to build graphics. - * Execute ``make install`` to install files to user's local directory. - * Don't execute ``make uninstall``. Why would you do that? - +This project uses [Nuvola SDK](https://github.com/tiliado/nuvolasdk#create-new-project). Please refer to +the [Build a Project Using Nuvola SDK](https://github.com/tiliado/nuvolasdk#build-a-project-using-nuvola-sdk) +page in order to obtain information about dependencies and installation instructions. Copyright --------- - - `Makefile`, `svg-convert.sh`, `svg-optimize.sh` - + Copyright 2014-2016 Jiří Janoušek - + Copyright 2016 Patrick Burroughs (Celti) - + License: [2-Clause BSD-license](./LICENSE-BSD.txt) - - `src/icon*.svg` + Copyright 2011 Alexander King + Copyright 2011 Arturo Torres Sánchez diff --git a/configure b/configure new file mode 100755 index 0000000..799fb01 --- /dev/null +++ b/configure @@ -0,0 +1,3 @@ +#!/usr/bin/env python3 +import nuvolasdk +nuvolasdk.gen_makefile() diff --git a/metadata.in.json b/metadata.in.json new file mode 100644 index 0000000..a97529b --- /dev/null +++ b/metadata.in.json @@ -0,0 +1,22 @@ +{ + "id": "siriusxm", + "name": "SiriusXM", + "maintainer_name": "Jiří Janoušek", + "maintainer_link": "https://github.com/fenryxo", + "version_major": 1, + "version_minor": 2, + "api_major": 3, + "api_minor": 0, + "categories": "AudioVideo;Audio;", + "home_url": "https://player.siriusxm.com/", + "license": "2-Clause BSD, CC-BY-3.0", + "window_width": 1340, + "window_height": 800, + "build": { + "icons": [ + "icons/icon.svg SCALABLE 64 128 256", + "icons/icon-xs.svg 16 22 24", + "icons/icon-sm.svg 32 48" + ] + } +} \ No newline at end of file diff --git a/metadata.json b/metadata.json deleted file mode 100644 index 732297d..0000000 --- a/metadata.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "id": "siriusxm", - "name": "SiriusXM", - "maintainer_name": "Jiří Janoušek", - "maintainer_link": "https://github.com/fenryxo", - "version_major": 1, - "version_minor": 2, - "api_major": 3, - "api_minor": 0, - "categories": "AudioVideo;Audio;", - "home_url": "https://player.siriusxm.com/", - "license": "2-Clause BSD, CC-BY-3.0", - "window_width": 1340, - "window_height": 800 -} diff --git a/svg-convert.sh b/svg-convert.sh deleted file mode 100755 index a51d985..0000000 --- a/svg-convert.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh -# -# Copyright 2016 Patrick Burroughs (Celti) -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -source_file="$1" -dest_size="$2" -dest_file="$3" - -exists () { - type "$1" >/dev/null 2>/dev/null -} - -divide () { - echo - | awk "{ print $1 / $2 }" -} - -if exists lasem-render; then # GNOME/Lasem - CONVERT=lasem-render -elif exists lasem-render-0.4; then # GNOME/Lasem (current version May 2016) - CONVERT=lasem-render-0.4 -elif exists rsvg-convert; then # librsvg (broken on Arch Linux as of May 2016) - CONVERT=rsvg-convert -elif exists gm; then # GraphicsMagick - CONVERT=gm -elif exists convert; then # ImageMagick - CONVERT=convert -else - echo "No supported SVG converter found! (Tried: Lasem, librsvg, GraphicsMagick, ImageMagick)" >&2 - exit 1 -fi - -case $CONVERT in - lasem-render*) - source_size=$($CONVERT --debug render "${source_file}" -o /dev/null | awk '/width/ { print $3 }') - zoom_factor=$(divide ${dest_size} ${source_size}) - $CONVERT -z ${zoom_factor} "${source_file}" -o "${dest_file}" - ;; - rsvg-convert) - $CONVERT -w ${dest_size} -h ${dest_size} "${source_file}" -o "${dest_file}" - ;; - gm) - $CONVERT convert "${source_file}" -resize ${dest_size} "${dest_file}" - ;; - convert) - $CONVERT "${source_file}" -resize ${dest_size} "${dest_file}" - ;; -esac diff --git a/svg-optimize.sh b/svg-optimize.sh deleted file mode 100755 index 309c2ad..0000000 --- a/svg-optimize.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# -# Copyright 2016 Patrick Burroughs (Celti) -# Copyright 2016 Jiří Janoušek -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# 1. Redistributions of source code must retain the above copyright notice, this -# list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright notice, -# this list of conditions and the following disclaimer in the documentation -# and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -source_file="$1" -dest_file="$2" - -exists () { - type "$1" >/dev/null 2>/dev/null -} - -if exists scour; then # Scour: https://github.com/codedread/scour - CONVERT=scour -# svgo doesn't work well :-( -elif test ! -z "$SVGO_ENABLED" && exists svgo; then # svgo: https://github.com/svg/svgo - CONVERT=svgo -else - echo "No supported SVG optimizer found! Tried: " >&2 - echo "- scour: https://github.com/codedread/scour" >&2 - test ! -z "$SVGO_ENABLED" && echo "- svgo: https://github.com/svg/svgo" >&2 - exit 1 -fi - -case $CONVERT in - scour) - $CONVERT -i "${source_file}" -o "${dest_file}" --enable-viewboxing --enable-id-stripping \ - --enable-comment-stripping --shorten-ids --indent=none --remove-metadata - ;; - svgo) - $CONVERT -i "${source_file}" -o "${dest_file}" - ;; -esac