Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#265 support m4b audiobook #409

Merged
merged 9 commits into from
Apr 5, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class MusicFolderSettingsCommand {
private String excludePatternString;
private boolean ignoreSymLinks;
private boolean enableCueIndexing;
private boolean hideIndexedFiles;
private boolean hideVirtualTracks;
private Boolean fullScan;
private Boolean clearFullScanSettingAfterScan;

Expand Down Expand Up @@ -149,12 +149,12 @@ public void setEnableCueIndexing(boolean enableCueIndexing) {
this.enableCueIndexing = enableCueIndexing;
}

public boolean getHideIndexedFiles() {
return hideIndexedFiles;
public boolean isHideVirtualTracks() {
return hideVirtualTracks;
}

public void setHideIndexedFiles(boolean hideIndexedFiles) {
this.hideIndexedFiles = hideIndexedFiles;
public void setHideVirtualTracks(boolean hideVirtualTracks) {
this.hideVirtualTracks = hideVirtualTracks;
}

public void setIgnoreSymLinks(boolean ignoreSymLinks) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package org.airsonic.player.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "airsonic.cue")
public class AirsonicCueConfig {

private static final Logger LOG = LoggerFactory.getLogger(AirsonicCueConfig.class);

// properties
private boolean enabled;
private boolean hideIndexedFiles;
Expand All @@ -24,6 +28,7 @@ public void setEnabled(boolean enabled) {
}

public void setHideIndexedFiles(boolean hideIndexedFiles) {
LOG.warn("deprecated property 'airsonic.cue.hide-indexed-files'. Use 'airsonic.hide-virtual-tracks' instead.");
this.hideIndexedFiles = hideIndexedFiles;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

@Component
@ConfigurationProperties(prefix = "airsonic")
public class AirsonicDefaultFolderConfig {
public class AirsonicFolderConfig {

// constants
private static final String DEFAULT_MUSIC_FOLDER_WINDOWS = "c:\\music";
Expand All @@ -41,6 +41,10 @@ public class AirsonicDefaultFolderConfig {
private String defaultPodcastFolder = Util.isWindows() ? DEFAULT_PODCAST_FOLDER_WINDOWS : DEFAULT_PODCAST_FOLDER_OTHER;
// airsonic.defaultPlaylistFolder
private String defaultPlaylistFolder = Util.isWindows() ? DEFAULT_PLAYLIST_FOLDER_WINDOWS : DEFAULT_PLAYLIST_FOLDER_OTHER;
// airsonic.hideVirtualTracks
private boolean hideVirtualTracks = true;



/**
* Returns the directory
Expand Down Expand Up @@ -69,6 +73,10 @@ public String getDefaultPlaylistFolder() {
return defaultPlaylistFolder;
}

public boolean isHideVirtualTracks() {
return hideVirtualTracks;
}

public void setDefaultMusicFolder(String defaultMusicFolder) {
this.defaultMusicFolder = getFolderProperty(defaultMusicFolder, DEFAULT_MUSIC_FOLDER_WINDOWS, DEFAULT_MUSIC_FOLDER_OTHER);
}
Expand All @@ -80,4 +88,8 @@ public void setDefaultPodcastFolder(String defaultPodcastFolder) {
public void setDefaultPlaylistFolder(String defaultPlaylistFolder) {
this.defaultPlaylistFolder = getFolderProperty(defaultPlaylistFolder, DEFAULT_PLAYLIST_FOLDER_WINDOWS, DEFAULT_PLAYLIST_FOLDER_OTHER);
}

public void setHideVirtualTracks(boolean hideVirtualTracks) {
this.hideVirtualTracks = hideVirtualTracks;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected void formBackingObject(@RequestParam(value = "scanNow", required = fal
command.setExcludePatternString(settingsService.getExcludePatternString());
command.setIgnoreSymLinks(settingsService.getIgnoreSymLinks());
command.setEnableCueIndexing(settingsService.getEnableCueIndexing());
command.setHideIndexedFiles(settingsService.getEnableCueIndexing() && settingsService.getHideIndexedFiles());
command.setHideVirtualTracks(settingsService.getHideVirtualTracks());
command.setFullScan(settingsService.getFullScan());
command.setClearFullScanSettingAfterScan(!settingsService.getFullScan() ? settingsService.getFullScan() : settingsService.getClearFullScanSettingAfterScan());

Expand Down Expand Up @@ -207,7 +207,7 @@ protected String onSubmit(@ModelAttribute("command") MusicFolderSettingsCommand
settingsService.setExcludePatternString(command.getExcludePatternString());
settingsService.setIgnoreSymLinks(command.getIgnoreSymLinks());
settingsService.setEnableCueIndexing(command.isEnableCueIndexing());
settingsService.setHideIndexedFiles(command.isEnableCueIndexing() && command.getHideIndexedFiles());
settingsService.setHideVirtualTracks(command.isHideVirtualTracks());
settingsService.setFullScan(command.getFullScan());
settingsService.setClearFullScanSettingAfterScan(!command.getFullScan() ? command.getFullScan() : command.getClearFullScanSettingAfterScan());
settingsService.save();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@
import org.springframework.util.StreamUtils;
import org.springframework.web.bind.ServletRequestBindingException;
import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.context.request.ServletWebRequest;
import org.springframework.web.context.request.async.AsyncRequestNotUsableException;

import jakarta.servlet.http.HttpServletRequest;

Expand Down Expand Up @@ -279,6 +281,11 @@ public ResponseEntity<Resource> handleRequest(Authentication authentication,
return ResponseEntity.ok().headers(headers).body(resource);
}

@ExceptionHandler(AsyncRequestNotUsableException.class)
public void handleAsyncRequestNotUsableException(AsyncRequestNotUsableException e) {
LOG.info("Client Aborted");
}

private void scrobble(MediaFile mediaFile, Player player, boolean submission) {
// Don't scrobble REST players (except Sonos)
if (player.getClientId() == null || player.getClientId().equals(SonosHelper.AIRSONIC_CLIENT_ID)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ public class CoverArtCreateService {
@Autowired
private CoverArtService coverArtService;

@Autowired
private JaudiotaggerParser jaudiotaggerParser;

@Autowired
private PlaylistService playlistService;

Expand Down Expand Up @@ -315,7 +312,7 @@ private InputStream getImageInputStream(CoverArt art) throws IOException {
public Pair<InputStream, String> getImageInputStreamWithType(Path file) throws IOException {
InputStream is;
String mimeType;
if (jaudiotaggerParser.isApplicable(file)) {
if (JaudiotaggerParser.isImageAvailable(file)) {
LOG.trace("Using Jaudio Tagger for reading artwork from {}", file);
try {
LOG.trace("Reading artwork from file {}", file);
Expand Down
Loading