Sencha Ext JS 7.7 is Here – Discover What’s New and Exciting – LEARN MORE

Full Stack Development with Ext JS 6.5 – Bookmarks for Spotify

June 27, 2017 106 Views
Show

Guest Blog Post

As an Ext JS consultant, I’m often on the road. During my travel time, I like to listen to audiobooks with Spotify. It has a huge collection of uncut audiobooks which is great. An audiobook normally consists of dozens to hundreds of tracks.

And sometimes, after a long day, I need some good music to calm down. Luckily, Spotify offers music as well, so I can easily switch to my favorite playlist.

The Problem

When I want to switch back to my audiobook, my progress position within the audiobook is lost, and I have to manually seek through the tracks to find the position where I left off (based on my memory). Spotify doesn’t offer a feature to bookmark a track position. Unsurprisingly, I’m not the only one with this problem. Looking at the Spotify community forums, there are many posts and comments from people who have the same problem. The feature request has been out there for more than two years.

The Solutions

Manually finding the right progress position every time you want to listen to an audiobook is very annoying. Typically, you would need three pieces of information:

  • Album name
  • Track name – audiobook track names normally contain a continuous number which only helps to sort them and listen to the tracks in the right order
  • Track playback progress time

Currently, I know of at least three ways that users solve the problem.

  1. Before switching from your audiobook to a playlist, take a screenshot from Spotify. That screenshot contains all the information you need to find the right track again. I’ve done did that in the past.
  2. My wife used to delete all of the audiobook tracks from the album list that she had already listened to, so the next time she opened the audiobook album, she just had to start the first track in her list. This solution doesn’t save the tracks progress time.
  3. I’m a developer, so I developed an app to solve my problem.

The Application

My solution is an Ext JS web app, Bookmarks for Spotify, which uses the Spotify Web API to access my Spotify track information.

Ext JS - Bookmarks for Spotify Login

Ext JS - Bookmarks for Spotify

Ext JS - Bookmarks for Spotify

Ext JS - Bookmarks for Spotify - App Info

Features

The app has the following features:

  • Authentication for Spotify (auth / logout)
  • Show the user’s currently playing track
  • Show the user’s 50 recently played tracks
  • Show the user’s bookmarked tracks
  • Bookmark the currently playing track with time progress position
  • Bookmark a recently played track
  • Open Spotify and start playing a currently playing, recently played or bookmarked track. If the progress time is known, it jumps to that position and starts playing from there.

Architecture

My app runs on a Node.js server. The server-side application serves the Ext JS client application and provides services for the Ext JS app to communicate with the Spotify API. The Spotify API REST calls are done from the Node.js server app. The client app uses Ext JS 6.5 (the latest framework release), the modern toolkit, and is generated and built by Sencha Cmd. The custom theme was generated with Sencha Themer. I use therootcause.io for error tracking. For hosting, I created a docker image and run the docker container on sloppy.io. I use a set of npm scripts for the automated build and deploy process.

Technology Stack:

  • Ext JS 6.5.0
  • Node JS 7.8
  • Spotify Web API
  • Sencha Cmd 6.5.0.180
  • Sencha Themer 1.2
  • therootcause.io
  • sloppy.io
  • GIT
  • Docker
  • Docker Hub
  • NPM Scripts

Sencha Cmd

I kick off the development by using Sencha Cmd to generate a Sencha workspace and my Spotify application.

sencha generate app -modern Spotify client/

During development, I use Sencha Cmd to solve all the file dependencies and generate bootstrap and styling files.

sencha app watch

My build.xml is extended to set the app.json version based on the version from package.json, and I set custom values through my index.html file. That allows me to manage the version number via npm in one place and use it for error tracking and display it in the app.

In app.json and index.html, placeholders are defined which will be replaced during the build.

Here is my app.json:

{
    ...
    /**
     * The version of the application.
     */
    "version": "@@@version@@@",
    ...
}

I hook into the “-after-init” target in build.xml to replace the placeholders with values from package.json and config.json.


    
    
        
        
        

        


coming soon

Something Awesome Is

COMING SOON!