Jump to content


Photo

How do I add Artist to a music track in Swagger Api


  • Please log in to reply
17 replies to this topic

#1 mickle026 OFFLINE  

mickle026

    Advanced Member

  • Members
  • 285 posts
  • Local time: 12:50 PM

Posted 17 February 2020 - 03:37 PM

I was looking to add an Artist to a track in the api documentation, but cannot find exactly what i need.

 

What I am trying to is probably not intended or documented, but its what i want to do.

 

I am attempting to add music albums that I already have  in a library to a seperate library, like top 40 albums of 1999 etc, but instead of having the actual media - i am attempting to use .strm files as links to the media.  I have created a crude windows app that copies a folder and files and creates an copy of the album as strm files with the link inside to the media.  This is all working fine, BUT, i want them to look the same on the screen.  At the moment the covers and artists for the tracks are not recognised and the media is shown as the filenames.

 

I have tried copying the album.nfo but it doesnt seem to get imported like the proper media directory does

 

 

This image is the original album and how it looks

5e4ae9000c3c4_api1.jpg

 

 

This is the strm copy, the bottom 3 tracks have been tagged using the metadata editor, the 4th with swagger api

5e4ae92a48207_api2.jpg

 

if i use the TAG service it will tag the media, but also adds a tag at the bottom, which i do not want

 

curl -X POST "http://mylan:8096/em...i_key=myapikey"-H  "accept: */*" -H  "Content-Type: application/json" -d "{\"Tags\":[{\"Name\":\" 04\",\"Id\":\"The Script\"}]}"

 

5e4ae9cf3f735_api3.jpg

 

before doing this these fields were blank

 

5e4aea0fde478_api4.jpg

 

I guess the tagging service is meant for the bottom tag in the second image.

 

My question is how do achieve what I want to do?

 

Many thanks


Edited by mickle026, 17 February 2020 - 03:43 PM.


#2 PenkethBoy OFFLINE  

PenkethBoy

    Advanced Member

  • Members
  • 3889 posts
  • Local time: 12:50 PM
  • LocationWarrington,UK

Posted 17 February 2020 - 03:54 PM

An idea - not tried this but....

 

Can you copy the relevant metadata from the song to the equivalent strm item via the api

 

as i think emby does not read the file referenced in the strm file until its played - might be wrong on that

 

and most of the music functionality comes from metadata tags read from the song file

 

 

"but also adds a tag at the bottom, which i do not want" what does this mean and can you show it?



#3 mickle026 OFFLINE  

mickle026

    Advanced Member

  • Members
  • 285 posts
  • Local time: 12:50 PM

Posted 17 February 2020 - 04:02 PM

An idea - not tried this but....

 

Can you copy the relevant metadata from the song to the equivalent strm item via the api

 

as i think emby does not read the file referenced in the strm file until its played - might be wrong on that

 

and most of the music functionality comes from metadata tags read from the song file

 

 

"but also adds a tag at the bottom, which i do not want" what does this mean and can you show it?

Picture 2 above, I tagged track 4 and it also created a general tag at the bottom of the page.

 

I think I have found what i need "ItemUpdateService", tried it and it worked but blanked everything else so it must be formatted wrongly

 

curl -X POST "http://mylan:8096/em...i_key=myapikey"-H  "accept: */*" -H  "Content-Type: application/json" -d "{  \"Name\": \"Science & Faith\",  \"TagItems\": [    {      \"Name\": \"03 - Nothing.mp3\",      \"The Script\": 3    }  ],  \"Album\": \"Science & Faith\",  \"AlbumArtist\": \"The Script\",  ],}"

 

5e4af15e94092_api5.jpg



#4 PenkethBoy OFFLINE  

PenkethBoy

    Advanced Member

  • Members
  • 3889 posts
  • Local time: 12:50 PM
  • LocationWarrington,UK

Posted 17 February 2020 - 04:19 PM

If you want to update an items metadata - you have to pull the full existing record first - then update that and post back

 

partial updating is not supported

 

 

as for the 04 tag - thats an error in your api call



#5 mickle026 OFFLINE  

mickle026

    Advanced Member

  • Members
  • 285 posts
  • Local time: 12:50 PM

Posted 17 February 2020 - 04:41 PM

If you want to update an items metadata - you have to pull the full existing record first - then update that and post back

 

partial updating is not supported

 

 

as for the 04 tag - thats an error in your api call

 

I figured that I might but what do I call?  There are so many request calls but i cannot find one for the actual metadata of an item, not getting the track info with mediasources.

 

 

curl -X GET "http://mylan:8096/em...i_key=myapikey"-H  "accept: application/json"

 

