Merge remote-tracking branch 'upstream/develop' into biconou_develop_PR_SpringBoot

master
Rémi Cocula 8 years ago
commit 08942fe9c5
  1. 2
      libresonic-main/src/main/java/org/libresonic/player/ajax/PlayQueueService.java
  2. 7
      libresonic-main/src/main/java/org/libresonic/player/dao/MusicFolderDao.java
  3. 2
      libresonic-main/src/main/java/org/libresonic/player/dao/UserDao.java
  4. 5
      libresonic-main/src/main/java/org/libresonic/player/service/SettingsService.java
  5. 2
      libresonic-main/src/main/resources/applicationContext-db-legacy.xml
  6. 1
      libresonic-main/src/main/resources/applicationContext-service.xml
  7. 10
      libresonic-main/src/main/webapp/WEB-INF/jsp/playQueue.jsp
  8. 2
      libresonic-main/src/main/webapp/WEB-INF/jsp/playQueueCast.jsp
  9. 43
      libresonic-main/src/main/webapp/script/cast_sender-v1.js
  10. 1
      libresonic-main/src/test/java/org/libresonic/player/dao/DaoTestCaseBase.java

@ -697,7 +697,7 @@ public class PlayQueueService {
} }
private String formatFormat(Player player, MediaFile file) { private String formatFormat(Player player, MediaFile file) {
return transcodingService.getSuffix(player, file, null); return file.getFormat();
} }
private String formatContentType(String format) { private String formatContentType(String format) {

@ -40,6 +40,8 @@ public class MusicFolderDao extends AbstractDao {
private static final String QUERY_COLUMNS = "id, " + INSERT_COLUMNS; private static final String QUERY_COLUMNS = "id, " + INSERT_COLUMNS;
private final MusicFolderRowMapper rowMapper = new MusicFolderRowMapper(); private final MusicFolderRowMapper rowMapper = new MusicFolderRowMapper();
private UserDao userDao;
/** /**
* Returns all music folders. * Returns all music folders.
* *
@ -60,7 +62,7 @@ public class MusicFolderDao extends AbstractDao {
update(sql, musicFolder.getPath(), musicFolder.getName(), musicFolder.isEnabled(), musicFolder.getChanged()); update(sql, musicFolder.getPath(), musicFolder.getName(), musicFolder.isEnabled(), musicFolder.getChanged());
Integer id = queryForInt("select max(id) from music_folder", 0); Integer id = queryForInt("select max(id) from music_folder", 0);
update("insert into music_folder_user (music_folder_id, username) select ?, username from user", id); update("insert into music_folder_user (music_folder_id, username) select ?, username from " + userDao.getUserTable(), id);
LOG.info("Created music folder " + musicFolder.getPath()); LOG.info("Created music folder " + musicFolder.getPath());
} }
@ -105,4 +107,7 @@ public class MusicFolderDao extends AbstractDao {
} }
} }
public void setUserDao(UserDao userDao) {
this.userDao = userDao;
}
} }

@ -358,7 +358,7 @@ public class UserDao extends AbstractDao {
} }
} }
private String getUserTable() { String getUserTable() {
return userTableQuote + "user" + userTableQuote; return userTableQuote + "user" + userTableQuote;
} }

@ -217,6 +217,10 @@ public class SettingsService {
private List<MusicFolder> cachedMusicFolders; private List<MusicFolder> cachedMusicFolders;
private final ConcurrentMap<String, List<MusicFolder>> cachedMusicFoldersPerUser = new ConcurrentHashMap<String, List<MusicFolder>>(); private final ConcurrentMap<String, List<MusicFolder>> cachedMusicFoldersPerUser = new ConcurrentHashMap<String, List<MusicFolder>>();
private final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
private static final long LOCAL_IP_LOOKUP_DELAY_SECONDS = 60;
private String localIpAddress; private String localIpAddress;
private void removeObseleteProperties() { private void removeObseleteProperties() {
@ -1285,6 +1289,7 @@ public class SettingsService {
localIpAddress = Util.getLocalIpAddress(); localIpAddress = Util.getLocalIpAddress();
} }
}; };
executor.scheduleWithFixedDelay(task,0, LOCAL_IP_LOOKUP_DELAY_SECONDS, TimeUnit.SECONDS);
} }
public void setInternetRadioDao(InternetRadioDao internetRadioDao) { public void setInternetRadioDao(InternetRadioDao internetRadioDao) {

@ -8,7 +8,7 @@
class="org.springframework.jdbc.datasource.DriverManagerDataSource"> class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver" /> <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
<property name="url" value="jdbc:hsqldb:file:#{systemProperties['libresonic.home']}/db/libresonic" /> <property name="url" value="jdbc:hsqldb:file:#{T(org.libresonic.player.service.SettingsService).libresonicHome.path}/db/libresonic" />
<property name="username" value="sa" /> <property name="username" value="sa" />
<property name="password" value="" /> <property name="password" value="" />
</bean> </bean>

@ -45,6 +45,7 @@
<bean id="musicFolderDao" class="org.libresonic.player.dao.MusicFolderDao"> <bean id="musicFolderDao" class="org.libresonic.player.dao.MusicFolderDao">
<property name="daoHelper" ref="daoHelper"/> <property name="daoHelper" ref="daoHelper"/>
<property name="userDao" ref="userDao" />
</bean> </bean>
<bean id="userDao" class="org.libresonic.player.dao.UserDao"> <bean id="userDao" class="org.libresonic.player.dao.UserDao">

@ -11,7 +11,6 @@
<script type="text/javascript" src="<c:url value="/dwr/engine.js"/>"></script> <script type="text/javascript" src="<c:url value="/dwr/engine.js"/>"></script>
<script type="text/javascript" src="<c:url value="/dwr/util.js"/>"></script> <script type="text/javascript" src="<c:url value="/dwr/util.js"/>"></script>
<script type="text/javascript" src="<c:url value="/script/jwplayer-5.10.min.js"/>"></script> <script type="text/javascript" src="<c:url value="/script/jwplayer-5.10.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="/script/cast_sender-v1.js"/>"></script>
<%@ include file="playQueueCast.jsp" %> <%@ include file="playQueueCast.jsp" %>
<link type="text/css" rel="stylesheet" href="<c:url value="/script/webfx/luna.css"/>"> <link type="text/css" rel="stylesheet" href="<c:url value="/script/webfx/luna.css"/>">
<style type="text/css"> <style type="text/css">
@ -846,4 +845,13 @@
<div id="dialog-select-playlist-list"></div> <div id="dialog-select-playlist-list"></div>
</div> </div>
<script type="text/javascript">
window['__onGCastApiAvailable'] = function(isAvailable) {
if (isAvailable) {
CastPlayer.initializeCastPlayer();
}
};
</script>
<script type="text/javascript" src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1"></script>
</body></html> </body></html>

@ -7,8 +7,6 @@
this.castSession = null; this.castSession = null;
this.mediaSession = null; this.mediaSession = null;
this.volume = 1.0; this.volume = 1.0;
this.initializeCastPlayer();
}; };
CastPlayer.prototype.initializeCastPlayer = function () { CastPlayer.prototype.initializeCastPlayer = function () {

@ -1,43 +0,0 @@
(function() {var chrome = window.chrome || {};
chrome.cast = chrome.cast || {};
chrome.cast.media = chrome.cast.media || {};
chrome.cast.ApiBootstrap_ = function() {
};
chrome.cast.ApiBootstrap_.EXTENSION_IDS = ["boadgeojelhgndaghljhdicfkmllpafd", "dliochdbjfkdbacpmhlcpmleaejidimm", "hfaagokkkhdbgiakmmlclaapfelnkoah", "fmfcbgogabcbclcofgocippekhfcmgfj", "enhhojjnijigcajfphajepfemndkmdlo"];
chrome.cast.ApiBootstrap_.findInstalledExtension_ = function(callback) {
chrome.cast.ApiBootstrap_.findInstalledExtensionHelper_(0, callback);
};
chrome.cast.ApiBootstrap_.findInstalledExtensionHelper_ = function(index, callback) {
index == chrome.cast.ApiBootstrap_.EXTENSION_IDS.length ? callback(null) : chrome.cast.ApiBootstrap_.isExtensionInstalled_(chrome.cast.ApiBootstrap_.EXTENSION_IDS[index], function(installed) {
installed ? callback(chrome.cast.ApiBootstrap_.EXTENSION_IDS[index]) : chrome.cast.ApiBootstrap_.findInstalledExtensionHelper_(index + 1, callback);
});
};
chrome.cast.ApiBootstrap_.getCastSenderUrl_ = function(extensionId) {
return "chrome-extension://" + extensionId + "/cast_sender.js";
};
chrome.cast.ApiBootstrap_.isExtensionInstalled_ = function(extensionId, callback) {
var xmlhttp = new XMLHttpRequest;
xmlhttp.onreadystatechange = function() {
4 == xmlhttp.readyState && 200 == xmlhttp.status && callback(!0);
};
xmlhttp.onerror = function() {
callback(!1);
};
xmlhttp.open("GET", chrome.cast.ApiBootstrap_.getCastSenderUrl_(extensionId), !0);
xmlhttp.send();
};
chrome.cast.ApiBootstrap_.findInstalledExtension_(function(extensionId) {
if (extensionId) {
console.log("Found cast extension: " + extensionId);
chrome.cast.extensionId = extensionId;
var apiScript = document.createElement("script");
apiScript.src = chrome.cast.ApiBootstrap_.getCastSenderUrl_(extensionId);
(document.head || document.documentElement).appendChild(apiScript);
} else {
var msg = "No cast extension found";
console.log(msg);
var callback = window.__onGCastApiAvailable;
callback && "function" == typeof callback && callback(!1, msg);
}
});
})();

@ -59,6 +59,7 @@ public abstract class DaoTestCaseBase extends TestCase {
internetRadioDao.setDaoHelper(daoHelper); internetRadioDao.setDaoHelper(daoHelper);
ratingDao.setDaoHelper(daoHelper); ratingDao.setDaoHelper(daoHelper);
musicFolderDao.setDaoHelper(daoHelper); musicFolderDao.setDaoHelper(daoHelper);
musicFolderDao.setUserDao(userDao);
userDao.setDaoHelper(daoHelper); userDao.setDaoHelper(daoHelper);
transcodingDao.setDaoHelper(daoHelper); transcodingDao.setDaoHelper(daoHelper);
podcastDao.setDaoHelper(daoHelper); podcastDao.setDaoHelper(daoHelper);

Loading…
Cancel
Save