summaryrefslogtreecommitdiff
path: root/src/standards/Tizen/Mediacontent
diff options
context:
space:
mode:
Diffstat (limited to 'src/standards/Tizen/Mediacontent')
-rwxr-xr-xsrc/standards/Tizen/Mediacontent/JSAudio.cpp49
-rwxr-xr-xsrc/standards/Tizen/Mediacontent/JSImage.cpp9
-rwxr-xr-xsrc/standards/Tizen/Mediacontent/JSVideo.cpp45
-rwxr-xr-xsrc/standards/Tizen/Mediacontent/JSVideo.h6
4 files changed, 99 insertions, 10 deletions
diff --git a/src/standards/Tizen/Mediacontent/JSAudio.cpp b/src/standards/Tizen/Mediacontent/JSAudio.cpp
index bb458df..7c4cc85 100755
--- a/src/standards/Tizen/Mediacontent/JSAudio.cpp
+++ b/src/standards/Tizen/Mediacontent/JSAudio.cpp
@@ -544,8 +544,9 @@ bool JSAudio::setPropertyPlayCount(
{
Converter converter(context);
MediacontentAudioPtr audio = getAudioObject(object);
- int rating = converter.toInt(value);
- audio->setAudioPlayCount(rating);
+ int count = converter.toInt(value);
+ LogDebug("count : " << count);
+ audio->setAudioPlayCount(count);
return true;
}
Catch(Exception)
@@ -600,6 +601,8 @@ bool JSAudio::setPropertyArtist(
vector<std::string> artists;
if (!JSValueIsNull(context, value)) {
+ if (JSIsArrayValue(context, value))
+ {
JSObjectRef jsObject = converter.toJSObjectRef(value);
for (std::size_t i = 0; i < JSGetArrayLength(context, jsObject); ++i) {
@@ -607,13 +610,24 @@ bool JSAudio::setPropertyArtist(
artists.push_back(converter.toString(element));
}
}
+ else
+ {
+ TizenApis::Commons::JSTizenExceptionFactory::postException(context, exception, TizenApis::Commons::JSTizenException::TYPE_MISMATCH_ERROR);
+ return false;
+ }
+ }
+ else
+ {
+ artists.push_back(converter.toString(value));
+ }
+
audio->setAudioArtist(artists, true);
return true;
}
Catch(Exception)
{
LogWarning("trying to set incorrect value");
- TizenApis::Commons::JSTizenExceptionFactory::postException(context, exception, TizenApis::Commons::JSTizenException::TYPE_MISMATCH_ERROR);
+ return TizenApis::Commons::JSTizenExceptionFactory::postException(context, exception, TizenApis::Commons::JSTizenException::TYPE_MISMATCH_ERROR);
}
return false;
@@ -634,7 +648,10 @@ bool JSAudio::setPropertyComposer(
MediacontentAudioPtr audio = getAudioObject(object);
vector<std::string> composers;
- if (!JSValueIsNull(context, value)) {
+ if (!JSValueIsNull(context, value) )
+ {
+ if (JSIsArrayValue(context, value))
+ {
JSObjectRef jsObject = converter.toJSObjectRef(value);
for (std::size_t i = 0; i < JSGetArrayLength(context, jsObject); ++i) {
@@ -642,13 +659,19 @@ bool JSAudio::setPropertyComposer(
composers.push_back(converter.toString(element));
}
}
+ }
+ else
+ {
+ composers.push_back(converter.toString(value));
+ }
+
audio->setAudioComposer(composers, true);
return true;
}
Catch(Exception)
{
LogWarning("trying to set incorrect value");
- TizenApis::Commons::JSTizenExceptionFactory::postException(context, exception, TizenApis::Commons::JSTizenException::TYPE_MISMATCH_ERROR);
+ return TizenApis::Commons::JSTizenExceptionFactory::postException(context, exception, TizenApis::Commons::JSTizenException::TYPE_MISMATCH_ERROR);
}
return false;
@@ -668,21 +691,31 @@ bool JSAudio::setPropertyGenre(
MediacontentAudioPtr audio = getAudioObject(object);
vector<std::string> genres;
- if (!JSValueIsNull(context, value)) {
+ if (!JSValueIsNull(context, value) )
+ {
+ if (JSIsArrayValue(context, value))
+ {
JSObjectRef jsObject = converter.toJSObjectRef(value);
for (std::size_t i = 0; i < JSGetArrayLength(context, jsObject); ++i) {
JSValueRef element = JSGetArrayElement(context, jsObject, i);
genres.push_back(converter.toString(element));
}
+
+ }
+ }
+ else
+ {
+ genres.push_back(converter.toString(value));
}
- audio->setAudioComposer(genres, true);
+
+ audio->setAudioGenre(genres, true);
return true;
}
Catch(Exception)
{
LogWarning("trying to set incorrect value");
- TizenApis::Commons::JSTizenExceptionFactory::postException(context, exception, TizenApis::Commons::JSTizenException::TYPE_MISMATCH_ERROR);
+ return TizenApis::Commons::JSTizenExceptionFactory::postException(context, exception, TizenApis::Commons::JSTizenException::TYPE_MISMATCH_ERROR);
}
return false;
diff --git a/src/standards/Tizen/Mediacontent/JSImage.cpp b/src/standards/Tizen/Mediacontent/JSImage.cpp
index 3f00acf..a1813fc 100755
--- a/src/standards/Tizen/Mediacontent/JSImage.cpp
+++ b/src/standards/Tizen/Mediacontent/JSImage.cpp
@@ -21,6 +21,11 @@
#include <CommonsJavaScript/JSUtils.h>
#include <CommonsJavaScript/JSDOMExceptionFactory.h>
#include <Tizen/Tizen/JSSimpleCoordinates.h>
+
+#include <Tizen/Common/JSTizenExceptionFactory.h>
+#include <Tizen/Common/JSTizenException.h>
+#include <Tizen/Common/SecurityExceptions.h>
+
#include "JSMediacontent.h"
#include "JSImage.h"
@@ -32,6 +37,8 @@
#define TIZEN_MEDIACONTENT_IMAGE_ORIENTATION "orientation"
using namespace TizenApis::Tizen1_0::Tizen;
+using namespace TizenApis::Commons;
+using namespace WrtDeviceApis::Commons;
namespace TizenApis {
namespace Tizen1_0 {
@@ -242,6 +249,7 @@ bool JSImage::setPropertyOrientation(
Catch(Exception)
{
LogWarning("trying to get incorrect value");
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR);
}
return false;
@@ -272,6 +280,7 @@ bool JSImage::setPropertyGeolocation(
Catch(Exception)
{
LogWarning("trying to get incorrect value");
+ TizenApis::Commons::JSTizenExceptionFactory::postException(context, exception, TizenApis::Commons::JSTizenException::TYPE_MISMATCH_ERROR);
}
return false;
diff --git a/src/standards/Tizen/Mediacontent/JSVideo.cpp b/src/standards/Tizen/Mediacontent/JSVideo.cpp
index 0e6e57a..5e6b6d8 100755
--- a/src/standards/Tizen/Mediacontent/JSVideo.cpp
+++ b/src/standards/Tizen/Mediacontent/JSVideo.cpp
@@ -39,6 +39,8 @@
#define TIZEN_MEDIACONTENT_VIDEO_HEIGHT "height"
using namespace TizenApis::Tizen1_0::Tizen;
+using namespace TizenApis::Commons;
+using namespace WrtDeviceApis::Commons;
namespace TizenApis {
namespace Tizen1_0 {
@@ -166,6 +168,35 @@ JSValueRef JSVideo::getPropertyGeoLocation(
return JSValueMakeUndefined(context);
}
+bool JSVideo::setPropertyGeoLocation(
+ JSContextRef context,
+ JSObjectRef object,
+ JSStringRef propertyName,
+ JSValueRef value,
+ JSValueRef* exception)
+{
+ LogDebug("entered");
+ Try
+ {
+ Converter converter(context);
+ MediacontentVideoPtr video = getVideoObject(object);
+
+ TizenApis::Api::Tizen::SimpleCoordinatesPtr geoLocation =
+ TizenApis::Tizen1_0::Tizen::JSSimpleCoordinates::getSimpleCoordinates(context, value);
+
+ video->setVideoLatitude(geoLocation->getLatitude());
+ video->setVideoLongitude(geoLocation->getLongitude());
+
+ return true;
+ }
+ Catch(Exception)
+ {
+ LogWarning("trying to get incorrect value");
+ return JSTizenExceptionFactory::postException(context, exception, JSTizenException::TYPE_MISMATCH_ERROR);
+ }
+ return JSValueMakeUndefined(context);
+}
+
JSValueRef JSVideo::getPropertyAlbum(
JSContextRef context,
@@ -365,8 +396,9 @@ bool JSVideo::setPropertyPlayCount(
{
Converter converter(context);
MediacontentVideoPtr video = getVideoObject(object);
- int rating = converter.toInt(value);
- video->setVideoPlayCount(rating, true);
+ int count = converter.toInt(value);
+ LogDebug("count:" << count);
+ video->setVideoPlayCount(count, true);
return true;
}
Catch(Exception)
@@ -394,6 +426,9 @@ bool JSVideo::setPropertyArtists(
vector<std::string> artists;
if (!JSValueIsNull(context, value)) {
+
+ if (JSIsArrayValue(context, value))
+ {
JSObjectRef jsObject = converter.toJSObjectRef(value);
for (std::size_t i = 0; i < JSGetArrayLength(context, jsObject); ++i) {
@@ -401,6 +436,12 @@ bool JSVideo::setPropertyArtists(
artists.push_back(converter.toString(element));
}
}
+ else
+ {
+ TizenApis::Commons::JSTizenExceptionFactory::postException(context, exception, TizenApis::Commons::JSTizenException::TYPE_MISMATCH_ERROR);
+ return false;
+ }
+ }
video->setVideoArtist(artists, true);
return true;
}
diff --git a/src/standards/Tizen/Mediacontent/JSVideo.h b/src/standards/Tizen/Mediacontent/JSVideo.h
index 8397d5c..5f40193 100755
--- a/src/standards/Tizen/Mediacontent/JSVideo.h
+++ b/src/standards/Tizen/Mediacontent/JSVideo.h
@@ -159,6 +159,12 @@ private:
JSValueRef value,
JSValueRef* exception);
+ static bool setPropertyGeoLocation(
+ JSContextRef context,
+ JSObjectRef object,
+ JSStringRef propertyName,
+ JSValueRef value,
+ JSValueRef* exception);
//todo-dykim
//static JSValueRef setPropertyPlayedTime