{
"Items": [
{
"Name": "Science & Faith",
"ServerId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"Id": "833761",
"IsFolder": true,
"Type": "MusicAlbum",
"Artists": [],
"ArtistItems": [],
"AlbumArtists": [],
"ImageTags": {
"Primary": "d6094bdac954ab9cf739e079c9e775ac"
},
"BackdropImageTags": []
}
],
"TotalRecordCount": 1
}

 


Edited by mickle026, 22 February 2020 - 12:06 PM.


#6 PenkethBoy OFFLINE  

PenkethBoy

    Advanced Member

  • Members
  • 3889 posts
  • Local time: 12:50 PM
  • LocationWarrington,UK

Posted 17 February 2020 - 04:59 PM

this will return the full item record - its powershell but you should be able to figure it out for curl

$MediaUrl = $embyServerUrl + "/emby/users/" + $User.User.Id + "/items/643529?api_key=" + $User.AccessToken

and to put the data back

Invoke-Webrequest -uri $MediaUrl -Method Post -Body ($Result | ConvertTo-Json) -ContentType "application/json; charset=utf-8"

where $result in this case is the modified item metadata - converted back to json as the body 

 

the charset=utf-8 is needed for any diacritic characters to be rendered correctly in Emby



#7 mickle026 OFFLINE  

mickle026

    Advanced Member

  • Members
  • 285 posts
  • Local time: 12:50 PM

Posted 17 February 2020 - 05:17 PM

This is a lot better than i was trying but still no tracks or track info.

 

Not getting any so cannot put any back :(

 

Reading the api it seams that adding MediaSources to the fields should return the track ... but not getting any...


Edited by mickle026, 17 February 2020 - 05:20 PM.


#8 PenkethBoy OFFLINE  

PenkethBoy

    Advanced Member

  • Members
  • 3889 posts
  • Local time: 12:50 PM
  • LocationWarrington,UK

Posted 17 February 2020 - 05:21 PM

because its a strm file and not an actual track - i guess - assuming no user error :)

 

if you refresh metadata on the strm item does it add any of the song metadata??

 

[edit]

 

i dont use strm files so i am guessing here on some of this :)


Edited by PenkethBoy, 17 February 2020 - 05:22 PM.


#9 mickle026 OFFLINE  

mickle026

    Advanced Member

  • Members
  • 285 posts
  • Local time: 12:50 PM

Posted 17 February 2020 - 05:25 PM

because its a strm file and not an actual track - i guess - assuming no user error :)

 

if you refresh metadata on the strm item does it add any of the song metadata??

 

[edit]

 

i dont use strm files so i am guessing here on some of this :)

Refreshing doesn't,  obviously identify does.  Playing the file adds the metadata for the single track.  What I want to do is make the album appear as it does as mp3's  so some way of updating without actually playing it.

 

Adding the strm, doesnt do the backdrop, metadata or logo. it will do the poster though. and like i mentioned the tracks are filenames until the are played.

 

its frustrating me, new tousing the api too doesnt help.

 

