Skip to content

Commit

Permalink
Merge branch 'svn' of github.com:daneren2005/Subsonic-Plus
Browse files Browse the repository at this point in the history
  • Loading branch information
daneren2005 committed Dec 26, 2015
2 parents 3f33081 + a2b1eb5 commit 14cdaa7
Show file tree
Hide file tree
Showing 53 changed files with 1,029 additions and 319 deletions.
65 changes: 53 additions & 12 deletions subsonic-main/TODO.TXT
Original file line number Diff line number Diff line change
@@ -1,10 +1,52 @@
TODO IN 5.3
DONE IN 5.4
-----------
Artist thumbnail image
Show album year, song count, genre and duration
Show album notes
Sonos: Star/unstar tracks
Sonos: Artist bio and album notes
Sonos: Improved radio feature
Sonos: Artist top songs
Sonos: Nicer presentation on Android and iOS controllers
Sonos: Show artist image, if cached.
REST: Added getAlbumInfo and getAlbumInfo2
REST: Added playCount
Bugfix: Reimplemented cover art search using Last.fm
Bugfix: Ensure changed cover art is displayed

TODO IN 5.4
------------
Review forum comments.
HTML5 player?
http://forum.subsonic.org/forum/viewtopic.php?f=6&t=16239&p=69649
Google image search broken?
Ensure https
Cover art caching
Review scanning algorithm. Always visit children?
Ensure cover art is refreshed when changed.
REST: Artist image url?
Sonos: Star button missing on ipad
Don't queue following songs when playing from search results / starred songs.
https://mail.google.com/mail/ca/u/0/?zx=nmcjqt3dyrzj#inbox/15169f6c8b06cc1b
Remove Thumper?
https://mail.google.com/mail/ca/u/0/?zx=nmcjqt3dyrzj#inbox/151634428b1feffc

Last.fm song matching and playlists
http://forum.subsonic.org/forum/viewtopic.php?f=3&t=16126
Keyboard shortcuts
http://forum.subsonic.org/forum/viewtopic.php?f=3&t=15926
Status and log should only be available for admin.

Content length of FLAC transcoded to WAV incorrect
http://sourceforge.net/p/subsonic/bugs/121/
REST authentication not supported for LDAP users.
https://mail.google.com/mail/ca/u/0/#inbox/14fc35534d00d8e4
https://sourceforge.net/p/subsonic/bugs/158/
New server:
subsonic.canaca.com: 66.49.215.227
backup: forum -> subsonic.org

Site: Update SubStreamer
https://mail.google.com/mail/ca/u/0/#inbox/1505f8232760c3bf
Support ID3 lyrics
https://mail.google.com/mail/ca/u/0/#inbox/150960f1fc7133ac
Google Chart API
Expand All @@ -28,7 +70,6 @@ Port-forward https port also
Outdated SSL
https://mail.google.com/mail/ca/u/0/?zx=8dc6yomg8opi#inbox/14ef975868d1aaa5
Test with Windows 10
Status and log should only be available for admin.
Problem with updating "deep" folders?
https://mail.google.com/mail/ca/u/0/?zx=8dc6yomg8opi#inbox/14ee79c0a22dc5ed
Integrate with iTunes playlists
Expand All @@ -37,7 +78,6 @@ Make logout float right
Check jwplayer in external player
https://mail.google.com/mail/ca/u/0/?zx=8dc6yomg8opi#inbox/14ec51aec7f9f483
Change chromecast background.
Custom Sonos texts for starring.
Upgrade sonos wsdl.
AbstractMedia.summary
AbstractMedia.isFavorite
Expand Down Expand Up @@ -969,16 +1009,17 @@ order by n desc

Update subsonic.org
-----------------------------------
mkdir /var/lib/tomcat/webapps-2015-08-17/
scp subsonic-backend/target/subsonic-backend-*.war [email protected]:/var/lib/tomcat/webapps-2015-08-17/ROOT.war
scp subsonic-site/target/pages.war [email protected]:/var/lib/tomcat/webapps-2015-08-17/pages.war
mkdir /var/lib/tomcat/webapps-2015-10-25/
scp subsonic-backend/target/subsonic-backend-*.war [email protected]:/var/lib/tomcat/webapps-2015-10-25/ROOT.war
scp subsonic-site/target/pages.war [email protected]:/var/lib/tomcat/webapps-2015-10-25/pages.war

