don't panic when we can't find an old podcast episode path in migration

related #393
This commit is contained in:
sentriz
2023-10-18 20:09:10 +01:00
parent 69c02e8352
commit d503282faf

View File

@@ -667,7 +667,8 @@ func migratePlaylistsPaths(tx *gorm.DB, ctx MigrationContext) error {
filepath.Join(ctx.PodcastsPath, p.Title), filepath.Join(ctx.PodcastsPath, p.Title),
) )
if err != nil { if err != nil {
return fmt.Errorf("find old podcast path: %w", err) log.Printf("error finding old podcast path: %v. ignoring", err)
continue
} }
newPath := filepath.Join(ctx.PodcastsPath, fileutil.Safe(p.Title)) newPath := filepath.Join(ctx.PodcastsPath, fileutil.Safe(p.Title))
p.RootDir = newPath p.RootDir = newPath
@@ -696,7 +697,8 @@ func migratePlaylistsPaths(tx *gorm.DB, ctx MigrationContext) error {
filepath.Join(pe.Podcast.RootDir, pe.Filename), filepath.Join(pe.Podcast.RootDir, pe.Filename),
) )
if err != nil { if err != nil {
return fmt.Errorf("find old podcast episode path: %w", err) log.Printf("error finding old podcast episode path: %v. ignoring", err)
continue
} }
newName := fileutil.Safe(filepath.Base(oldPath)) newName := fileutil.Safe(filepath.Base(oldPath))
pe.Filename = newName pe.Filename = newName