6457d5ea5034306f89217cf14d0fde25da82ee70
[profile/ivi/wrt-plugins-tizen.git] / src / platform / API / Mediacontent / MediacontentMedia.cpp
1 /*
2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License. 
15 */
16
17 #include <dpl/log/log.h>
18 #include <Commons/Exception.h>
19 #include "MediacontentMedia.h"
20 #include <aul/aul.h>
21
22
23 namespace TizenApis {
24 namespace Api {
25 namespace Mediacontent {
26
27 MediacontentMedia::MediacontentMedia()
28 {
29         m_isChangedFavorite = false;
30         m_isGetMimetype = false;
31 }
32
33 MediacontentMedia::~MediacontentMedia()
34 {
35 }
36
37 string MediacontentMedia::getMediaUUID() const
38 {
39         return m_mediaUUID;
40 }
41
42 void MediacontentMedia::setMediaUUID(const string &value)
43 {
44         m_mediaUUID = value;
45 }
46
47 string MediacontentMedia::getMimeType()
48 {
49         LogDebug("MediacontentMedia::getMimeType");
50         if(!m_isGetMimetype)
51         {
52                 int res;
53                 char type[256];
54                 res = aul_get_mime_from_file(m_filePath.c_str(), type, sizeof(type));
55                 LogDebug("file:"<< m_filePath <<"  type:" << type);
56                 if(res == 0)
57                 {
58                         m_mimeType = type;
59                         m_isGetMimetype = true;
60                 }
61         }
62         return m_mimeType;
63 }
64
65 string MediacontentMedia::getDisplayName() const
66 {
67     return m_displayName;
68 }
69
70 void MediacontentMedia::setMimeType(const string &value)
71 {
72         m_mimeType = value;
73 }
74
75
76 void MediacontentMedia::setDisplayName(const string &value)
77 {
78         m_displayName = value;
79 }
80
81 string MediacontentMedia::getFilePath() const
82 {
83         return m_filePath;
84
85 }
86
87 void MediacontentMedia::setFilePath(const string &value)
88 {
89         m_filePath = value;
90
91 }
92
93 string MediacontentMedia::getThumbnailPath() const
94 {
95         return m_thumbnailPath;
96 }
97
98
99 tm MediacontentMedia::getCreatedDate() const
100 {
101         return m_createdDate;
102 }
103
104 tm MediacontentMedia::getReleasedDate() const
105 {
106         return m_releasedDate;
107 }
108
109 void MediacontentMedia::setThumbnailPath(const string &value)
110 {
111         m_thumbnailPath = value;
112
113 }
114 tm MediacontentMedia::getModifiedDate() const
115 {
116         return m_modifiedDate;
117 }
118
119 void MediacontentMedia::setCreatedDate(const tm &value)
120 {
121         m_createdDate = value;
122
123 }
124
125 void MediacontentMedia::setReleasedDate(const tm &value)
126 {
127         m_releasedDate = value;
128
129 }
130
131 void MediacontentMedia::setModifiedDate(const tm &value)
132 {
133         m_modifiedDate = value;
134
135 }
136 int MediacontentMedia::getFavorite() const
137 {
138         return m_favorite;
139 }
140 void MediacontentMedia::setFavorite(int value)
141 {
142         m_favorite = value;
143         m_isChangedFavorite = true;
144
145 }
146 string MediacontentMedia::getMediaType() const
147 {
148         return m_mediaType;
149 }
150
151 void MediacontentMedia::setMediaType(const string &value) 
152 {
153         m_mediaType = value;
154 }
155
156 void MediacontentMedia::display() const
157 {
158
159         LogDebug("m_mediaUUID : " << m_mediaUUID);
160         LogDebug("m_mediaType : " << m_mediaType);
161 //      LogDebug("m_mimeType : " << m_mimeType);
162         LogDebug("m_displayName : " << m_displayName);
163         LogDebug("m_filePath : " << m_filePath);
164         LogDebug("m_thumbnailPath : " << m_thumbnailPath);
165         LogDebug("m_description : " << m_description);
166 //      LogDebug("m_createdDate : " << m_createdDate);
167 //      LogDebug("m_releasedDate : " << m_releasedDate);
168 //      LogDebug("m_modifiedDate : " << m_modifiedDate);
169         LogDebug("m_favorite : " << m_favorite);
170         
171
172 }
173 string MediacontentMedia::getDescription() const
174 {
175         return m_description;
176 }
177
178 void MediacontentMedia::setDescription(const string &value)
179 {
180         m_description = value;
181 }
182
183 bool MediacontentMedia::getIsChangedFavorite() const
184 {
185         return m_isChangedFavorite;
186 }
187
188
189
190 EditableAttributeListPtr        MediacontentMedia::getEditableAttr() const
191 {
192     return m_editableAttrPtr;
193 }
194
195
196 }
197 }
198 }