[1.1.x] Spotify Now Playing

Created on 17 December 2024, 5 days ago

This module offers the ability to show your currently playing song on your website.

1. A JSON endpoint allows you to create this functionality yourself. A request to `/spotify_playing` will yield a
cached JSON response identical to Spotify's currently playing API.
2. Passing `reduce=1` will limit the data to only the items needed to render the custom block.
3. A custom block can be added to a region that will display a now playing widget.

## Project link

https://www.drupal.org/project/spotify_playing →

📌 Task
Status

Needs review

Component

module

Created by

🇺🇸United States nessthehero

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @nessthehero
  • 🇺🇸United States nessthehero
  • 🇮🇳India vishal.kadam Mumbai

    Thank you for applying!

    Please read Review process for security advisory coverage: What to expect → for more details and Security advisory coverage application checklist → to understand what reviewers look for. Tips for ensuring a smooth review → gives some hints for a smoother review.

    The important notes are the following.

    • If you have not done it yet, you should run phpcs --standard=Drupal,DrupalPractice on the project, which alone fixes most of what reviewers would report.
    • For the time this application is open, only your commits are allowed.
    • The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status won't be changed by this application and no other user will be able to opt projects into security advisory policy.
    • We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.

    To the reviewers

    Please read How to review security advisory coverage applications → , Application workflow → , What to cover in an application review → , and Tools to use for reviews → .

    The important notes are the following.

    • It is preferable to wait for a Code Review Administrator before commenting on newly created applications. Code Review Administrators will do some preliminary checks that are necessary before any change on the project files is suggested.
    • Reviewers should show the output of a CLI tool → only once per application.
    • It may be best to have the applicant fix things before further review.

    For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues → .

  • 🇮🇳India vishal.kadam Mumbai
  • 🇮🇳India vishal.kadam Mumbai

    1. Fix phpcs issues.

    phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml spotify_playing/
    
    FILE: spotify_playing/spotify_playing.module
    ------------------------------------------------------------------------------
    FOUND 31 ERRORS AND 3 WARNINGS AFFECTING 21 LINES
    ------------------------------------------------------------------------------
      1 | ERROR   | [x] Missing file doc comment
      3 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
      3 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 1
      5 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
      5 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 1
      5 | ERROR   | [x] Missing function doc comment
      6 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
      7 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
      8 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
      9 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
     10 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
     10 | WARNING | [x] A comma should follow the last multiline array item. Found: ''
     11 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
     11 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
     12 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
     12 | WARNING | [x] A comma should follow the last multiline array item. Found: ]
     13 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
     14 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
     14 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 1
     16 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
     16 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 1
     16 | ERROR   | [x] Missing function doc comment
     18 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
     20 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
     20 | ERROR   | [x] Line indented incorrectly; expected 4 spaces, found 3
     21 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
     21 | ERROR   | [x] Case breaking statement indented incorrectly; expected 5 spaces, found 4
     22 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
     24 | ERROR   | [x] Empty array declaration must have no space between the parentheses
     26 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
     28 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
     30 | ERROR   | [x] Spaces must be used to indent lines; tabs are not allowed
     30 | ERROR   | [x] Expected 1 newline at end of file; 0 found
     30 | ERROR   | [x] Line indented incorrectly; expected 0 spaces, found 1
    ------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 34 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------
    
    FILE: spotify_playing/spotify_playing.services.yml
    ------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------
     4 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------
    
    FILE: spotify_playing/spotify_playing.info.yml
    ------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------
     4 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------
    
    FILE: spotify_playing/README.md
    ----------------------------------------------------------------------
    FOUND 0 ERRORS AND 9 WARNINGS AFFECTING 9 LINES
    ----------------------------------------------------------------------
      3 | WARNING | Line exceeds 80 characters; contains 83 characters
      5 | WARNING | Line exceeds 80 characters; contains 113 characters
      7 | WARNING | Line exceeds 80 characters; contains 97 characters
      8 | WARNING | Line exceeds 80 characters; contains 82 characters
     10 | WARNING | Line exceeds 80 characters; contains 115 characters
     11 | WARNING | Line exceeds 80 characters; contains 111 characters
     19 | WARNING | Line exceeds 80 characters; contains 91 characters
     30 | WARNING | Line exceeds 80 characters; contains 102 characters
     32 | WARNING | Line exceeds 80 characters; contains 83 characters
    ----------------------------------------------------------------------
    
    FILE: spotify_playing/config/schema/spotify_playing.settings.yml
    ------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------
     5 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------
    
    FILE: spotify_playing/spotify_playing.links.menu.yml
    ------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------
     6 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------
    
    FILE: spotify_playing/spotify_playing.libraries.yml
    ------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------
     6 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------
    
    FILE: spotify_playing/src/Plugin/Block/SpotifyNowPlayingBlock.php
    ------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------
     8 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Block\BlockBase.
    ------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------
    
    FILE: spotify_playing/src/SpotifyHelper.php
    ------------------------------------------------------------------------------
    FOUND 2 ERRORS AFFECTING 2 LINES
    ------------------------------------------------------------------------------
      6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Config\Config.
     29 | ERROR | [x] Missing function doc comment
    ------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------
    
    FILE: spotify_playing/src/Controller/SpotifyController.php
    ------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\Core\Cache\CacheableJsonResponse.
    ------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------
    
    FILE: spotify_playing/src/Controller/SpotifyAuthController.php
    ------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------
     6 | ERROR | [x] Use statements should be sorted alphabetically. The first wrong one is Drupal\spotify_playing\SpotifyHelper.
    ------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------
    
    FILE: spotify_playing/spotify_playing.permissions.yml
    ------------------------------------------------------------------------------
    FOUND 1 ERROR AFFECTING 1 LINE
    ------------------------------------------------------------------------------
     3 | ERROR | [x] Expected 1 newline at end of file; 0 found
    ------------------------------------------------------------------------------
    PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
    ------------------------------------------------------------------------------

    2. FILE: js/spotify_playing.js

    Javascript code needs to be correctly indented. Drupal uses two spaces for indentation, not four spaces or tabs.

    3. FILE: templates/spotify-playing-block.html.twig

    Twig code needs to be correctly indented. Drupal uses two spaces for indentation, not four spaces or tabs.

    4. FILE: src/Controller/SpotifyAuthController.php

      /**
       * {@inheritDoc}
       */
      public function __construct(SpotifyHelper $spotify, ConfigFactoryInterface $config_factory, RequestStack $request_stack) {

    FILE: src/Controller/SpotifyController.php

      /**
       * {@inheritDoc}
       */
      public function __construct(SpotifyHelper $spotify, ConfigFactoryInterface $config_factory, RequestStack $request_stack) {

    The documentation comment for constructors is not mandatory anymore, If it is given, the description must be Constructs a new [class name] object. where [class name] includes the class namespace.

  • 🇺🇸United States nessthehero

    Thank you very much @vishal.kadam. I appreciate including what command you ran. I was not including all the file extensions you did.

    I have pushed improvements that fix all your mentioned issues.

  • 🇮🇳India vishal.kadam Mumbai

    Rest looks fine to me.

    Let’s wait for a Code Review Administrator to take a look and if everything goes fine, you will get the role.

Production build 0.71.5 2024