Class MediaInfoCommand
Definition
- Namespace:
- Tizen.Content.MediaContent
- Assembly:
- Tizen.Content.MediaContent.dll
Provides commands to manage the media information and query related items in the database.
public class MediaInfoCommand : MediaCommand
- Inheritance
Constructors
View SourceMediaInfoCommand(MediaDatabase)
Initializes a new instance of the FolderCommand class with the specified MediaDatabase.
Declaration
public MediaInfoCommand(MediaDatabase database)
Parameters
Type | Name | Description |
---|---|---|
MediaDatabase | database | The MediaDatabase that the commands run on. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ObjectDisposedException |
|
Methods
View SourceAdd(string)
Adds the media to the database.
Declaration
public MediaInfo Add(string path)
Parameters
Type | Name | Description |
---|---|---|
string | path | The file path to add. |
Returns
Type | Description |
---|---|
MediaInfo | The MediaInfo instance that contains the record information in the database. |
Remarks
If the media already exists in the database, it returns the existing information.
The ScanFile(string) or the ScanFolderAsync(string) can be used instead.
If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
If http://tizen.org/feature/content.scanning.others feature is not supported and the specified file is other-type,
System.NotSupportedException will be thrown.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
System.IO.FileNotFoundException |
|
System.UnauthorizedAccessException | The caller has no required privilege. |
System.NotSupportedException | The required feature is not supported. |
AddAsync(IEnumerable<string>)
Adds media files into the media database.
Declaration
public Task AddAsync(IEnumerable<string> paths)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T><string> | paths | The paths of the media files to add. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A task that represents the asynchronous add operation. |
Remarks
The paths that already exist in the database will be ignored.
At most 300 items can be added at once.
If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
If http://tizen.org/feature/content.scanning.others feature is not supported and the specified file is other-type,
System.NotSupportedException will be thrown.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
System.IO.FileNotFoundException |
|
System.UnauthorizedAccessException | The caller has no required privilege. |
System.NotSupportedException | The required feature is not supported. |
CountBookmark(string, CountArguments)
Retrieves the number of the bookmarks added to the media with the CountArguments.
Declaration
public int CountBookmark(string mediaId, CountArguments arguments)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to count the bookmarks added to the media. |
CountArguments | arguments | The criteria to use to filter. This value can be null. |
Returns
Type | Description |
---|---|
int | The number of the bookmarks. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
CountBookmark(string)
Retrieves the number of the bookmarks added to the media.
Declaration
public int CountBookmark(string mediaId)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to count the bookmarks added to the media. |
Returns
Type | Description |
---|---|
int | The number of the bookmarks. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
CountFaceInfo(string, CountArguments)
Retrieves the number of the face information added to or detected from the media with filter.
Declaration
public int CountFaceInfo(string mediaId, CountArguments arguments)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to count the face information added to the media. |
CountArguments | arguments | The criteria to use to filter. This value can be null. |
Returns
Type | Description |
---|---|
int | The number of the face information. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
CountFaceInfo(string)
Retrieves the number of the face information added to or detected from the media.
Declaration
public int CountFaceInfo(string mediaId)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to count face information added to the media. |
Returns
Type | Description |
---|---|
int | The number of the face information. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
CountGroupBy(MediaInfoColumnKey, CountArguments)
Retrieves the number of values grouped by the specified column with the SelectArguments.
Declaration
public int CountGroupBy(MediaInfoColumnKey columnKey, CountArguments arguments)
Parameters
Type | Name | Description |
---|---|---|
MediaInfoColumnKey | columnKey | The column key. |
CountArguments | arguments | The criteria to use to filter. This value can be null. |
Returns
Type | Description |
---|---|
int | The number of groups. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentException |
|
CountGroupBy(MediaInfoColumnKey)
Retrieves the number of values grouped by the specified column with the SelectArguments.
Declaration
public int CountGroupBy(MediaInfoColumnKey columnKey)
Parameters
Type | Name | Description |
---|---|---|
MediaInfoColumnKey | columnKey | The column key. |
Returns
Type | Description |
---|---|
int | The number of groups. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentException |
|
CountMedia()
Retrieves the number of the media information.
Declaration
public int CountMedia()
Returns
Type | Description |
---|---|
int | The number of the media information. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
CountMedia(CountArguments)
Retrieves the number of the media information with the SelectArguments.
Declaration
public int CountMedia(CountArguments arguments)
Parameters
Type | Name | Description |
---|---|---|
CountArguments | arguments | The criteria to use to filter. This value can be null. |
Returns
Type | Description |
---|---|
int | The number of media information. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
CountTag(string, CountArguments)
Retrieves the number of tags that the media has with the CountArguments.
Declaration
public int CountTag(string mediaId, CountArguments arguments)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to count tags added to the media. |
CountArguments | arguments | The criteria to use to filter. This value can be null. |
Returns
Type | Description |
---|---|
int | The number of tags. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
CountTag(string)
Retrieves the number of tags that the media has.
Declaration
public int CountTag(string mediaId)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to count tags added to the media. |
Returns
Type | Description |
---|---|
int | The number of tags. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
CreateThumbnailAsync(string, CancellationToken)
Creates the thumbnail image for the given media. If the thumbnail already exists for the given media, the existing path will be returned.
Declaration
public Task<string> CreateThumbnailAsync(string mediaId, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to create the thumbnail. |
System.Threading.CancellationToken | cancellationToken | The token to cancel the operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TResult><string> | A task that represents the asynchronous operation. The task result contains the thumbnail path. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
RecordNotFoundException |
|
System.ArgumentException |
|
System.IO.FileNotFoundException | The file of the media does not exists; moved or deleted. |
UnsupportedContentException | The thumbnail is not available for the given media. |
CreateThumbnailAsync(string)
Creates the thumbnail image for the given media. If the thumbnail already exists for the given media, the existing path will be returned.
Declaration
public Task<string> CreateThumbnailAsync(string mediaId)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to create the thumbnail. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TResult><string> | A task that represents the asynchronous operation. The task result contains the thumbnail path. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
RecordNotFoundException |
|
System.ArgumentException |
|
System.IO.FileNotFoundException | The file of the media does not exists; moved or deleted. |
UnsupportedContentException | The thumbnail is not available for the given media. |
Delete(string)
Deletes the media from the database.
Declaration
public bool Delete(string mediaId)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to delete. |
Returns
Type | Description |
---|---|
bool | true if the matched record was found and deleted, otherwise false. |
Remarks
The ScanFile(string) or the ScanFolderAsync(string) can be used instead.
Since API level 6, if the file related with the mediaId
in DB still exists in file system before calling this method,
System.InvalidOperationException will be thrown to keep consistency in DB.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
System.UnauthorizedAccessException | The caller has no required privilege. |
DetectFaceAsync(string, CancellationToken)
Creates the thumbnail image for the given media. If the thumbnail already exists for the given media, the existing path will be returned.
Declaration
public Task<int> DetectFaceAsync(string mediaId, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to create the thumbnail. |
System.Threading.CancellationToken | cancellationToken | The token to cancel the operation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TResult><int> | A task that represents the asynchronous operation. The task result contains the number of faces detected. |
Remarks
Media in the external storage is not supported, with the exception of MMC. Only JPEG, PNG, BMP images are supported.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
RecordNotFoundException |
|
System.ArgumentException |
|
System.IO.FileNotFoundException | The file of the media does not exists; moved or deleted. |
UnsupportedContentException | Face detection is not available for the given media. |
System.NotSupportedException | The required feature is not supported. |
DetectFaceAsync(string)
Detects faces from the given media. If the thumbnail already exists for the given media, the existing path will be returned.
Declaration
public Task<int> DetectFaceAsync(string mediaId)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to create the thumbnail. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<TResult><int> | A task that represents the asynchronous add operation. The task result contains the number of faces detected. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
RecordNotFoundException |
|
System.ArgumentException |
|
System.IO.FileNotFoundException | The file of the media does not exists; moved or deleted. |
UnsupportedContentException | Face detection is not available for the given media. |
System.NotSupportedException | The required feature is not supported. |
System.UnauthorizedAccessException | The caller has no required privilege. |
Move(string, string)
Updates the path of the media to the specified destination path in the database.
Declaration
public bool Move(string mediaId, string newPath)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to move. |
string | newPath | The path that the media has been moved to. |
Returns
Type | Description |
---|---|
bool | true if the matched record was found and updated, otherwise false. |
Remarks
Usually, it is used after the media file is moved to the another path.
If you want to access internal storage, you should add privilege http://tizen.org/privilege/mediastorage.
If you want to access external storage, you should add privilege http://tizen.org/privilege/externalstorage.
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
System.IO.FileNotFoundException |
|
System.UnauthorizedAccessException | The caller has no required privilege. |
SelectBookmark(string, SelectArguments)
Retrieves the bookmarks added to the media with the SelectArguments.
Declaration
public MediaDataReader<Bookmark> SelectBookmark(string mediaId, SelectArguments filter)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to select the bookmarks added to the media. |
SelectArguments | filter | The criteria to use to filter. This value can be null. |
Returns
Type | Description |
---|---|
MediaDataReader<Bookmark> | The MediaDataReader<TRecord> containing the results. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
SelectBookmark(string)
Retrieves the bookmarks added to the media.
Declaration
public MediaDataReader<Bookmark> SelectBookmark(string mediaId)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to select the bookmarks added to the media. |
Returns
Type | Description |
---|---|
MediaDataReader<Bookmark> | The MediaDataReader<TRecord> containing the results. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
SelectEbookPath(string)
Retrieves all matched ebook paths with given keyword
.
Declaration
public MediaDataReader<string> SelectEbookPath(string keyword)
Parameters
Type | Name | Description |
---|---|---|
string | keyword | The keyword to search. |
Returns
Type | Description |
---|---|
MediaDataReader<string> | A list of ebook paths which contain |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.UnauthorizedAccessException | The caller has no required privilege. |
SelectFaceInfo(string, SelectArguments)
Retrieves the face information added to or detected from the media with the SelectArguments.
Declaration
public MediaDataReader<FaceInfo> SelectFaceInfo(string mediaId, SelectArguments arguments)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to select the face information added to the media. |
SelectArguments | arguments | The criteria to use to filter. This value can be null. |
Returns
Type | Description |
---|---|
MediaDataReader<FaceInfo> | The MediaDataReader<TRecord> containing the results. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
SelectFaceInfo(string)
Retrieves the face information added to or detected from the media.
Declaration
public MediaDataReader<FaceInfo> SelectFaceInfo(string mediaId)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to select face information added to the media. |
Returns
Type | Description |
---|---|
MediaDataReader<FaceInfo> | The MediaDataReader<TRecord> containing the results. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
SelectGroupBy(MediaInfoColumnKey, SelectArguments)
Retrieves the group values of the specified column with the SelectArguments.
Declaration
public MediaDataReader<string> SelectGroupBy(MediaInfoColumnKey columnKey, SelectArguments arguments)
Parameters
Type | Name | Description |
---|---|---|
MediaInfoColumnKey | columnKey | The column key. |
SelectArguments | arguments | The criteria to use to filter. This value can be null. |
Returns
Type | Description |
---|---|
MediaDataReader<string> | The MediaDataReader<TRecord> containing the results. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentException |
|
SelectGroupBy(MediaInfoColumnKey)
Retrieves the group values of the specified column.
Declaration
public MediaDataReader<string> SelectGroupBy(MediaInfoColumnKey columnKey)
Parameters
Type | Name | Description |
---|---|---|
MediaInfoColumnKey | columnKey | The column key. |
Returns
Type | Description |
---|---|
MediaDataReader<string> | The MediaDataReader<TRecord> containing the results. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentException |
|
SelectMedia()
Retrieves all the media.
Declaration
public MediaDataReader<MediaInfo> SelectMedia()
Returns
Type | Description |
---|---|
MediaDataReader<MediaInfo> | The MediaDataReader<TRecord> containing the results. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
SelectMedia(string)
Retrieves the media.
Declaration
public MediaInfo SelectMedia(string mediaId)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to retrieve. |
Returns
Type | Description |
---|---|
MediaInfo | The MediaInfo instance if the matched record was found in the database, otherwise null. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
SelectMedia(SelectArguments)
Retrieves the media with the SelectArguments.
Declaration
public MediaDataReader<MediaInfo> SelectMedia(SelectArguments arguments)
Parameters
Type | Name | Description |
---|---|---|
SelectArguments | arguments | The criteria to use to filter. This value can be null. |
Returns
Type | Description |
---|---|
MediaDataReader<MediaInfo> | The MediaDataReader<TRecord> containing the results. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
SelectTag(string, SelectArguments)
Retrieves the tags that the media has with the SelectArguments.
Declaration
public MediaDataReader<Tag> SelectTag(string mediaId, SelectArguments filter)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to select tags added to the media. |
SelectArguments | filter | The criteria to use to filter. This value can be null. |
Returns
Type | Description |
---|---|
MediaDataReader<Tag> | The MediaDataReader<TRecord> containing the results. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
SelectTag(string)
Retrieves the tags that the media has.
Declaration
public MediaDataReader<Tag> SelectTag(string mediaId)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to select tags added to the media. |
Returns
Type | Description |
---|---|
MediaDataReader<Tag> | The MediaDataReader<TRecord> containing the results. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
UpdateFavorite(string, bool)
Updates the media with the favorite value.
Declaration
public bool UpdateFavorite(string mediaId, bool value)
Parameters
Type | Name | Description |
---|---|---|
string | mediaId | The media ID to update. |
bool | value | The value indicating whether the media is favorite. |
Returns
Type | Description |
---|---|
bool | true if the matched record was found and updated, otherwise false. |
Exceptions
Type | Condition |
---|---|
System.InvalidOperationException | The MediaDatabase is disconnected. |
System.ObjectDisposedException | The MediaDatabase has already been disposed. |
MediaDatabaseException | An error occurred while executing the command. |
System.ArgumentNullException |
|
System.ArgumentException |
|
System.UnauthorizedAccessException | The caller has no required privilege. |