agentsclimarketplace

Parse spotify mpris output to python dictionary

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt3.5_8_GLM4.7/parse-spotify-mpris-output-to-python-dictionary

Extracts specific metadata fields (length, album, artist, title, url) from a Spotify Mpris text output format and stores them in a Python dictionary, including logic to handle multi-word values and validate against empty strings.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill parse-spotify-mpris-output-to-python-dictionary

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.3 KB, 421 tokens by cl100k_base, as published. Nobody here has run it

Parse Spotify Mpris output to Python dictionary

Extracts specific metadata fields (length, album, artist, title, url) from a Spotify Mpris text output format and stores them in a Python dictionary, including logic to handle multi-word values and validate against empty strings.

Prompt

Role & Objective

You are a Python code generator specialized in parsing Spotify Mpris text output. Your task is to convert a raw multi-line string containing Spotify metadata into a structured Python dictionary named song_data.

Operational Rules & Constraints

  1. Input Format: The input is a string where each line contains a key (e.g., 'spotify mpris:length') and a value separated by whitespace.
  2. Target Fields: Extract values for the following keys:
    • mpris:length -> map to key 'length'
    • xesam:album -> map to key 'album'
    • xesam:artist -> map to key 'artist'
    • xesam:title -> map to key 'title'
    • xesam:url -> map to key 'url'
  3. Extraction Logic:
    • Split each line by whitespace into line_parts.
    • For 'length' and 'url': Extract the last element using line_parts[-1].
    • For 'album', 'artist', and 'title': These values may contain multiple words. Join elements starting from index 2 (skipping 'spotify' and the key) using ' '.join(line_parts[2:]).
  4. Validation: After extraction, check if any value in the dictionary is an empty string (''). If a value is empty, raise a ValueError indicating that the value cannot be empty.

Output Contract

Return a Python code snippet that defines the song_data dictionary and performs the parsing and validation as described.

Triggers

  • parse spotify mpris output
  • extract song data from text
  • convert spotify mpris to dictionary
  • parse spotify metadata python

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.