LeoKlaus / plappa

An Audiobook client for Jellyfin and AudioBookShelf, written in Swift/SwiftUI.
https://plappa.me
240 stars 1 forks source link

[BUG] Podcasts without published date don't show up in Plappa #114

Closed spy14 closed 5 months ago

spy14 commented 6 months ago

Describe the bug

First of all, thank you for the application! Besides this issue it is working very well! I have some podcasts which were downloaded earlier and I just imported the mp3s into Audiobookshelf. This causes the podcast to not have a published date. If the podcast doesn't have a published date, it doesn't show up in plappa and there is an exception in the logs. Adding the pubDate solves the issue. This makes importing inconvenient as I have to go through them one by one in Audiobookshelf and add a published date.

To Reproduce Steps to reproduce the behavior:

  1. Import already downloaded podcast mp3 in Audiobookshelf.
  2. Try to listen in plappa.
  3. It won't show up under podcasts.
  4. Match the episode in Audiobookshelf(this will fill out details, published date, etc.)
  5. Now it will show up in plappa.

Expected behavior I should be able to play podcasts without a published date.

Logs

[4/6/2024, 11:55] [plappa] Encountered an error while decoding recent episodes: The data couldn’t be read because it is missing.
valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 4", intValue: 4), CodingKeys(stringValue: "pubDate", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))
[4/6/2024, 11:55] [plappa] Encountered an error while loading audio files: The operation couldn’t be completed. (plappa.APIError error 1.)
unexpected
[4/6/2024, 12:55] [plappa] Encountered an error while decoding recent episodes: The data couldn’t be read because it is missing.
valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 3", intValue: 3), CodingKeys(stringValue: "pubDate", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))
[4/6/2024, 12:55] [plappa] Encountered an error while loading audio files: The operation couldn’t be completed. (plappa.APIError error 1.)
unexpected
[4/6/2024, 12:55] [plappa] Encountered an error while decoding item: The data couldn’t be read because it is missing.
valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "media", intValue: nil), CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "pubDate", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))
[4/6/2024, 12:55] [plappa] Encountered an error while decoding item: The data couldn’t be read because it is missing.
valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "media", intValue: nil), CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "pubDate", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))
[4/6/2024, 12:55] [plappa] Encountered an error while decoding item: The data couldn’t be read because it is missing.
valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "media", intValue: nil), CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "pubDate", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))
[4/6/2024, 12:59] [plappa] Encountered an error while decoding item: The data couldn’t be read because it is missing.
valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "media", intValue: nil), CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "pubDate", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))
[4/6/2024, 12:59] [plappa] Encountered an error while decoding item: The data couldn’t be read because it is missing.
valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "media", intValue: nil), CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "pubDate", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))
[4/6/2024, 12:59] [plappa] Encountered an error while decoding item: The data couldn’t be read because it is missing.
valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "media", intValue: nil), CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "pubDate", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))
[4/6/2024, 12:59] [plappa] Encountered an error while decoding item: The data couldn’t be read because it is missing.
valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "media", intValue: nil), CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "pubDate", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))
[4/6/2024, 12:59] [plappa] Encountered an error while decoding item: The data couldn’t be read because it is missing.
valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "media", intValue: nil), CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "pubDate", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))
[4/6/2024, 13:36] [AudioBookShelfAPIHandler] Successfully pushed playbackstates
[4/6/2024, 13:37] [plappa] Encountered an error while decoding item: The data couldn’t be read because it is missing.
valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "media", intValue: nil), CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "pubDate", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))
[4/6/2024, 13:37] [plappa] Encountered an error while decoding item: The data couldn’t be read because it is missing.
valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "media", intValue: nil), CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "pubDate", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))
[4/6/2024, 13:38] [AudioBookShelfAPIHandler] Successfully pushed playbackstates

Environment(please complete the following information):

LeoKlaus commented 6 months ago

Hey spy14, thanks for reporting this! I just pushed a fix to TestFlight. If you're not in the TestFlight-Beta, you can join using the link at the bottom of the settings tab.

If you would like to stay on the AppStore version, you will have to wait a few days for the update to be ready and approved.

spy14 commented 6 months ago

Hey @LeoKlaus ,

I've updated to the latest version in testflight but still got the issue:

