Jump to content

Override Custom User Agent for RemoteImageService


Recommended Posts

damenootok

Hi, it seems that emby doesn't support overriding user-agent variable for remoteimageservice (http://swagger.emby.media/?staticview=true#/RemoteImageService) this is quite important since some website are blocking "script" http client, and it would help substantially if you can override it, probably by additional parameter

Thanks

Link to post
Share on other sites
damenootok

some website that i use for getting artist image implement some kind of filter based on user agent, and emby's default user agent is being rejected. I have confirmed that another string of user agent is allowed to curl that resource, hence the request.

I'm hitting the Item/{id}/RemoteImage url to add artist / actor's image url via api. Is there any other way to set the artist/actor's image without using the remote image service?

Link to post
Share on other sites
PenkethBoy

yes if you have a local copy of the image you want to upload to emby for the artist

Link to post
Share on other sites
PenkethBoy

no you dont use swagger for this as its just an interface for the api in a "friendly" gui

first you authenticate with an admin user or use the api key option from the dashboard

then you need to get the aritst ID - i.e the internal db item id for the artist - easy to do via the api

then you need to encode the image as a base64 string and tell emby what the content type is "image/jpeg" or "image/png"

then upload the base64 as the body of the POST

to 

$ImageUrl = $embyServerUrl + "/emby/Items/"+ $EmbyArtist.ID + "/Images/Primary?api_key=" + $User.AccessToken

where User.accesstoken is either from auth by name or the static api key you got from the dashboard - dont use the swagger one!

images/primary could be images/logo images/art etc

For a jpg/jpeg file

$Result = Invoke-Webrequest -uri $ImageUrl -Method POST -Body $Base64 -ContentType "image/jpeg"

Note - the last time i tried it you cant use swagger to uplaod an image - it just errors out - the above was worked out by trial and error a long time ago

I have not given you all the answers and the above is for Powershell but you should be able to work it out for you chosen language

Edited by PenkethBoy
Link to post
Share on other sites
damenootok

okay, i was pasting the swagger url since that seems to be a good resource for api reference. I think i got all the info I needed from your guide, thanks!

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...