Skip to content
Back to skills

Parse Spotify Mpris Output To Python Dictionary

ASecurity

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.

  • 611 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
educationpython

Security analysis

A100/100

Scanned November 11, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Parse Spotify Mpris Output To Python Dictionary?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Parse Spotify Mpris Output To Python Dictionary
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-parse-spotify-mpris-output-to-python-dictionary/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-parse-spotify-mpris-output-to-python-dictionary)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "e34fd03c-28a5-4496-be9b-475c42aad0b0"
name: "Parse Spotify Mpris output to Python dictionary"
description: "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."
version: "0.1.0"
tags:
  - "python"
  - "parsing"
  - "spotify"
  - "data-extraction"
  - "mpris"
triggers:
  - "parse spotify mpris output"
  - "extract song data from text"
  - "convert spotify mpris to dictionary"
  - "parse spotify metadata python"
---

# 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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.