[DllImport(Libraries.MediaContent, EntryPoint = "media_album_destroy")]
internal static extern MediaContentError Destroy(IntPtr album);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_album_clone")]
- internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_album_get_album_id")]
internal static extern MediaContentError GetId(IntPtr album, out int albumId);
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_media_count_from_db")]
internal static extern MediaContentError GetMediaCountFromDb(string folder_id, FilterHandle filter, out int count);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_clone")]
- internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_destroy")]
internal static extern MediaContentError Destroy(IntPtr folder);
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_folder_id")]
internal static extern MediaContentError GetFolderId(IntPtr folder, out IntPtr folder_id);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_parent_folder_id")]
- internal static extern MediaContentError GetParentFolderId(IntPtr folder, out IntPtr parent_folder_id);
-
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_path")]
internal static extern MediaContentError GetPath(IntPtr folder, out IntPtr folderPath);
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_name")]
internal static extern MediaContentError GetName(IntPtr folder, out IntPtr folder_name);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_modified_time")]
- internal static extern MediaContentError GetModifiedTime(IntPtr folder, out IntPtr date);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_storage_type")]
internal static extern MediaContentError GetStorageType(IntPtr folder, out StorageType storage_type);
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_storage_id")]
internal static extern MediaContentError GetStorageId(IntPtr folder, out IntPtr storage_id);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_order")]
- internal static extern MediaContentError GetOrder(IntPtr folder, out int order);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_get_folder_from_db")]
internal static extern MediaContentError GetFolderFromDb(string id, out IntPtr folder);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_set_name")]
- internal static extern MediaContentError SetName(IntPtr folder, string name);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_set_order")]
- internal static extern MediaContentError SetOrder(IntPtr folder, int order);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_folder_update_to_db")]
- internal static extern MediaContentError UpdateToDb(IntPtr folder);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_folder_foreach_folder_from_db")]
internal static extern MediaContentError ForeachFolderFromDb(FilterHandle filter,
Common.ItemCallback callback, IntPtr userData = default(IntPtr));
[DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_model", CallingConvention = CallingConvention.Cdecl)]
internal static extern MediaContentError GetModel(IntPtr handle, out IntPtr model);
- [DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_media_id", CallingConvention = CallingConvention.Cdecl)]
- internal static extern MediaContentError GetMediaId(IntPtr handle, out IntPtr mediaId);
-
[DllImport(Libraries.MediaContent, EntryPoint = "image_meta_get_width", CallingConvention = CallingConvention.Cdecl)]
internal static extern MediaContentError GetWidth(IntPtr handle, out int width);
[DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_altitude")]
internal static extern MediaContentError GetAltitude(MediaInfoHandle mediaInformationHandle, out double altitude);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_weather")]
- internal static extern MediaContentError GetWeather(MediaInfoHandle mediaInformationHandle, out IntPtr weather);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_rating")]
internal static extern MediaContentError GetRating(MediaInfoHandle mediaInformationHandle, out int rating);
[DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_favorite")]
internal static extern MediaContentError GetFavorite(MediaInfoHandle mediaInformationHandle, out bool favorite);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_provider")]
- internal static extern MediaContentError GetProvider(MediaInfoHandle mediaInformationHandle, out IntPtr provider);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_title")]
internal static extern MediaContentError GetTitle(MediaInfoHandle mediaInformationHandle, out IntPtr title);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_category")]
- internal static extern MediaContentError GetCategory(MediaInfoHandle mediaInformationHandle, out IntPtr category);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_location_tag")]
- internal static extern MediaContentError GetLocationTag(MediaInfoHandle mediaInformationHandle, out IntPtr locationTag);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_age_rating")]
- internal static extern MediaContentError GetAgeRating(MediaInfoHandle mediaInformationHandle, out IntPtr ageRating);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_storage_id")]
internal static extern MediaContentError GetStorageId(MediaInfoHandle mediaInformationHandle, out IntPtr storageId);
[DllImport(Libraries.MediaContent, EntryPoint = "media_info_get_media_from_db")]
internal static extern MediaContentError GetMediaFromDB(string mediaId, out MediaInfoHandle handle);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_weather")]
- internal static extern MediaContentError SetWeather(MediaInfoHandle mediaInformationHandle, string weather);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_favorite")]
internal static extern MediaContentError SetFavorite(MediaInfoHandle mediaInformationHandle, bool favorite);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_provider")]
- internal static extern MediaContentError SetProvider(MediaInfoHandle mediaInformationHandle, string provider);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_category")]
- internal static extern MediaContentError SetCategory(MediaInfoHandle mediaInformationHandle, string category);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_location_tag")]
- internal static extern MediaContentError SetLocationTag(MediaInfoHandle mediaInformationHandle, string locationTag);
-
- [DllImport(Libraries.MediaContent, EntryPoint = "media_info_set_age_rating")]
- internal static extern MediaContentError SetAgeRating(MediaInfoHandle mediaInformationHandle, string ageRating);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_info_update_to_db")]
internal static extern MediaContentError UpdateToDB(MediaInfoHandle mediaInformationHandle);
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_destroy")]
internal static extern MediaContentError Destroy(IntPtr playlist);
- [DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_clone")]
- internal static extern MediaContentError Clone(out IntPtr dst, IntPtr src);
-
[DllImport(Libraries.MediaContent, EntryPoint = "media_playlist_get_playlist_id")]
internal static extern MediaContentError GetId(IntPtr playlist, out int id);
public static string Favorite => "MEDIA_FAVOURITE";
/// <summary>
- /// Gets the column name for the provider of media.
- /// </summary>
- /// <value>The column name for the provider of media.</value>
- /// <remarks>
- /// The value type is string.
- /// </remarks>
- /// <seealso cref="MediaInfo.Provider"/>
- public static string Provider => "MEDIA_PROVIDER";
-
- /// <summary>
- /// Gets the column name for the category of media.
- /// </summary>
- /// <value>The column name for the category of media.</value>
- /// <remarks>
- /// The value type is string.
- /// </remarks>
- /// <seealso cref="MediaInfo.Category"/>
- public static string Category => "MEDIA_CATEGORY";
-
- /// <summary>
- /// Gets the column name for the location tag of media.
- /// </summary>
- /// <value>The column name for the location tag of media.</value>
- /// <remarks>
- /// The value type is string.
- /// </remarks>
- /// <seealso cref="MediaInfo.LocationTag"/>
- public static string LocationTag => "MEDIA_LOCATION_TAG";
-
- /// <summary>
- /// Gets the column name for the age rating of media.
- /// </summary>
- /// <value>The column name for the age rating of media.</value>
- /// <remarks>
- /// The value type is string.
- /// </remarks>
- /// <seealso cref="MediaInfo.AgeRating"/>>
- public static string AgeRating => "MEDIA_AGE_RATING";
-
- /// <summary>
- /// Gets the column name for the weather information of media.
- /// </summary>
- /// <value>The column name for the weather information of media.</value>
- /// <remarks>
- /// The value type is string.
- /// </remarks>
- /// <seealso cref="MediaInfo.Weather"/>
- public static string Weather => "MEDIA_WEATHER";
-
- /// <summary>
/// Gets the column name for the drm of media.
/// </summary>
/// <value>The column name for the drm of media.</value>
/// Represents the information related to the media stored.
/// </summary>
/// <seealso cref="MediaInfoCommand"/>
- /// <seealso cref="MediaInfoUpdateValues"/>
public class MediaInfo
{
internal MediaInfo(Interop.MediaInfoHandle handle)
Latitude = InteropHelper.GetValue<double>(handle, Interop.MediaInfo.GetLatitude);
Altitude = InteropHelper.GetValue<double>(handle, Interop.MediaInfo.GetAltitude);
- Weather = InteropHelper.GetString(handle, Interop.MediaInfo.GetWeather);
Rating = InteropHelper.GetValue<int>(handle, Interop.MediaInfo.GetRating);
IsFavorite = InteropHelper.GetValue<bool>(handle, Interop.MediaInfo.GetFavorite);
- Provider = InteropHelper.GetString(handle, Interop.MediaInfo.GetProvider);
Title = InteropHelper.GetString(handle, Interop.MediaInfo.GetTitle);
- Category = InteropHelper.GetString(handle, Interop.MediaInfo.GetCategory);
- LocationTag = InteropHelper.GetString(handle, Interop.MediaInfo.GetLocationTag);
- AgeRating = InteropHelper.GetString(handle, Interop.MediaInfo.GetAgeRating);
StorageId = InteropHelper.GetString(handle, Interop.MediaInfo.GetStorageId);
IsDrm = InteropHelper.GetValue<bool>(handle, Interop.MediaInfo.IsDrm);
public double Altitude { get; }
/// <summary>
- /// Gets the weather information of media.
- /// </summary>
- /// <value>The weather information which a user sets.</value>
- public string Weather { get; }
-
- /// <summary>
/// Gets the rating of media.
/// </summary>
/// <value>The rating from the metadata.</value>
public bool IsFavorite { get; }
/// <summary>
- /// Gets the provider of media.
- /// </summary>
- /// <value>The provider which a user sets.</value>
- public string Provider { get; }
-
- /// <summary>
/// Gets the title of media.
/// </summary>
/// <value>The title of media.</value>
public string Title { get; }
/// <summary>
- /// Gets the category of media.
- /// </summary>
- /// <value>The category which a user sets.</value>
- public string Category { get; }
-
- /// <summary>
- /// Gets the location tag of media.
- /// </summary>
- /// <value>The location tag which a user sets.</value>
- public string LocationTag { get; }
-
- /// <summary>
- /// Gets the age rating of media.
- /// </summary>
- /// <value>The age rating which a user sets.</value>
- public string AgeRating { get; }
-
- /// <summary>
/// Gets the storage ID of the storage that the media is stored on.
/// </summary>
/// <value>The storage ID of the storage that the media is stored on.</value>
/// Rating.
/// </summary>
Rating = 20,
-
- /// <summary>
- /// Provider.
- /// </summary>
- Provider = 22,
-
- /// <summary>
- /// Category.
- /// </summary>
- Category = 24,
- /// <summary>
- /// Location tag.
- /// </summary>
- LocationTag,
- /// <summary>
- /// Age rating.
- /// </summary>
- AgeRating,
- /// <summary>
- /// Weather.
- /// </summary>
- Weather = 28
}
}
}
}
- private static void SetUpdateValue<T>(Interop.MediaInfoHandle handle, T value,
- Func<Interop.MediaInfoHandle, T, MediaContentError> func)
- {
- if (value != null)
- {
- func(handle, value).ThrowIfError("Failed to update");
- }
- }
-
- private static void SetUpdateValue<T>(Interop.MediaInfoHandle handle, Nullable<T> value,
- Func<Interop.MediaInfoHandle, T, MediaContentError> func) where T : struct
- {
- if (value.HasValue)
- {
- func(handle, value.Value).ThrowIfError("Failed to update");
- }
- }
-
/// <summary>
- /// Updates the media with the specified values.
+ /// Updates the media with the favorite value.
/// </summary>
/// <privilege>http://tizen.org/privilege/content.write</privilege>
/// <param name="mediaId">The media ID to update.</param>
- /// <param name="values">The values for update.</param>
+ /// <param name="value">The value indicating whether the media is favorite.</param>
/// <returns>true if the matched record was found and updated, otherwise false.</returns>
- /// <remarks>Only values set in the <see cref="MediaInfoUpdateValues"/> are updated.</remarks>
/// <exception cref="InvalidOperationException">The <see cref="MediaDatabase"/> is disconnected.</exception>
/// <exception cref="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed of.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
- /// <exception cref="ArgumentNullException">
- /// <paramref name="mediaId"/> is null.\n
- /// -or-\n
- /// <paramref name="values"/> is null.
- /// </exception>
+ /// <exception cref="ArgumentNullException"><paramref name="mediaId"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="mediaId"/> is a zero-length string, contains only white space.</exception>
/// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
- public bool Update(string mediaId, MediaInfoUpdateValues values)
+ public bool UpdateFavorite(string mediaId, bool value)
{
ValidateDatabase();
ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
- if (values == null)
- {
- throw new ArgumentNullException(nameof(values));
- }
-
if (CommandHelper.Count(
Interop.MediaInfo.GetMediaCount, $"{MediaInfoColumns.Id}='{mediaId}'") == 0)
{
try
{
- SetUpdateValue(handle, values.Weather, Interop.MediaInfo.SetWeather);
- SetUpdateValue(handle, values.IsFavorite, Interop.MediaInfo.SetFavorite);
- SetUpdateValue(handle, values.Provider, Interop.MediaInfo.SetProvider);
- SetUpdateValue(handle, values.Category, Interop.MediaInfo.SetCategory);
- SetUpdateValue(handle, values.LocationTag, Interop.MediaInfo.SetLocationTag);
- SetUpdateValue(handle, values.AgeRating, Interop.MediaInfo.SetAgeRating);
+ Interop.MediaInfo.SetFavorite(handle, value).ThrowIfError("Failed to update");
Interop.MediaInfo.UpdateToDB(handle).ThrowIfError("Failed to update");
return true;
+++ /dev/null
-/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the License);
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an AS IS BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-
-namespace Tizen.Content.MediaContent
-{
- /// <summary>
- /// Provides means to set values used for the update command.
- /// </summary>
- /// <remarks>
- /// The values only set in the object will be affected to the update command.
- /// </remarks>
- /// <seealso cref="MediaInfoCommand.Update(string, MediaInfoUpdateValues)"/>
- public class MediaInfoUpdateValues
- {
- /// <summary>
- /// Gets or sets the weather information for an update.
- /// </summary>
- /// <remarks>If the value is null, the update operation will have no effect on the field.</remarks>
- /// <value>A string for weather; the field will not be updated if null.</value>
- public string Weather { get; set; }
-
- /// <summary>
- /// Gets or sets the favorite status for an update.
- /// </summary>
- /// <remarks>If the value is null, the update operation will have no effect on the field.</remarks>
- /// <value>A value indicating whether the media is favorite; the field will not be updated if null.</value>
- public bool? IsFavorite { get; set; }
-
- /// <summary>
- /// Gets or sets the provider information for an update.
- /// </summary>
- /// <remarks>If the value is null, the update operation will have no effect on the field.</remarks>
- /// <value>A string for provider; the field will not be updated if null.</value>
- public string Provider { get; set; }
-
- /// <summary>
- /// Gets or sets the category information for an update.
- /// </summary>
- /// <remarks>If the value is null, the update operation will have no effect on the field.</remarks>
- /// <value>A string for category; the field will not be updated if null.</value>
- public string Category { get; set; }
-
-
- /// <summary>
- /// Gets or sets the location tag for an update.
- /// </summary>
- /// <remarks>If the value is null, the update operation will have no effect on the field.</remarks>
- /// <value>A string for location tag; the field will not be updated if null.</value>
- public string LocationTag { get; set; }
-
- /// <summary>
- /// Gets or sets the age rating information for an update.
- /// </summary>
- /// <remarks>If the value is null, the update operation will have no effect on the field.</remarks>
- /// <value>A string for age rating; the field will not be updated if null.</value>
- public string AgeRating { get; set; }
- }
-}