Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
D
deemix
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 13
    • Issues 13
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 0
    • Merge Requests 0
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar

and though bugs are the bane of my existence, rest assured the wretched thing will get the best of care here

  • RemixDev
  • deemix
  • Issues
  • #18

Closed
Open
Opened Dec 19, 2020 by Shiraz@smcclennon

Parse multiple links directly from Spotify

Details

Parse multiple links in the search bar.

This would allow you to directly select and then copy/drag songs/links from the Spotify client into the search bar, and have the selected links added directly to the download queue (instead of having to make a temporary playlist with the selected songs)

Currently works (single link):

https://open.spotify.com/track/5e9TFTbltYBg2xThimr0rU?si=CfnABhn0Ss2mi-sTLH4F0A

This link is then sent to the download queue

Currently does not work (multiple links):

https://open.spotify.com/track/0ofHAoxe9vBkTCp2UQIavz?si=t6pDXfkuRlmg6j96ugQrwAhttps://open.spotify.com/track/5e9TFTbltYBg2xThimr0rU?si=lcAahTooT7CwVkn4Cjzm3whttps://open.spotify.com/track/5ihS6UUlyQAfmp48eSkxuQ?si=q4ghleFRTreFlza0Cb8bUw

Proposed code:

# Simple setup code for my example
import sys
command_line_args = sys.argv  # Get command line arguments
command_line_args = command_line_args[1:]  # Remove first argument referencing the python file ('link-split.py')
command_line_args = ''.join(command_line_args)  # Merge the array into a string

links = command_line_args
# 'links' would be the value of the items in the search bar
links = links.replace('\n', '')


# Split links based off of 'https://'
if 'https://' in links:  # If 'links' contains 'https://'
    links = links.split('https://') # Split each link into an array (according to the 'https://')

    # Add 'https' back to the links where it was removed due to the splitting
    for i, link in enumerate(links):  # For every link in the array created by the splitting
        links[i] = 'https://'+link  # Add 'https://' back to the beginning of each link (that was removed during splitting)

    # The previous for loop may have left array values such as 'https://' (invalid link). Remove values which don't contain a '.'
    for i, link in enumerate(links):  # For every link in the array
        if '.' not in links[i]:  # If links[i] is not a proper link (does not contain a .)
            del links[i]  # Remove the value from the array


else:
    links = [links]  # Convert the link into an array ['https://link.com'] (for a single link for example)
print(links)

Example code output

Example input (command line args): https://open.spotify.com/track/0ofHAoxe9vBkTCp2UQIavz?si=t6pDXfkuRlmg6j96ugQrwAhttps://open.spotify.com/track/5e9TFTbltYBg2xThimr0rU?si=lcAahTooT7CwVkn4Cjzm3whttps://open.spotify.com/track/5ihS6UUlyQAfmp48eSkxuQ?si=q4ghleFRTreFlza0Cb8bUw

Example output (print statement): ['https://open.spotify.com/track/0ofHAoxe9vBkTCp2UQIavz?si=t6pDXfkuRlmg6j96ugQrwA', 'https://open.spotify.com/track/5e9TFTbltYBg2xThimr0rU?si=lcAahTooT7CwVkn4Cjzm3w', 'https://open.spotify.com/track/5ihS6UUlyQAfmp48eSkxuQ?si=q4ghleFRTreFlza0Cb8bUw']

Implimentation

Instead of the print statement, you would use this psuedocode:

for link in links:
    add_link_to_download_queue(link)
Edited Dec 19, 2020 by Shiraz
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: RemixDev/deemix#18