summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xTVMediaHub/TVMediaHub.Tizen/Models/ContentProvider.cs130
1 files changed, 66 insertions, 64 deletions
diff --git a/TVMediaHub/TVMediaHub.Tizen/Models/ContentProvider.cs b/TVMediaHub/TVMediaHub.Tizen/Models/ContentProvider.cs
index 4072c37..328323c 100755
--- a/TVMediaHub/TVMediaHub.Tizen/Models/ContentProvider.cs
+++ b/TVMediaHub/TVMediaHub.Tizen/Models/ContentProvider.cs
@@ -310,9 +310,11 @@ namespace TVMediaHub.Tizen.Models
foreach (MediaInfo mediaInformation in mediaInformationList)
{
- var mediaInformationEx = new MediaInformationEx();
+ var mediaInformationEx = new MediaInformationEx
+ {
+ MediaContentInformation = mediaInformation
+ };
- mediaInformationEx.MediaContentInformation = mediaInformation;
CheckUnavailableContent(mediaInformationEx);
mediaInformationExList.Add(mediaInformationEx);
}
@@ -356,83 +358,83 @@ namespace TVMediaHub.Tizen.Models
/// <param name="offset">The start position of the given filter Starting from zero</param>
/// <param name="count">The number of items to be searched with respect to the offset</param>
/// <returns>A list of media informations</returns>
-#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
public async Task<IEnumerable<MediaInformationEx>> ReadWithoutGroupAsync(SortOption sortOption, string storageId = null, int offset = -1, int count = -1)
-#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
{
- // Makes Content Filter by arguments
- var selectArguments = new SelectArguments();
+ return await Task.Run(() => {
+ // Makes Content Filter by arguments
+ var selectArguments = new SelectArguments();
- switch (sortOption)
- {
- case SortOption.Title:
- selectArguments.SortOrder = "MEDIA_DISPLAY_NAME";
- break;
- case SortOption.Date:
- selectArguments.SortOrder = "MEDIA_RECORDED_DATE";
- break;
- case SortOption.Genre:
- selectArguments.SortOrder = "MEDIA_GENRE";
- break;
- case SortOption.Type:
- selectArguments.SortOrder = "MEDIA_TYPE";
- break;
- case SortOption.Album:
- selectArguments.SortOrder = "MEDIA_ALBUM";
- break;
- case SortOption.Artist:
- selectArguments.SortOrder = "MEDIA_ARTIST";
- break;
- default:
- throw new System.ArgumentException("Invalid sorting option.");
- }
+ switch (sortOption)
+ {
+ case SortOption.Title:
+ selectArguments.SortOrder = "MEDIA_DISPLAY_NAME";
+ break;
+ case SortOption.Date:
+ selectArguments.SortOrder = "MEDIA_RECORDED_DATE";
+ break;
+ case SortOption.Genre:
+ selectArguments.SortOrder = "MEDIA_GENRE";
+ break;
+ case SortOption.Type:
+ selectArguments.SortOrder = "MEDIA_TYPE";
+ break;
+ case SortOption.Album:
+ selectArguments.SortOrder = "MEDIA_ALBUM";
+ break;
+ case SortOption.Artist:
+ selectArguments.SortOrder = "MEDIA_ARTIST";
+ break;
+ default:
+ throw new System.ArgumentException("Invalid sorting option.");
+ }
- if (offset >= 0)
- {
- selectArguments.StartRowIndex = offset;
- }
+ if (offset >= 0)
+ {
+ selectArguments.StartRowIndex = offset;
+ }
- if (count >= 0)
- {
- selectArguments.TotalRowCount = count;
- }
+ if (count >= 0)
+ {
+ selectArguments.TotalRowCount = count;
+ }
- if (storageId != null)
- {
- selectArguments.StorageId = storageId;
- }
+ if (storageId != null)
+ {
+ selectArguments.StorageId = storageId;
+ }
- selectArguments.FilterExpression = GetConditionStringForSelection();
+ selectArguments.FilterExpression = GetConditionStringForSelection();
- // Executes the 'select' query
- List<MediaInfo> mediaInformationList = new List<MediaInfo>();
- List<MediaInformationEx> mediaInformationExList = new List<MediaInformationEx>();
- try
- {
+ // Executes the 'select' query
+ List<MediaInfo> mediaInformationList = new List<MediaInfo>();
+ List<MediaInformationEx> mediaInformationExList = new List<MediaInformationEx>();
+ try
+ {
- var reader = MediaHubImpl.GetInstance.MediaInfoCommand.SelectMedia(selectArguments);
+ var reader = MediaHubImpl.GetInstance.MediaInfoCommand.SelectMedia(selectArguments);
- while (reader.Read())
- {
- mediaInformationList.Add(reader.Current);
- }
+ while (reader.Read())
+ {
+ mediaInformationList.Add(reader.Current);
+ }
- foreach (MediaInfo mediaInformation in mediaInformationList)
- {
- var mediaInformationEx = new MediaInformationEx();
+ foreach (MediaInfo mediaInformation in mediaInformationList)
+ {
+ var mediaInformationEx = new MediaInformationEx();
- mediaInformationEx.MediaContentInformation = mediaInformation;
- CheckUnavailableContent(mediaInformationEx);
- mediaInformationExList.Add(mediaInformationEx);
+ mediaInformationEx.MediaContentInformation = mediaInformation;
+ CheckUnavailableContent(mediaInformationEx);
+ mediaInformationExList.Add(mediaInformationEx);
+ }
+ }
+ catch (Exception exception)
+ {
+ DbgPort.E(exception.Message);
}
- }
- catch (Exception exception)
- {
- DbgPort.E(exception.Message);
- }
- return mediaInformationExList;
+ return mediaInformationExList;
+ });
}
/// <summary>