/// Provides the commands to manage playlists in the database.
/// </summary>
/// <seealso cref="Playlist"/>
+ /// <since_tizen> 4 </since_tizen>
public class PlaylistCommand : MediaCommand
{
/// <summary>
/// </summary>
/// <param name="database">A <see cref="MediaDatabase"/> that the commands run on.</param>
/// <exception cref="ArgumentNullException"><paramref name="database"/> is null.</exception>
- /// <exception cref="ObjectDisposedException"><paramref name="database"/> has already been disposed of.</exception>
+ /// <exception cref="ObjectDisposedException"><paramref name="database"/> has already been disposed.</exception>
+ /// <since_tizen> 4 </since_tizen>
public PlaylistCommand(MediaDatabase database) : base(database)
{
}
/// </summary>
/// <returns>The number of playlists.</returns>
/// <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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <since_tizen> 4 </since_tizen>
public int Count()
{
return Count(null);
/// <param name="arguments">The criteria to use to filter. This value can be null.</param>
/// <returns>The number of playlists.</returns>
/// <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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <since_tizen> 4 </since_tizen>
public int Count(CountArguments arguments)
{
ValidateDatabase();
/// </summary>
/// <param name="playlistId">The playlist ID.</param>
/// <param name="memberId">The member ID of the playlist.</param>
- /// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
+ /// <returns>The order of the member in the playlist.</returns>
/// <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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="playlistId"/> is less than or equal to zero.<br/>
/// -or-<br/>
/// <paramref name="memberId"/> is less than or equal to zero.
/// </exception>
+ /// <since_tizen> 4 </since_tizen>
public int GetPlayOrder(int playlistId, int memberId)
{
ValidateDatabase();
/// <param name="playlistId">The playlist ID to delete.</param>
/// <returns>true if the matched record was found and deleted, otherwise false.</returns>
/// <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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
/// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ /// <since_tizen> 4 </since_tizen>
public bool Delete(int playlistId)
{
ValidateDatabase();
/// <param name="path">The path to a M3U file to import.</param>
/// <returns>The <see cref="Playlist"/> instance that contains the record information inserted.</returns>
/// <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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentNullException">
/// <paramref name="name"/> is null.<br/>
/// </exception>
/// <exception cref="FileNotFoundException"><paramref name="path"/> does not exists.</exception>
/// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ /// <since_tizen> 4 </since_tizen>
public Playlist InsertFromFile(string name, string path)
{
ValidateDatabase();
/// <param name="playlistId">The playlist ID to export.</param>
/// <param name="path">The path to a M3U file.</param>
/// <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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentNullException"><paramref name="path"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="path"/> is a zero-length string, contains only white space.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
/// <exception cref="RecordNotFoundException">No matching playlist exists.</exception>
/// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ /// <since_tizen> 4 </since_tizen>
public void ExportToFile(int playlistId, string path)
{
ValidateDatabase();
{
Interop.Playlist.GetPlaylistFromDb(playlistId, out handle).ThrowIfError("Failed to query");
- if (handle == IntPtr.Zero)
- {
- throw new RecordNotFoundException("No matching playlist exists.");
- }
-
Interop.Playlist.ExportToFile(handle, path).ThrowIfError("Failed to export");
}
+ catch (ArgumentException)
+ {
+ // Native FW returns ArgumentException when there's no matched record.
+ throw new RecordNotFoundException("No matching playlist exists.");
+ }
finally
{
if (handle != IntPtr.Zero)
/// <param name="name">The name of the playlist.</param>
/// <returns>The <see cref="Playlist"/> instance that contains the record information inserted.</returns>
/// <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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentNullException"><paramref name="name"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="name"/> is a zero-length string.</exception>
/// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ /// <since_tizen> 4 </since_tizen>
public Playlist Insert(string name)
{
return Insert(name, null);
/// <param name="thumbnailPath">The path of the thumbnail for the playlist. This value can be null.</param>
/// <returns>The <see cref="Playlist"/> instance that contains the record information inserted.</returns>
/// <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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentNullException"><paramref name="name"/> is null.</exception>
/// <exception cref="ArgumentException"><paramref name="name"/> is a zero-length string.</exception>
/// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ /// <since_tizen> 4 </since_tizen>
public Playlist Insert(string name, string thumbnailPath)
{
ValidateDatabase();
/// </summary>
/// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
/// <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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <since_tizen> 4 </since_tizen>
public MediaDataReader<Playlist> Select()
{
return Select(null);
/// <param name="filter">The criteria to use to filter. This value can be null.</param>
/// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
/// <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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
+ /// <since_tizen> 4 </since_tizen>
public MediaDataReader<Playlist> Select(SelectArguments filter)
{
ValidateDatabase();
/// <param name="playlistId">The playlist ID to select.</param>
/// <returns>The <see cref="Playlist"/> instance if the matched record was found in the database, otherwise null.</returns>
/// <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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ /// <since_tizen> 4 </since_tizen>
public Playlist Select(int playlistId)
{
ValidateDatabase();
{
Interop.Playlist.GetPlaylistFromDb(playlistId, out handle).ThrowIfError("Failed to query");
- if (handle == IntPtr.Zero)
- {
- return null;
- }
-
return new Playlist(handle);
}
+ catch (ArgumentException)
+ {
+ // Native FW returns ArgumentException when there's no matched record.
+ return null;
+ }
finally
{
if (handle != IntPtr.Zero)
/// <param name="playlistId">The playlist ID to count media added to the playlist.</param>
/// <returns>The number of media information.</returns>
/// <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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ /// <since_tizen> 4 </since_tizen>
public int CountMember(int playlistId)
{
return CountMember(playlistId, null);
/// <param name="arguments">The criteria to use to filter. This value can be null.</param>
/// <returns>The number of media information.</returns>
/// <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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ /// <since_tizen> 4 </since_tizen>
public int CountMember(int playlistId, CountArguments arguments)
{
ValidateDatabase();
/// <param name="mediaId">The media ID.</param>
/// <returns>The member ID if the member was found in the playlist, otherwise -1.</returns>
/// <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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</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>
+ /// <since_tizen> 4 </since_tizen>
public int GetMemberId(int playlistId, string mediaId)
{
ValidateDatabase();
/// <param name="playlistId">The playlist ID to query with.</param>
/// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
/// <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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ /// <since_tizen> 4 </since_tizen>
public MediaDataReader<PlaylistMember> SelectMember(int playlistId)
{
return SelectMember(playlistId, null);
/// <param name="filter">The criteria to use to filter. This value can be null.</param>
/// <returns>The <see cref="MediaDataReader{TRecord}"/> containing the results.</returns>
/// <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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ /// <since_tizen> 4 </since_tizen>
public MediaDataReader<PlaylistMember> SelectMember(int playlistId, SelectArguments filter)
{
ValidateDatabase();
/// <returns>true if the matched record was found and updated, otherwise false.</returns>
/// <remarks>Only values set in the <see cref="PlaylistUpdateValues"/> 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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentNullException"><paramref name="values"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
/// <exception cref="UnauthorizedAccessException">The caller has no required privilege.</exception>
+ /// <since_tizen> 4 </since_tizen>
public bool Update(int playlistId, PlaylistUpdateValues values)
{
ValidateDatabase();
/// <returns>true if the matched record was found and updated, otherwise false.</returns>
/// <remarks>The invalid media ID will be ignored.</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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</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="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ /// <since_tizen> 4 </since_tizen>
public bool AddMember(int playlistId, string mediaId)
{
ValidationUtil.ValidateNotNullOrEmpty(mediaId, nameof(mediaId));
/// <returns>true if the matched record was found and updated, otherwise false.</returns>
/// <remarks>The invalid media IDs will be ignored.</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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentNullException"><paramref name="mediaIds"/> is null.</exception>
/// <exception cref="ArgumentException">
/// <paramref name="mediaIds"/> contains a zero-length string or white space.
/// </exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ /// <since_tizen> 4 </since_tizen>
public bool AddMembers(int playlistId, IEnumerable<string> mediaIds)
{
ValidateDatabase();
/// <returns>true if the matched record was found and updated, otherwise false.</returns>
/// <remarks>The invalid ID will be ignored.</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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentOutOfRangeException">
/// <paramref name="playlistId"/> is less than or equal to zero.<br/>
/// -or-<br/>
/// <paramref name="memberId"/> is less than or equal to zero.
/// </exception>
+ /// <since_tizen> 4 </since_tizen>
public bool RemoveMember(int playlistId, int memberId)
{
if (memberId <= 0)
/// <returns>true if the matched record was found and updated, otherwise false.</returns>
/// <remarks>The invalid IDs will be ignored.</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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentNullException"><paramref name="memberIds"/> is null.</exception>
/// <exception cref="ArgumentException">
/// <paramref name="memberIds"/> contains a value which is less than or equal to zero.
/// </exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ /// <since_tizen> 4 </since_tizen>
public bool RemoveMembers(int playlistId, IEnumerable<int> memberIds)
{
ValidateDatabase();
/// <returns>true if the matched record was found and updated, otherwise false.</returns>
/// <remarks>The <see cref="PlayOrder.MemberId"/> that is invalid will be ignored.</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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentNullException"><paramref name="playOrder"/> is null.</exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ /// <since_tizen> 4 </since_tizen>
public bool UpdatePlayOrder(int playlistId, PlayOrder playOrder)
{
if (playOrder == null)
/// <returns>true if the matched record was found and updated, otherwise false.</returns>
/// <remarks>The <see cref="PlayOrder.MemberId"/> that is invalid will be ignored.</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="ObjectDisposedException">The <see cref="MediaDatabase"/> has already been disposed.</exception>
/// <exception cref="MediaDatabaseException">An error occurred while executing the command.</exception>
/// <exception cref="ArgumentNullException"><paramref name="orders"/> is null.</exception>
/// <exception cref="ArgumentException">
/// <paramref name="orders"/> contains a null value.
/// </exception>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="playlistId"/> is less than or equal to zero.</exception>
+ /// <since_tizen> 4 </since_tizen>
public bool UpdatePlayOrders(int playlistId, IEnumerable<PlayOrder> orders)
{
ValidateDatabase();