[4/6/2024, 14:52] [CoreDataHandler] Initializing core data store...
[4/6/2024, 14:52] [CoreDataHandler] CoreData store initialized
[4/6/2024, 14:52] [PlaybackStateHandler] Syncing playback states through server
[4/6/2024, 14:52] [ReadingListHandler] Found no objects in reading list
[4/6/2024, 14:52] [plappa] Encountered an error while decoding recent episodes: The data couldn’t be read because it is missing.
valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 54", intValue: 54), CodingKeys(stringValue: "pubDate", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))
[4/6/2024, 14:52] [plappa] Encountered an error while loading audio files: The operation couldn’t be completed. (plappa.APIError error 1.)
unexpected
[4/6/2024, 14:52] [AudioBookShelfAPIHandler] Successfully pushed playbackstates
[4/6/2024, 14:52] [plappa] Encountered an error while decoding item: The data couldn’t be read because it is missing.
valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "media", intValue: nil), CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "pubDate", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))
[4/6/2024, 14:53] [plappa] Encountered an error while decoding item: The data couldn’t be read because it is missing.
valueNotFound(Swift.String, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "media", intValue: nil), CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "pubDate", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))
LeoKlaus commented 6 months ago

My bad, I missed a spot. I've just published another update.

spy14 commented 6 months ago

updated again

[4/6/2024, 15:15] [CoreDataHandler] Initializing core data store...
[4/6/2024, 15:15] [CoreDataHandler] CoreData store initialized
[4/6/2024, 15:15] [PlaybackStateHandler] Syncing playback states through server
[4/6/2024, 15:15] [ReadingListHandler] Found no objects in reading list
[4/6/2024, 15:15] [plappa] Encountered an error while decoding recent episodes: The data couldn’t be read because it is missing.
valueNotFound(Swift.Int, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 54", intValue: 54), CodingKeys(stringValue: "publishedAt", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))
[4/6/2024, 15:15] [plappa] Encountered an error while loading audio files: The operation couldn’t be completed. (plappa.APIError error 1.)
unexpected
[4/6/2024, 15:15] [AudioBookShelfAPIHandler] Successfully pushed playbackstates
[4/6/2024, 15:15] [plappa] Encountered an error while decoding item: The data couldn’t be read because it is missing.
valueNotFound(Swift.Int, Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "media", intValue: nil), CodingKeys(stringValue: "episodes", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0), CodingKeys(stringValue: "publishedAt", intValue: nil)], debugDescription: "Cannot get unkeyed decoding container -- found null value instead", underlyingError: nil))

If you need the response from Audiobookshelf I can also get it if you tell me which endpoint you are using.

spy14 commented 6 months ago

This is the response for the item from Audiobookshelf:

