Example #1
0
 /// <remarks>See
 /// https://github.com/MediaBrowser/Emby/blob/master/MediaBrowser.Api/Movies/CollectionService.cs
 /// for the POST URL.</remarks>
 public async Task AddMovieToCollectionAsync(IEmbyClient client, string movieId, string collectionId)
 {
     var args = new Dictionary <string, string>
     {
         { "Ids", movieId }
     };
     var url = client.GetApiUrl($"Collections/{collectionId}/Items");
     await client.SendAsync <EmptyRequestResult>(url, "POST", args);
 }
Example #2
0
        public async Task SetMovieAsWatchedAsync(IEmbyClient client, DateTime lastPlayedDate, string movieId)
        {
            var args = new Dictionary <string, string>
            {
                { "DatePlayed", lastPlayedDate.ToLocalTime().ToString("yyyyMMddHHmmss") }
            };

            var url = client.GetApiUrl($"Users/{client.CurrentUserId}/PlayedItems/{movieId}");
            await client.SendAsync <EmptyRequestResult>(url, "POST", args);
        }
Example #3
0
        /// <remarks>
        /// There seems to be some issue somewhere, which prevents a image from being reindexed.
        /// See
        /// https://emby.media/community/index.php?/topic/50794-apiclient-server-3230-cannot-reindex-the-backdrop-image-of-a-movie/
        /// </remarks>
        public async Task ReindexImageOfMovieAsync(IEmbyClient client, ImageType imageType, int index, int newIndex, string movieId)
        {
            var args = new Dictionary <string, string>
            {
                { "newIndex", newIndex.ToString() }
            };

            var url = client.GetApiUrl($"Items/{movieId}/Images/{imageType}/{index}/Index");
            await client.SendAsync <EmptyRequestResult>(url, "POST", args);
        }
Example #4
0
        public async Task AddImageToMovieAsync(IEmbyClient client, ImageType imageType, Uri imageUrl, string movieId)
        {
            var args = new Dictionary <string, string>
            {
                { "Type", imageType.ToString() },
                { "ImageUrl", imageUrl.AbsoluteUri }
            };

            var url = client.GetApiUrl($"Items/{movieId}/RemoteImages/Download");
            await client.SendAsync <EmptyRequestResult>(url, "POST", args);
        }
Example #5
0
        /// <remarks>Please read
        /// https://emby.media/community/index.php?/topic/50514-apiclient-how-to-check-whether-an-arbitrary-string-matches-an-existing-boxset/
        /// </remarks>
        public async Task <ICollectionIdentifier> CreateCollectionAsync(IEmbyClient client, string collectionName)
        {
            var args = new Dictionary <string, string>
            {
                { "IsLocked", "false" },
                { "Name", collectionName },
                { "ParentId", "" },
                { "Ids", "" }
            };
            var url = client.GetApiUrl("Collections");
            var collectionCreationResult = await client.SendAsync <CollectionCreationResult>(url, "POST", args);

            var baseItemDto = await client.GetItemAsync(collectionCreationResult.Id, client.CurrentUserId);

            return(new CollectionIdentifier
            {
                Path = baseItemDto.Path,
                Id = collectionCreationResult.Id,
                Name = baseItemDto.Name
            });
        }
Example #6
0
 public async Task SetMovieAsUnwatchedAsync(IEmbyClient client, string movieId)
 {
     var url = client.GetApiUrl($"Users/{client.CurrentUserId}/PlayedItems/{movieId}");
     await client.SendAsync <EmptyRequestResult>(url, "DELETE");
 }
Example #7
0
        public async Task <PublicSystemInfo> GetPublicSystemInfoAsync(IEmbyClient client)
        {
            var url = client.GetApiUrl("System/Info/Public");

            return(await client.SendAsync <PublicSystemInfo>(url, "GET"));
        }
Example #8
0
 public async Task DeleteImageFromMovieAsync(IEmbyClient client, ImageType imageType, int index, string movieId)
 {
     var url = client.GetApiUrl($"Items/{movieId}/Images/{imageType}/{index}");
     await client.SendAsync <EmptyRequestResult>(url, "DELETE");
 }
Example #9
0
        public async Task <IReadOnlyCollection <ImageInfo> > GetImageInfosAsync(IEmbyClient client, string movieId)
        {
            var url = client.GetApiUrl($"Items/{movieId}/Images");

            return(await client.SendAsync <List <ImageInfo> >(url, "GET"));
        }