Jump to content

Customizing Search Results/Lists (Music)


Recommended Posts

Posted

Hi,

 

I searched but did not find anything related, as I am using Emby as a music collection player and I want to customize the search result list fields by adding some more meta tags from mp3 files:

 post-272993-0-28685500-1515160278_thumb.jpg

 

like genre, album name etc.

 

Can someone hint me how to achieve this? I have some basic programming knowledge so editing should be no problem for me, just need a little starting helping hand.

 

Thanks!

Posted

With the search api you can't customize the fields right now but in the coming months we're going to overhaul search. Thanks.

Posted

I dont want to have a fancy menu where I can customize.

I want to develop and code this stuff into, like for example on the player - showing the Album + Genre names:

post-272993-0-27017300-1515524283_thumb.png

 

But its unreliable.. sometimes it shows the tags, sometimes not... I am not a real coder, so its hard for me to scan all the thousand files to know whats going on,

so I thought to find some help here.

 

Hope someone can enlighten me. Thanks!

Posted

Well now you're talking about two different things because this topic is about search but the image you're showing is from now playing info on the session object. You're going to have to provide a little more detail. thanks.

Posted

Yes two things, but both are to be coded!

 

So

 

1. Player - add Genre & Album tags from ID3/mp3 to the first row of playing information

 

2. Search Results / LISTs - also add Genre & Album tags to the result list view

 

My guess is, if I achieve number 1, its easier to achieve number 2 because I maybe already know how I get the information in JS.

And as said, 1 is 50% finished - it justs not working every time.. very often it tells me "undefined" instead of the ID3 tag.

Posted (edited)

another hint I found was this in mediasession.js .. I guess I have to add the genre there.. but as already told I am not a real coder, so its really hard for me to get here results,

and thats why I am searching help here on the forums...

 

post-272993-0-87219700-1515525217_thumb.jpg

 

 

and at the moment my player looks like this:

 

post-272993-0-79249600-1515525287_thumb.jpg

Edited by xanthos84
Posted

is this really so hard to implement?

 

my final question is how I can get the genre of the currently playing song and show/insert it beside the title/interpret...

Posted

ok I got so far that I can print the genre in console.log,

but when I try to show them in a text on the website it shows only the promise object [object Promise]

see this screenshot:

 

post-272993-0-45696400-1515747472_thumb.png

 

maybe someone can give me a hint how i can print a promise object variable...

Posted

finally got a result how to get it working.

 

so in the rare case someone else wants album + genre from current song in his playbar like this:

 

post-272993-0-27606200-1515757304_thumb.jpg

 

then change /opt/emby-server/system/dashboard-ui/bower_components/emby-webcomponents/playback/nowplayinghelper.js

 

to this:

define(["connectionManager"], function(connectionManager) {
    "use strict";
    function getNowPlayingNames(nowPlayingItem, includeNonNameInfo) {
     
       var apiClient = connectionManager.getApiClient(nowPlayingItem.ServerId);
       var iteminfos = apiClient.getItem(apiClient.getCurrentUserId(), nowPlayingItem.Id);
       iteminfos.then(function(result) {
               document.getElementById('currentsonggenre').innerHTML = result.Genres;
            });
        var topItem = nowPlayingItem,
            bottomItem = null,
            topText = nowPlayingItem.Name  + " | " + nowPlayingItem.Album + " | <div id=\"currentsonggenre\" style=\"display:inline;\"></div>";

        nowPlayingItem.AlbumId && "Audio" === nowPlayingItem.MediaType && (topItem = {
            Id: nowPlayingItem.AlbumId,
            Name: nowPlayingItem.Album,
            Type: "MusicAlbum",
            IsFolder: !0
        }), "Video" === nowPlayingItem.MediaType && (null != nowPlayingItem.IndexNumber && (topText = nowPlayingItem.IndexNumber + " - " + topText), null != nowPlayingItem.ParentIndexNumber && (topText = nowPlayingItem.ParentIndexNumber + "." + topText));
        var bottomText = "";
        nowPlayingItem.ArtistItems && nowPlayingItem.ArtistItems.length ? (bottomItem = {
            Id: nowPlayingItem.ArtistItems[0].Id,
            Name: nowPlayingItem.ArtistItems[0].Name,
            Type: "MusicArtist",
            IsFolder: !0
        }, bottomText = nowPlayingItem.ArtistItems.map(function(a) {
            return a.Name
        }).join(", ")) : nowPlayingItem.Artists && nowPlayingItem.Artists.length ? bottomText = nowPlayingItem.Artists.join(", ") : nowPlayingItem.SeriesName || nowPlayingItem.Album ? (bottomText = topText, topText = nowPlayingItem.SeriesName || nowPlayingItem.Album, bottomItem = topItem, topItem = nowPlayingItem.SeriesId ? {
            Id: nowPlayingItem.SeriesId,
            Name: nowPlayingItem.SeriesName,
            Type: "Series",
            IsFolder: !0
        } : null) : nowPlayingItem.ProductionYear && includeNonNameInfo !== !1 && (bottomText = nowPlayingItem.ProductionYear);
        var list = [];
        return list.push({
            text: topText,
            item: topItem
        }), bottomText && list.push({
            text: bottomText,
            item: bottomItem
        }), list
    }
    return {
        getNowPlayingNames: getNowPlayingNames
    }
});
Posted

Great stuff, thanks !

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...