Giter VIP home page Giter VIP logo

cdrani / chorus Goto Github PK

View Code? Open in Web Editor NEW
9.0 3.0 6.0 874 KB

Enhance Spotify with controls to save favourite snips, auto-skip tracks, and set global and custom speed. More to come!

Home Page: https://chrome.google.com/webstore/detail/chorus-spotify-enhancer/jfnjmnapkhdbaidedlbdcmhiphfjljcd

License: MIT License

JavaScript 96.62% CSS 3.20% HTML 0.16% Shell 0.03%
chrome-extension pitch-shift playback-speed song-skipper spotify web-audio song-snippets firefox-addon firefox-extension impulse-response

chorus's Introduction

๐Ÿ’ƒ Chorus - Spotify Enhancer ๐Ÿ’ƒ

All Contributors GitHub manifest version GitHub last commit GitHub

Chrome WebStore # Users Chrome WebStore Rating Mozilla Add-on # Users Mozilla Add-on Rating

Enhance Spotify with controls to save favourite track section and auto-skip. Save sections can be used for infinite looping of a chorus, verse, etc. Snips can be shared with others. Auto-skip tracks in a playlists or albums and never hear them again. Additionally set global playback speed and per track speed! More features to come!

โฌ‡๏ธ Install โฌ‡๏ธ

Chrome and other Chromium browsers (Edge, Opera, Brave, Vivaldi, etc)

Firefox (Might occasionally be behind until I setup auto-publishing to Addons. Bare with me. ๐Ÿป)

๐ŸŽ‰ Chorus Features ๐ŸŽ‰

Settings UI Icon to update snip, speed, and seek values. Block Icon to block currently playing track.

Block/Unblock tracks from any view - album, artist, playlist, queue, search, etc

Save your favourite section of a track (verse, chorus,etc) and play/replay only that section forever.

Generate a shareable link of a snip for easy sharing across social media.

Custom Playback Speed. Toggle the "Pitch Correct" to switch vocals from low to high pitch.

Custom Seeking (Fast-Forward & Rewind) for all G(eneral) and (P)odcasts/(A)udioBooks.

โญ ๐Ÿ’ก Toggling the entire extension on/off by clicking the extension icon in the toolbar. Toggle the extension off whenever you want to listen to Spotify without your snips, blocked songs, or custom playback speeds and pitch. Toggle it back on to enjoy the features. It would be a good idea to have the extension pinned for quick access and use of this feature.

โญ โŒจ๏ธ Keyboard Shortcuts. The core functionality of the extension can be triggered via keypress. Additional media commands such as play/pause, shuffle, mute/unmute, etc are also available. Reference "Setting Browser Keyboard Shortcuts" for your specific browser.

๐Ÿ“† Upcoming Features ๐Ÿ“†

โœ‚๏ธ Multi-Snips. More snips in a track. For example, snips to only play a chorus and the second verse of a track.

๐Ÿ’ฟ Discography. Keep track of your progress as you work through an artist's discography and resume where you left off.

๐Ÿ““ Review. View your favourite snips and blocked songs. Some filtering.

๐ŸŽ€ V2 ๐ŸŽ€

๐Ÿ“ฑ Web App. This will likely just be a simple UI utilizing Spotify Connect to apply the above features/controls, but areas like search, playlist creation, music discovery will left to the official Spotify App.

โš™๏ธ Releases โš™๏ธ

Releases are automated based on semantic releases and tagged as such in the Releases page. Releases have the newest features, bug fixes, etc, but the Web Store / Addons versions are most likely a day or two behind due to Chrome/Mozilla review cycle. If you want the latest and greatest, the download the chorus-chrome.zip or chorus-firefox.zip file from the newest release.

๐Ÿ‘‹ Closing Remarks ๐Ÿ‘‹

Please give a โญ if you like and/or use this project. Contributions are wholeheartedly welcome if they adhere to the Code of Conduct.

For issues, questions, feature suggestions, etc please report it here.

