[MediaContent] Fix not working findItem function, when title Filter.
authorDongjin Choi <milkelf.choi@samsung.com>
Thu, 23 Aug 2012 09:14:04 +0000 (18:14 +0900)
committerKisub Song <kisubs.song@samsung.com>
Thu, 23 Aug 2012 10:05:10 +0000 (19:05 +0900)
[Title] Fix not working findItem function.
[Issue] N_SE-1229, N_SE-7294, N_SE-7296
[Problem] when the title search, the search results not.
[Cause] The Image Type, title column is empty.
[Solution] including file name condition to the sql statement.
[SCMRequest] N/A

Test Done.

Signed-off-by: Dongjin Choi <milkelf.choi@samsung.com>
src/platform/API/Mediacontent/IEventBrowseFolder.h
src/platform/API/Mediacontent/MediacontentAudio.cpp
src/platform/API/Mediacontent/MediacontentImage.cpp
src/platform/API/Mediacontent/MediacontentVideo.cpp
src/platform/Tizen/Mediacontent/MediaSearchVisitor.cpp
src/platform/Tizen/Mediacontent/Mediacontent.cpp
src/standards/Tizen/Mediacontent/JSMedia.cpp
src/standards/Tizen/Mediacontent/JSMediacontent.cpp

index 4f8c8aa..9f26484 100755 (executable)
@@ -63,12 +63,12 @@ class IEventBrowseFolder : public WrtDeviceApis::Commons::IEvent<IEventBrowseFol
        }
        
 
-       void setLimit(const unsigned long value)
+       void setLimit(const long value)
        {
                m_limitIsSet = true;
                m_limit = value;
        }
-       void setOffset(const unsigned long value)
+       void setOffset(const long value)
        {
                m_offsetIsSet = true;
                m_offset = value;
@@ -139,12 +139,12 @@ class IEventBrowseFolder : public WrtDeviceApis::Commons::IEvent<IEventBrowseFol
                return m_sortModesIsSet; 
        }
 
-       unsigned long getLimit() const
+       long getLimit() const
        {
                return m_limit;
        }
        
-       unsigned long getOffset() const
+       long getOffset() const
        {
                return m_offset;
        }       
@@ -173,8 +173,8 @@ class IEventBrowseFolder : public WrtDeviceApis::Commons::IEvent<IEventBrowseFol
        bool m_offsetIsSet;
        bool m_folderIdIsSet;
 
-       unsigned long m_limit;
-       unsigned long m_offset;
+       long m_limit;
+       long m_offset;
        FilterPtr m_filter;
        SortModeArrayPtr m_sortModes;
        SortModePtr m_sortMode;
index 10039ab..831d1dc 100755 (executable)
@@ -33,10 +33,8 @@ MediacontentAudio::MediacontentAudio()
        m_editableAttrList.push_back("rating");
        m_editableAttrList.push_back("playedTime");
        m_editableAttrList.push_back("playCount");
-       m_editableAttrList.push_back("album");
-       m_editableAttrList.push_back("genres"); 
-       m_editableAttrList.push_back("artists");
-       m_editableAttrList.push_back("composers");      
+       m_editableAttrList.push_back("title");
+       m_editableAttrList.push_back("description");
 }
 
 MediacontentAudio::~MediacontentAudio()
index 543f6a1..5c14a9c 100755 (executable)
@@ -28,6 +28,7 @@ MediacontentImage::MediacontentImage()
 {
        LogDebug("enter");
        m_editableAttrList.push_back("rating");
+       m_editableAttrList.push_back("description");
 }
 
 MediacontentImage::~MediacontentImage()
index 409a348..8c60292 100755 (executable)
@@ -29,13 +29,12 @@ MediacontentVideo::MediacontentVideo()
        m_isChangedPlayCount = false;
        m_isChangedPlayedTime = false;
 
+       m_editableAttrList.push_back("title");
        m_editableAttrList.push_back("rating");
        m_editableAttrList.push_back("playedTime");
        m_editableAttrList.push_back("playCount");
-       m_editableAttrList.push_back("geolocation");
-       m_editableAttrList.push_back("album");
-       m_editableAttrList.push_back("artists");
-
+       m_editableAttrList.push_back("description");
+       m_editableAttrList.push_back("orientation");
 }
 
 MediacontentVideo::~MediacontentVideo()
index 321aec4..ecf6646 100755 (executable)
@@ -247,7 +247,24 @@ string MediaSearchVisitor::convertAttribute(string &attrName, AnyPtr& matchValue
        }
        operatorStr = operatorKey[cond];
 
