sentriz/gonic

Panic on migration of podcast paths -> PEs need generated filenames

Closed this issue ยท 5 comments

gonic version:

if from docker, docker tag:
if from source, git tag/branch: 69c02e8

I'm seeing a panic when migrating to the latest version:

goroutine 1 [running]:
log.Panicf({0xc2a591?, 0xc00002b968?}, {0xc000433c20?, 0xc00002b8a8?, 0x12?})
/opt/go/src/log/log.go:439 +0x65
main.main()
/home/brian/gonic/cmd/gonic/gonic.go:153 +0x10fa
2023/10/18 11:51:40 error migrating database: "202309161411": find old podcast episode path: stat /media/media/Podcasts/HeadsInTheCloud/default_tc.mp3: no such file or directory
panic: error migrating database: "202309161411": find old podcast episode path: stat /media/media/Podcasts/HeadsInTheCloud/default_tc.mp3: no such file or directory

The root cause is that:

  1. Some podcasts use the same filename for each episode with ? parameters to differentiate. Example: https://feeds.simplecast.com/l2i9YnTd
  2. This leads to gonic using the same filename for different episodes. In addition to the obvious problem (each episode is actually the latest episode when you play it), this leads the podcast purger to delete that file which leaves future episodes pointing to a non-existing file.

I suggest two changes to fix this issue:

  1. The key change to make is to start creating a unique local filename for podcast episodes independent of what's in the RSS, using mktemp() or equivalent.
  2. I would also suggest not panicking on that migration just because a podcast episode filename is missing.
  1. i think this should already be the case with the new fileutil.Unique() function
  2. i agree ๐Ÿ‘ i just pushed a commit for that. could you try fetch and re-run? i think it should retry the failed migration since it didn't finish last time

cheers ๐Ÿ‘

how did it go with 1.?

nice, thanks for testing ๐Ÿ‘