Kofi Page if you are inclined. No obligation - in fact I might take it as an offence. This project is about adding some missing features in Spotify that I deem might warrant the price hikes. Just giving it a โญ here and rating on the Web Store is sufficient for me to keep adding features, fixing bugs, and maintaining it. Thanks!

๐Ÿ‘ทโ€โ™€๏ธ Contributors ๐Ÿ‘ทโ€โ™‚๏ธ

โค๏ธ Shout out and love for people helping and/or helped on this project. โค๏ธ

charles
charles

๐Ÿค” ๐Ÿš‡ ๐ŸŽจ ๐Ÿ‘€ ๐Ÿ› ๐Ÿ“– ๏ธ๏ธ๏ธ๏ธโ™ฟ๏ธ ๐Ÿ’ป
Geraldo PMJ
Geraldo PMJ

๐Ÿ’ป ๏ธ๏ธ๏ธ๏ธโ™ฟ๏ธ
Piyush Deshmukh
Piyush Deshmukh

๐Ÿ’ป ๏ธ๏ธ๏ธ๏ธโ™ฟ๏ธ
Abdul Hanan
Abdul Hanan

๐ŸŽจ ๐Ÿ’ป
Bhoopen
Bhoopen

๐Ÿ“– ๐Ÿ’ป
Stephany
Stephany

๐Ÿ› ๐Ÿ“– ๐Ÿ’ป

chorus's People

Contributors

actions-user avatar ahmohil avatar allcontributors[bot] avatar cdrani avatar geraldopmj avatar kasai2210 avatar piyush-deshmukh avatar sstephanyy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

chorus's Issues

[Docs]: Setup All-Contributors

Describe the bug

This project has had a few contributors from a few people. It would be good to acknowledge them through an automated way.

Expected behavior

Using the @all-contributors bot add command through issues or prs, they should be added to the contributors section in the readme

Screenshots

Example of how it should/can appear in the readme:

image

[BUG]: Fix AriaLabel Alignment

Describe the bug

Currently the Edit Snip label for the settings icon is misaligned.

Expected behavior

Edit Snip label should be centered over settings icon

Screenshots

image

Additional context

This should be able to fix the alignment issue in the file below:

transform: translate3d(-2.25rem, -1.5rem, 10rem);

right: 50%;
transform: translate3d(calc(50%), -1.5rem, 10rem);

[BUG]: Tracklist Settings Icon & Block Icon Events Not Triggering

Describe the bug

In Queue view, the Settings and Block icons click events are not being triggered. Setting click should open Chorus modal. Block icon should set toggle isSkipped attribute of the track.

To Reproduce

Steps to reproduce the behaviour:

  1. Go to Queue, Artist, Album, or Playlist view
  2. Click on Snip Edit or Block Icon
  3. Click Events are not triggered

Screenshots

If applicable, add screenshots to help explain your problem.
SCR-20230727-smyq

[BUG]

Describe the bug

The manifest.json file has now been moved out of the root project folder and separated into chrome/manifest.json and firefox/manifest.json files. This change is now resulting in the below issue with shields.io badge:

image

Expected behavior

The version badge should display the current version of the latest release. Currently it's 1.6.1? Anyways, the shields badge url should be changed to reference the manifest.json in the firefox directory. It should be as simple as including the filename query param to the shields route. You can test it on the shields.io site before applying it to the README.

Additional context

While referencing the link above, I would welcome updates to the colour of the other labels. A majority of them are some variant of green, but I would love to see some bright blues, pinks, purples, etc. Maybe update the style as well, but they all badges in the README would need to be update to the new style for uniformity.

Here's the particular line to focus on:

<img alt="GitHub manifest version" src="https://img.shields.io/github/manifest-json/v/cdrani/chorus">

Settings Icon in Now Playing Widget Should Display Aria Label on Hover

Describe the bug
Settings Icon in Now Playing Widget Should Display Aria Label on Hover. Other icons display an tooltip with their element's aria label and we should follow the lead.

