Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playlist, artist and album download from web app. #1865

Merged
merged 7 commits into from
Jul 13, 2023
Merged

Conversation

oscarvx00
Copy link
Contributor

Title

Playlist, artist and album download from web app.

Description

This feature allows download lists of songs (Playlists, albums and artists) from web app.
The songs are displayed in the already present list. In future implementations a sub menu can be developed for each song list.

Nomenclature:

  • B: Backend
  • F: web-ui
  • Old version: < 4.1.12
  • New version: 4.1.12
  • List of songs: Album, playlist or artist

The changes can be divided in two sections:

  1. Backend
    • Endpoint at /api/url: receives an url, checks if it's a song, playlist, album or artist. Then it gets the info of the songs by calling from_url of the respective object and returns a song list. If only one song is searched, then a list with an unique element will be returned.
    • Endpoint at /api/version: this endpoint returns the current version of the backend. It's used by the frontend to perform different actions based on the backend version
  2. Frontend
    • Version handling: Due to the fact that the last version of the frontend is downloaded regardless of the version of the backend, a version property, which is stored on localStorage, is added to the application. This version needs to have the format w.x.y.z (No need to have all sub-versions) and is converted to a number. Then, inside the application, the version number is used to perform different actions. The version is fetched at startup. IMPORTANT: This PR assumes that the new spotdl version will be released as 4.1.12, if a lower version is released, then the web code conditionals needs to be modified with the new version. This conditionals can be searched with the following number in the code: 4001012000
    • URL search (search.js): Playlist, album and artist urls are accepted IF version >= 4001012000 (4.1.12), if not it will be rejected as in previous version.
    • Donwload from URL (download.js): Due to the new download endpoint returns a list of songs instead of a single song, a verification needs to be done in the frontend. Also, a loading reactive variable has been added. More details in next point.
    • Search status (SearchInput.vue): Using the loading variable described in the previous point, a spinner is shown if the backend is searching for the details of an input. This change is added due to the petition time is longer with the song lists.
    • Main page alert (Hero.vue): An alert indicating that the new version supports playlists, artists and albums is shown. If the backend version is minor than 4.1.12, a new message appears behind the previous one indicating that spotdl needs to be updated to use this feature.

Related Issue

#1863

Motivation and Context

This PR solves the problem of having to go through all the songs on the list one by one by downloading them, accepting the url of the list and downloading all of them at once.

How Has This Been Tested?

Testing by module:

  • Backend: Pytest + manual testing though web UI.
  • Frontend: Manual testing.

The following cases has been covered, all by manual testing:

  • B new version, F new version:
    • Single song download
    • List of songs download
    • Main page alert (need ot update to new version) not shown.
  • B old version, F new version:
    • Single song download
    • List of songs URL rejected.
    • List of songs not downloaded.
    • Main page alert (need ot update to new version) shown.
  • B new version, F old version (This case in unlikely to happen if the PR of the web-ui is merged before the spotdl PR):
    • Single song download
    • List of songs URL rejected.
    • List of songs not downloaded.
    • Main page alert is the one of the previous version.

Screenshots (if appropriate)

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have read the CONTRIBUTING document
  • I have read the CORE VALUES document
  • I have added tests to cover my changes
  • All new and existing tests passed (*)

(*) One test is failing, but it's not related to this changes:

test_ytmusic_matching[https://open.spotify.com/track/3ATwxbyPDsZWvlBdnyKNPQ-expected35] - AssertionError

@xnetcat
Copy link
Member

xnetcat commented Jun 24, 2023

Looks good, but maybe you could add like a confirmation button before downloading all songs from the playlist/artist/etc?

@xnetcat
Copy link
Member

xnetcat commented Jun 24, 2023

Also make sure you are basing your changes on the dev branch.

@xnetcat xnetcat changed the base branch from master to dev June 24, 2023 12:26
@xnetcat xnetcat linked an issue Jun 29, 2023 that may be closed by this pull request
@xnetcat
Copy link
Member

xnetcat commented Jul 11, 2023

Closing in favor of #1872

@xnetcat xnetcat merged commit 2921e96 into spotDL:dev Jul 13, 2023
@xnetcat xnetcat mentioned this pull request Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Playlist download from web app.
2 participants