All Projects → wsmd → github-now-playing

wsmd / github-now-playing

Licence: MIT license
🎵 Display what you're listening to right on your Github profile

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to github-now-playing

Musaicfm
Screensaver inspired by Apple’s inbuilt iTunes Screensaver. It can display Artwork by Spotify or last.fm Profile Data.
Stars: ✭ 144 (+92%)
Mutual labels:  spotify, itunes, lastfm
MusaicFM
Screensaver inspired by Apple’s inbuilt iTunes Screensaver. It can display Artwork by Spotify or last.fm Profile Data.
Stars: ✭ 223 (+197.33%)
Mutual labels:  spotify, itunes, lastfm
Olivia
Elegant music player for LINUX
Stars: ✭ 261 (+248%)
Mutual labels:  spotify, itunes
Ytmdl Web V2
Web version of ytmdl. Allows downloading songs with metadata embedded from various sources like itunes, gaana, LastFM etc.
Stars: ✭ 398 (+430.67%)
Mutual labels:  spotify, itunes
Lyricsx
🎶 Ultimate lyrics app for macOS.
Stars: ✭ 3,251 (+4234.67%)
Mutual labels:  spotify, itunes
owntone-server
OwnTone is forked-daapd's new name. Linux/FreeBSD DAAP (iTunes) and MPD media server with support for AirPlay devices (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio.
Stars: ✭ 1,408 (+1777.33%)
Mutual labels:  spotify, itunes
plumeria
🤖 A Discord chat bot with rich data piping between commands
Stars: ✭ 35 (-53.33%)
Mutual labels:  spotify, lastfm
Muse
An open-source Spotify controller with TouchBar support
Stars: ✭ 594 (+692%)
Mutual labels:  spotify, itunes
LyricsPyRobot
A Telegram bot for searching lyrics.
Stars: ✭ 29 (-61.33%)
Mutual labels:  spotify, lastfm
Carol Xamarin
A minimal and beautiful lyrics app for macOS built with Xamarin and C#
Stars: ✭ 97 (+29.33%)
Mutual labels:  spotify, itunes
Spotifycurrentlyplaying.js
Display your currently playing Spotify song(s) using Last.fm scrobbling.
Stars: ✭ 71 (-5.33%)
Mutual labels:  spotify, lastfm
Ytmdl
A simple app to get songs from YouTube in mp3 format with artist name, album name etc from sources like iTunes, Spotify, LastFM, Deezer, Gaana etc.
Stars: ✭ 2,070 (+2660%)
Mutual labels:  spotify, itunes
multi-scrobbler
Scrobble plays from multiple sources to multiple clients
Stars: ✭ 54 (-28%)
Mutual labels:  spotify, lastfm
Lyricify-App
A fantastic app to provide auto-scrolling lyrics for Spotify, iTunes, Music Center, QQ Music, Netease Cloud Music, and YesPlayMusic. 一款为Spotify、iTunes、Music Center、QQ音乐、网易云音乐、YesPlayMusic提供滚动歌词的软件。
Stars: ✭ 486 (+548%)
Mutual labels:  spotify, itunes
spotify-connect-scrobbler
Last.fm scrobbler for Spotify Connect
Stars: ✭ 20 (-73.33%)
Mutual labels:  spotify, lastfm
now-playing-profile
Originally created by github.com/natemoo-re, a small Spotify widget suitable for your profile! Read the "spotify-setup-guide.md" to get started
Stars: ✭ 32 (-57.33%)
Mutual labels:  spotify, now-playing
Tauonmusicbox
The Linux desktop music player from the future! 🌆
Stars: ✭ 494 (+558.67%)
Mutual labels:  spotify, lastfm
Moosync
A simple music player capable of playing local audio or from Youtube or Spotify
Stars: ✭ 185 (+146.67%)
Mutual labels:  spotify, lastfm
mulukhiya-toot-proxy
各種ActivityPub対応インスタンスへの投稿に対して、内容の更新等を行うプロキシ。通称「モロヘイヤ」。
Stars: ✭ 24 (-68%)
Mutual labels:  spotify, itunes
Forked Daapd
Linux/FreeBSD DAAP (iTunes) and MPD media server with support for AirPlay devices (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio.
Stars: ✭ 1,073 (+1330.67%)
Mutual labels:  spotify, itunes

github-now-playing

Current Release CI Build Coverage Status Licence

📖 Table of Contents

Motivation

GitHub introduced a new feature that allows you to set a status on your profile, so I thought it would be a cool idea if I could share the music I'm listening to — kind of like #NowPlaying — right on my GitHub profile!

Screen Shot 2019-04-09 at 7 28 36 PM

Installation

This library is available on the npm registry as a node module and can be installed by running:

# via npm
npm install --save github-now-playing

# via yarn
yarn add github-now-playing

You also need to generate a personal access token with the user scope to allow this library to communicate with GitHub.

Example

import { GitHubNowPlaying } from 'github-now-playing';

const nowPlaying = new GitHubNowPlaying({
 token: process.env.GITHUB_ACCESS_TOKEN,
});

// Create a new source to retrieve the track that is currently playing
const spotifySource = new GitHubNowPlaying.Sources.Spotify({
 // wait time in milliseconds between checks for any track changes
 updateFrequency: 1000,
});

// Make sure a source is set before calling listen()
nowPlaying.setSource(spotifySource);

// Don't forget to handle the error event!
nowPlaying.on(GitHubNowPlaying.Events.Error, error => {
  console.log('something went wrong');
});

// Listen to any track changes and update the profile status accordingly.
nowPlaying.listen();

// Don't forget to stop reporting any track changes when the process exists.
process.on('SIGINT', () => {
  // Calling the stop() method will clear the profile status.
  nowPlaying.stop()
});

API

github-now-playing exposes a named export class GitHubNowPlaying that is also a namespace for various source providers and event names.

Class: GitHubNowPlaying

new GitHubNowPlaying(options: GitHubNowPlayingConstructorOptions)

Creates a new instance of GitHubNowPlaying.

Constructor Options

An object with the following keys:

Methods

nowPlaying.setSource(source)

Assigns a source provider object from which the currently-playing track will be retrieved.

This method must be called before calling listen().

nowPlaying.on(event, listener)

Adds the listener function as an event handler for the named event. The event parameter can be one of the values available under the GitHubNowPlaying.Events namespace.

Returns a reference to the GitHubNowPlaying instance, so that calls can be chained.

nowPlaying.off(event, listener)

Removes the specified listener function for the named event.

The event parameter can be one of the values available under the GitHubNowPlaying.Events namespace.

Returns a reference to the GitHubNowPlaying instance, so that calls can be chained.

nowPlaying.listen()

Starts listening to any track changes coming from the specified source and updates the GitHub profile status accordingly.

The event GitHubNowPlaying.Events.ListenStart is emitted upon calling this method.

Additionally, every time the profile status is updated, the event GitHubNowPlaying.Events.StatusUpdated is emitted with the profile status object.

Note that upon calling listen(), the profile status will be updated immediately to reflect the currently playing track.

nowPlaying.stop()

Stops listening to any track changes.

Calling this method will result in clearing the profile status if it has been already updated with a currently playing track.

If the status is cleared, the event GitHubNowPlaying.Events.StatusCleared is emitted, then followed by the event GitHubNowPlaying.Events.ListenStop.

This method is asynchronous and will resolve after clearing the profile status.


Sources Providers: GitHubNowPlaying.Sources

GitHubNowPlaying relies on a source provider object that retrieves the currently playing track from a specific source.

These sources can be either local desktop applications, such iTunes or Spotify, or even via web APIs, such as Last.fm.

GitHubNowPlaying comes with built-in support for all of these sources. Note that support for desktop applications is currently limited to macOS.

The following sources are available under the namespace GitHubNowPlaying.Sources:

LastFM

Fetches information about the currently-playing track via Last.fm.

const lastFmSource = new GitHubNowPlaying.Sources.LastFM({
 apiKey: process.env.LAST_FM_API_KEY, // Your Last.fm API key
 updateFrequency: 1000,
});

nowPlaying.setSource(lastFmSource);

ITunes

Fetches information about the currently-playing track in iTunes.

const iTunesSource = new GitHubNowPlaying.Sources.ITunes({
 updateFrequency: 1000,
});

nowPlaying.setSource(iTunesSource);

Platforms supported: macOS

Spotify

Fetches information about the currently-playing track in Spotify.

const spotifySource = new GitHubNowPlaying.Sources.Spotify({
 updateFrequency: 1000,
});

nowPlaying.setSource(spotifySource);

Platforms supported: macOS


Events: GitHubNowPlaying.Events

Instances of GitHubNowPlaying emit various events during the program life-cycle. You can add or remove event listeners via on() and off() respectively.

Error

Emitted when an error occurs:

nowPlaying.on(GitHubNowPlaying.Events.Error, (error) => { /* ... */ });

ListenStart

Emitted when GitHubNowPlaying starts listening to track changes via the specified source:

nowPlaying.on(GitHubNowPlaying.Events.ListenStart, () => { /* ... */ });

ListenStop

Emitted when GitHubNowPlaying has stopped listening to track changes via the specified source:

nowPlaying.on(GitHubNowPlaying.Events.ListenStop, () => { /* ... */ });

StatusUpdated

Emitted when GitHubNowPlaying has updated the profile status with currently-playing track successfully. Listeners of this event are called with the user-status object.

nowPlaying.on(GitHubNowPlaying.Events.ListenStop, (status) => { /* ... */ });

StatusCleared

Emitted when GitHubNowPlaying has cleared the profile status after it has been updated with a currently playing track. This happens when the source provider reports that there are no tracks are currently playing, or when stop() is called.

nowPlaying.on(GitHubNowPlaying.Events.StatusCleared, () => { /* ... */ });

See Also

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].