Add : AlbumArtist and RecordedDate information for content
[platform/framework/native/content.git] / src / FCnt_ContentManagerImpl.cpp
index 07614cb..fbede74 100644 (file)
@@ -1875,6 +1875,20 @@ _ContentManagerImpl::MakeAudioContentInfo(const media_info_h pMediaInfo, void* p
                SysLog(NID_CNT, "META: artist[%ls]", (String(pStrValue.get())).GetPointer());
        }
 
+       // album artist
+       val = audio_meta_get_album_artist(*(pAudioMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "audio_meta_get_album_artist failed[%d].", val);
+
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
+
+               pAudioContentInfoImpl->SetAlbumArtist(String(pStrValue.get()));
+
+               SysLog(NID_CNT, "META: album artist[%ls]", (String(pStrValue.get())).GetPointer());
+       }
+
        // composer
        val = audio_meta_get_composer(*(pAudioMeta.get()), &pTempValue);
        SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
@@ -2049,6 +2063,92 @@ _ContentManagerImpl::MakeVideoContentInfo(const media_info_h pMediaInfo, void* p
        pVideoContentInfoImpl->SetDuration(intValue);
        SysLog(NID_CNT, "META: duration[%d]", intValue);
 
+       // recorded date
+       val = video_meta_get_recorded_date(*(pVideoMeta.get()), &pTempValue);
+       SysTryReturnResult(NID_CNT, val == MEDIA_CONTENT_ERROR_NONE, ConvertError(val),
+                       "video_meta_get_recorded_date failed[%d].", val);
+
+       DateTime dt;
+
+       if (pTempValue != null)
+       {
+               pStrValue.reset(pTempValue);
+               String recordedDate(pStrValue.get());
+               String newRecordedDate(L"");
+
+               // detour the unexpected recorded date format
+               String tempDelim(L"+-Z");
+               String token;
+
+               StringTokenizer tempStrTok(recordedDate, tempDelim);
+
+               result r = tempStrTok.GetNextToken(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation.");
+
+               recordedDate = token;
+
+               String delim(L": ");
+               String year(L"");
+
+               StringTokenizer strTok(recordedDate, delim);
+
+               r = strTok.SetDelimiters(delim);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform SetDelimiters operation.");
+
+               r = strTok.GetNextToken(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation.");
+
+               year = token;
+
+               // Append month
+               r = strTok.GetNextToken(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation.");
+
+               r = newRecordedDate.Append(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               r = newRecordedDate.Append(L"/");
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               // Append day
+               r = strTok.GetNextToken(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation.");
+
+               r = newRecordedDate.Append(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               r = newRecordedDate.Append(L"/");
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               // Append year
+               r = newRecordedDate.Append(year);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               r = newRecordedDate.Append(L" ");
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               String newDelim(L" ");
+
+               r = strTok.SetDelimiters(newDelim);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform SetDelimiters operation.");
+
+               r = strTok.GetNextToken(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform GetNextToken operation.");
+
+               r = newRecordedDate.Append(token);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_OUT_OF_MEMORY, "Failed to perform Append operation.");
+
+               r = DateTime::Parse(newRecordedDate, dt);
+               SysTryReturnResult(NID_CNT, !IsFailed(r), E_INVALID_ARG, "Failed to perform Parse operation for DateTime.");
+       }
+       else
+       {
+               dt = DateTime::GetMinValue();
+       }
+
+       pVideoContentInfoImpl->SetVideoRecordedDate(dt);
+       SysLog(NID_CNT, "META: recorded date[%ls]", dt.ToString().GetPointer());
+
        // Get some information from metadata extractor when calling VideoContentInfo (framerate, audio bitrate, video bitrate)
 
        return E_SUCCESS;