fixing #1895, plus cleaning up some search/browse code
This commit is contained in:
parent
b0f60b4a4a
commit
07d057b69b
12 changed files with 136 additions and 143 deletions
|
@ -351,7 +351,7 @@ class StorageClientInterface
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for audio clips or playlists. The results can be read
|
* Search for audio clips or playlists. The results can be read
|
||||||
* using getSearchResults().
|
* using getLocalSearchResults().
|
||||||
*
|
*
|
||||||
* @param sessionId the session ID from the authentication client
|
* @param sessionId the session ID from the authentication client
|
||||||
* @param searchCriteria an object containing the search criteria
|
* @param searchCriteria an object containing the search criteria
|
||||||
|
@ -410,7 +410,7 @@ class StorageClientInterface
|
||||||
*
|
*
|
||||||
* If this search is in the finishedState, it will be moved to the
|
* If this search is in the finishedState, it will be moved to the
|
||||||
* closedState, the transport token will be invalidated, and the
|
* closedState, the transport token will be invalidated, and the
|
||||||
* search results can be read using getSearchResults().
|
* search results can be read using getRemoteSearchResults().
|
||||||
*
|
*
|
||||||
* If the search is in any other state, an exception is raised.
|
* If the search is in any other state, an exception is raised.
|
||||||
*
|
*
|
||||||
|
@ -435,18 +435,27 @@ class StorageClientInterface
|
||||||
SearchResultsType;
|
SearchResultsType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the list of items found by the latest search.
|
* Return the list of items found by the latest local search.
|
||||||
*
|
*
|
||||||
* (Or the list of items returned by reset() -- used for testing.)
|
* (Or the list of items returned by reset() -- used for testing.)
|
||||||
*
|
*
|
||||||
* @return a vector of Playable objects.
|
* @return a vector of Playable objects.
|
||||||
*/
|
*/
|
||||||
virtual Ptr<SearchResultsType>::Ref
|
virtual Ptr<SearchResultsType>::Ref
|
||||||
getSearchResults(void) throw () = 0;
|
getLocalSearchResults(void) throw () = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the list of items found by the latest remote search.
|
||||||
|
*
|
||||||
|
* @return a vector of Playable objects.
|
||||||
|
*/
|
||||||
|
virtual Ptr<SearchResultsType>::Ref
|
||||||
|
getRemoteSearchResults(void) throw () = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset the storage to its initial state.
|
* Reset the storage to its initial state.
|
||||||
* The contents of the storage can be read using getSearchResults().
|
* The contents of the storage can be read using
|
||||||
|
* getLocalSearchResults().
|
||||||
* Used for testing.
|
* Used for testing.
|
||||||
*
|
*
|
||||||
* @exception XmlRpcException if the server returns an error.
|
* @exception XmlRpcException if the server returns an error.
|
||||||
|
|
|
@ -250,7 +250,7 @@ TestStorageClient :: reset(void)
|
||||||
= nodes.begin();
|
= nodes.begin();
|
||||||
playlistMap.clear();
|
playlistMap.clear();
|
||||||
editedPlaylists.clear();
|
editedPlaylists.clear();
|
||||||
searchResults.reset(new SearchResultsType);
|
localSearchResults.reset(new SearchResultsType);
|
||||||
|
|
||||||
while (it != nodes.end()) {
|
while (it != nodes.end()) {
|
||||||
Ptr<Playlist>::Ref playlist(new Playlist);
|
Ptr<Playlist>::Ref playlist(new Playlist);
|
||||||
|
@ -258,7 +258,7 @@ TestStorageClient :: reset(void)
|
||||||
dynamic_cast<const xmlpp::Element*> (*it);
|
dynamic_cast<const xmlpp::Element*> (*it);
|
||||||
playlist->configure(*element);
|
playlist->configure(*element);
|
||||||
playlistMap[playlist->getId()->getId()] = playlist;
|
playlistMap[playlist->getId()->getId()] = playlist;
|
||||||
searchResults->push_back(playlist);
|
localSearchResults->push_back(playlist);
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,7 +279,7 @@ TestStorageClient :: reset(void)
|
||||||
audioClip->setUri(nullPointer);
|
audioClip->setUri(nullPointer);
|
||||||
}
|
}
|
||||||
audioClipMap[audioClip->getId()->getId()] = audioClip;
|
audioClipMap[audioClip->getId()->getId()] = audioClip;
|
||||||
searchResults->push_back(audioClip);
|
localSearchResults->push_back(audioClip);
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -801,14 +801,14 @@ TestStorageClient :: search(Ptr<SessionId>::Ref sessionId,
|
||||||
last = 0;
|
last = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
searchResults.reset(new SearchResultsType);
|
localSearchResults.reset(new SearchResultsType);
|
||||||
|
|
||||||
if (searchCriteria->type == "audioclip" || searchCriteria->type == "all") {
|
if (searchCriteria->type == "audioclip" || searchCriteria->type == "all") {
|
||||||
AudioClipMapType::const_iterator it = audioClipMap.begin();
|
AudioClipMapType::const_iterator it = audioClipMap.begin();
|
||||||
while (it != audioClipMap.end()) {
|
while (it != audioClipMap.end()) {
|
||||||
if (matchesCriteria(it->second, searchCriteria)) {
|
if (matchesCriteria(it->second, searchCriteria)) {
|
||||||
if (counter >= first && (!last || counter < last)) {
|
if (counter >= first && (!last || counter < last)) {
|
||||||
searchResults->push_back(it->second);
|
localSearchResults->push_back(it->second);
|
||||||
}
|
}
|
||||||
++counter;
|
++counter;
|
||||||
}
|
}
|
||||||
|
@ -821,7 +821,7 @@ TestStorageClient :: search(Ptr<SessionId>::Ref sessionId,
|
||||||
while (it != playlistMap.end()) {
|
while (it != playlistMap.end()) {
|
||||||
if (matchesCriteria(it->second, searchCriteria)) {
|
if (matchesCriteria(it->second, searchCriteria)) {
|
||||||
if (counter >= first && (!last || counter < last)) {
|
if (counter >= first && (!last || counter < last)) {
|
||||||
searchResults->push_back(it->second);
|
localSearchResults->push_back(it->second);
|
||||||
}
|
}
|
||||||
++counter;
|
++counter;
|
||||||
}
|
}
|
||||||
|
@ -975,7 +975,8 @@ TestStorageClient :: getAllPlaylists(Ptr<SessionId>::Ref sessionId,
|
||||||
new std::vector<Ptr<Playlist>::Ref>);
|
new std::vector<Ptr<Playlist>::Ref>);
|
||||||
|
|
||||||
SearchResultsType::const_iterator it;
|
SearchResultsType::const_iterator it;
|
||||||
for (it = searchResults->begin(); it != searchResults->end(); ++it) {
|
for (it = localSearchResults->begin();
|
||||||
|
it != localSearchResults->end(); ++it) {
|
||||||
Ptr<Playlist>::Ref playlist = (*it)->getPlaylist();
|
Ptr<Playlist>::Ref playlist = (*it)->getPlaylist();
|
||||||
if (playlist) {
|
if (playlist) {
|
||||||
playlists->push_back(playlist);
|
playlists->push_back(playlist);
|
||||||
|
@ -1005,7 +1006,8 @@ TestStorageClient :: getAllAudioClips(Ptr<SessionId>::Ref sessionId,
|
||||||
new std::vector<Ptr<AudioClip>::Ref>);
|
new std::vector<Ptr<AudioClip>::Ref>);
|
||||||
|
|
||||||
SearchResultsType::const_iterator it;
|
SearchResultsType::const_iterator it;
|
||||||
for (it = searchResults->begin(); it != searchResults->end(); ++it) {
|
for (it = localSearchResults->begin();
|
||||||
|
it != localSearchResults->end(); ++it) {
|
||||||
Ptr<AudioClip>::Ref audioClip = (*it)->getAudioClip();
|
Ptr<AudioClip>::Ref audioClip = (*it)->getAudioClip();
|
||||||
if (audioClip) {
|
if (audioClip) {
|
||||||
audioClips->push_back(audioClip);
|
audioClips->push_back(audioClip);
|
||||||
|
|
|
@ -160,7 +160,7 @@ class TestStorageClient :
|
||||||
/**
|
/**
|
||||||
* A vector containing the items returned by search() or by reset().
|
* A vector containing the items returned by search() or by reset().
|
||||||
*/
|
*/
|
||||||
Ptr<SearchResultsType>::Ref searchResults;
|
Ptr<SearchResultsType>::Ref localSearchResults;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Auxilliary method used by search().
|
* Auxilliary method used by search().
|
||||||
|
@ -467,7 +467,7 @@ class TestStorageClient :
|
||||||
* Reset the storage to its initial state.
|
* Reset the storage to its initial state.
|
||||||
* Re-initializes the storage based on the xml element which was
|
* Re-initializes the storage based on the xml element which was
|
||||||
* passed to configure() earlier; the new contents of the storage
|
* passed to configure() earlier; the new contents of the storage
|
||||||
* can be read using getSearchResults().
|
* can be read using getLocalSearchResults().
|
||||||
* Used for testing.
|
* Used for testing.
|
||||||
*
|
*
|
||||||
* @exception XmlRpcException if the server returns an error.
|
* @exception XmlRpcException if the server returns an error.
|
||||||
|
@ -479,7 +479,7 @@ class TestStorageClient :
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for audio clips or playlists. The results can be read
|
* Search for audio clips or playlists. The results can be read
|
||||||
* using getSearchResults().
|
* using getLocalSearchResults().
|
||||||
*
|
*
|
||||||
* If an audio clip or playlist does not have a metadata field X,
|
* If an audio clip or playlist does not have a metadata field X,
|
||||||
* it does not match any condition about field X. In particular,
|
* it does not match any condition about field X. In particular,
|
||||||
|
@ -544,7 +544,7 @@ class TestStorageClient :
|
||||||
*
|
*
|
||||||
* If this search is in the finishedState, it will be moved to the
|
* If this search is in the finishedState, it will be moved to the
|
||||||
* closedState, the transport token will be invalidated, and the
|
* closedState, the transport token will be invalidated, and the
|
||||||
* search results can be read using getSearchResults().
|
* search results can be read using getRemoteSearchResults().
|
||||||
*
|
*
|
||||||
* If the search is in any other state, an exception is raised.
|
* If the search is in any other state, an exception is raised.
|
||||||
*
|
*
|
||||||
|
@ -562,16 +562,29 @@ class TestStorageClient :
|
||||||
throw (XmlRpcException);
|
throw (XmlRpcException);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the list of items found by the search method.
|
* Return the list of items found by the local search method.
|
||||||
*
|
*
|
||||||
* (Or the list of items returned by reset() -- used for testing.)
|
* (Or the list of items returned by reset() -- used for testing.)
|
||||||
*
|
*
|
||||||
* @return a vector of Playable objects.
|
* @return a vector of Playable objects.
|
||||||
*/
|
*/
|
||||||
virtual Ptr<SearchResultsType>::Ref
|
virtual Ptr<SearchResultsType>::Ref
|
||||||
getSearchResults(void) throw ()
|
getLocalSearchResults(void) throw ()
|
||||||
{
|
{
|
||||||
return searchResults;
|
return localSearchResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the list of items found by the remote search method.
|
||||||
|
* NOT IMPLEMENTED, always returns 0.
|
||||||
|
*
|
||||||
|
* @return a vector of Playable objects.
|
||||||
|
*/
|
||||||
|
virtual Ptr<SearchResultsType>::Ref
|
||||||
|
getRemoteSearchResults(void) throw ()
|
||||||
|
{
|
||||||
|
Ptr<SearchResultsType>::Ref nullPointer;
|
||||||
|
return nullPointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -171,7 +171,7 @@ TestStorageClientTest :: resetTest(void)
|
||||||
CPPUNIT_FAIL(e.what());
|
CPPUNIT_FAIL(e.what());
|
||||||
}
|
}
|
||||||
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
||||||
= tsc->getSearchResults();
|
= tsc->getLocalSearchResults();
|
||||||
CPPUNIT_ASSERT(searchResults);
|
CPPUNIT_ASSERT(searchResults);
|
||||||
CPPUNIT_ASSERT(searchResults->size() >= 4);
|
CPPUNIT_ASSERT(searchResults->size() >= 4);
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ TestStorageClientTest :: audioClipTest(void)
|
||||||
CPPUNIT_FAIL(e.what());
|
CPPUNIT_FAIL(e.what());
|
||||||
}
|
}
|
||||||
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
||||||
= tsc->getSearchResults();
|
= tsc->getLocalSearchResults();
|
||||||
CPPUNIT_ASSERT(searchResults);
|
CPPUNIT_ASSERT(searchResults);
|
||||||
CPPUNIT_ASSERT(searchResults->size() >= 3);
|
CPPUNIT_ASSERT(searchResults->size() >= 3);
|
||||||
|
|
||||||
|
@ -388,8 +388,8 @@ TestStorageClientTest :: searchTest(void)
|
||||||
|
|
||||||
int numberFound = tsc->search(dummySessionId, criteria);
|
int numberFound = tsc->search(dummySessionId, criteria);
|
||||||
CPPUNIT_ASSERT(numberFound == 2);
|
CPPUNIT_ASSERT(numberFound == 2);
|
||||||
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref
|
||||||
= tsc->getSearchResults();
|
searchResults = tsc->getLocalSearchResults();
|
||||||
CPPUNIT_ASSERT(searchResults->size() == 2);
|
CPPUNIT_ASSERT(searchResults->size() == 2);
|
||||||
CPPUNIT_ASSERT(searchResults->at(0)->getId()->getId() == 0x10001);
|
CPPUNIT_ASSERT(searchResults->at(0)->getId()->getId() == 0x10001);
|
||||||
CPPUNIT_ASSERT(searchResults->at(1)->getId()->getId() == 0x10003);
|
CPPUNIT_ASSERT(searchResults->at(1)->getId()->getId() == 0x10003);
|
||||||
|
@ -406,8 +406,8 @@ TestStorageClientTest :: searchTest(void)
|
||||||
criteria->addCondition("dc:title", "prefix", "Playlist");
|
criteria->addCondition("dc:title", "prefix", "Playlist");
|
||||||
int numberFound = tsc->search(dummySessionId, criteria);
|
int numberFound = tsc->search(dummySessionId, criteria);
|
||||||
CPPUNIT_ASSERT(numberFound == 3);
|
CPPUNIT_ASSERT(numberFound == 3);
|
||||||
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref
|
||||||
= tsc->getSearchResults();
|
searchResults = tsc->getLocalSearchResults();
|
||||||
CPPUNIT_ASSERT(searchResults->size() == 3);
|
CPPUNIT_ASSERT(searchResults->size() == 3);
|
||||||
CPPUNIT_ASSERT(searchResults->at(0)->getId()->getId() == 0x10002);
|
CPPUNIT_ASSERT(searchResults->at(0)->getId()->getId() == 0x10002);
|
||||||
CPPUNIT_ASSERT(searchResults->at(1)->getId()->getId() == 1);
|
CPPUNIT_ASSERT(searchResults->at(1)->getId()->getId() == 1);
|
||||||
|
@ -427,8 +427,8 @@ TestStorageClientTest :: searchTest(void)
|
||||||
criteria->setOffset(1);
|
criteria->setOffset(1);
|
||||||
int numberFound = tsc->search(dummySessionId, criteria);
|
int numberFound = tsc->search(dummySessionId, criteria);
|
||||||
CPPUNIT_ASSERT(numberFound == 4);
|
CPPUNIT_ASSERT(numberFound == 4);
|
||||||
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref
|
||||||
= tsc->getSearchResults();
|
searchResults = tsc->getLocalSearchResults();
|
||||||
CPPUNIT_ASSERT(searchResults->size() == 2);
|
CPPUNIT_ASSERT(searchResults->size() == 2);
|
||||||
CPPUNIT_ASSERT(searchResults->at(0)->getId()->getId() == 0x10003);
|
CPPUNIT_ASSERT(searchResults->at(0)->getId()->getId() == 0x10003);
|
||||||
CPPUNIT_ASSERT(searchResults->at(1)->getId()->getId() == 1);
|
CPPUNIT_ASSERT(searchResults->at(1)->getId()->getId() == 1);
|
||||||
|
|
|
@ -2097,7 +2097,7 @@ WebStorageClient :: reset(void)
|
||||||
|
|
||||||
execute(resetStorageMethodName, parameters, result);
|
execute(resetStorageMethodName, parameters, result);
|
||||||
|
|
||||||
extractSearchResults(resetStorageMethodName, result);
|
extractSearchResults(resetStorageMethodName, result, localSearchResults);
|
||||||
|
|
||||||
editedPlaylists.clear();
|
editedPlaylists.clear();
|
||||||
}
|
}
|
||||||
|
@ -2122,7 +2122,7 @@ WebStorageClient :: search(Ptr<SessionId>::Ref sessionId,
|
||||||
|
|
||||||
execute(searchMethodName, parameters, result);
|
execute(searchMethodName, parameters, result);
|
||||||
|
|
||||||
return extractSearchResults(searchMethodName, result);
|
return extractSearchResults(searchMethodName, result, localSearchResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2130,8 +2130,10 @@ WebStorageClient :: search(Ptr<SessionId>::Ref sessionId,
|
||||||
* Extract the results returned by search() or remoteSearchClose().
|
* Extract the results returned by search() or remoteSearchClose().
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
int
|
int
|
||||||
WebStorageClient :: extractSearchResults(const std::string & methodName,
|
WebStorageClient :: extractSearchResults(
|
||||||
XmlRpcValue & xmlRpcStruct)
|
const std::string & methodName,
|
||||||
|
XmlRpcValue & xmlRpcStruct,
|
||||||
|
Ptr<SearchResultsType>::Ref & searchResults)
|
||||||
throw (XmlRpcException)
|
throw (XmlRpcException)
|
||||||
{
|
{
|
||||||
checkStruct(methodName,
|
checkStruct(methodName,
|
||||||
|
@ -2307,7 +2309,9 @@ WebStorageClient :: remoteSearchClose(Ptr<const Glib::ustring>::Ref token)
|
||||||
|
|
||||||
execute(remoteSearchCloseMethodName, parameters, result);
|
execute(remoteSearchCloseMethodName, parameters, result);
|
||||||
|
|
||||||
return extractSearchResults(remoteSearchCloseMethodName, result);
|
return extractSearchResults(remoteSearchCloseMethodName,
|
||||||
|
result,
|
||||||
|
remoteSearchResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2330,7 +2334,8 @@ WebStorageClient :: getAllPlaylists(Ptr<SessionId>::Ref sessionId,
|
||||||
new std::vector<Ptr<Playlist>::Ref>);
|
new std::vector<Ptr<Playlist>::Ref>);
|
||||||
|
|
||||||
SearchResultsType::const_iterator it;
|
SearchResultsType::const_iterator it;
|
||||||
for (it = searchResults->begin(); it != searchResults->end(); ++it) {
|
for (it = localSearchResults->begin();
|
||||||
|
it != localSearchResults->end(); ++it) {
|
||||||
Ptr<Playlist>::Ref playlist = (*it)->getPlaylist();
|
Ptr<Playlist>::Ref playlist = (*it)->getPlaylist();
|
||||||
if (playlist) {
|
if (playlist) {
|
||||||
playlists->push_back(playlist);
|
playlists->push_back(playlist);
|
||||||
|
@ -2360,7 +2365,8 @@ WebStorageClient :: getAllAudioClips(Ptr<SessionId>::Ref sessionId,
|
||||||
new std::vector<Ptr<AudioClip>::Ref>);
|
new std::vector<Ptr<AudioClip>::Ref>);
|
||||||
|
|
||||||
SearchResultsType::const_iterator it;
|
SearchResultsType::const_iterator it;
|
||||||
for (it = searchResults->begin(); it != searchResults->end(); ++it) {
|
for (it = localSearchResults->begin();
|
||||||
|
it != localSearchResults->end(); ++it) {
|
||||||
Ptr<AudioClip>::Ref audioClip = (*it)->getAudioClip();
|
Ptr<AudioClip>::Ref audioClip = (*it)->getAudioClip();
|
||||||
if (audioClip) {
|
if (audioClip) {
|
||||||
audioClips->push_back(audioClip);
|
audioClips->push_back(audioClip);
|
||||||
|
@ -2890,17 +2896,9 @@ WebStorageClient :: createPlayable(XmlRpcValue data)
|
||||||
Ptr<const Glib::ustring>::Ref title(new const Glib::ustring(std::string(
|
Ptr<const Glib::ustring>::Ref title(new const Glib::ustring(std::string(
|
||||||
data["title"] )));
|
data["title"] )));
|
||||||
|
|
||||||
checkStruct("private:createPlayable",
|
|
||||||
data,
|
|
||||||
"creator",
|
|
||||||
XmlRpcValue::TypeString);
|
|
||||||
Ptr<const Glib::ustring>::Ref creator(new const Glib::ustring(std::string(
|
Ptr<const Glib::ustring>::Ref creator(new const Glib::ustring(std::string(
|
||||||
data["creator"] )));
|
data["creator"] )));
|
||||||
|
|
||||||
checkStruct("private:createPlayable",
|
|
||||||
data,
|
|
||||||
"source",
|
|
||||||
XmlRpcValue::TypeString);
|
|
||||||
Ptr<const Glib::ustring>::Ref source(new const Glib::ustring(std::string(
|
Ptr<const Glib::ustring>::Ref source(new const Glib::ustring(std::string(
|
||||||
data["source"] )));
|
data["source"] )));
|
||||||
|
|
||||||
|
|
|
@ -147,7 +147,12 @@ class WebStorageClient :
|
||||||
/**
|
/**
|
||||||
* A vector containing the items returned by search() or by reset().
|
* A vector containing the items returned by search() or by reset().
|
||||||
*/
|
*/
|
||||||
Ptr<SearchResultsType>::Ref searchResults;
|
Ptr<SearchResultsType>::Ref localSearchResults;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A vector containing the items returned by remoteSearchClose().
|
||||||
|
*/
|
||||||
|
Ptr<SearchResultsType>::Ref remoteSearchResults;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute an XML-RPC function call.
|
* Execute an XML-RPC function call.
|
||||||
|
@ -193,11 +198,13 @@ class WebStorageClient :
|
||||||
*
|
*
|
||||||
* @param methodName the name of the calling method.
|
* @param methodName the name of the calling method.
|
||||||
* @param xmlRpcStruct the XML-RPC struct to be extracted.
|
* @param xmlRpcStruct the XML-RPC struct to be extracted.
|
||||||
|
* @param searchResults the array to store the results in.
|
||||||
* @exception XmlRpcException if the format of xmlRpcStruct is wrong.
|
* @exception XmlRpcException if the format of xmlRpcStruct is wrong.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
extractSearchResults(const std::string & methodName,
|
extractSearchResults(const std::string & methodName,
|
||||||
XmlRpcValue & xmlRpcStruct)
|
XmlRpcValue & xmlRpcStruct,
|
||||||
|
Ptr<SearchResultsType>::Ref & searchResults)
|
||||||
throw (XmlRpcException);
|
throw (XmlRpcException);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -590,7 +597,7 @@ class WebStorageClient :
|
||||||
/**
|
/**
|
||||||
* Reset the storage to its initial state.
|
* Reset the storage to its initial state.
|
||||||
* Calls locstor.resetStorage; the new contents of the storage
|
* Calls locstor.resetStorage; the new contents of the storage
|
||||||
* can be read using getSearchResults().
|
* can be read using getLocalSearchResults().
|
||||||
* Used for testing.
|
* Used for testing.
|
||||||
*
|
*
|
||||||
* @exception XmlRpcException if the server returns an error.
|
* @exception XmlRpcException if the server returns an error.
|
||||||
|
@ -602,7 +609,7 @@ class WebStorageClient :
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search for audio clips or playlists. The results can be read
|
* Search for audio clips or playlists. The results can be read
|
||||||
* using getSearchResults().
|
* using getLocalSearchResults().
|
||||||
*
|
*
|
||||||
* @param sessionId the session ID from the authentication client
|
* @param sessionId the session ID from the authentication client
|
||||||
* @param searchCriteria an object containing the search criteria
|
* @param searchCriteria an object containing the search criteria
|
||||||
|
@ -658,7 +665,7 @@ class WebStorageClient :
|
||||||
*
|
*
|
||||||
* If this search is in the finishedState, it will be moved to the
|
* If this search is in the finishedState, it will be moved to the
|
||||||
* closedState, the transport token will be invalidated, and the
|
* closedState, the transport token will be invalidated, and the
|
||||||
* search results can be read using getSearchResults().
|
* search results can be read using getRemoteSearchResults().
|
||||||
*
|
*
|
||||||
* If the search is in any other state, an exception is raised.
|
* If the search is in any other state, an exception is raised.
|
||||||
*
|
*
|
||||||
|
@ -676,16 +683,27 @@ class WebStorageClient :
|
||||||
throw (XmlRpcException);
|
throw (XmlRpcException);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the list of items found by the search method.
|
* Return the list of items found by the local search method.
|
||||||
*
|
*
|
||||||
* (Or the list of items returned by reset() -- used for testing.)
|
* (Or the list of items returned by reset() -- used for testing.)
|
||||||
*
|
*
|
||||||
* @return a vector of Playable objects.
|
* @return a vector of Playable objects.
|
||||||
*/
|
*/
|
||||||
virtual Ptr<SearchResultsType>::Ref
|
virtual Ptr<SearchResultsType>::Ref
|
||||||
getSearchResults(void) throw ()
|
getLocalSearchResults(void) throw ()
|
||||||
{
|
{
|
||||||
return searchResults;
|
return localSearchResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the list of items found by the remote search method.
|
||||||
|
*
|
||||||
|
* @return a vector of Playable objects.
|
||||||
|
*/
|
||||||
|
virtual Ptr<SearchResultsType>::Ref
|
||||||
|
getRemoteSearchResults(void) throw ()
|
||||||
|
{
|
||||||
|
return remoteSearchResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -280,10 +280,10 @@ WebStorageClientTest :: playlistTest(void)
|
||||||
}
|
}
|
||||||
CPPUNIT_ASSERT(playlist);
|
CPPUNIT_ASSERT(playlist);
|
||||||
|
|
||||||
// searchResults was filled by reset() with a list of all items
|
// localSearchResults was filled by reset() with a list of all items
|
||||||
// in the storage
|
// in the storage
|
||||||
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref
|
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref
|
||||||
searchResults = wsc->getSearchResults();
|
searchResults = wsc->getLocalSearchResults();
|
||||||
CPPUNIT_ASSERT(searchResults->size() >= 7);
|
CPPUNIT_ASSERT(searchResults->size() >= 7);
|
||||||
Ptr<AudioClip>::Ref audioClip = searchResults->at(4)->getAudioClip();
|
Ptr<AudioClip>::Ref audioClip = searchResults->at(4)->getAudioClip();
|
||||||
CPPUNIT_ASSERT(audioClip);
|
CPPUNIT_ASSERT(audioClip);
|
||||||
|
@ -377,7 +377,7 @@ WebStorageClientTest :: embeddedPlaylistTest(void)
|
||||||
CPPUNIT_FAIL(e.what());
|
CPPUNIT_FAIL(e.what());
|
||||||
}
|
}
|
||||||
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
||||||
= wsc->getSearchResults();
|
= wsc->getLocalSearchResults();
|
||||||
CPPUNIT_ASSERT(searchResults->size() >= 7);
|
CPPUNIT_ASSERT(searchResults->size() >= 7);
|
||||||
Ptr<AudioClip>::Ref audioClip = searchResults->at(6)->getAudioClip();
|
Ptr<AudioClip>::Ref audioClip = searchResults->at(6)->getAudioClip();
|
||||||
CPPUNIT_ASSERT(audioClip);
|
CPPUNIT_ASSERT(audioClip);
|
||||||
|
@ -432,7 +432,7 @@ WebStorageClientTest :: audioClipTest(void)
|
||||||
CPPUNIT_FAIL(e.what());
|
CPPUNIT_FAIL(e.what());
|
||||||
}
|
}
|
||||||
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
||||||
= wsc->getSearchResults();
|
= wsc->getLocalSearchResults();
|
||||||
CPPUNIT_ASSERT(searchResults->size() >= 7);
|
CPPUNIT_ASSERT(searchResults->size() >= 7);
|
||||||
Ptr<AudioClip>::Ref audioClip = searchResults->at(6)->getAudioClip();
|
Ptr<AudioClip>::Ref audioClip = searchResults->at(6)->getAudioClip();
|
||||||
CPPUNIT_ASSERT(audioClip);
|
CPPUNIT_ASSERT(audioClip);
|
||||||
|
@ -541,7 +541,7 @@ WebStorageClientTest :: simplePlaylistTest(void)
|
||||||
CPPUNIT_FAIL(e.what());
|
CPPUNIT_FAIL(e.what());
|
||||||
}
|
}
|
||||||
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
||||||
= wsc->getSearchResults();
|
= wsc->getLocalSearchResults();
|
||||||
CPPUNIT_ASSERT(searchResults->size() >= 7);
|
CPPUNIT_ASSERT(searchResults->size() >= 7);
|
||||||
Ptr<AudioClip>::Ref audioClip = searchResults->at(6)->getAudioClip();
|
Ptr<AudioClip>::Ref audioClip = searchResults->at(6)->getAudioClip();
|
||||||
CPPUNIT_ASSERT(audioClip);
|
CPPUNIT_ASSERT(audioClip);
|
||||||
|
@ -624,7 +624,7 @@ WebStorageClientTest :: searchTest(void)
|
||||||
CPPUNIT_FAIL(e.what());
|
CPPUNIT_FAIL(e.what());
|
||||||
}
|
}
|
||||||
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
||||||
= wsc->getSearchResults();
|
= wsc->getLocalSearchResults();
|
||||||
CPPUNIT_ASSERT(searchResults->size() >= 9);
|
CPPUNIT_ASSERT(searchResults->size() >= 9);
|
||||||
Ptr<Playlist>::Ref playlist0 = searchResults->at(0)->getPlaylist();
|
Ptr<Playlist>::Ref playlist0 = searchResults->at(0)->getPlaylist();
|
||||||
Ptr<Playlist>::Ref playlist1 = searchResults->at(1)->getPlaylist();
|
Ptr<Playlist>::Ref playlist1 = searchResults->at(1)->getPlaylist();
|
||||||
|
@ -660,7 +660,7 @@ WebStorageClientTest :: searchTest(void)
|
||||||
"dc:title", "prefix", "File "));
|
"dc:title", "prefix", "File "));
|
||||||
int numberFound = wsc->search(sessionId, criteria);
|
int numberFound = wsc->search(sessionId, criteria);
|
||||||
CPPUNIT_ASSERT(numberFound == 1);
|
CPPUNIT_ASSERT(numberFound == 1);
|
||||||
searchResults = wsc->getSearchResults();
|
searchResults = wsc->getLocalSearchResults();
|
||||||
CPPUNIT_ASSERT(searchResults->size() == 1);
|
CPPUNIT_ASSERT(searchResults->size() == 1);
|
||||||
CPPUNIT_ASSERT(*searchResults->at(0)->getId() == *audioClip1->getId());
|
CPPUNIT_ASSERT(*searchResults->at(0)->getId() == *audioClip1->getId());
|
||||||
|
|
||||||
|
@ -677,7 +677,7 @@ WebStorageClientTest :: searchTest(void)
|
||||||
criteria->setLimit(10);
|
criteria->setLimit(10);
|
||||||
int numberFound = wsc->search(sessionId, criteria);
|
int numberFound = wsc->search(sessionId, criteria);
|
||||||
CPPUNIT_ASSERT(numberFound >= 2);
|
CPPUNIT_ASSERT(numberFound >= 2);
|
||||||
searchResults = wsc->getSearchResults();
|
searchResults = wsc->getLocalSearchResults();
|
||||||
CPPUNIT_ASSERT(searchResults->size() >= 2);
|
CPPUNIT_ASSERT(searchResults->size() >= 2);
|
||||||
CPPUNIT_ASSERT(*searchResults->at(0)->getId() == *playlist0->getId());
|
CPPUNIT_ASSERT(*searchResults->at(0)->getId() == *playlist0->getId());
|
||||||
CPPUNIT_ASSERT(*searchResults->at(1)->getId() == *playlist1->getId());
|
CPPUNIT_ASSERT(*searchResults->at(1)->getId() == *playlist1->getId());
|
||||||
|
@ -696,7 +696,7 @@ WebStorageClientTest :: searchTest(void)
|
||||||
criteria->addCondition("dc:title", "partial", "Title ");
|
criteria->addCondition("dc:title", "partial", "Title ");
|
||||||
int numberFound = wsc->search(sessionId, criteria);
|
int numberFound = wsc->search(sessionId, criteria);
|
||||||
CPPUNIT_ASSERT(numberFound == 1);
|
CPPUNIT_ASSERT(numberFound == 1);
|
||||||
searchResults = wsc->getSearchResults();
|
searchResults = wsc->getLocalSearchResults();
|
||||||
CPPUNIT_ASSERT(searchResults->size() == 1);
|
CPPUNIT_ASSERT(searchResults->size() == 1);
|
||||||
CPPUNIT_ASSERT(*searchResults->at(0)->getId() == *audioClip0->getId());
|
CPPUNIT_ASSERT(*searchResults->at(0)->getId() == *audioClip0->getId());
|
||||||
|
|
||||||
|
@ -712,7 +712,7 @@ WebStorageClientTest :: searchTest(void)
|
||||||
criteria->addCondition("dc:title", "prefix", "My");
|
criteria->addCondition("dc:title", "prefix", "My");
|
||||||
int numberFound = wsc->search(sessionId, criteria);
|
int numberFound = wsc->search(sessionId, criteria);
|
||||||
CPPUNIT_ASSERT(numberFound >= 5);
|
CPPUNIT_ASSERT(numberFound >= 5);
|
||||||
searchResults = wsc->getSearchResults();
|
searchResults = wsc->getLocalSearchResults();
|
||||||
CPPUNIT_ASSERT(searchResults->size() >= 5);
|
CPPUNIT_ASSERT(searchResults->size() >= 5);
|
||||||
CPPUNIT_ASSERT(*searchResults->at(0)->getId() == *playlist0->getId());
|
CPPUNIT_ASSERT(*searchResults->at(0)->getId() == *playlist0->getId());
|
||||||
CPPUNIT_ASSERT(*searchResults->at(3)->getId() == *audioClip0->getId());
|
CPPUNIT_ASSERT(*searchResults->at(3)->getId() == *audioClip0->getId());
|
||||||
|
@ -731,7 +731,7 @@ WebStorageClientTest :: searchTest(void)
|
||||||
criteria->setOffset(3);
|
criteria->setOffset(3);
|
||||||
int numberFound = wsc->search(sessionId, criteria);
|
int numberFound = wsc->search(sessionId, criteria);
|
||||||
CPPUNIT_ASSERT(numberFound >= 5);
|
CPPUNIT_ASSERT(numberFound >= 5);
|
||||||
searchResults = wsc->getSearchResults();
|
searchResults = wsc->getLocalSearchResults();
|
||||||
CPPUNIT_ASSERT(searchResults->size() == 2);
|
CPPUNIT_ASSERT(searchResults->size() == 2);
|
||||||
CPPUNIT_ASSERT(*searchResults->at(0)->getId() == *audioClip4->getId());
|
CPPUNIT_ASSERT(*searchResults->at(0)->getId() == *audioClip4->getId());
|
||||||
CPPUNIT_ASSERT(*searchResults->at(1)->getId() == *audioClip5->getId());
|
CPPUNIT_ASSERT(*searchResults->at(1)->getId() == *audioClip5->getId());
|
||||||
|
@ -763,7 +763,7 @@ WebStorageClientTest :: searchUnicodeTest(void)
|
||||||
CPPUNIT_FAIL(e.what());
|
CPPUNIT_FAIL(e.what());
|
||||||
}
|
}
|
||||||
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
Ptr<std::vector<Ptr<Playable>::Ref> >::Ref searchResults
|
||||||
= wsc->getSearchResults();
|
= wsc->getLocalSearchResults();
|
||||||
CPPUNIT_ASSERT(searchResults->size() >= 9);
|
CPPUNIT_ASSERT(searchResults->size() >= 9);
|
||||||
Ptr<AudioClip>::Ref audioClip1 = searchResults->at(4)->getAudioClip();
|
Ptr<AudioClip>::Ref audioClip1 = searchResults->at(4)->getAudioClip();
|
||||||
|
|
||||||
|
@ -1105,6 +1105,11 @@ WebStorageClientTest :: remoteSearchTest(void)
|
||||||
wsc->cancelTransport(sessionId, token)
|
wsc->cancelTransport(sessionId, token)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
CPPUNIT_ASSERT_NO_THROW(
|
||||||
|
token = wsc->remoteSearchOpen(sessionId, criteria);
|
||||||
|
);
|
||||||
|
CPPUNIT_ASSERT(token);
|
||||||
|
|
||||||
Ptr<Glib::ustring>::Ref errorMessage(new Glib::ustring);
|
Ptr<Glib::ustring>::Ref errorMessage(new Glib::ustring);
|
||||||
AsyncState state;
|
AsyncState state;
|
||||||
|
|
||||||
|
|
|
@ -147,9 +147,13 @@ BrowseItem :: onShow(void) throw ()
|
||||||
{
|
{
|
||||||
Ptr<const Glib::ustring>::Ref metadataKey = metadataEntry->getActiveKey();
|
Ptr<const Glib::ustring>::Ref metadataKey = metadataEntry->getActiveKey();
|
||||||
|
|
||||||
|
Ptr<StorageClientInterface>::Ref
|
||||||
|
storage = gLiveSupport->getStorageClient();
|
||||||
|
Ptr<SessionId>::Ref sessionId = gLiveSupport->getSessionId();
|
||||||
|
|
||||||
Ptr<std::vector<Glib::ustring> >::Ref values;
|
Ptr<std::vector<Glib::ustring> >::Ref values;
|
||||||
try {
|
try {
|
||||||
values = gLiveSupport->browse(metadataKey, parentCriteria);
|
values = storage->browse(sessionId, metadataKey, parentCriteria);
|
||||||
} catch (XmlRpcException &e) {
|
} catch (XmlRpcException &e) {
|
||||||
std::cerr << "Error in BrowseItem::onShow(): "
|
std::cerr << "Error in BrowseItem::onShow(): "
|
||||||
<< e.what() << std::endl;
|
<< e.what() << std::endl;
|
||||||
|
|
|
@ -1388,42 +1388,6 @@ GLiveSupport :: detachCueAudioListener(AudioPlayerEventListener * listener)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Search in the local storage.
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
int
|
|
||||||
LiveSupport :: GLiveSupport ::
|
|
||||||
GLiveSupport :: search(Ptr<SearchCriteria>::Ref criteria)
|
|
||||||
throw (XmlRpcException)
|
|
||||||
{
|
|
||||||
return storage->search(sessionId, criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Return the Playable items found by the latest search (local or remote).
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
Ptr<LiveSupport::GLiveSupport::GLiveSupport::PlayableList>::Ref
|
|
||||||
LiveSupport :: GLiveSupport ::
|
|
||||||
GLiveSupport :: getSearchResults(void) throw (XmlRpcException)
|
|
||||||
{
|
|
||||||
return storage->getSearchResults();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
|
||||||
* Browse in the local storage.
|
|
||||||
*----------------------------------------------------------------------------*/
|
|
||||||
Ptr<std::vector<Glib::ustring> >::Ref
|
|
||||||
LiveSupport :: GLiveSupport ::
|
|
||||||
GLiveSupport :: browse(Ptr<const Glib::ustring>::Ref metadata,
|
|
||||||
Ptr<SearchCriteria>::Ref criteria)
|
|
||||||
throw (XmlRpcException)
|
|
||||||
{
|
|
||||||
return storage->browse(sessionId, metadata, criteria);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------------------
|
/*------------------------------------------------------------------------------
|
||||||
* Return an image containing the radio station logo.
|
* Return an image containing the radio station logo.
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
|
|
|
@ -130,12 +130,6 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
typedef std::map<const Glib::ustring,
|
typedef std::map<const Glib::ustring,
|
||||||
const std::string> LanguageMap;
|
const std::string> LanguageMap;
|
||||||
|
|
||||||
/**
|
|
||||||
* The type of the list of search results.
|
|
||||||
*/
|
|
||||||
typedef StorageClientInterface::SearchResultsType
|
|
||||||
PlayableList;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A type for having a map of AudioClip objects, with using
|
* A type for having a map of AudioClip objects, with using
|
||||||
* the ids of the objects as keys.
|
* the ids of the objects as keys.
|
||||||
|
@ -975,30 +969,6 @@ class GLiveSupport : public LocalizedConfigurable,
|
||||||
search(Ptr<SearchCriteria>::Ref criteria)
|
search(Ptr<SearchCriteria>::Ref criteria)
|
||||||
throw (XmlRpcException);
|
throw (XmlRpcException);
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the Playable items found by the latest search.
|
|
||||||
*
|
|
||||||
* @return the list of audio clips and playlists found.
|
|
||||||
* @exception XmlRpcException passed on from getAudioClip() or
|
|
||||||
* getPlaylist().
|
|
||||||
*/
|
|
||||||
Ptr<PlayableList>::Ref
|
|
||||||
getSearchResults(void) throw (XmlRpcException);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Browse in the local storage.
|
|
||||||
*
|
|
||||||
* @param metadata the type of metadata to list (e.g., "dc:title").
|
|
||||||
* @param criteria the search conditions to use.
|
|
||||||
* @return the list of metadata values found.
|
|
||||||
* @exception XmlRpcException thrown by
|
|
||||||
* StorageClientInterface::browse()
|
|
||||||
*/
|
|
||||||
Ptr<std::vector<Glib::ustring> >::Ref
|
|
||||||
browse(Ptr<const Glib::ustring>::Ref metadata,
|
|
||||||
Ptr<SearchCriteria>::Ref criteria)
|
|
||||||
throw (XmlRpcException);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Event handler for the "output audio player has stopped" event.
|
* Event handler for the "output audio player has stopped" event.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -508,10 +508,14 @@ SearchWindow :: localSearch(Ptr<SearchCriteria>::Ref criteria)
|
||||||
displayMessage("pleaseWaitMsg", localSearchResults);
|
displayMessage("pleaseWaitMsg", localSearchResults);
|
||||||
gLiveSupport->runMainLoop();
|
gLiveSupport->runMainLoop();
|
||||||
|
|
||||||
Ptr<GLiveSupport::PlayableList>::Ref searchResults;
|
Ptr<StorageClientInterface>::Ref
|
||||||
|
storage = gLiveSupport->getStorageClient();
|
||||||
|
Ptr<SessionId>::Ref sessionId = gLiveSupport->getSessionId();
|
||||||
|
|
||||||
|
Ptr<SearchResultsType>::Ref searchResults;
|
||||||
try {
|
try {
|
||||||
localSearchResultsCount = gLiveSupport->search(criteria);
|
localSearchResultsCount = storage->search(sessionId, criteria);
|
||||||
searchResults = gLiveSupport->getSearchResults();
|
searchResults = storage->getLocalSearchResults();
|
||||||
} catch (XmlRpcException &e) {
|
} catch (XmlRpcException &e) {
|
||||||
displayLocalSearchError(e);
|
displayLocalSearchError(e);
|
||||||
return;
|
return;
|
||||||
|
@ -528,7 +532,7 @@ SearchWindow :: localSearch(Ptr<SearchCriteria>::Ref criteria)
|
||||||
*----------------------------------------------------------------------------*/
|
*----------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
SearchWindow :: displaySearchResults(
|
SearchWindow :: displaySearchResults(
|
||||||
Ptr<GLiveSupport::PlayableList>::Ref searchResults,
|
Ptr<SearchResultsType>::Ref searchResults,
|
||||||
Glib::RefPtr<Gtk::ListStore> treeModel)
|
Glib::RefPtr<Gtk::ListStore> treeModel)
|
||||||
throw ()
|
throw ()
|
||||||
{
|
{
|
||||||
|
@ -538,7 +542,7 @@ SearchWindow :: displaySearchResults(
|
||||||
|
|
||||||
Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance();
|
Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance();
|
||||||
|
|
||||||
GLiveSupport::PlayableList::const_iterator it = searchResults->begin();
|
SearchResultsType::const_iterator it = searchResults->begin();
|
||||||
|
|
||||||
if (it == searchResults->end()) {
|
if (it == searchResults->end()) {
|
||||||
displayMessage("nothingFoundMsg", treeModel);
|
displayMessage("nothingFoundMsg", treeModel);
|
||||||
|
@ -642,10 +646,11 @@ SearchWindow :: remoteSearchClose(void)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ptr<GLiveSupport::PlayableList>::Ref results;
|
Ptr<SearchResultsType>::Ref results;
|
||||||
|
|
||||||
if (state == AsyncState::finishedState) {
|
if (state == AsyncState::finishedState) {
|
||||||
try {
|
try {
|
||||||
|
remoteSearchResultsCount =
|
||||||
storage->remoteSearchClose(remoteSearchToken);
|
storage->remoteSearchClose(remoteSearchToken);
|
||||||
} catch (XmlRpcException &e) {
|
} catch (XmlRpcException &e) {
|
||||||
displayRemoteSearchError(e);
|
displayRemoteSearchError(e);
|
||||||
|
@ -654,13 +659,12 @@ SearchWindow :: remoteSearchClose(void)
|
||||||
remoteSearchToken.reset();
|
remoteSearchToken.reset();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
results = gLiveSupport->getSearchResults();
|
results = storage->getRemoteSearchResults();
|
||||||
} catch (XmlRpcException &e) {
|
} catch (XmlRpcException &e) {
|
||||||
displayRemoteSearchError(e);
|
displayRemoteSearchError(e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
remoteSearchResultsCount = results->size(); // FIXME
|
|
||||||
displaySearchResults(results, remoteSearchResults);
|
displaySearchResults(results, remoteSearchResults);
|
||||||
|
|
||||||
} else if (state == AsyncState::closedState) {
|
} else if (state == AsyncState::closedState) {
|
||||||
|
|
|
@ -329,6 +329,12 @@ class SearchWindow : public GuiWindow
|
||||||
void
|
void
|
||||||
remoteSearchClose(void) throw ();
|
remoteSearchClose(void) throw ();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Typedef to save some typing.
|
||||||
|
*/
|
||||||
|
typedef StorageClientInterface::SearchResultsType
|
||||||
|
SearchResultsType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the search results.
|
* Display the search results.
|
||||||
* The most important metadata are shown in the rows of the given
|
* The most important metadata are shown in the rows of the given
|
||||||
|
@ -336,7 +342,7 @@ class SearchWindow : public GuiWindow
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
displaySearchResults(
|
displaySearchResults(
|
||||||
Ptr<GLiveSupport::PlayableList>::Ref searchResults,
|
Ptr<SearchResultsType>::Ref searchResults,
|
||||||
Glib::RefPtr<Gtk::ListStore> treeModel)
|
Glib::RefPtr<Gtk::ListStore> treeModel)
|
||||||
throw ();
|
throw ();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue