Example #1
0
        public async Task UpdateMetadataAsync(IEmbyClient client, IEmbyMovieMetadata movieMetadata, string movieId)
        {
            var baseItemDto = await client.GetItemAsync(movieId, client.CurrentUserId);

            baseItemDto.Name           = movieMetadata.Name;
            baseItemDto.ForcedSortName = movieMetadata.ForcedSortName;

            await client.UpdateItemAsync(movieId, baseItemDto);
        }
Example #2
0
        public async Task <Person> GetPersonById(string id)
        {
            var person = _personRepository.GetPersonById(id);

            if (person == null || !person.Synced)
            {
                var settings = _configurationRepository.GetSingle();
                var query    = new ItemQuery {
                    UserId = settings.EmbyUserId
                };

                _embyClient.SetAddressAndUrl(settings.EmbyServerAddress, settings.AccessToken);
                var rawPerson = await _embyClient.GetItemAsync(query, id, CancellationToken.None);

                person = PersonHelper.ConvertToPerson(rawPerson);
                _personRepository.AddOrUpdatePerson(person);
            }

            return(person);
        }
Example #3
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
            });
        }