Checkpoint database (db.view)
cd /var/lib/tomcat
chown -R tomcat:tomcat webapps-2015-10-25
Checkpoint database (db.view)
ps -elf | grep tomcat
systemctl stop tomcat
rm webapps
ln -s webapps-2015-08-17 webapps
ln -s webapps-2015-10-25 webapps
ln -s /var/lib/tomcat/download webapps/download
ll webapps/
rm -rf work logs/*
Expand All @@ -987,13 +1028,13 @@ tail -f /var/subsonic-backend/subsonic-backend.log

Update demo.subsonic.org (192.157.241.116)
------------------------------------------
mkdir /var/lib/tomcat6/webapps-2015-08-17/
scp subsonic-main/target/subsonic.war [email protected]:/var/lib/tomcat6/webapps-2015-08-17/ROOT.war
mkdir /var/lib/tomcat6/webapps-2015-10-25/
scp subsonic-main/target/subsonic.war [email protected]:/var/lib/tomcat6/webapps-2015-10-25/ROOT.war
service tomcat6 stop
cd /var/lib/tomcat6/
rm -rf work/Catalina logs/*
rm webapps
ln -s webapps-2015-08-17 webapps
ln -s webapps-2015-10-25 webapps
ll webapps/
service tomcat6 start
tail -f /var/subsonic/subsonic.log
Expand Down
10 changes: 2 additions & 8 deletions subsonic-main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,8 @@

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava-base</artifactId>
<version>r03</version>
</dependency>

<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava-collections</artifactId>
<version>r03</version>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* This file is part of Subsonic.
*
* Subsonic is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Subsonic is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2015 (C) Sindre Mehus
*/

package net.sourceforge.subsonic.ajax;