Expected behavior
Hovering over the Settings Icon should display a tooltip displaying a 'Edit Snip' aria label. This is quite similar to the implementation on the track list.

Screenshots
If applicable, add screenshots to help explain your problem.

CURRENT

Screenshot 2023-07-27 at 21 11 35

EXPECTED (based on tracklist implementation)

image

IMPLEMENTATION

Based on the tracklist implementation, it should be as simple as adding the role and aria-label attributes to the Icon component? Reference

role="snip"
type="button"
aria-label="Edit Snip"

Chore: Minify Files Prior to Zipping Package

To minimize package size, minify files to a single file. Might actually have to be 3 files:

  1. background script
  2. content scripts (minify and concat into single file)
  3. page scripts (minify and concat into single file)

Feature: Toggle skip on/off for tracks

Add UI to skip a tracks without having to use the slider. Additionally, user should be able to revert the skip just as easily.

Add a button with icon per track (much like the โค๏ธ button) to toggle skip. By "add" I mean just add the icon on hover over the track.
image


As the for the data model we can add a isSkipped key with the boolean value toggled from true to false in the DataStore.

{
+      isSkipped: boolean,
       isSnip: boolean,
       endTime: integer,
       startTime: integer
}

[Bug]: Snip Actions Not Working

Describe the bug

Snip actions like save and delete no longer working causing the following error:

To Reproduce

Steps to reproduce the behaviour:

  1. Click on Settings icon in Now Playing Widget or on TrackList
  2. Click save (or remove if already a snip)
  3. See error (in screenshot below)

Expected behaviour

Should not error and save and remove actions should be performed as before.

Screenshots

image

CAUSE

Seems to be related to this codeblock:

async save() {
const { inputLeft, inputRight } = this._controls.slider.elements
await this._store.saveTrack({
id: currentSongId(),
value: {
isSnip: true,
startTime: inputLeft.value,
endTime: inputRight.value,
... inputRight.value == 0 && { isSkipped: true },
},
})
this.updateView()
}

In a previous commit the slider getter method must have been removed.

SOLUTION

Add back the slider getter method in the SnipControls class.

[BUG]: Editing of Snip EndTime Property Causes Next Track Jump

Describe the bug

When editing a snip, on sliding the endTime (right) thumb to the right (seeking forward) causes Spotify to jump to the next track as the currentTime would now be greater than the snip's endTime.

Expected behavior

I don't want that to happen. In most situations, I want to be able to edit a snip and that entails playing around with the startTime and endTime properties. While editing I want to remain on the same track.

[Chore]: Clean Up Script Loading

Describe the chore

We currently have a loadScript function which takes a file path, creates a script tag, adds the file path as the script src value.

const loadScripts = scripts => {
scripts.forEach(script => {
const s = document.createElement('script')
s.src = chrome.runtime.getURL(script)
s.type = 'module'
document.body.appendChild(s)
})
}

Earlier on we were injecting every script file, but now that we are using es modules, some files/functions are being imported into others. Therefore, we we only need to inject the parent files. As it stands the only file really required seems to be actions/init.js file.

chorus/content-script.js

Lines 10 to 12 in 9f07fd9

