jgonyea / grav-plugin-podcast

GravCMS plugin that creates podcast channel and podcast episode page templates along with a podcast RSS feed.
MIT License
18 stars 7 forks source link

Audio/local/path and Audio/meta/guid not using folder number prefixes #39

Closed agentirons closed 2 years ago

agentirons commented 3 years ago

After updating to v3.0, I found that the format of the image and audio tags had changed slightly and prevented me from loading the page editor until I removed or modified the image tag (separate issue). After I fix this and open the editor, if I select the .mp3 media from the dropdown on the Podcast Audio tab, the Audio:local:path: field and the Audio:meta:guid field do not use the folder number prefixes of my site, and are missing the "user/pages/" beginning, resulting in a broken link to the audio.

As you can see in this example from a podcast-episode.md file, the first instance of the path is correct but the other two fields are not.

    audio:
        local:
            select: Episode8_InvasionOfTheBodySnatchers.mp3
            user/pages/01.the-305/08.invasion-of-the-body-snatchers/Episode8_InvasionOfTheBodySnatchers.mp3:
                name: Episode8_InvasionOfTheBodySnatchers.mp3
                type: audio/mpeg
                size: 55239391
                path: /the-305/invasion-of-the-body-snatchers/Episode8_InvasionOfTheBodySnatchers.mp3
        meta:
            guid: /the-305/invasion-of-the-body-snatchers/Episode8_InvasionOfTheBodySnatchers.mp3
            type: audio/mpeg
            duration: '57:32'
            enclosure_length: 55239391
jgonyea commented 3 years ago

I have the following structure:

root (/grav-dev)
|- podcast-channel.md (04.technology-today)
  |- podcast-series.md (01.series-1)
    |- podcast-episode.md (01.episode-1)
    |- podcast-episode.md (02.episode-2)

I do see the lack of the numbered routes:

    audio:
        local:
            select: 'Pigstep Minecraft Remix.mp3'
            'user/pages/04.technology-today/01.series-1/02.episode-2/Pigstep Minecraft Remix.mp3':
                name: 'Pigstep Minecraft Remix.mp3'
                type: audio/mpeg
                size: 5057025
                path: '/grav-dev/technology-today/series-1/episode-2/Pigstep Minecraft Remix.mp3'
        meta:
            guid: '/grav-dev/technology-today/series-1/episode-2/Pigstep Minecraft Remix.mp3'
            type: audio/mpeg
            duration: '3:31'
            enclosure_length: 5057025

But I'm still able to route the files just fine on the front-end. Can you clear your cache and try viewing again?

image

jgonyea commented 3 years ago

I just also realized that images also broke.

It has to do with the breaking changes of the image field I had to make to get around the Grav 1.6 file field -> Grav 1.7 filepicker field issue.

To manually fix, open each page that has an image. If you're doing this locally, it probably will be faster to open the *.md files in a text editor.

You'll see something along the lines like:

series:
    image:
        user/pages/01.channel/01.series/featured_image.jpg:
            name: featured_image.jpg
            type: image/jpeg
            size: 8206
            path: user/pages/01.channel/01series/featured_image.jpg

This needs to be changed to:

series:
    image: featured_image.jpg
jgonyea commented 3 years ago

I'll work on seeing if I can get the admin plugin to automatically update that field when you go and attempt to edit the page.

agentirons commented 3 years ago

Here's the entirety of what I've experienced (after an upgrade to 3.0.1 and a cache-clear):

  1. Try to edit a page through the GUI, and receive the following error: 0 - An exception has been thrown during the rendering of a template ("Array to string conversion").
  2. Manually modify the image info from podcast-episode.md. Now I can edit the page through the GUI.
  3. Reenter the subtitle in the GUI and hit save (or do anything and hit save).
  4. The audio information has now been completely removed from podcast-episode.md.
  5. Reselect the audio in the GUI.
  6. The audio info has returned, but is now a broken link on the page. Instead of: https://bitcrush.io/user/pages/01.the-305/09.the-magnificent-ambersons/Episode9_TheMagnificentAmbersons.mp3 I get https://the-305/the-magnficent-ambersons/Episode9_TheMagnificentAmbersons.mp3
  7. Manually add "/user/pages" and the folder numbers to podcast-episode.md
  8. Finished, everything is as it should be, although I'm not sure if it will update if I change the folder order of pages.
agentirons commented 3 years ago

Steps 6 and 7 appear to be due to large differences in the templates for the plugin, which I had extended/modified from an earlier version. I'm attempting to weed through the changes to keep my styling intact, but I can report that I've had success using the new audio link format.

I needed to change the <audio><source> from {{ media_url }} to {{ page.header.podcast.audio.meta.guid }}

jgonyea commented 3 years ago

I'm currently working on a one-time upgrade cli command that will process all of the v2 podcast- page types and convert them up to v3 podcast- page types.

jgonyea commented 2 years ago

I've decided to not write en-masse converter.

Closing ticket.