Jump to content

Local Image Interface for Song Tracks ?


mickle026

Recommended Posts

mickle026

I want to trigger a local image reader with song tracks rather than albums.  THe current setup assumes that all songs belong to albums ...

There doesnt seem to be an interface for this within emby, but there is already for remote images.

Remote triggers just fine on Item is Audio

Task<IEnumerable<RemoteImageInfo>> IRemoteImageProvider.GetImages(BaseItem item, LibraryOptions libraryOptions, CancellationToken cancellationToken)

 

Task<IEnumerable<LocalImageInfo>> ILocalImageProvider.GetImages(BaseItem item, LibraryOptions libraryOptions, CancellationToken cancellationToken)

image.png.f97765ab60efab6d5fa3c1ef840567f2.png

I cannot return a local image on the remote interface

I can trigger a scanning and library update of a local image with the remote interface but i really wanted to do it without a "hack" method like this, then return nothing even though I did something.

var ImageList = new ItemImageInfo { Type = ImageType.Primary, Path = DetectedPath};
SongID.SetImage(ImageList, 0);
libraryManager.UpdateImages(SongID);

A local interface would probably look like this below, but I do not know how to either extend the original interface or how to do this.  Is this something I can do, or could the devs add it in the near future ??

using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace MediaBrowser.Controller.Providers
{
    
    public interface ILocalImageProvider : IImageProvider
    {
        Task<IEnumerable<LocalImageInfo>> GetImages(BaseItem item, LibraryOptions libraryOptions, CancellationToken cancellationToken);
        IEnumerable<ImageType> GetSupportedImages(BaseItem item);
    }
    
}

 

Lots of my music is already with an album cover and seperate covers for the tracks.  If I try to let emby do this on its own, the album cover gets associated with all the tracks.

If each track has an embedded image then the first one that gets read gets taken as the album image and all of the tracks too, even if they have their own image.

I want to be able to add track covers to a local folder or a seperate place from the image cache and within the album folder and assign them with my own plugin, but rather than when the album loads, i would like to do it at each track.

Screenshot2023-04-29at17-56-44Emby.thumb.png.24084fdbeb8b701c69d4301e1134bdb5.png

Screenshot2023-04-29at17-56-25Emby.thumb.png.01aa7da9aba7b0ea73affb0b1782608a.png

 

Link to comment
Share on other sites

mickle026

This is good but I can only get it to trigger with refresh metadata, and not via entering an individual audio file page that doesnt have a poster image.

The ILocalImageFileProvider also does not appear in the Library Edit as an Image Provider

So another Hack use the IRemoteImageProvider Interface to call a metadata refresh...it works as I need, but not really an ideal way to do it

The IRemoteImageProvider does appear in song track image fetchers and can be turned on/off, Only the remote one appears here.  I called my remote one "Local" as its not really going to go remote.

Screenshot2023-04-30at20-10-57MIKE-PC.png.5616519a63cd2bb14acba18fb9590a8d.png

public async Task<IEnumerable<RemoteImageInfo>> GetImages(BaseItem item, LibraryOptions libraryOptions, CancellationToken cancellationToken)
 {
            var mTrack = (Audio)item;
            await mTrack.RefreshMetadata(cancellationToken: System.Threading.CancellationToken.None);
	return null;
}

This way I can trigger the local Image provider as the individual audio track is viewed and update the poster image

 

I can either return it as a LocalImageInfo object or manually add it to the library and update it.

 

Im pretty sure there must be a better way to do this, but the Local one doesnt seem to trigger on entering the individual track page...

 

Edited by mickle026
Link to comment
Share on other sites

Quote

This is good but I can only get it to trigger with refresh metadata, and not via entering an individual audio file page that doesnt have a poster image.

That's the way it works when a user installs a new metadata provider plugin, so it's the same in your case.

Do not call refreshMetadata from within GetImages. Not appropriate there. but then again if this is your personal plugin, then do whatever you need obviously.

Link to comment
Share on other sites

mickle026
26 minutes ago, Luke said:

Do not call refreshMetadata from within GetImages. Not appropriate there

Thanks, I have what I need working now :)

Link to comment
Share on other sites

mickle026

Im currently having issue with musicbrainz track tags

 

I have tagged with mp3tag

Capture.JPG.e8eb616804a889a05943768b301cac16.JPG

 

However when I refresh metadta with replace all, the Emby Meatadata tag is still empty

 

Screenshot2023-05-01at00-20-39MIKE-PC.png.57afb453b2bd4f2000061b757b9e3282.png

 

So when I check the provider id its obviously empty

if (item.HasProviderId(MetadataProviders.MusicBrainzTrack))
{
      MusicBrainzTrackId = item.GetProviderId(MetadataProviders.MusicBrainzTrack);
}

I am using this provider id (along with other files) to import track image files so bdca3a66-673f-47e0-aa7c-4cdcc6040945.jpg will be a valid Track Cover/Poster file.

 

Is there something wrong with getting this info from ffprobe ??

 

 

Link to comment
Share on other sites

We're looking for MUSICBRAINZ_RELEASETRACKID, looks like yours is tagged with MUSICBRAINZ_TRACKID. We can add support for that though.

Link to comment
Share on other sites

mickle026
2 minutes ago, Luke said:

We're looking for MUSICBRAINZ_RELEASETRACKID, looks like yours is tagged with MUSICBRAINZ_TRACKID. We can add support for that though.

Thats what mp3Tag adds, so it'll probably be quite commonly used.

  • Agree 1
  • Thanks 1
Link to comment
Share on other sites

mickle026

@LukeWhile you are doing this can you add in Discogs id's in the meatadata editor and as provider id's ?

https://www.discogs.com/release/12533362-4-Non-Blondes-Whats-Up

Release id: 12533362

Capture.JPG.5ddccd755976b1a60ca665a4780ae6f4.JPG

 

This would be very helful to me instead of having to read the Tags myself, the Catlognumber and ASIN would also be very useful but they are not essential

 

Thanks

 

Thanks

  • Thanks 1
Link to comment
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...