// scripts MUST be loaded in order!
const scripts = [
'actions/overload.js',

Solution:

Clean up loadScript logic. This can mean either keeping the function and changing the argument to be as string value instead of an array, or just taking the inner code of the function and hard-coding it with the init file:

Ask questions or raise comments below about this issue or a better solution. ๐Ÿ˜„

Add/Remove Snip From Track Anytime

Much like the block/unblock UI, I should be able to add/remove a snip on a track without the track being the currently playing/paused song. Clicking on a snip icon should open up the modal with the track info. I should then be able to save a snip for the track without affecting the current playing/paused track.

[Bug]: Now Playing Icon Needs To Be Accessible

Describe the bug

We are currently using a div instead of a button as the parent of the settings icon in the Now Playing Widget. This is not semantically correct and has poor accessibility (a11y). We need to replace the div with a button.

Expected behavior

It should have similar accessible properties as displayed for the heart button and the settings icon on a tracklist/playlist/album track

image image

Additional context

Now Playing Icon file: https://github.com/cdrani/chorus/blob/develop/models/icon.js
Example to reference:

<button
role="snip"
type="button"
aria-label="Edit Snip"
style="visibility:hidden;border:none;background:none;display:flex;align-items:center;cursor:pointer"
>
<svg
role="snip"
fill="none"
width="16"
height="16"
stroke="currentColor"
viewBox="0 0 20 20"
stroke-width="1.5"
style="margin-bottom:4px;"
preserveAspectRatio="xMidYMid meet"
xmlns="http://www.w3.org/2000/svg"
>
<path
role="snip"
stroke-linecap="round"
stroke-linejoin="round"
d="M10.5 6h9.75M10.5 6a1.5 1.5 0 11-3 0m3 0a1.5 1.5 0 10-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 01-3 0m3 0a1.5 1.5 0 00-3 0m-9.75 0h9.75"
/>
</svg>
</button>

Some changes to styles might need to be made to keep the same UI. For example, the visibility attribute does not need to be set as it should always be visible, or the styles coming from the chorus-icon id might need to be updated. Use your discretion and get it as close as possible to the current UI, but just with replacing the div with a button. The a11y portion should transfer over with using the same attributes (role, aria-label, etc) currently on the div and some just based on the button element.

Feat: Deploy Workflow

Is your feature request related to a problem? Please describe.

I want to automate the upload and publish step. This is currently done manually, but it can be offloaded to CI to create zipped package and then uploaded and published. For now this can be done on pushes to the main branch. Perhaps, we can add an intermediate step to keep develop in sync with main branch and then publish a release on a schedule instead.

Sources:

  1. https://github.com/mnao305/chrome-extension-upload
  2. https://github.com/fregante/chrome-webstore-upload/blob/main/How%20to%20generate%20Google%20API%20keys.md

Release Script/Process with Github Actions

Setup a github action to create releases

  • update manifest.json version number
  • commit change to manifest.json, create a tag with new version, and push changes to branch
  • create artifact for release based on new version

[Feat]: Display Track Info In Modal

Is your feature request related to a problem? Please describe.

I would love to see track info displayed in the modal for the track that opened the modal. Somewhere in the red rectangle region.

SCR-20230813-bric-2

Describe the solution you'd like

Essentially the same ui as in the Now Playing Widget, but also in the modal

image

Cross-Browser Support

Make it work on non-chromium browsers like FireFox & Safari and update release process to include these browsers.

closed with #95

Action Icon Toggle

Action Icon toggling should basically switch off all the extension features including:

  • Removing the snip icon in the 'Now Playing' widget
  • Removing the block icons
  • Switch off all snip / block features - tracks should play normally

Reapply the above features when the action icon displays 'on'

UI: Replace X With SVG Icon

image

Use letter X with x-mark icon from heroicons.com

<svg 
    xmlns="http://www.w3.org/2000/svg" 
    fill="none" 
    viewBox="0 0 20 20" 
    stroke-width="1.5" 
    stroke="currentColor" 
>
  <path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" />
</svg>

[FEAT]: Customizable Seeking UI

Is your feature request related to a problem? Please describe.

I need skip forward and go back a few seconds buttons. Currently, this is only available for podcast episodes,

Describe the solution you'd like

I want these buttons to be available for all audio. Additionally, I want them to be customizable, for instance go back 5 seconds and skip forward 10 seconds. Customization options should be available from the modal

[BUG]: Update #chorus-controls Style Properties

Describe the bug

Currently using a dashed border around the chorus controls modal. Time for a change perhaps?
image

Expected behavior

Possible New border styles. These are starting points, but use your eyes to feel it out and make it look good.

  1. maybe a 6px border radius, 3px width, ridge
  2. maybe a solid border, 3px width, optional border-radius of 6, 8, or 10 px
  3. Open to other possibilities, but would prefer not to use dashed or dotted

Additional context

Location of #chorus-controls styles. Combine the two blocks into a single #chorus-controls block.

chorus/src/styles.css

Lines 46 to 57 in 4e8e7d5

#chorus-controls {
border: 1px dashed #1ed760;
}
#chorus-controls {
position: fixed;
left: 80px;
bottom: 80px;
padding: .5rem .75rem;
background-color: #171717;
width: 320px;
}

