Coder Social home page Coder Social logo

loupedeck / spotifypremiumplugin Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 4.0 700 KB

A sample plugin for the Loupedeck software, based on the Loupedeck Plugin SDK

Home Page: https://developer.loupedeck.com/

License: MIT License

C# 100.00%
loupedeck-plugin

spotifypremiumplugin's Introduction

Spotify Premium Plugin

Spotify plugin for Loupedeck software, based on Loupedeck Plugin SDK. See Developing plugins for Loupedeck - Process overview

It is recommended to use Loupedeck software version 5.0 or newer.

Restrictions for Spotify Plugin

Loupedeck software comes with an "internal" Spotify Premium plugin that does not use SDK Plugin API. Spotify Premium SDK solution uses SDK Plugin API and contains the same functionality as the "internal" plugin.

๐Ÿ›‘ It is not possible to use both "internal" and SDK Spotify Premium plugin versions at the same time. Select only Spotify Premium SDK from Manage Plugins.

The reason for this is that currently SDK plugins cannot use the same dll as Loupedeck application is using. In this case e.g., a modified version of SpotifyAPI-NET which is used to communicate with Spotify Web API. SDK Plugin must reference the SpotifyAPI-NET dlls within Loupedeck installation:

<INSTALLATION PATH>\Loupedeck\Loupedeck2\SpotifyAPI.Web.dll
<INSTALLATION PATH>\Loupedeck\Loupedeck2\SpotifyAPI.Web.Auth.dll

Hence it's not possible to upgrade this plugin to use latest version of SpotifyAPI-NET.

Solution description

Solution was created using the Plugin Generator tool

<TOOL LOCATION>\LoupedeckPluginTool.exe g -name=SpotifyPremium

Repository contains solution for Windows, SpotifyPremiumPluginWin.sln.

Main functionality is in SpotifyPremiumPlugin.cs and partial classes. Actions are under folders

Adjustments
CommandFolders
Commands
ParameterizedCommands

DLLs referencing Loupedeck installation, see Restrictions for Spotify plugin usage

SpotifyAPI.Web
SpotifyAPI.Web.Auth

VS Build Configuration for Debugging

SpotifyPremiumPlug.csproj

  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    ...
    <OutputPath>$(LocalAppData)\Loupedeck\Plugins\</OutputPath>
    ...
  </PropertyGroup>

Spotify Client Configuration

To access Spotify Web API, first create a simple server-side application. Then add the Client Id and Secret, and port to the configuration file:

%LOCALAPPDATA%/Loupedeck/PluginData/SpotifyPremium/spotify-client.txt

See example project file spotify-client-template.txt

Port(s) must correspond to that on the Spotify developers's configuration.

๐Ÿ›‘ IMPORTANT! This plugin uses Spotify Client Id and Secret that are read from text file. DO NOT DISTRIBUTE THIS FILE.

For creating distributable Spotify plugin, use Authorization code flow with PKCE. This concept is currently untested, but e.g.,

  1. Upgrade to latest SpotifyAPI-NET version and implement Authorization code flow with PKCE.
  2. Add automation to disable/remove SpotifyPlugin.dll, SpotifyAPI.Web.dll, SpotifyAPI.Web.Auth.dll from Loupedeck software installation folder.

Creating Installation Package for Loupedeck software 5.0 or newer

Loupedeck 5.0 comes with Loupedeck Plugin Package Installer (LoupedeckPluginPackageInstaller.exe) that can install and uninstall plugins.

The input for Loupedeck Plugin Package Installer is a ZIP archive with .lplug4 extension. Douple click the .lplug4 file will start plugin install with Loupedeck software 5.0 or newer.

ZIP archive must contain a LoupedeckPackage.yaml file with plugin manifest in YAML format.

Recommended archive structure:

/LoupedeckPackage.yaml   -- plugin manifest
/bin/win/                -- binaries for Windows version
/bin/mac/                -- (binaries for Mac version)

The YAML manifest has the following format (user modifiable fields are in <> brackets)

type: plugin4
name: <Name of the plugin>
displayName: <Display name of the plugin>
version: <version string>
author: <author id>
copyright: <copyright>

supportedDevices: <Note if you support only one, remove another>
    - LoupedeckCt  
    - LoupedeckLive

pluginFileName: <Plugin file name>
pluginFolderWin: <Folder for windows binaries within zip file>
pluginFolderMac: <Folder for mac binaries within zip file>

Example LoupedeckPackage.yaml for Spotify Premium SDK:

type: plugin4
name: SpotifyPremium
displayName: Spotify Premium SDK
version: 1.0
author: Loupedeck
copyright: Loupedeck

supportedDevices:
    - LoupedeckCt  
    - LoupedeckLive

pluginFileName: SpotifyPremiumPlugin.dll
pluginFolderWin: bin\win\
pluginFolderMac: bin\mac\

Plugin usage with Loupedeck software and devices

To use plugin, first select it in Loupedeck software. See Restrictions for Spotify plugin usage

Add action Login to Spotify or any other action. All will open browser for user to login with Spotify. Note that user must have Spotify Premium subscription.

Possible problems with plugin/Spotify API will display warning (yellow dot in plugin icon) and error (red dot) messages.

spotifypremiumplugin's People

Contributors

akihirvonen avatar virtjt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.