/**
* @author Sindre Mehus
* @version $Id$
*/
public class AlbumInfo {

private final ArtistInfo artistInfo;
private final String notes;

public AlbumInfo(ArtistInfo artistInfo, String notes) {
this.artistInfo = artistInfo;
this.notes = notes;
}

public ArtistInfo getArtistInfo() {
return artistInfo;
}

public String getNotes() {
return notes;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;

import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse;
Expand All @@ -31,7 +32,9 @@
import org.apache.http.params.HttpConnectionParams;

import net.sourceforge.subsonic.Logger;
import net.sourceforge.subsonic.domain.LastFmCoverArt;
import net.sourceforge.subsonic.domain.MediaFile;
import net.sourceforge.subsonic.service.LastFmService;
import net.sourceforge.subsonic.service.MediaFileService;
import net.sourceforge.subsonic.service.SecurityService;
import net.sourceforge.subsonic.util.StringUtil;
Expand All @@ -49,6 +52,11 @@ public class CoverArtService {

private SecurityService securityService;
private MediaFileService mediaFileService;
private LastFmService lastFmService;

public List<LastFmCoverArt> searchCoverArt(String artist, String album) {
return lastFmService.searchCoverArt(artist, album);
}

/**
* Downloads and saves the cover art at the given URL.
Expand Down Expand Up @@ -161,4 +169,8 @@ public void setSecurityService(SecurityService securityService) {
public void setMediaFileService(MediaFileService mediaFileService) {
this.mediaFileService = mediaFileService;
}

public void setLastFmService(LastFmService lastFmService) {
this.lastFmService = lastFmService;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.directwebremoting.WebContextFactory;

import net.sourceforge.subsonic.Logger;
import net.sourceforge.subsonic.domain.AlbumNotes;
import net.sourceforge.subsonic.domain.ArtistBio;
import net.sourceforge.subsonic.domain.MediaFile;
import net.sourceforge.subsonic.domain.MusicFolder;
Expand Down Expand Up @@ -76,6 +77,13 @@ public ArtistInfo getArtistInfo(int mediaFileId, int maxSimilarArtists, int maxT
return new ArtistInfo(similarArtists, artistBio, topSongs);
}

public AlbumInfo getAlbumInfo(int mediaFileId, int maxSimilarArtists) {
MediaFile mediaFile = mediaFileService.getMediaFile(mediaFileId);
AlbumNotes albumNotes = lastFmService.getAlbumNotes(mediaFile);
ArtistInfo artistInfo = getArtistInfo(mediaFileId, maxSimilarArtists, 0);
return new AlbumInfo(artistInfo, albumNotes == null ? null : albumNotes.getNotes());
}

private List<TopSong> getTopSongs(MediaFile mediaFile, int limit) {
HttpServletRequest request = WebContextFactory.get().getHttpServletRequest();
String username = securityService.getCurrentUsername(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.ParameterizableViewController;
Expand All @@ -48,10 +49,10 @@ protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpSer
String album = request.getParameter("album");
MediaFile dir = mediaFileService.getMediaFile(id);

if (artist == null) {
if (StringUtils.isBlank(artist)) {
artist = dir.getArtist();
}
if (album == null) {
if (StringUtils.isBlank(album)) {
album = dir.getAlbumName();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import net.sourceforge.subsonic.domain.CoverArtScheme;
import net.sourceforge.subsonic.domain.MediaFile;
import net.sourceforge.subsonic.domain.MediaFileComparator;
import net.sourceforge.subsonic.domain.MusicFolder;
import net.sourceforge.subsonic.domain.Player;
import net.sourceforge.subsonic.domain.UserSettings;
import net.sourceforge.subsonic.service.AdService;
Expand All @@ -48,6 +47,7 @@
import net.sourceforge.subsonic.service.RatingService;
import net.sourceforge.subsonic.service.SecurityService;
import net.sourceforge.subsonic.service.SettingsService;
import net.sourceforge.subsonic.util.StringUtil;

/**
* Controller for the main page.
Expand Down Expand Up @@ -122,16 +122,9 @@ protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpSer
map.put("viewAsList", isViewAsList(request, userSettings));
if (dir.isAlbum()) {
map.put("sieblingAlbums", getSieblingAlbums(dir));
map.put("artist", guessArtist(children));
map.put("album", guessAlbum(children));
}

try {
MediaFile parent = mediaFileService.getParentOf(dir);
map.put("parent", parent);
map.put("navigateUpAllowed", !mediaFileService.isRoot(parent));
} catch (SecurityException x) {
// Happens if Podcast directory is outside music folder.
map.put("artist", guessArtist(files));
map.put("album", guessAlbum(files));
map.put("duration", StringUtil.formatDuration(getDuration(files)));
}

Integer userRating = ratingService.getRatingForUser(username, dir);
Expand Down Expand Up @@ -203,24 +196,34 @@ private List<MediaFile> getMediaFiles(HttpServletRequest request) {
return mediaFiles;
}

private String guessArtist(List<MediaFile> children) {
for (MediaFile child : children) {
if (child.isFile() && child.getArtist() != null) {
return child.getArtist();
private String guessArtist(List<MediaFile> files) {
for (MediaFile file : files) {
if (file.isFile() && file.getArtist() != null) {
return file.getArtist();
}
}
return null;
}

private String guessAlbum(List<MediaFile> children) {
for (MediaFile child : children) {
if (child.isFile() && child.getArtist() != null) {
return child.getAlbumName();
private String guessAlbum(List<MediaFile> files) {
for (MediaFile file : files) {
if (file.isFile() && file.getArtist() != null) {
return file.getAlbumName();
}
}
return null;
}

private int getDuration(List<MediaFile> files) {
int duration = 0;
for (MediaFile file : files) {
if (file.isFile() && file.getDurationSeconds() != null) {
duration += file.getDurationSeconds();
}
}
return duration;
}

private List<MediaFile> getMultiFolderChildren(List<MediaFile> mediaFiles) throws IOException {
SortedSet<MediaFile> result = new TreeSet<MediaFile>(new MediaFileComparator(settingsService.isSortAlbumsByYear()));
for (MediaFile mediaFile : mediaFiles) {
Expand Down
Loading

0 comments on commit 14cdaa7

Please sign in to comment.