Jump to content

Customizing Search Results/Lists (Music)


xanthos84

Recommended Posts

xanthos84

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

xanthos84

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!

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

xanthos84

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.

Link to comment
Share on other sites

xanthos84

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
Link to comment
Share on other sites

xanthos84

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

Link to comment
Share on other sites

xanthos84

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

Link to comment
Share on other sites

xanthos84

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
    }
});
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...