Page 1 of 1

Subsonic fails to initialize due to permission error

PostPosted: Sat Sep 29, 2012 10:24 pm
by Rovanion
I changed the podcast folder from /var/music/Podcast to another folder and removed /var/music/Podcast. Now that I start subsonic I get the fallowing wonderful stacktrace:

http://paste.ubuntu.com/1250528/

My question boils down to, which config file defines the path to the podcasts folder? And why is it so determined to read this file that it crashes on it. I mean, it's kindof expected that some file goes missing at some point, you shouldn't leave such an exception unchecked.

Re: Subsonic fails to initialize due to permission error

PostPosted: Sun Sep 30, 2012 1:06 pm
by Rovanion
So I successfully managed to debug the issue and the fallowing patch resolves the issue:

commit d12a6f566ee24b49b2de314f30187ae0a7002bd1
Author: Rovanion Luckey <rovanion.luckey@gmail.com>
Date: Sun Sep 30 13:30:34 2012 +0200

Added a probably overly simple exception handling for loading podcasts

diff --git a/supersonic-main/src/main/java/net/sourceforge/subsonic/service/PodcastService.java b/subsonic-main/src/main/java/net/sourceforge/subsonic/service/PodcastService.java
index c93e809..80429ce 100644
--- a/subsonic-main/src/main/java/net/sourceforge/subsonic/service/PodcastService.java
+++ b/subsonic-main/src/main/java/net/sourceforge/subsonic/service/PodcastService.java
@@ -208,12 +208,19 @@ public class PodcastService {
}

private void addMediaFileIdToEpisodes(List<PodcastEpisode> episodes) {
- for (PodcastEpisode episode : episodes) {
- if (episode.getPath() != null) {
- MediaFile mediaFile = mediaFileService.getMediaFile(episode.getPath());
- if (mediaFile != null) {
- episode.setMediaFileId(mediaFile.getId());
- }
- }
- }
+ for (PodcastEpisode episode : episodes) {
+ try {
+ if (episode.getPath() != null) {
+ MediaFile mediaFile = mediaFileService.getMediaFile(episode.getPath());
+ if (mediaFile != null) {
+ episode.setMediaFileId(mediaFile.getId());
+ }
+ }
+ }
+ // If there was an error loading an episode, remove it.
+ catch (Exception e) {
+ podcastDao.deleteEpisode(episode.getId());
+ LOG.info("Deleted Podcast episode '" + episode.getTitle() + "' because:" e.getMessage());
+ }
+ }
}


You can get the full source with this patch from my git repo if you're having the same issue but don't know how to apply patches:

https://github.com/Rovanion/supersonic/ ... no-license