+       if (attrName.compare("MEDIA_TITLE")==0)
+       {       
+               string imageCond = STR_LEFT_BRACKET;
+               imageCond += STR_LEFT_BRACKET + " MEDIA_TYPE=0 " + STR_RIGHT_BRACKET;
+               imageCond += STR_AND + " MEDIA_DISPLAY_NAME " + operatorStr + valueStr;
+               imageCond += STR_RIGHT_BRACKET;
+
+               string videoNAudioCond = STR_LEFT_BRACKET;
+               videoNAudioCond += STR_LEFT_BRACKET + "MEDIA_TYPE=1 " + STR_OR + "  MEDIA_TYPE=3" + STR_RIGHT_BRACKET;
+               videoNAudioCond += STR_AND + " MEDIA_TITLE " + operatorStr + valueStr;
+               videoNAudioCond += STR_RIGHT_BRACKET;
+
+               conditionStr = STR_LEFT_BRACKET + imageCond + STR_OR + videoNAudioCond + STR_RIGHT_BRACKET;     
+       }
+       else
+       {
        conditionStr = STR_LEFT_BRACKET + attrName + operatorStr + valueStr + STR_RIGHT_BRACKET;
+       }
 
        return conditionStr;
 }
index 56c1c84..0e145fe 100755 (executable)
@@ -198,7 +198,8 @@ void Mediacontent::readCommonDataFromMediaInfo(media_info_h info, MediacontentMe
                }
        }
 
-       if ( MEDIA_CONTENT_ERROR_NONE == media_info_get_display_name(info, &tmpStr) )
+       if ( newMedia->getMediaType().compare("IMAGE") == 0 
+               && MEDIA_CONTENT_ERROR_NONE == media_info_get_display_name(info, &tmpStr) )
        {
                if (tmpStr)
                {
@@ -428,6 +429,17 @@ void Mediacontent::readVideoFromMediaInfo( media_info_h info, MediacontentVideo*
                                }
                        }
 
+                       if ( MEDIA_CONTENT_ERROR_NONE == video_meta_get_title(video, &tmpStr) )
+                       {
+                               if( tmpStr )
+                               {
+                                       newVideo->setDisplayName(tmpStr);
+                                       LogDebug(" Video Title. " << tmpStr);
+                                       free(tmpStr);
+                                       tmpStr = NULL;
+                               }
+                       }
+
                        if ( MEDIA_CONTENT_ERROR_NONE == video_meta_get_artist(video, &tmpStr) )
                        {       
                                if ( tmpStr)
@@ -532,6 +544,17 @@ void Mediacontent::readMusicFromMediaInfo( media_info_h info, MediacontentAudio*
                                }
                        }
 
+                       if ( MEDIA_CONTENT_ERROR_NONE == audio_meta_get_title(audio, &tmpStr) )
+                       {
+                               if (tmpStr)
+                               {
+                                       newAudio->setDisplayName(tmpStr);
+                                       LogDebug("Audio Title : " << tmpStr);
+                                       free(tmpStr);
+                                       tmpStr = NULL;
+                               }
+                       }
+
                        if ( MEDIA_CONTENT_ERROR_NONE == audio_meta_get_album(audio, &tmpStr) )
                        {
                                if (tmpStr)
@@ -845,8 +868,8 @@ void Mediacontent::OnRequestReceived(const IEventBrowseFolderPtr &eBrowse)
                                {       
                                        LogDebug("limit or offset");
                                        
-                                       int count = -1;
-                                       int offset = 0;
+                                       long count = -1;
+                                       long offset = 0;
                                        
                                        if ( eBrowse->getLimitIsSet() )
                                        {
index c5d3224..180fb4b 100755 (executable)
@@ -456,11 +456,7 @@ bool       JSMedia::setPropertyRating(
                rating = 0;
                LogDebug("Rating value set 0 as inserted value is too small");
        }
-       else if(rating > 10)
-       {
-               rating = 10;
-               LogDebug("Rating value set 10 as inserted value is too big");
-       }
+
        
        if ( objMedia->getRating() != rating)
        {
index bad5baa..3141372 100755 (executable)
@@ -404,13 +404,13 @@ JSValueRef JSMediacontent::findItems(
                {
                        long count = filterConverter->toLong(arguments[5]);
 
-                       if(count > 0.0)
+                       if(count > 0)
                        {
                                dplEvent->setLimit(count);
                        }
-                       else if ( count == 0.0)
+                       else if ( count == 0)
                        {
-                               dplEvent->setLimit(-1);
+                               dplEvent->setLimit(-1); // -1 is all row.
                        }
                        else
                        {
@@ -423,13 +423,13 @@ JSValueRef JSMediacontent::findItems(
                if(argumentCount >= 7)  //optional unsigned long? offset
                {
                        long offset = filterConverter->toLong(arguments[6]);
-                       if(offset != 0.0)
+                       if(offset != 0)
                        {
                                dplEvent->setOffset(offset);
                        }
                        else
                        {
-                               dplEvent->setOffset(-1);
+                               dplEvent->setOffset(0); 
                        }
                }               
         dplEvent->setPrivateData( DPL::StaticPointerCast<IEventPrivateData> (cbm));