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

metadata: handle empty trailer_uri for shows #1432

Merged
merged 2 commits into from
Dec 30, 2024

Conversation

eladyn
Copy link
Contributor

@eladyn eladyn commented Dec 29, 2024

I stumbled across a show, which has an empty trailer_uri. In particular, the trailer_uri field on the librespot_protocol::metadata::Show struct was Some(""), which led to the SpotifyId::from_uri parsing to fail.

This patch accounts for this possibility. Another option would of course be to just use String for that field, to avoid any parsing problems.

Example:

previously, doing Show::get(&session, &id).await yielded for spotify:show:28sR8OiOq0MMnGEzMJTXSt:

Error { kind: InvalidArgument, error: InvalidFormat }

With this, it returns:

Show {
    id: SpotifyId(
        "spotify:show:28sR8OiOq0MMnGEzMJTXSt",
    ),
    name: "1,5 Grad – der Klima-Podcast mit Luisa Neubauer",
    description: "Die Klimakrise ist hier. Wir haben alle Fakten, die wir brauchen, um gegen sie anzukämpfen. In Deutschland haben wir dafür sogar politische Mehrheiten. Wie kommen wir als Gesellschaft endlich ins Handeln? Im Spotify-Original Podcast “1,5 Grad” gibt Luisa Neubauer Antworten auf diese Frage. Sie gewährt Einblicke hinter die Kulissen ihres Aktivistinnen-Lebens und beleuchtet die Klimadiskussion mit ihren Gästen aus neuen Blickwinkeln. Für sie ist klar: Veränderung findet bereits statt, Quellen für Hoffnung gibt es überall. Jetzt liegt es an uns allen, den Wandel mit anzuschieben. \"1,5 Grad\" - der Klima-Podcast mit Luisa Neubauer, nur auf Spotify.",
    publisher: "Spotify & Luisa Neubauer",
    language: "de",
    is_explicit: false,
    covers: Images(
        [
            Image {
                id: FileId(
                    Ok(
                        "ab6765630000f68da378a43d00eddbb41f2f4c70",
                    ),
                ),
                size: SMALL,
                width: 64,
                height: 64,
            },
            Image {
                id: FileId(
                    Ok(
                        "ab67656300005f1fa378a43d00eddbb41f2f4c70",
                    ),
                ),
                size: DEFAULT,
                width: 300,
                height: 300,
            },
            Image {
                id: FileId(
                    Ok(
                        "ab6765630000ba8aa378a43d00eddbb41f2f4c70",
                    ),
                ),
                size: LARGE,
                width: 640,
                height: 640,
            },
        ],
    ),
    episodes: Episodes(
        [
            SpotifyId(
                "spotify:episode:2yJRySMdJa0IJyhiQt2KYe",
            ),
            SpotifyId(
                "spotify:episode:5keKoTZNooaeKboKsfuZNk",
            ),
            SpotifyId(
                "spotify:episode:09rvishjEfUJ3MxEZj6tO9",
            ),
            SpotifyId(
                "spotify:episode:2SgffAMDaqFuPmpc9QihBP",
            ),
            SpotifyId(
                "spotify:episode:4COEXOhmcH83gW2mVwxQOl",
            ),
            SpotifyId(
                "spotify:episode:1Uk9wVHzBJ1O8R1ale0zaV",
            ),
            SpotifyId(
                "spotify:episode:1LmstLMvSj9EuvziJc0cov",
            ),
            SpotifyId(
                "spotify:episode:5zzZdUXuMsnctu9Pz5G05u",
            ),
            SpotifyId(
                "spotify:episode:7FMbTNlH5XNzUcXvTnYh16",
            ),
            SpotifyId(
                "spotify:episode:6xHOj0wQFtGUK2SGSXjzKB",
            ),
            SpotifyId(
                "spotify:episode:2A1evUit45oQb65OWT6P8b",
            ),
            SpotifyId(
                "spotify:episode:5nXD7kVMvfwh0M2piTc0WJ",
            ),
            SpotifyId(
                "spotify:episode:0PsAw06YY8FuUspnCZS7nD",
            ),
            SpotifyId(
                "spotify:episode:1y7uYvJ9TPJVKxLnYN6Ror",
            ),
            SpotifyId(
                "spotify:episode:3vCNeuiYXmz2nWZYnbPND7",
            ),
            SpotifyId(
                "spotify:episode:2onaNST6VMOR3Tqyh40X8j",
            ),
            SpotifyId(
                "spotify:episode:1x6ripc5R6YgQFU9ViUzJI",
            ),
            SpotifyId(
                "spotify:episode:3KMAxjwnQ4zx2Z8dQjl70t",
            ),
            SpotifyId(
                "spotify:episode:6asAmilWvDl8PXjr3IIOnX",
            ),
            SpotifyId(
                "spotify:episode:1ymuViiEonDfMAWRjaaN1T",
            ),
            SpotifyId(
                "spotify:episode:39KFKqoDk4TuXlX9rKoWLS",
            ),
            SpotifyId(
                "spotify:episode:1qSu2efACZAxWuXDoeQaXh",
            ),
            SpotifyId(
                "spotify:episode:5vWMPof2Jb2iFNTlyigIcz",
            ),
            SpotifyId(
                "spotify:episode:7fzqrKo2HeIRfQQ9gtXbeX",
            ),
            SpotifyId(
                "spotify:episode:2EAt05dQh3p8GqeRdqWuxZ",
            ),
            SpotifyId(
                "spotify:episode:2OL68dHC8PtnSENJZuhUYT",
            ),
            SpotifyId(
                "spotify:episode:4hOrkGiMX87T2PWQ82KyTz",
            ),
            SpotifyId(
                "spotify:episode:3Ocm2w0et8jTk8zIrtKT2V",
            ),
            SpotifyId(
                "spotify:episode:34G1AB7LhH2CDj53TbgKlq",
            ),
            SpotifyId(
                "spotify:episode:4jtZGkwKDTgGm0omX3RImR",
            ),
            SpotifyId(
                "spotify:episode:1nJTLeXwgHCKH4Md82AlfX",
            ),
            SpotifyId(
                "spotify:episode:6u8PhdmS8mjxH6Ki67y8n4",
            ),
            SpotifyId(
                "spotify:episode:7dRCQTIDrTLLKMeiPNFTOm",
            ),
            SpotifyId(
                "spotify:episode:6544sUNuxTD0vaJ67qgop7",
            ),
            SpotifyId(
                "spotify:episode:220LAEscnWZ8PpY3CxwX8A",
            ),
            SpotifyId(
                "spotify:episode:7kPNMpbzl5m63DDEqChGmq",
            ),
            SpotifyId(
                "spotify:episode:4zO0xIqBlvG9BSO5ZFBNvL",
            ),
            SpotifyId(
                "spotify:episode:6rOdBsMjRc6jz46inwx7Hp",
            ),
            SpotifyId(
                "spotify:episode:274Faf5SUiQRe9wIefAmxJ",
            ),
            SpotifyId(
                "spotify:episode:7baOTUE0lzsxtTAqWCwrh3",
            ),
            SpotifyId(
                "spotify:episode:2f4Q1eGIlOiUs0GAy6uioj",
            ),
        ],
    ),
    copyrights: Copyrights(
        [],
    ),
    restrictions: Restrictions(
        [
            Restriction {
                catalogues: RestrictionCatalogues(
                    [],
                ),
                restriction_type: STREAMING,
                catalogue_strs: [
                    "all",
                    "free",
                    "premium",
                    "shuffle",
                    "commercial",
                ],
                countries_allowed: None,
                countries_forbidden: Some(
                    [],
                ),
            },
        ],
    ),
    keywords: [],
    media_type: AUDIO,
    consumption_order: EPISODIC,
    availability: Availabilities(
        [],
    ),
    trailer_uri: None,
    has_music_and_talk: false,
    is_audiobook: false,
}

metadata/src/show.rs Outdated Show resolved Hide resolved
@eladyn eladyn force-pushed the episode_metadata_fix branch from fdc98e3 to d2e4ac0 Compare December 30, 2024 01:52
@photovoltex
Copy link
Member

Thanks for the fix. Would you add a CHANGELOG entry?

@photovoltex photovoltex merged commit 7003e98 into librespot-org:dev Dec 30, 2024
13 checks passed
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.

2 participants