{
  "id": "9a92673a-333c-4a63-8460-24df2c541894",
  "ino": "26399",
  "oldLibraryItemId": null,
  "libraryId": "176533cf-717c-424d-9174-cee12b8341fd",
  "folderId": "a261c66a-1b21-4c16-8f58-3754578b2edd",
  "path": "/media/Podcasts/Orient/kraftie test 34",
  "relPath": "kraftie test 34",
  "isFile": false,
  "mtimeMs": 1717506879524,
  "ctimeMs": 1717506879524,
  "birthtimeMs": 0,
  "addedAt": 1717506891506,
  "updatedAt": 1717506891506,
  "lastScan": 1717506891505,
  "scanVersion": "2.9.0",
  "isMissing": false,
  "isInvalid": false,
  "mediaType": "podcast",
  "media": {
    "id": "c8bb359b-2933-4c0d-afb1-bbb35235cbf4",
    "libraryItemId": "9a92673a-333c-4a63-8460-24df2c541894",
    "metadata": {
      "title": "kraftie test 34",
      "titleIgnorePrefix": "kraftie test 34",
      "author": null,
      "description": null,
      "releaseDate": null,
      "genres": [],
      "feedUrl": null,
      "imageUrl": null,
      "itunesPageUrl": null,
      "itunesId": null,
      "itunesArtistId": null,
      "explicit": false,
      "language": null,
      "type": "episodic"
    },
    "coverPath": null,
    "tags": [],
    "episodes": [
      {
        "libraryItemId": "9a92673a-333c-4a63-8460-24df2c541894",
        "podcastId": "c8bb359b-2933-4c0d-afb1-bbb35235cbf4",
        "id": "4459888b-44cb-4e88-ab65-e8180373b6a8",
        "oldEpisodeId": null,
        "index": null,
        "season": null,
        "episode": null,
        "episodeType": null,
        "title": "lF9xEiZJkDze.128",
        "subtitle": null,
        "description": null,
        "enclosure": null,
        "guid": null,
        "pubDate": null,
        "chapters": [],
        "audioFile": {
          "index": 1,
          "ino": "26400",
          "metadata": {
            "filename": "lF9xEiZJkDze.128.mp3",
            "ext": ".mp3",
            "path": "/media/Podcasts/Orient/kraftie test 34/lF9xEiZJkDze.128.mp3",
            "relPath": "lF9xEiZJkDze.128.mp3",
            "size": 51164890,
            "mtimeMs": 1717506885280,
            "ctimeMs": 1717506885280,
            "birthtimeMs": 0
          },
          "addedAt": 1717506891503,
          "updatedAt": 1717506891503,
          "trackNumFromMeta": null,
          "discNumFromMeta": null,
          "trackNumFromFilename": null,
          "discNumFromFilename": null,
          "manuallyVerified": false,
          "exclude": false,
          "error": null,
          "format": "MP2/3 (MPEG audio layer 2/3)",
          "duration": 3197.779592,
          "bitRate": 128000,
          "language": null,
          "codec": "mp3",
          "timeBase": "1/14112000",
          "channels": 2,
          "channelLayout": "stereo",
          "chapters": [],
          "embeddedCoverArt": null,
          "metaTags": {
            "tagEncoder": "LAME3.100"
          },
          "mimeType": "audio/mpeg"
        },
        "audioTrack": {
          "index": 1,
          "startOffset": 0,
          "duration": 3197.779592,
          "title": "lF9xEiZJkDze.128.mp3",
          "contentUrl": "/api/items/9a92673a-333c-4a63-8460-24df2c541894/file/26400",
          "mimeType": "audio/mpeg",
          "codec": "mp3",
          "metadata": {
            "filename": "lF9xEiZJkDze.128.mp3",
            "ext": ".mp3",
            "path": "/media/Podcasts/Orient/kraftie test 34/lF9xEiZJkDze.128.mp3",
            "relPath": "lF9xEiZJkDze.128.mp3",
            "size": 51164890,
            "mtimeMs": 1717506885280,
            "ctimeMs": 1717506885280,
            "birthtimeMs": 0
          }
        },
        "publishedAt": null,
        "addedAt": 1717506891514,
        "updatedAt": 1717506891514,
        "duration": 3197.779592,
        "size": 51164890
      }
    ],
    "autoDownloadEpisodes": false,
    "autoDownloadSchedule": "0 * * * *",
    "lastEpisodeCheck": 0,
    "maxEpisodesToKeep": 0,
    "maxNewEpisodesToDownload": 3,
    "size": 51164890
  },
  "libraryFiles": [
    {
      "ino": "26400",
      "metadata": {
        "filename": "lF9xEiZJkDze.128.mp3",
        "ext": ".mp3",
        "path": "/media/Podcasts/Orient/kraftie test 34/lF9xEiZJkDze.128.mp3",
        "relPath": "lF9xEiZJkDze.128.mp3",
        "size": 51164890,
        "mtimeMs": 1717506885280,
        "ctimeMs": 1717506885280,
        "birthtimeMs": 0
      },
      "isSupplementary": null,
      "addedAt": 1717506891375,
      "updatedAt": 1717506891375,
      "fileType": "audio"
    }
  ],
  "size": 51164890,
  "rssFeed": null,
  "episodeDownloadsQueued": []
}
LeoKlaus commented 6 months ago

Thank you very much for your patience and for sending the API response! I'll make the necessary changes and let you know once I've got news.

LeoKlaus commented 6 months ago

I've just uploaded build 9 to TestFlight. At least for the response you posted, everything works now. Let me know if it fixed the issue :)

spy14 commented 6 months ago

Works now! Thank you!

LeoKlaus commented 5 months ago

Great, I'll close this then!