return gmtime_hours;
}
+std::string get_date(char* tmpStr) {
+ if (tmpStr) {
+ struct tm* result = (struct tm*) calloc(1, sizeof(struct tm));
+ if (strptime(tmpStr, "%Y:%m:%d %H:%M:%S", result) == NULL) {
+ return std::string();
+ } else {
+ time_t t = mktime(result);// + get_utc_offset() * 3600;
+ std::stringstream str_date;
+ str_date << t;
+ free(tmpStr);
+ free(result);
+ tmpStr = NULL;
+ return str_date.str();
+ }
+ }
+ return std::string();
+}
void ContentToJson(media_info_h info, picojson::object& o) {
int ret;
image_meta_h img;
if (MEDIA_CONTENT_ERROR_NONE == media_info_get_image(info, &img)) {
if (MEDIA_CONTENT_ERROR_NONE == image_meta_get_date_taken(img, &tmpStr)) {
- if (tmpStr) {
- struct tm* result = (struct tm*) calloc(1, sizeof(struct tm));
- if (strptime(tmpStr, "%Y:%m:%d %H:%M:%S", result) == NULL) {
- LoggerE("Couldn't convert supplied date.");
- }
- else {
- time_t t = mktime(result);// + get_utc_offset() * 3600;
- std::stringstream str_date;
- str_date << t;
- o["releaseDate"] = picojson::value(str_date.str());
- free(tmpStr);
- free(result);
- tmpStr = NULL;
- }
- }
+ o["releaseDate"] = picojson::value(get_date(tmpStr));
}
if (MEDIA_CONTENT_ERROR_NONE == image_meta_get_width(img, &tmpInt)) {
o["width"] = picojson::value(static_cast<double>(tmpInt));
if (MEDIA_CONTENT_ERROR_NONE == video_meta_get_duration(video, &tmpInt)) {
o["duration"] = picojson::value(static_cast<double>(tmpInt));
}
+ if (MEDIA_CONTENT_ERROR_NONE == video_meta_get_recorded_date(video, &tmpStr)) {
+ o["releaseDate"] = picojson::value(get_date(tmpStr));
+ }
}
picojson::object geo;
if (MEDIA_CONTENT_ERROR_NONE == media_info_get_latitude(info, &tmpDouble)) {
audio_meta_h audio;
if (MEDIA_CONTENT_ERROR_NONE == media_info_get_audio(info, &audio)) {
if (MEDIA_CONTENT_ERROR_NONE == audio_meta_get_recorded_date(audio, &tmpStr)) {
- if (tmpStr) {
- struct tm* result = (struct tm*) calloc(1, sizeof(struct tm));
-
- if (strptime(tmpStr, "%Y:%m:%d %H:%M:%S", result) == NULL) {
- LoggerD("Couldn't convert supplied date.");
- }
- time_t t = mktime(result) + get_utc_offset() * 3600;
- std::stringstream str_date;
- str_date << t;
- o["releaseDate"] = picojson::value(str_date.str());
- free(tmpStr);
- free(result);
- tmpStr = NULL;
- }
+ o["releaseDate"] = picojson::value(get_date(tmpStr));
}
if (MEDIA_CONTENT_ERROR_NONE == audio_meta_get_album(audio, &tmpStr)) {
if (tmpStr) {
{name: 'sourcePlaylist', type: types_.PLATFORM_OBJECT, values: Playlist, optional: true, nullable: true}
]);
+ if (!arguments.length || !type_.isString(arguments[0]) ||
+ (type_.isString(arguments[0]) && !arguments[0].length)) {
+ setTimeout(function() {
+ args.errorCallback(new WebAPIException(WebAPIException.INVALID_VALUES_ERR));
+ }, 0);
+ return;
+ }
+
var data = {
name: args.name,
sourcePlaylist: args.sourcePlaylist
{name: 'offset', type: types_.LONG, optional: true}
]);
+ if (args.offset < 0 || args.count < 0) {
+ setTimeout(function() {
+ args.errorCallback(new WebAPIException(WebAPIException.INVALID_VALUES_ERR));
+ }, 0);
+ return;
+ }
+
var data = {
playlistId: this.id,
count: type_.isNullOrUndefined(args.count) ? -1 : args.count,
{name: 'errorCallback', type: types_.FUNCTION, optional: true, nullable: true}
]);
+ if (!args.items.length) {
+ setTimeout(function() {
+ args.errorCallback(new WebAPIException(WebAPIException.INVALID_VALUES_ERR));
+ }, 0);
+ return;
+ }
+
var members = [];
for (var i = 0; i < args.items.length; i++) {
members.push(args.items[i].content.memberId);