Fix: Next & Previous Buttons Defaults Causes Early Track Start

Next & Previous Buttons default click handlers conflict with snip and skip features. On Next click, track might play for a half second prior to either being skipped or currentTime being set to the snip startTime. Same thing occurs with the Previous click.

Easy solution is prevent the default actions and then mute the track. This will give enough time for the CurrentTimeObserver running on a 1 second interval to then apply it's logic on the track.

On Action Toggle, the new events should be removed.

[FEAT]: Play & Track Artist Discography

Is your feature request related to a problem? Please describe.

I want to be able to play an artist's entire discography. Obviously it won't be a straight through listen so I want to be able to track the current album and track I am at so that I can resume playback from that state.

Describe the solution you'd like

I want this functionality built into the extension

Describe alternatives you've considered

This can kind of be approximated using the queue features, but I would have to add albums to the queue and if I were to start listening to a different album, track, podcast, etc, then I would need to remember which I album and track I was at and start the queue from that position. This is not ideal.

[Bug]: Playlist TrackLists Do Not Show Skip & Settings Icons

Describe the bug

In playlist tracklist view, the skip and settings icons click events are not triggered

To Reproduce

Steps to reproduce the behaviour:

  1. Go to a Spotify Curated playlist such as "Discover Weekly"
  2. Click on on Skip or Settings Icon
  3. Settings icon click should cause Chorus Modal to display. Skip icon should set track as blocked and be highlight in Spotify green colour

Expected behaviour

Settings icon click should cause Chorus Modal to display. Skip icon should set track as blocked and be highlight in Spotify green colour

Screenshots

Screen.Recording.2023-07-31.at.00.03.11.mov

SOLUTION

Currently the Skip and Settings are set on the overall tracklist container based on the data-testid="track-list" as shown here:

const trackLists = Array.from(document.querySelectorAll('[data-testid="track-list"]'))

However, for the curated playlists, the data-testid is "playlist-tracklist".

image

We need to update the container query to include this other element as well. Per MDN:

Multiple selectors may be specified by separating them using commas.

const matches = myBox.querySelectorAll("div.note, div.alert")

however, to keep the line length manageable, preference would be to use an array instead and place the two selectors on separate lines.

Reach out if you need some help resolving this issue. ๐Ÿ˜„

Fix: Jerky Track Start For Normal Tracks

On a non-snip and non-blocked track, the track should start normally. However, there seems to be a false start where the song starts for a few seconds (<2) and then gets reset back to 0.

Playback Rate

Allow for adjusting the playback rate much like for Spotify's podcast episodes.

Multi Snips

I want to have multiple snips per song:

  • They cannot over lap
  • each snip on a track will require a different colour
  • on play/loop song should jump from snip to snip
  • should be able to edit/delete snip individually on song

[FEAT]: Sleep Timer

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Settings Icon on Now Playing Widget Cursor Should be Pointer

Describe the bug

Hovering over or clicking on the Chorus/Settings Icon in the Now Playing Widget displays the cursor as the default. It should be a pointer to signify that it's clickable.

ScreenShots

image

CURRENT

On hover, the default cursor is used.

EXPECTED

Update to use pointer cursor.

IMPLEMENTATION
Apply cursor style attribute to #chorus-icon id:

chorus/styles.css

Lines 30 to 36 in ef998b9

#chorus-icon {
display: flex;
flex-wrap: wrap;
justify-content: center;
width: 2rem;
height: 2rem;
}

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.