I would love the guys to add to the server admin "create virtual copy in another library", but i think as there wouldnt be a huge demand that would be a tall order :( especially as they would have to remove or upadte links if the original was deleted or moved.


Edited by mickle026, 17 February 2020 - 05:27 PM.


#10 mickle026 OFFLINE  

mickle026

    Advanced Member

  • Members
  • 285 posts
  • Local time: 12:50 PM

Posted 17 February 2020 - 05:33 PM

Update:

 

Getting the original data, changing the item id to the strm copy and putting it, does everything, except the tracks (background, logo, etc).  So thats a big step forward

 

thanks


Edited by mickle026, 17 February 2020 - 05:33 PM.


#11 PenkethBoy OFFLINE  

PenkethBoy

    Advanced Member

  • Members
  • 3889 posts
  • Local time: 12:50 PM
  • LocationWarrington,UK

Posted 17 February 2020 - 07:01 PM

background/logos etc

 

you need to add those separately 

 

d/l the existing ones and upload them back to the strm item - make sure to encode them as tobase64 before you try as it will fail otherwise

 

- or maybe add the UIDs to the json you pass back if you have not already tried that



#12 mickle026 OFFLINE  

mickle026

    Advanced Member

  • Members
  • 285 posts
  • Local time: 12:50 PM

Posted 17 February 2020 - 09:16 PM

I am not actually using curl, im using vb.net - vb because im pretty good at it and c# or c++ i know nothing really..  I did C and C++ at university but thats over 20 years ago and forgot most of it.

 

When I download an Albums Information

{"Name":"Happiness","ServerId":+MyServerID+,"Id":"818556","Etag":"8106f8783a2c34e57c7f76c1a686047f","DateCreated":"2020-02-14T21:21:56.0000000+00:00","CanDelete":true,"CanDownload":false,"PresentationUniqueKey":"6ce423bdb0a43ddf01a12b1c36befbe9","SupportsSync":true,"SortName":"happiness","ExternalUrls":[{"Name":"MusicBrainz Album","Url":"https://musicbrainz.org/release/5335aa4d-5848-4e08-81be-8b88cb51608e"},{"Name":"MusicBrainz Album Artist","Url":"https://musicbrainz.org/artist/fcd954c7-f327-446f-87a3-2c4b242c6f38"},{"Name":"MusicBrainz Release Group","Url":"https://musicbrainz.org/release-group/38112243-08b0-4a0f-8570-7495970e3822"},{"Name":"TheAudioDb","Url":"https://www.theaudiodb.com/album/2117658"},{"Name":"TheAudioDb Artist","Url":"https://www.theaudiodb.com/artist/112342"}],"Path":"D:\\Music\\Top 40 Albums\\Weekly\\2010\\Top 40 Albums 03.10.10\\40 - Hurts - Happiness","Overview":"Happiness is the debut studio album by English synthpop duo Hurts, released on 27 August 2010 by RCA Records. It was preceded by the release of the singles \"Better Than Love\" on 23 May 2010 and \"Wonderful Life\" on 22 August 2010. Collaborators include Jonas Quant and production team The Nexus, as well as a duet with Australian singer Kylie Minogue on the song \"Devotion\". To promote the release of the album the band made the non-album song \"Happiness\" available as a free download via Amazon.co.uk on 1 August 2010.\nHappiness received mixed reviews from music critics. The album debuted at number four on the UK Albums Chart, selling 25,493 copies in its first week the fastest-selling debut album of 2010 by a band in the United Kingdom. It reached number one on the Greek Foreign Albums Chart, number two in Austria, Germany, Poland and Switzerland, and the top ten in Denmark, Finland, Ireland and Sweden. Happiness has sold 169,710 copies in the UK and over two million copies worldwide.","Taglines":[],"Genres":["Styles"],"RunTimeTicks":28829057910,"PlayAccess":"Full","ProductionYear":2010,"RemoteTrailers":[],"ProviderIds":{"MusicBrainzAlbumArtist":"fcd954c7-f327-446f-87a3-2c4b242c6f38","MusicBrainzAlbum":"5335aa4d-5848-4e08-81be-8b88cb51608e","MusicBrainzReleaseGroup":"38112243-08b0-4a0f-8570-7495970e3822","AudioDbArtist":"112342","AudioDbAlbum":"2117658"},"IsFolder":true,"ParentId":"818516","Type":"MusicAlbum","Studios":[{"Name":"RCA","Id":185316}],"GenreItems":[{"Name":"Styles","Id":818279}],"TagItems":[],"ParentLogoItemId":"818301","ParentBackdropItemId":"818301","ParentBackdropImageTags":["762f01d3673a15f8824aa73f3b202701"],"UserData":{"PlaybackPositionTicks":0,"PlayCount":0,"IsFavorite":false,"Played":false},"RecursiveItemCount":11,"ChildCount":11,"DisplayPreferencesId":"f13d7f51d4f1f8b6fcd620855eb88c1e","Tags":[],"PrimaryImageAspectRatio":1,"Artists":["Hurts"],"ArtistItems":[{"Name":"Hurts","Id":"818301"}],"AlbumArtist":"Hurts","AlbumArtists":[{"Name":"Hurts","Id":"818301"}],"ImageTags":{"Primary":"3f7a4dbda270235f4beea6e549811031"},"BackdropImageTags":[],"ParentLogoImageTag":"511b0dd6edbb3a6132cc38ea50af1b96","LockedFields":[],"LockData":false}

Then change the ID from 818556 to my new strm id 826012 I thought that replacing the data all of it would be amended, but it doesn't seem so

{"Name":"Happiness","ServerId":+MyServerID+,"Id":"826012","Etag":"8106f8783a2c34e57c7f76c1a686047f","DateCreated":"2020-02-14T21:21:56.0000000+00:00","CanDelete":true,"CanDownload":false,"PresentationUniqueKey":"6ce423bdb0a43ddf01a12b1c36befbe9","SupportsSync":true,"SortName":"happiness","ExternalUrls":[{"Name":"MusicBrainz Album","Url":"https://musicbrainz.org/release/5335aa4d-5848-4e08-81be-8b88cb51608e"},{"Name":"MusicBrainz Album Artist","Url":"https://musicbrainz.org/artist/fcd954c7-f327-446f-87a3-2c4b242c6f38"},{"Name":"MusicBrainz Release Group","Url":"https://musicbrainz.org/release-group/38112243-08b0-4a0f-8570-7495970e3822"},{"Name":"TheAudioDb","Url":"https://www.theaudiodb.com/album/2117658"},{"Name":"TheAudioDb Artist","Url":"https://www.theaudiodb.com/artist/112342"}],"Path":"D:\\Music\\Top 40 Albums\\Weekly\\2010\\Top 40 Albums 03.10.10\\40 - Hurts - Happiness","Overview":"Happiness is the debut studio album by English synthpop duo Hurts, released on 27 August 2010 by RCA Records. It was preceded by the release of the singles \"Better Than Love\" on 23 May 2010 and \"Wonderful Life\" on 22 August 2010. Collaborators include Jonas Quant and production team The Nexus, as well as a duet with Australian singer Kylie Minogue on the song \"Devotion\". To promote the release of the album the band made the non-album song \"Happiness\" available as a free download via Amazon.co.uk on 1 August 2010.\nHappiness received mixed reviews from music critics. The album debuted at number four on the UK Albums Chart, selling 25,493 copies in its first week the fastest-selling debut album of 2010 by a band in the United Kingdom. It reached number one on the Greek Foreign Albums Chart, number two in Austria, Germany, Poland and Switzerland, and the top ten in Denmark, Finland, Ireland and Sweden. Happiness has sold 169,710 copies in the UK and over two million copies worldwide.","Taglines":[],"Genres":["Styles"],"RunTimeTicks":28829057910,"PlayAccess":"Full","ProductionYear":2010,"RemoteTrailers":[],"ProviderIds":{"MusicBrainzAlbumArtist":"fcd954c7-f327-446f-87a3-2c4b242c6f38","MusicBrainzAlbum":"5335aa4d-5848-4e08-81be-8b88cb51608e","MusicBrainzReleaseGroup":"38112243-08b0-4a0f-8570-7495970e3822","AudioDbArtist":"112342","AudioDbAlbum":"2117658"},"IsFolder":true,"ParentId":"818516","Type":"MusicAlbum","Studios":[{"Name":"RCA","Id":185316}],"GenreItems":[{"Name":"Styles","Id":818279}],"TagItems":[],"ParentLogoItemId":"818301","ParentBackdropItemId":"818301","ParentBackdropImageTags":["762f01d3673a15f8824aa73f3b202701"],"UserData":{"PlaybackPositionTicks":0,"PlayCount":0,"IsFavorite":false,"Played":false},"RecursiveItemCount":11,"ChildCount":11,"DisplayPreferencesId":"f13d7f51d4f1f8b6fcd620855eb88c1e","Tags":[],"PrimaryImageAspectRatio":1,"Artists":["Hurts"],"ArtistItems":[{"Name":"Hurts","Id":"818301"}],"AlbumArtist":"Hurts","AlbumArtists":[{"Name":"Hurts","Id":"818301"}],"ImageTags":{"Primary":"3f7a4dbda270235f4beea6e549811031"},"BackdropImageTags":[],"ParentLogoImageTag":"511b0dd6edbb3a6132cc38ea50af1b96","LockedFields":[],"LockData":false}

I post this data and then re-request the data from the new id and this part has not updated properly

"ImageTags":{"Primary":"3f7a4dbda270235f4beea6e549811031"},"BackdropImageTags":[],"ParentLogoImageTag":"511b0dd6edbb3a6132cc38ea50af1b96",

getting the data from the strm files id 826012  The primary image Tag is omitted.  This means that we cannot use the same image multiple times, i am guessing this is to prevent read access issues down the line.

{"Name":"Happiness","ServerId":+MyServerID+,"Id":"826012","Etag":"e0c1fdff49e18a1e5ac4f0681dba23f0","DateCreated":"2020-02-14T21:21:56.0000000+00:00","CanDelete":true,"CanDownload":false,"PresentationUniqueKey":"102d6534ce1a1cd0e592866826e152c5","SupportsSync":true,"SortName":"happiness","ExternalUrls":[{"Name":"MusicBrainz Album","Url":"https://musicbrainz.org/release/5335aa4d-5848-4e08-81be-8b88cb51608e"},{"Name":"MusicBrainz Album Artist","Url":"https://musicbrainz.org/artist/fcd954c7-f327-446f-87a3-2c4b242c6f38"},{"Name":"MusicBrainz Release Group","Url":"https://musicbrainz.org/release-group/38112243-08b0-4a0f-8570-7495970e3822"},{"Name":"TheAudioDb","Url":"https://www.theaudiodb.com/album/2117658"},{"Name":"TheAudioDb Artist","Url":"https://www.theaudiodb.com/artist/112342"}],"Path":"E:\\Music\\Test Library\\Top 40 Albums\\40 - Hurts - Happiness","Overview":"Happiness is the debut studio album by English synthpop duo Hurts, released on 27 August 2010 by RCA Records. It was preceded by the release of the singles \"Better Than Love\" on 23 May 2010 and \"Wonderful Life\" on 22 August 2010. Collaborators include Jonas Quant and production team The Nexus, as well as a duet with Australian singer Kylie Minogue on the song \"Devotion\". To promote the release of the album the band made the non-album song \"Happiness\" available as a free download via Amazon.co.uk on 1 August 2010.\nHappiness received mixed reviews from music critics. The album debuted at number four on the UK Albums Chart, selling 25,493 copies in its first week the fastest-selling debut album of 2010 by a band in the United Kingdom. It reached number one on the Greek Foreign Albums Chart, number two in Austria, Germany, Poland and Switzerland, and the top ten in Denmark, Finland, Ireland and Sweden. Happiness has sold 169,710 copies in the UK and over two million copies worldwide.","Taglines":[],"Genres":["Styles"],"RunTimeTicks":0,"PlayAccess":"Full","ProductionYear":2010,"RemoteTrailers":[],"ProviderIds":{"MusicBrainzAlbumArtist":"fcd954c7-f327-446f-87a3-2c4b242c6f38","MusicBrainzAlbum":"5335aa4d-5848-4e08-81be-8b88cb51608e","MusicBrainzReleaseGroup":"38112243-08b0-4a0f-8570-7495970e3822","AudioDbArtist":"112342","AudioDbAlbum":"2117658"},"IsFolder":true,"ParentId":"825976","Type":"MusicAlbum","Studios":[{"Name":"RCA","Id":185316}],"GenreItems":[{"Name":"Styles","Id":818279}],"TagItems":[],"ParentLogoItemId":"818301","ParentBackdropItemId":"818301","ParentBackdropImageTags":["762f01d3673a15f8824aa73f3b202701"],"UserData":{"PlaybackPositionTicks":0,"PlayCount":0,"IsFavorite":false,"Played":false},"RecursiveItemCount":11,"ChildCount":11,"DisplayPreferencesId":"f13d7f51d4f1f8b6fcd620855eb88c1e","Tags":[],"Artists":["Hurts"],"ArtistItems":[{"Name":"Hurts","Id":"818301"}],"AlbumArtist":"Hurts","AlbumArtists":[{"Name":"Hurts","Id":"818301"}],"ImageTags":{},"BackdropImageTags":[],"ParentLogoImageTag":"511b0dd6edbb3a6132cc38ea50af1b96","LockedFields":[],"LockData":false}
"ImageTags":{},"BackdropImageTags":[],"ParentLogoImageTag":"511b0dd6edbb3a6132cc38ea50af1b96"

So I have gone another route  - to download it from the server I have used the http response to create the jpg on my ssd.  TAG is the primary : "Primary":"3f7a4dbda270235f4beea6e549811031"

http://myserver:8096/emby/Items/820172/Images/Primary?maxWidth=800&tag=3f7a4dbda270235f4beea6e549811031&quality=90&format=jpg

 

Dim MyWebClient As New System.Net.WebClient
Dim ImageInBytes() As Byte = MyWebClient.DownloadData("http://"+ServerIP+":8096/emby/Items/" + TextBox2.Text + "/Images/Primary?maxWidth=800&tag=" + txtPrimaryImage.Text + "&quality=90&format=jpg")
Dim MyImage As New Bitmap(New IO.MemoryStream(ImageInBytes))
MyImage.Save(Application.StartupPath & "\temp.jpg")

Then I have converted it to Base64 and trying to re-upload it

I am trying to put it like this

        Dim myReq As HttpWebRequest
        Dim myResp As HttpWebResponse

        myReq = HttpWebRequest.Create("http://"+ServerIp+":8096/emby/Items/" + ItemID + "/Images/Primary?api_key="+MyApiKey)

        myReq.Method = "POST"
        myReq.ContentType = "application/octet-stream"
        myReq.Headers.Add("Authorization", "Basic " & Convert.ToBase64String(Encoding.UTF8.GetBytes("username:password")))
        Dim bmp As Image = Image.FromFile(Application.StartupPath + "\temp.jpg")
        Dim myData As String = ImageToBase64(bmp, ImageFormat.Jpeg)
        myReq.GetRequestStream.Write(System.Text.Encoding.UTF8.GetBytes(myData), 0, System.Text.Encoding.UTF8.GetBytes(myData).Count)
        myResp = myReq.GetResponse
        Dim myreader As New System.IO.StreamReader(myResp.GetResponseStream)
        Dim myText As String
        myText = myreader.ReadToEnd


And the response i am getting is 400 bad request - Protocol Error

 

Also the Api Pages say it requires Authentification as administrator, so If i putr my Admin User and Password, it also fails.

 

I tested in the swagger ui,

saved my image as a base64 encoded file with a jpg extension and used the post method :

POST "http://"+ServerIP+":8096/emby/Items/819122/Images/Primary?api_key=MyApiKey with the base 64 encode file attached (basically a text file with a jpg extension) but i get this error: 

Unable to determine image file extension from mime type application/octet-stream

How do I send that in the swagger UI?
 

Do you guys have an example of uploading a poster by any methods?
 


Edited by mickle026, 17 February 2020 - 10:26 PM.


#13 PenkethBoy OFFLINE  

PenkethBoy

    Advanced Member

  • Members
  • 3889 posts
  • Local time: 12:50 PM
  • LocationWarrington,UK

Posted 18 February 2020 - 05:21 AM

yep the octet-stream error is because its not seeing the image as a base64 image - had same problem when i first started to do this

 

Swagger cant do this via the interface which i reported at the time to Luke. So....

 

example snippet from some powershell code

 

This is replacing an existing image so $BackupImage is a file saved on disk which is encoded to base64 (in the code below) then passed to emby with a ContentType of jpeg or png

 

(Log -logstring is a function i wrote so you wont find that online)

 

If successful you will get a 204 status code from Emby

                    Log -logString $("["+$(Get-Date -Format F)+"] - Backup Image and Emby Image are different for - " + $BackImage.BaseName + " - Restoring Backup Image")
                    # Save changes back to Emby Server
                    $ImageUrl = $embyServerUrl + "/emby/Items/"+ $EmbyImage.ID + "/Images/Primary?api_key=" + $User.AccessToken
                    [String]$Base64 = [convert]::ToBase64String((Get-Content $BackImage.FullName -Encoding Byte))
                    if ($BackImage.Extension -eq ".jpg")
                    {
                        try 
                        {
                            $Result = Invoke-Webrequest -uri $ImageUrl -Method POST -Body $Base64 -ContentType "image/jpeg" -ErrorAction SilentlyContinue -ErrorVariable Trace
                        }
                        catch 
                        {
                            Log -logString $("["+$(Get-Date -Format F)+"] - ERROR: " + "$_")
                        }
                    }
                    else #png 
                    {
                        try 
                        {
                            $Result = Invoke-Webrequest -uri $ImageUrl -Method POST -Body $Base64 -ContentType "image/png" -ErrorAction SilentlyContinue -ErrorVariable Trace
                        }
                        catch 
                        {
                            Log -logString $("["+$(Get-Date -Format F)+"] - ERROR: " + "$_")
                        }
                    }

Edited by PenkethBoy, 18 February 2020 - 05:26 AM.


#14 mickle026 OFFLINE  

mickle026

    Advanced Member

  • Members
  • 285 posts
  • Local time: 12:50 PM

Posted 18 February 2020 - 07:30 AM

So that was it,I thought I had tried this already - obviously not  - Thankyou very much

myReq.ContentType = "image/jpeg"

Just the filenames to sort, but I guess that I cannot do that :(, they correct when played as already mentioned but not before whilst just browsing


Edited by mickle026, 18 February 2020 - 07:32 AM.


#15 mickle026 OFFLINE  

mickle026

    Advanced Member

  • Members
  • 285 posts
  • Local time: 12:50 PM

Posted 18 February 2020 - 07:49 AM

Posting this for others as there is next to no info on it anywhere.

 

So I have already in my MAIN library like ,this:

 

5e4bcc039586a_m1.jpg

 

So I create a copy with strm files (so i dont use up disk space with the mp3's or flacs by duplicating

 

5e4bcc49f157f_m2.jpg

Emby does its thing and creates an NFO

 

The WEB UI looks like this

 

5e4bcc9d5a7de_m3.jpg

 

I read the originals metadata and get

{"Name":"Tiger Suit","ServerId":"xxxxxxxxxxxxxxxxxxxxxxxxxx","Id":"818521","Etag":"c900625c5db2e470b7fa41aed9996cc8","DateCreated":"2020-02-14T21:18:47.0000000+00:00","CanDelete":true,"CanDownload":false,"PresentationUniqueKey":"b0a6364bd09bf52afeee073b9867c74a","SupportsSync":true,"SortName":"tiger suit","ExternalUrls":[{"Name":"MusicBrainz Album","Url":"https://musicbrainz.org/release/90b88dc8-a4d1-440d-a2e9-1917f2ec4e60"},{"Name":"MusicBrainz Album Artist","Url":"https://musicbrainz.org/artist/951d2103-9c7d-4849-ae60-88bf6aa4790b"},{"Name":"MusicBrainz Release Group","Url":"https://musicbrainz.org/release-group/bac471c8-02e3-4013-ae07-b6166e2059fa"},{"Name":"TheAudioDb","Url":"https://www.theaudiodb.com/album/2113279"},{"Name":"TheAudioDb Artist","Url":"https://www.theaudiodb.com/artist/111539"}],"Path":"D:\\Music\\Top 40 Albums\\Weekly\\2010\\Top 40 Albums 03.10.10\\05 - KT Tunstall - Tiger Suit","Overview":"\"Tiger Suit\" is the third studio album by British singer-songwriter KT Tunstall which features more contemporary ingredients than her previous work. Several tracks such as \"Push That Knot Away\" harness electronic beats to her acoustic guitar.\nIt was released by Relentless Records in Ireland on 24 September 2010, in the United Kingdom on 27 September 2010 and in the United States and Canada on 5 October 2010. It was released in Europe on the 22nd and 25 October 2010. The Japanese edition, released on 22 September, features two additional tracks: a cover of LCD Soundsystem's \"New York, I Love You But You're Bringing Me Down\" and \"It Doesn't Have To Be Like This (Baby)\"\n\"Fade Like a Shadow\" was lead single in the United States and was released on 6 August 2010 via iTunes, while \"(Still a) Weirdo\" in the United Kingdom was released on 26 September 2010 via iTunes. On July 2010, as advance to the album, Tunstall uploaded via YouTube a non-single video for the song \"Push That Knot Away\". On 13 December 2010, KT Tunstall made a collaborative video for \"Glamour Puss\" with fans.\nOn 25 December 2013, over three years after the album release, and even after her fourth studio album Invisible Empire // Crescent Moon release, Tunstall re-released a song from 'Tiger Suit' as a last single : Come On, Get In.\nThe album peaked at #5 in the UK album chart and #43 in the US Billboard 200 Albums .","Taglines":[],"Genres":["Kategorien"],"RunTimeTicks":25871934690,"PlayAccess":"Full","ProductionYear":2010,"RemoteTrailers":[],"ProviderIds":{"MusicBrainzAlbumArtist":"951d2103-9c7d-4849-ae60-88bf6aa4790b","MusicBrainzAlbum":"90b88dc8-a4d1-440d-a2e9-1917f2ec4e60","MusicBrainzReleaseGroup":"bac471c8-02e3-4013-ae07-b6166e2059fa","AudioDbArtist":"111539","AudioDbAlbum":"2113279"},"IsFolder":true,"ParentId":"818516","Type":"MusicAlbum","Studios":[{"Name":"Relentless (EMI)","Id":818285}],"GenreItems":[{"Name":"Kategorien","Id":818280}],"TagItems":[],"ParentLogoItemId":"188169","ParentBackdropItemId":"188169","ParentBackdropImageTags":["537da3adeafb7b2644ef5990ef7bbd18"],"UserData":{"PlaybackPositionTicks":0,"PlayCount":0,"IsFavorite":false,"Played":false},"RecursiveItemCount":11,"ChildCount":11,"DisplayPreferencesId":"f13d7f51d4f1f8b6fcd620855eb88c1e","Tags":[],"PrimaryImageAspectRatio":1,"Artists":["KT Tunstall"],"ArtistItems":[{"Name":"KT Tunstall","Id":"188169"}],"AlbumArtist":"KT Tunstall","AlbumArtists":[{"Name":"KT Tunstall","Id":"188169"}],"ImageTags":{"Primary":"9e7c00466c80253e0b7a9dd21d78ad88"},"BackdropImageTags":[],"ParentLogoImageTag":"602d5f0f74f4b60d5171006769078cca","LockedFields":[],"LockData":false}

I change the "Id":"818520" to "Id","825980"

 

and post it back, emby doesn't post the image tag id back for whatever reason ...  Note below that the image tags primary id is empty

{"Name":"Tiger Suit","ServerId":"xxxxxxxxxxxxxxxxxxxxxxxxxx","Id":"825981","Etag":"fcf34b2c29afd8e07475afe6ccf0a34a","DateCreated":"2020-02-14T21:18:47.0000000+00:00","CanDelete":true,"CanDownload":false,"PresentationUniqueKey":"899cf1aa404752eda2afb3c1a353c3e1","SupportsSync":true,"SortName":"tiger suit","ExternalUrls":[{"Name":"MusicBrainz Album","Url":"https://musicbrainz.org/release/90b88dc8-a4d1-440d-a2e9-1917f2ec4e60"},{"Name":"MusicBrainz Album Artist","Url":"https://musicbrainz.org/artist/951d2103-9c7d-4849-ae60-88bf6aa4790b"},{"Name":"MusicBrainz Release Group","Url":"https://musicbrainz.org/release-group/bac471c8-02e3-4013-ae07-b6166e2059fa"},{"Name":"TheAudioDb","Url":"https://www.theaudiodb.com/album/2113279"},{"Name":"TheAudioDb Artist","Url":"https://www.theaudiodb.com/artist/111539"}],"Path":"E:\\Music\\Test Library\\Top 40 Albums\\05 - KT Tunstall - Tiger Suit","Overview":"\"Tiger Suit\" is the third studio album by British singer-songwriter KT Tunstall which features more contemporary ingredients than her previous work. Several tracks such as \"Push That Knot Away\" harness electronic beats to her acoustic guitar.\nIt was released by Relentless Records in Ireland on 24 September 2010, in the United Kingdom on 27 September 2010 and in the United States and Canada on 5 October 2010. It was released in Europe on the 22nd and 25 October 2010. The Japanese edition, released on 22 September, features two additional tracks: a cover of LCD Soundsystem's \"New York, I Love You But You're Bringing Me Down\" and \"It Doesn't Have To Be Like This (Baby)\"\n\"Fade Like a Shadow\" was lead single in the United States and was released on 6 August 2010 via iTunes, while \"(Still a) Weirdo\" in the United Kingdom was released on 26 September 2010 via iTunes. On July 2010, as advance to the album, Tunstall uploaded via YouTube a non-single video for the song \"Push That Knot Away\". On 13 December 2010, KT Tunstall made a collaborative video for \"Glamour Puss\" with fans.\nOn 25 December 2013, over three years after the album release, and even after her fourth studio album Invisible Empire // Crescent Moon release, Tunstall re-released a song from 'Tiger Suit' as a last single : Come On, Get In.\nThe album peaked at #5 in the UK album chart and #43 in the US Billboard 200 Albums .","Taglines":[],"Genres":["Kategorien"],"PlayAccess":"Full","ProductionYear":2010,"RemoteTrailers":[],"ProviderIds":{"MusicBrainzAlbumArtist":"951d2103-9c7d-4849-ae60-88bf6aa4790b","MusicBrainzAlbum":"90b88dc8-a4d1-440d-a2e9-1917f2ec4e60","MusicBrainzReleaseGroup":"bac471c8-02e3-4013-ae07-b6166e2059fa","AudioDbArtist":"111539","AudioDbAlbum":"2113279"},"IsFolder":true,"ParentId":"825976","Type":"MusicAlbum","Studios":[{"Name":"Relentless (EMI)","Id":818285}],"GenreItems":[{"Name":"Kategorien","Id":818280}],"TagItems":[],"ParentLogoItemId":"188169","ParentBackdropItemId":"188169","ParentBackdropImageTags":["537da3adeafb7b2644ef5990ef7bbd18"],"UserData":{"PlaybackPositionTicks":0,"PlayCount":0,"IsFavorite":false,"Played":false},"RecursiveItemCount":11,"ChildCount":11,"DisplayPreferencesId":"f13d7f51d4f1f8b6fcd620855eb88c1e","Tags":[],"Artists":["KT Tunstall"],"ArtistItems":[{"Name":"KT Tunstall","Id":"188169"}],"AlbumArtist":"KT Tunstall","AlbumArtists":[{"Name":"KT Tunstall","Id":"188169"}],"ImageTags":{},"BackdropImageTags":[],"ParentLogoImageTag":"602d5f0f74f4b60d5171006769078cca","LockedFields":[],"LockData":false}

so I get the image from the original using the original image tags id

9e7c00466c80253e0b7a9dd21d78ad88

with a webrequest (vb.net code in earlier post)

http://myserver:8096/emby/Items/825981/Images/Primary?maxWidth=800&tag=3f7a4dbda270235f4beea6e549811031&quality=90&format=jpg

and put it to the new strm entry id and get

 

5e4bce5f13091_m5.jpg

 

 

Which is almost the same, when the songs are played and the screen is exited and re-entered it starts to look correct like this:

5e4bcf0f9f562_m6.jpg

 

 

Thanks for your help @PenkethBoy

 

I just need to update the actual tracks without playing the media, I don't think at this time that can be done easily .... its a shame

 

@Luke, why cant we post back the Primary Image ID ??


Edited by mickle026, 22 February 2020 - 12:07 PM.

  • PenkethBoy likes this

#16 mickle026 OFFLINE  

mickle026

    Advanced Member

  • Members
  • 285 posts
  • Local time: 12:50 PM

Posted 18 February 2020 - 08:10 AM

Oh WOW, just been testing and found that wherever i have the album duplicated in different places and collections I can put the metadata and the image and fix all the library contents of all of them in one click of my app.

 

This is going to be handy because now i can remove duplicate mp3s and flacs and replace them with strm files and vastly reduce disk usage space.



#17 PenkethBoy OFFLINE  

PenkethBoy

    Advanced Member

  • Members
  • 3889 posts
  • Local time: 12:50 PM
  • LocationWarrington,UK

Posted 18 February 2020 - 08:26 AM

Question - did the logo image get added by emby or did you do that the same way as the primary image?



#18 mickle026 OFFLINE  

mickle026

    Advanced Member

  • Members
  • 285 posts
  • Local time: 12:50 PM

Posted 18 February 2020 - 01:36 PM

The logo and the backdrop were from POST Metadata json back, it's only the primary image that didn't.

Another update doing this with strms is brilliant but until they are all played they are screwed up in view on the android tv app, playing just one throws them out of order as the numbers are different on the firetv and android tv app.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users