From 07d057b69b2c5780d3b37c9ce88eb31c0da9000e Mon Sep 17 00:00:00 2001 From: fgerlits Date: Tue, 31 Oct 2006 14:12:56 +0000 Subject: [PATCH] fixing #1895, plus cleaning up some search/browse code --- .../StorageClient/StorageClientInterface.h | 19 +++++++--- .../storageClient/src/TestStorageClient.cxx | 18 +++++----- .../storageClient/src/TestStorageClient.h | 27 ++++++++++---- .../src/TestStorageClientTest.cxx | 16 ++++----- .../storageClient/src/WebStorageClient.cxx | 28 +++++++-------- .../storageClient/src/WebStorageClient.h | 36 ++++++++++++++----- .../src/WebStorageClientTest.cxx | 29 ++++++++------- .../products/gLiveSupport/src/BrowseItem.cxx | 6 +++- .../gLiveSupport/src/GLiveSupport.cxx | 36 ------------------- .../products/gLiveSupport/src/GLiveSupport.h | 30 ---------------- .../gLiveSupport/src/SearchWindow.cxx | 24 +++++++------ .../products/gLiveSupport/src/SearchWindow.h | 10 ++++-- 12 files changed, 136 insertions(+), 143 deletions(-) diff --git a/campcaster/src/modules/storageClient/include/LiveSupport/StorageClient/StorageClientInterface.h b/campcaster/src/modules/storageClient/include/LiveSupport/StorageClient/StorageClientInterface.h index 510acce65..793fe3bb1 100644 --- a/campcaster/src/modules/storageClient/include/LiveSupport/StorageClient/StorageClientInterface.h +++ b/campcaster/src/modules/storageClient/include/LiveSupport/StorageClient/StorageClientInterface.h @@ -351,7 +351,7 @@ class StorageClientInterface /** * 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 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 * 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. * @@ -435,18 +435,27 @@ class StorageClientInterface 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.) * * @return a vector of Playable objects. */ virtual Ptr::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::Ref + getRemoteSearchResults(void) throw () = 0; /** * 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. * * @exception XmlRpcException if the server returns an error. diff --git a/campcaster/src/modules/storageClient/src/TestStorageClient.cxx b/campcaster/src/modules/storageClient/src/TestStorageClient.cxx index 19a1a04ec..801a0340d 100644 --- a/campcaster/src/modules/storageClient/src/TestStorageClient.cxx +++ b/campcaster/src/modules/storageClient/src/TestStorageClient.cxx @@ -250,7 +250,7 @@ TestStorageClient :: reset(void) = nodes.begin(); playlistMap.clear(); editedPlaylists.clear(); - searchResults.reset(new SearchResultsType); + localSearchResults.reset(new SearchResultsType); while (it != nodes.end()) { Ptr::Ref playlist(new Playlist); @@ -258,7 +258,7 @@ TestStorageClient :: reset(void) dynamic_cast (*it); playlist->configure(*element); playlistMap[playlist->getId()->getId()] = playlist; - searchResults->push_back(playlist); + localSearchResults->push_back(playlist); ++it; } @@ -279,7 +279,7 @@ TestStorageClient :: reset(void) audioClip->setUri(nullPointer); } audioClipMap[audioClip->getId()->getId()] = audioClip; - searchResults->push_back(audioClip); + localSearchResults->push_back(audioClip); ++it; } } @@ -801,14 +801,14 @@ TestStorageClient :: search(Ptr::Ref sessionId, last = 0; } - searchResults.reset(new SearchResultsType); + localSearchResults.reset(new SearchResultsType); if (searchCriteria->type == "audioclip" || searchCriteria->type == "all") { AudioClipMapType::const_iterator it = audioClipMap.begin(); while (it != audioClipMap.end()) { if (matchesCriteria(it->second, searchCriteria)) { if (counter >= first && (!last || counter < last)) { - searchResults->push_back(it->second); + localSearchResults->push_back(it->second); } ++counter; } @@ -821,7 +821,7 @@ TestStorageClient :: search(Ptr::Ref sessionId, while (it != playlistMap.end()) { if (matchesCriteria(it->second, searchCriteria)) { if (counter >= first && (!last || counter < last)) { - searchResults->push_back(it->second); + localSearchResults->push_back(it->second); } ++counter; } @@ -975,7 +975,8 @@ TestStorageClient :: getAllPlaylists(Ptr::Ref sessionId, new std::vector::Ref>); SearchResultsType::const_iterator it; - for (it = searchResults->begin(); it != searchResults->end(); ++it) { + for (it = localSearchResults->begin(); + it != localSearchResults->end(); ++it) { Ptr::Ref playlist = (*it)->getPlaylist(); if (playlist) { playlists->push_back(playlist); @@ -1005,7 +1006,8 @@ TestStorageClient :: getAllAudioClips(Ptr::Ref sessionId, new std::vector::Ref>); SearchResultsType::const_iterator it; - for (it = searchResults->begin(); it != searchResults->end(); ++it) { + for (it = localSearchResults->begin(); + it != localSearchResults->end(); ++it) { Ptr::Ref audioClip = (*it)->getAudioClip(); if (audioClip) { audioClips->push_back(audioClip); diff --git a/campcaster/src/modules/storageClient/src/TestStorageClient.h b/campcaster/src/modules/storageClient/src/TestStorageClient.h index 228f730e2..8285e8a07 100644 --- a/campcaster/src/modules/storageClient/src/TestStorageClient.h +++ b/campcaster/src/modules/storageClient/src/TestStorageClient.h @@ -160,7 +160,7 @@ class TestStorageClient : /** * A vector containing the items returned by search() or by reset(). */ - Ptr::Ref searchResults; + Ptr::Ref localSearchResults; /** * Auxilliary method used by search(). @@ -467,7 +467,7 @@ class TestStorageClient : * Reset the storage to its initial state. * Re-initializes the storage based on the xml element which was * passed to configure() earlier; the new contents of the storage - * can be read using getSearchResults(). + * can be read using getLocalSearchResults(). * Used for testing. * * @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 - * using getSearchResults(). + * using getLocalSearchResults(). * * If an audio clip or playlist does not have a metadata field X, * 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 * 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. * @@ -562,16 +562,29 @@ class TestStorageClient : 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.) * * @return a vector of Playable objects. */ virtual Ptr::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::Ref + getRemoteSearchResults(void) throw () + { + Ptr::Ref nullPointer; + return nullPointer; } diff --git a/campcaster/src/modules/storageClient/src/TestStorageClientTest.cxx b/campcaster/src/modules/storageClient/src/TestStorageClientTest.cxx index f5d57564f..a3e328b14 100644 --- a/campcaster/src/modules/storageClient/src/TestStorageClientTest.cxx +++ b/campcaster/src/modules/storageClient/src/TestStorageClientTest.cxx @@ -171,7 +171,7 @@ TestStorageClientTest :: resetTest(void) CPPUNIT_FAIL(e.what()); } Ptr::Ref> >::Ref searchResults - = tsc->getSearchResults(); + = tsc->getLocalSearchResults(); CPPUNIT_ASSERT(searchResults); CPPUNIT_ASSERT(searchResults->size() >= 4); @@ -244,7 +244,7 @@ TestStorageClientTest :: audioClipTest(void) CPPUNIT_FAIL(e.what()); } Ptr::Ref> >::Ref searchResults - = tsc->getSearchResults(); + = tsc->getLocalSearchResults(); CPPUNIT_ASSERT(searchResults); CPPUNIT_ASSERT(searchResults->size() >= 3); @@ -388,8 +388,8 @@ TestStorageClientTest :: searchTest(void) int numberFound = tsc->search(dummySessionId, criteria); CPPUNIT_ASSERT(numberFound == 2); - Ptr::Ref> >::Ref searchResults - = tsc->getSearchResults(); + Ptr::Ref> >::Ref + searchResults = tsc->getLocalSearchResults(); CPPUNIT_ASSERT(searchResults->size() == 2); CPPUNIT_ASSERT(searchResults->at(0)->getId()->getId() == 0x10001); CPPUNIT_ASSERT(searchResults->at(1)->getId()->getId() == 0x10003); @@ -406,8 +406,8 @@ TestStorageClientTest :: searchTest(void) criteria->addCondition("dc:title", "prefix", "Playlist"); int numberFound = tsc->search(dummySessionId, criteria); CPPUNIT_ASSERT(numberFound == 3); - Ptr::Ref> >::Ref searchResults - = tsc->getSearchResults(); + Ptr::Ref> >::Ref + searchResults = tsc->getLocalSearchResults(); CPPUNIT_ASSERT(searchResults->size() == 3); CPPUNIT_ASSERT(searchResults->at(0)->getId()->getId() == 0x10002); CPPUNIT_ASSERT(searchResults->at(1)->getId()->getId() == 1); @@ -427,8 +427,8 @@ TestStorageClientTest :: searchTest(void) criteria->setOffset(1); int numberFound = tsc->search(dummySessionId, criteria); CPPUNIT_ASSERT(numberFound == 4); - Ptr::Ref> >::Ref searchResults - = tsc->getSearchResults(); + Ptr::Ref> >::Ref + searchResults = tsc->getLocalSearchResults(); CPPUNIT_ASSERT(searchResults->size() == 2); CPPUNIT_ASSERT(searchResults->at(0)->getId()->getId() == 0x10003); CPPUNIT_ASSERT(searchResults->at(1)->getId()->getId() == 1); diff --git a/campcaster/src/modules/storageClient/src/WebStorageClient.cxx b/campcaster/src/modules/storageClient/src/WebStorageClient.cxx index 07e10351c..a32794053 100644 --- a/campcaster/src/modules/storageClient/src/WebStorageClient.cxx +++ b/campcaster/src/modules/storageClient/src/WebStorageClient.cxx @@ -2097,7 +2097,7 @@ WebStorageClient :: reset(void) execute(resetStorageMethodName, parameters, result); - extractSearchResults(resetStorageMethodName, result); + extractSearchResults(resetStorageMethodName, result, localSearchResults); editedPlaylists.clear(); } @@ -2122,7 +2122,7 @@ WebStorageClient :: search(Ptr::Ref sessionId, execute(searchMethodName, parameters, result); - return extractSearchResults(searchMethodName, result); + return extractSearchResults(searchMethodName, result, localSearchResults); } @@ -2130,8 +2130,10 @@ WebStorageClient :: search(Ptr::Ref sessionId, * Extract the results returned by search() or remoteSearchClose(). *----------------------------------------------------------------------------*/ int -WebStorageClient :: extractSearchResults(const std::string & methodName, - XmlRpcValue & xmlRpcStruct) +WebStorageClient :: extractSearchResults( + const std::string & methodName, + XmlRpcValue & xmlRpcStruct, + Ptr::Ref & searchResults) throw (XmlRpcException) { checkStruct(methodName, @@ -2307,7 +2309,9 @@ WebStorageClient :: remoteSearchClose(Ptr::Ref token) execute(remoteSearchCloseMethodName, parameters, result); - return extractSearchResults(remoteSearchCloseMethodName, result); + return extractSearchResults(remoteSearchCloseMethodName, + result, + remoteSearchResults); } @@ -2330,7 +2334,8 @@ WebStorageClient :: getAllPlaylists(Ptr::Ref sessionId, new std::vector::Ref>); SearchResultsType::const_iterator it; - for (it = searchResults->begin(); it != searchResults->end(); ++it) { + for (it = localSearchResults->begin(); + it != localSearchResults->end(); ++it) { Ptr::Ref playlist = (*it)->getPlaylist(); if (playlist) { playlists->push_back(playlist); @@ -2360,7 +2365,8 @@ WebStorageClient :: getAllAudioClips(Ptr::Ref sessionId, new std::vector::Ref>); SearchResultsType::const_iterator it; - for (it = searchResults->begin(); it != searchResults->end(); ++it) { + for (it = localSearchResults->begin(); + it != localSearchResults->end(); ++it) { Ptr::Ref audioClip = (*it)->getAudioClip(); if (audioClip) { audioClips->push_back(audioClip); @@ -2890,17 +2896,9 @@ WebStorageClient :: createPlayable(XmlRpcValue data) Ptr::Ref title(new const Glib::ustring(std::string( data["title"] ))); - checkStruct("private:createPlayable", - data, - "creator", - XmlRpcValue::TypeString); Ptr::Ref creator(new const Glib::ustring(std::string( data["creator"] ))); - checkStruct("private:createPlayable", - data, - "source", - XmlRpcValue::TypeString); Ptr::Ref source(new const Glib::ustring(std::string( data["source"] ))); diff --git a/campcaster/src/modules/storageClient/src/WebStorageClient.h b/campcaster/src/modules/storageClient/src/WebStorageClient.h index 6f6774e73..747b0cde7 100644 --- a/campcaster/src/modules/storageClient/src/WebStorageClient.h +++ b/campcaster/src/modules/storageClient/src/WebStorageClient.h @@ -147,7 +147,12 @@ class WebStorageClient : /** * A vector containing the items returned by search() or by reset(). */ - Ptr::Ref searchResults; + Ptr::Ref localSearchResults; + + /** + * A vector containing the items returned by remoteSearchClose(). + */ + Ptr::Ref remoteSearchResults; /** * Execute an XML-RPC function call. @@ -193,11 +198,13 @@ class WebStorageClient : * * @param methodName the name of the calling method. * @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. */ int - extractSearchResults(const std::string & methodName, - XmlRpcValue & xmlRpcStruct) + extractSearchResults(const std::string & methodName, + XmlRpcValue & xmlRpcStruct, + Ptr::Ref & searchResults) throw (XmlRpcException); /** @@ -590,7 +597,7 @@ class WebStorageClient : /** * Reset the storage to its initial state. * Calls locstor.resetStorage; the new contents of the storage - * can be read using getSearchResults(). + * can be read using getLocalSearchResults(). * Used for testing. * * @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 - * using getSearchResults(). + * using getLocalSearchResults(). * * @param sessionId the session ID from the authentication client * @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 * 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. * @@ -676,16 +683,27 @@ class WebStorageClient : 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.) * * @return a vector of Playable objects. */ virtual Ptr::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::Ref + getRemoteSearchResults(void) throw () + { + return remoteSearchResults; } diff --git a/campcaster/src/modules/storageClient/src/WebStorageClientTest.cxx b/campcaster/src/modules/storageClient/src/WebStorageClientTest.cxx index 46d072ae6..f841c11b2 100644 --- a/campcaster/src/modules/storageClient/src/WebStorageClientTest.cxx +++ b/campcaster/src/modules/storageClient/src/WebStorageClientTest.cxx @@ -280,10 +280,10 @@ WebStorageClientTest :: playlistTest(void) } 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 Ptr::Ref> >::Ref - searchResults = wsc->getSearchResults(); + searchResults = wsc->getLocalSearchResults(); CPPUNIT_ASSERT(searchResults->size() >= 7); Ptr::Ref audioClip = searchResults->at(4)->getAudioClip(); CPPUNIT_ASSERT(audioClip); @@ -377,7 +377,7 @@ WebStorageClientTest :: embeddedPlaylistTest(void) CPPUNIT_FAIL(e.what()); } Ptr::Ref> >::Ref searchResults - = wsc->getSearchResults(); + = wsc->getLocalSearchResults(); CPPUNIT_ASSERT(searchResults->size() >= 7); Ptr::Ref audioClip = searchResults->at(6)->getAudioClip(); CPPUNIT_ASSERT(audioClip); @@ -432,7 +432,7 @@ WebStorageClientTest :: audioClipTest(void) CPPUNIT_FAIL(e.what()); } Ptr::Ref> >::Ref searchResults - = wsc->getSearchResults(); + = wsc->getLocalSearchResults(); CPPUNIT_ASSERT(searchResults->size() >= 7); Ptr::Ref audioClip = searchResults->at(6)->getAudioClip(); CPPUNIT_ASSERT(audioClip); @@ -541,7 +541,7 @@ WebStorageClientTest :: simplePlaylistTest(void) CPPUNIT_FAIL(e.what()); } Ptr::Ref> >::Ref searchResults - = wsc->getSearchResults(); + = wsc->getLocalSearchResults(); CPPUNIT_ASSERT(searchResults->size() >= 7); Ptr::Ref audioClip = searchResults->at(6)->getAudioClip(); CPPUNIT_ASSERT(audioClip); @@ -624,7 +624,7 @@ WebStorageClientTest :: searchTest(void) CPPUNIT_FAIL(e.what()); } Ptr::Ref> >::Ref searchResults - = wsc->getSearchResults(); + = wsc->getLocalSearchResults(); CPPUNIT_ASSERT(searchResults->size() >= 9); Ptr::Ref playlist0 = searchResults->at(0)->getPlaylist(); Ptr::Ref playlist1 = searchResults->at(1)->getPlaylist(); @@ -660,7 +660,7 @@ WebStorageClientTest :: searchTest(void) "dc:title", "prefix", "File ")); int numberFound = wsc->search(sessionId, criteria); CPPUNIT_ASSERT(numberFound == 1); - searchResults = wsc->getSearchResults(); + searchResults = wsc->getLocalSearchResults(); CPPUNIT_ASSERT(searchResults->size() == 1); CPPUNIT_ASSERT(*searchResults->at(0)->getId() == *audioClip1->getId()); @@ -677,7 +677,7 @@ WebStorageClientTest :: searchTest(void) criteria->setLimit(10); int numberFound = wsc->search(sessionId, criteria); CPPUNIT_ASSERT(numberFound >= 2); - searchResults = wsc->getSearchResults(); + searchResults = wsc->getLocalSearchResults(); CPPUNIT_ASSERT(searchResults->size() >= 2); CPPUNIT_ASSERT(*searchResults->at(0)->getId() == *playlist0->getId()); CPPUNIT_ASSERT(*searchResults->at(1)->getId() == *playlist1->getId()); @@ -696,7 +696,7 @@ WebStorageClientTest :: searchTest(void) criteria->addCondition("dc:title", "partial", "Title "); int numberFound = wsc->search(sessionId, criteria); CPPUNIT_ASSERT(numberFound == 1); - searchResults = wsc->getSearchResults(); + searchResults = wsc->getLocalSearchResults(); CPPUNIT_ASSERT(searchResults->size() == 1); CPPUNIT_ASSERT(*searchResults->at(0)->getId() == *audioClip0->getId()); @@ -712,7 +712,7 @@ WebStorageClientTest :: searchTest(void) criteria->addCondition("dc:title", "prefix", "My"); int numberFound = wsc->search(sessionId, criteria); CPPUNIT_ASSERT(numberFound >= 5); - searchResults = wsc->getSearchResults(); + searchResults = wsc->getLocalSearchResults(); CPPUNIT_ASSERT(searchResults->size() >= 5); CPPUNIT_ASSERT(*searchResults->at(0)->getId() == *playlist0->getId()); CPPUNIT_ASSERT(*searchResults->at(3)->getId() == *audioClip0->getId()); @@ -731,7 +731,7 @@ WebStorageClientTest :: searchTest(void) criteria->setOffset(3); int numberFound = wsc->search(sessionId, criteria); CPPUNIT_ASSERT(numberFound >= 5); - searchResults = wsc->getSearchResults(); + searchResults = wsc->getLocalSearchResults(); CPPUNIT_ASSERT(searchResults->size() == 2); CPPUNIT_ASSERT(*searchResults->at(0)->getId() == *audioClip4->getId()); CPPUNIT_ASSERT(*searchResults->at(1)->getId() == *audioClip5->getId()); @@ -763,7 +763,7 @@ WebStorageClientTest :: searchUnicodeTest(void) CPPUNIT_FAIL(e.what()); } Ptr::Ref> >::Ref searchResults - = wsc->getSearchResults(); + = wsc->getLocalSearchResults(); CPPUNIT_ASSERT(searchResults->size() >= 9); Ptr::Ref audioClip1 = searchResults->at(4)->getAudioClip(); @@ -1105,6 +1105,11 @@ WebStorageClientTest :: remoteSearchTest(void) wsc->cancelTransport(sessionId, token) ); + CPPUNIT_ASSERT_NO_THROW( + token = wsc->remoteSearchOpen(sessionId, criteria); + ); + CPPUNIT_ASSERT(token); + Ptr::Ref errorMessage(new Glib::ustring); AsyncState state; diff --git a/campcaster/src/products/gLiveSupport/src/BrowseItem.cxx b/campcaster/src/products/gLiveSupport/src/BrowseItem.cxx index 8505f53be..bd1e0b982 100644 --- a/campcaster/src/products/gLiveSupport/src/BrowseItem.cxx +++ b/campcaster/src/products/gLiveSupport/src/BrowseItem.cxx @@ -147,9 +147,13 @@ BrowseItem :: onShow(void) throw () { Ptr::Ref metadataKey = metadataEntry->getActiveKey(); + Ptr::Ref + storage = gLiveSupport->getStorageClient(); + Ptr::Ref sessionId = gLiveSupport->getSessionId(); + Ptr >::Ref values; try { - values = gLiveSupport->browse(metadataKey, parentCriteria); + values = storage->browse(sessionId, metadataKey, parentCriteria); } catch (XmlRpcException &e) { std::cerr << "Error in BrowseItem::onShow(): " << e.what() << std::endl; diff --git a/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx b/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx index d3a4fa5e3..a2ee98c94 100644 --- a/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx +++ b/campcaster/src/products/gLiveSupport/src/GLiveSupport.cxx @@ -1388,42 +1388,6 @@ GLiveSupport :: detachCueAudioListener(AudioPlayerEventListener * listener) } -/*------------------------------------------------------------------------------ - * Search in the local storage. - *----------------------------------------------------------------------------*/ -int -LiveSupport :: GLiveSupport :: -GLiveSupport :: search(Ptr::Ref criteria) - throw (XmlRpcException) -{ - return storage->search(sessionId, criteria); -} - - -/*------------------------------------------------------------------------------ - * Return the Playable items found by the latest search (local or remote). - *----------------------------------------------------------------------------*/ -Ptr::Ref -LiveSupport :: GLiveSupport :: -GLiveSupport :: getSearchResults(void) throw (XmlRpcException) -{ - return storage->getSearchResults(); -} - - -/*------------------------------------------------------------------------------ - * Browse in the local storage. - *----------------------------------------------------------------------------*/ -Ptr >::Ref -LiveSupport :: GLiveSupport :: -GLiveSupport :: browse(Ptr::Ref metadata, - Ptr::Ref criteria) - throw (XmlRpcException) -{ - return storage->browse(sessionId, metadata, criteria); -} - - /*------------------------------------------------------------------------------ * Return an image containing the radio station logo. *----------------------------------------------------------------------------*/ diff --git a/campcaster/src/products/gLiveSupport/src/GLiveSupport.h b/campcaster/src/products/gLiveSupport/src/GLiveSupport.h index 2dd736ddf..4ecf8a1de 100644 --- a/campcaster/src/products/gLiveSupport/src/GLiveSupport.h +++ b/campcaster/src/products/gLiveSupport/src/GLiveSupport.h @@ -130,12 +130,6 @@ class GLiveSupport : public LocalizedConfigurable, typedef std::map LanguageMap; - /** - * The type of the list of search results. - */ - typedef StorageClientInterface::SearchResultsType - PlayableList; - /** * A type for having a map of AudioClip objects, with using * the ids of the objects as keys. @@ -975,30 +969,6 @@ class GLiveSupport : public LocalizedConfigurable, search(Ptr::Ref criteria) 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::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 >::Ref - browse(Ptr::Ref metadata, - Ptr::Ref criteria) - throw (XmlRpcException); - /** * Event handler for the "output audio player has stopped" event. */ diff --git a/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx b/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx index ed8e762c5..861dd2b1a 100644 --- a/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/SearchWindow.cxx @@ -508,10 +508,14 @@ SearchWindow :: localSearch(Ptr::Ref criteria) displayMessage("pleaseWaitMsg", localSearchResults); gLiveSupport->runMainLoop(); - Ptr::Ref searchResults; + Ptr::Ref + storage = gLiveSupport->getStorageClient(); + Ptr::Ref sessionId = gLiveSupport->getSessionId(); + + Ptr::Ref searchResults; try { - localSearchResultsCount = gLiveSupport->search(criteria); - searchResults = gLiveSupport->getSearchResults(); + localSearchResultsCount = storage->search(sessionId, criteria); + searchResults = storage->getLocalSearchResults(); } catch (XmlRpcException &e) { displayLocalSearchError(e); return; @@ -528,8 +532,8 @@ SearchWindow :: localSearch(Ptr::Ref criteria) *----------------------------------------------------------------------------*/ void SearchWindow :: displaySearchResults( - Ptr::Ref searchResults, - Glib::RefPtr treeModel) + Ptr::Ref searchResults, + Glib::RefPtr treeModel) throw () { treeModel->clear(); @@ -538,7 +542,7 @@ SearchWindow :: displaySearchResults( Ptr::Ref widgetFactory = WidgetFactory::getInstance(); - GLiveSupport::PlayableList::const_iterator it = searchResults->begin(); + SearchResultsType::const_iterator it = searchResults->begin(); if (it == searchResults->end()) { displayMessage("nothingFoundMsg", treeModel); @@ -642,11 +646,12 @@ SearchWindow :: remoteSearchClose(void) return; } - Ptr::Ref results; + Ptr::Ref results; if (state == AsyncState::finishedState) { try { - storage->remoteSearchClose(remoteSearchToken); + remoteSearchResultsCount = + storage->remoteSearchClose(remoteSearchToken); } catch (XmlRpcException &e) { displayRemoteSearchError(e); return; @@ -654,13 +659,12 @@ SearchWindow :: remoteSearchClose(void) remoteSearchToken.reset(); try { - results = gLiveSupport->getSearchResults(); + results = storage->getRemoteSearchResults(); } catch (XmlRpcException &e) { displayRemoteSearchError(e); return; } - remoteSearchResultsCount = results->size(); // FIXME displaySearchResults(results, remoteSearchResults); } else if (state == AsyncState::closedState) { diff --git a/campcaster/src/products/gLiveSupport/src/SearchWindow.h b/campcaster/src/products/gLiveSupport/src/SearchWindow.h index 099bd418a..74954bbb8 100644 --- a/campcaster/src/products/gLiveSupport/src/SearchWindow.h +++ b/campcaster/src/products/gLiveSupport/src/SearchWindow.h @@ -329,6 +329,12 @@ class SearchWindow : public GuiWindow void remoteSearchClose(void) throw (); + /** + * Typedef to save some typing. + */ + typedef StorageClientInterface::SearchResultsType + SearchResultsType; + /** * Display the search results. * The most important metadata are shown in the rows of the given @@ -336,8 +342,8 @@ class SearchWindow : public GuiWindow */ void displaySearchResults( - Ptr::Ref searchResults, - Glib::RefPtr treeModel) + Ptr::Ref searchResults, + Glib::RefPtr treeModel) throw (); /**