Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing music album cover art when browsing on album level #2747

Closed
ermingol23 opened this issue Nov 15, 2022 · 12 comments · Fixed by #2759
Closed

Missing music album cover art when browsing on album level #2747

ermingol23 opened this issue Nov 15, 2022 · 12 comments · Fixed by #2759

Comments

@ermingol23
Copy link

I'm sorry if this is a bit vague, but here it goes anyway. When using an older version of Gerbera together with Android app Hi-Fi Cast UPnP client/controller I was able to get music album covers to show up when browsing on album level. What I mean is that when viewing an individual song I get the album art since I have embedded the album cover within my .flac files, but when browsing on the album level I only see default/dummy images for the albums. To make matters worse I have also managed to loose my old Gerbera config.xml file (I had to re-install my computer and somehow missed to backup this file) so I am not sure how I had it configured before the upgrade; I'm thus starting from scratch with a default config.xml file for Gerbera 1.12 and also rebuilding the database...

My music files are organized so that each album is in a separate folder and in this folder I also have a file named cover.jpg which is the cover for the music album. Within this folder there is also an m3u file containing just the songs for the album. For instance /home/<userid>/Music/flac/Whale-We_Care/ contain the files

01.Kickin.flac
02.Thats_Where_Its_At.flac
03.Pay_For_Me.flac
04.Eurodog.flac
05.Ill_Do_Ya.flac
06.Electricity.flac
07.Hobo_Humpin_Slobo_Babe.flac
08.Tryzasnice.flac
09.Happy_In_You.flac
10.I_Miss_Me.flac
11.Young_Dumb_n_Full_of_Cum.flac
12.Im_Cold.flac
13.Born_to_Raise_Hell.flac
cover.jpg
We_Care.m3u

What I am trying to figure out (and so far failed to recreate) is that Gerbera should pick up the cover.jpg files for each album and provide them to the client (Hi-Fi Cast in this case) when I browse on the album level. I guess I need to add something to the Gerbera config.xml file, but I have so far not been able to figure out what I need to do. :(

Any help/pointers are appreciated! :)

@ermingol23
Copy link
Author

Not sure if these things make any difference, but I have added

    <resources case-sensitive="yes">
      <container location="." parentCount="1"/>
    </resources>
    <add-file name="cover.jpg"/>

to the config.xml file. When I browse on "album level" I still see the default generic icons for the albums, but when I open up an album the album art for the album is visible (just as it is visible for the currently playing song, but I guess this is due to the embedded album art image). So somehow the client is able to get the album cover representing all the songs, but not "one level up" so to speak. As I do not fully grasp the semantics of the configuration options I am a bit reluctant of just wildly changing stuff. But would changing the value of the parentCount attribute from 1 to 2 make the album cover visible when browsing albums?

@KarlStraussberger
Copy link
Member

Your configuration is almost fine. Without assuming an error in our system it should be

<resources case-sensitive="yes">
  <container location="." parentCount="1">
     <add-file name="cover.jpg"/>
  </container>
</resources>

@ermingol23
Copy link
Author

Thanks! Just adding that didn't seem to do the trick so I played around a bit. Finally I ended up deleting the whole SQLite database and now I can not recreate it. But via the web interface and database "tab" I can only view the images for the cover art (below Photos) and playlists (below Playlists) for each album. But the virtual Album folder is empty, that is if I go to the Gerbera web page and select the database "tab" the Audio folder is "orange". However if I expand it, all of Album, Artists, Genres, Years, and so on are "black" (and empty) and can not be expanded any further.

I can get Gerbera to rescan the folders, but that does not help and no new database file is created. But I can play tracks in the web browser via the playlist folder.

I guess I need to add something more to my config file (see below) to get Gerbera to import my flac tracks? Please note that I have replaced my userid with "<userid>" and set sensitive sensitive account information to the empty string.

Please note that the reason for having the three elements container, fanart, and resource below resources is due to that I couldn't figure out from the documentation which of them I should use. So I added all three of them to see if I could get it working, and then my plan was to remove them one by one until I only had one left that worked.

<?xml version="1.0" encoding="UTF-8"?>
<config version="2" xmlns="http://mediatomb.cc/config/2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://mediatomb.cc/config/2 http://mediatomb.cc/config/2.xsd">
  <!--
     See https://gerbera.io or read the docs for more
     information on creating and using config.xml configuration files.
    -->
  <server>
    <ui enabled="yes" show-tooltips="yes">
      <accounts enabled="no" session-timeout="30">
        <account user="" password="" />
      </accounts>
    </ui>
    <name>Gerbera</name>
    <udn>uuid:d378ca09-9aa2-46f9-857f-a8fe1915dac1</udn>
    <home>/home/<userid>/.config/gerbera</home>
    <webroot>/usr/share/gerbera/web</webroot>
    <!--
        How frequently (in seconds) to send ssdp:alive advertisements.
        Minimum alive value accepted is: 62

        The advertisement will be sent every (A/2)-30 seconds,
        and will have a cache-control max-age of A where A is
        the value configured here. Ex: A value of 62 will result
        in an SSDP advertisement being sent every second.
    -->
    <alive>180</alive>
    <!--
    <pc-directory upnp-hide="yes"/>
    -->
    <storage>
      <sqlite3 enabled="yes">
        <database-file>gerbera.db</database-file>
      </sqlite3>
      <mysql enabled="no">
        <host>localhost</host>
        <username>gerbera</username>
        <database>gerbera</database>
      </mysql>
    </storage>
    <containers enabled="yes">
      <container location="/LastAdded" title="Recently Added" sort="-last_updated">
        <filter>upnp:class derivedfrom "object.item" and last_updated &gt; "@last7"</filter>
      </container>
      <container location="/LastModified" title="Recently Modified" sort="-last_modified">
        <filter>upnp:class derivedfrom "object.item" and last_modified &gt; "@last7"</filter>
      </container>
    </containers>
    <extended-runtime-options>
      <ffmpegthumbnailer enabled="no">
        <thumbnail-size>160</thumbnail-size>
        <seek-percentage>5</seek-percentage>
        <filmstrip-overlay>no</filmstrip-overlay>
        <image-quality>8</image-quality>
      </ffmpegthumbnailer>
      <mark-played-items enabled="no" suppress-cds-updates="yes">
        <string mode="prepend">*</string>
        <mark>
          <content>video</content>
        </mark>
      </mark-played-items>
    </extended-runtime-options>
  </server>
  <import hidden-files="no">
    <scripting script-charset="UTF-8">
      <common-script>/usr/share/gerbera/js/common.js</common-script>
      <playlist-script>/usr/share/gerbera/js/playlists.js</playlist-script>
      <metafile-script>/usr/share/gerbera/js/metadata.js</metafile-script>
      <virtual-layout type="builtin">
        <import-script>/usr/share/gerbera/js/import.js</import-script>
      </virtual-layout>
    </scripting>
    <resources case-sensitive="yes">
      <container location="." parentCount="2">
	<add-file name="cover.jpg"/>
      </container>
      <fanart location="." parentCount="2">
	<add-file name="cover.jpg"/>
      </fanart>
      <resource location="." parentCount="2">
	<add-file name="cover.jpg"/>
      </resource>
    </resources>
    <mappings>
      <extension-mimetype ignore-unknown="no">
        <map from="asf" to="video/x-ms-asf" />
        <map from="asx" to="video/x-ms-asx" />
        <map from="dff" to="audio/x-dff" />
        <map from="dsd" to="audio/x-dsd" />
        <map from="dsf" to="audio/x-dsf" />
        <map from="flv" to="video/x-flv" />
        <map from="flac" to="audio/flac" />
        <map from="m2ts" to="video/mp2t" />
        <map from="m3u" to="audio/x-mpegurl" />
        <map from="m3u8" to="audio/x-mpegurl" />
        <map from="m4a" to="audio/mp4" />
        <map from="mka" to="audio/x-matroska" />
        <map from="mkv" to="video/x-matroska" />
        <map from="mp3" to="audio/mpeg" />
        <map from="mts" to="video/mp2t" />
        <map from="oga" to="audio/ogg" />
        <map from="ogg" to="audio/ogg" />
        <map from="ogm" to="video/ogg" />
        <map from="ogv" to="video/ogg" />
        <map from="ogx" to="application/ogg" />
        <map from="pls" to="audio/x-scpls" />
        <map from="ts" to="video/mp2t" />
        <map from="tsa" to="audio/mp2t" />
        <map from="tsv" to="video/mp2t" />
        <map from="wax" to="audio/x-ms-wax" />
        <map from="wm" to="video/x-ms-wm" />
        <map from="wma" to="audio/x-ms-wma" />
        <map from="wmv" to="video/x-ms-wmv" />
        <map from="wmx" to="video/x-ms-wmx" />
        <map from="wv" to="audio/x-wavpack" />
        <map from="wvx" to="video/x-ms-wvx" />
        <!-- Uncomment the line below for PS3 divx support -->
        <!-- <map from="avi" to="video/divx" /> -->
        <!-- Uncomment the line below for D-Link DSM / ZyXEL DMA-1000 -->
        <!-- <map from="avi" to="video/avi" /> -->
      </extension-mimetype>
      <mimetype-upnpclass>
        <map from="application/ogg" to="object.item.audioItem.musicTrack" />
        <map from="audio/*" to="object.item.audioItem.musicTrack" />
        <map from="image/*" to="object.item.imageItem" />
        <map from="video/*" to="object.item.videoItem" />
      </mimetype-upnpclass>
      <mimetype-contenttype>
        <treat mimetype="application/ogg" as="ogg" />
        <treat mimetype="audio/L16" as="pcm" />
        <treat mimetype="audio/flac" as="flac" />
        <treat mimetype="audio/mp4" as="mp4" />
        <treat mimetype="audio/mpeg" as="mp3" />
        <treat mimetype="audio/ogg" as="ogg" />
        <treat mimetype="audio/x-dsd" as="dsd" />
        <treat mimetype="audio/x-flac" as="flac" />
        <treat mimetype="audio/x-matroska" as="mka" />
        <treat mimetype="audio/x-mpegurl" as="playlist" />
        <treat mimetype="audio/x-ms-wma" as="wma" />
        <treat mimetype="audio/x-scpls" as="playlist" />
        <treat mimetype="audio/x-wav" as="pcm" />
        <treat mimetype="audio/x-wavpack" as="wv" />
        <treat mimetype="image/jpeg" as="jpg" />
        <treat mimetype="image/png" as="png" />
        <treat mimetype="video/mkv" as="mkv" />
        <treat mimetype="video/mp4" as="mp4" />
        <treat mimetype="video/mpeg" as="mpeg" />
        <treat mimetype="video/x-matroska" as="mkv" />
        <treat mimetype="video/x-mkv" as="mkv" />
        <treat mimetype="video/x-ms-asf" as="asf" />
        <treat mimetype="video/x-ms-asx" as="playlist" />
        <treat mimetype="video/x-msvideo" as="avi" />
      </mimetype-contenttype>
      <mimetype-dlnatransfermode>
        <map from="application/ogg" to="Streaming" />
        <map from="application/x-srt" to="Background" />
        <map from="audio/*" to="Streaming" />
        <map from="image/*" to="Interactive" />
        <map from="srt" to="Background" />
        <map from="text/*" to="Background" />
        <map from="video/*" to="Streaming" />
      </mimetype-dlnatransfermode>
      <contenttype-dlnaprofile>
        <map from="asf" to="VC_ASF_AP_L2_WMA" />
        <map from="avi" to="AVI" />
        <map from="dsd" to="DSF" />
        <map from="flac" to="FLAC" />
        <map from="jpg" to="JPEG_LRG" />
        <map from="mka" to="MKV" />
        <map from="mkv" to="MKV" />
        <map from="mp3" to="MP3" />
        <map from="mp4" to="AVC_MP4_EU" />
        <map from="mpeg" to="MPEG_PS_PAL" />
        <map from="ogg" to="OGG" />
        <map from="pcm" to="LPCM" />
        <map from="png" to="PNG_LRG" />
        <map from="wma" to="WMAFULL" />
      </contenttype-dlnaprofile>
    </mappings>
    <online-content>
      <AppleTrailers enabled="no" refresh="43200" update-at-start="no" resolution="640" />
    </online-content>
  </import>
  <transcoding enabled="no">
    <mimetype-profile-mappings>
      <transcode mimetype="application/ogg" using="vlcmpeg" />
      <transcode mimetype="audio/ogg" using="ogg2mp3" />
      <transcode mimetype="video/x-flv" using="vlcmpeg" />
    </mimetype-profile-mappings>
    <profiles>
      <profile name="ogg2mp3" enabled="no" type="external">
        <mimetype>audio/mpeg</mimetype>
        <accept-url>no</accept-url>
        <first-resource>yes</first-resource>
        <accept-ogg-theora>no</accept-ogg-theora>
        <agent command="ffmpeg" arguments="-y -i %in -f mp3 %out" />
        <buffer size="1048576" chunk-size="131072" fill-size="262144" />
      </profile>
      <profile name="vlcmpeg" enabled="no" type="external">
        <mimetype>video/mpeg</mimetype>
        <accept-url>yes</accept-url>
        <first-resource>yes</first-resource>
        <accept-ogg-theora>yes</accept-ogg-theora>
        <agent command="vlc" arguments="-I dummy %in --sout #transcode{venc=ffmpeg,vcodec=mp2v,vb=4096,fps=25,aenc=ffmpeg,acodec=mpga,ab=192,samplerate=44100,channels=2}:standard{access=file,mux=ps,dst=%out} vlc:quit" />
        <buffer size="14400000" chunk-size="512000" fill-size="120000" />
      </profile>
    </profiles>
  </transcoding>
</config>

@ermingol23
Copy link
Author

By using command line option --add-file I was able to get Gerbera to import my flac files (via m3u import). I can get HiFi-Cast to connect to Gerbera and I see the virtual folders like Albums and so on (see Virtual Folder View.jpg). When selecting Albums HiFi Cast shows me Album View.jpg (cover art is shown at the bottom for the currently playing track). When I click on one of the albums, for instance Afterburner, it looks like Afterburner.jpg and here the album cover art is also shown (which does not show up in the album list view). When I used an earlier version of Gerbera I was able to see the album covers when browsing albums, but after the upgrade I have so far not been able to get Gerbera to do this any more. :(

My guess is that I am missing something in the configuration file and any help is really appreciated. :)

Virtual Folder View
Album View
Afterburner

@KarlStraussberger
Copy link
Member

If you want to be sure that the import does not skip any image try this in your resources section

<container location="." parentCount="2" minDepth="2">
                                <add-file name="%album%.jpg"/>
                                <add-file name="%filename%.jpg"/>
                                <add-file name="%title%.jpg"/>
                                <add-file name="cover.jpg"/>
</container>
<fanart>
                                <add-file name="%album%.jpg"/>
                                <add-file name="%filename%-poster.jpg"/>
                                <add-file name="%filename%-landscape.jpg"/>
                                <add-file name="%filename%-fanart.jpg"/>
                                <add-file name="cover.png"/>
                                <add-file name="cover.jpg"/>
                                <add-file name="album.jpg"/>
                                <add-file name="front.jpg"/>
</fanart>

The more entries you remove the faster the import will be.

@ermingol23
Copy link
Author

ermingol23 commented Dec 1, 2022 via email

@KarlStraussberger
Copy link
Member

For a description regarding the attributes I redirect you to https://docs.gerbera.io/en/stable/config-import.html#resources

You can run gerbera with --debug to get load of details including requests and responses. If you are running curent head you can also set debug-mode to "Cds|Xml" (see https://docs.gerbera.io/en/latest/config-server.html#server) to reduce the number of messages you get.

@ermingol23
Copy link
Author

ermingol23 commented Dec 2, 2022 via email

@KarlStraussberger
Copy link
Member

So the problem is that when writing the documentation I was not in the mood to do it properly. What do you think about the following text:

container

::

    <container location="images" parentCount="2" minDepth="2"/>

* Optional

Set up container images. The fanart of a media file is added automatically as a thumbnail to the container (e.g. the album container).

    ::

        location="..."

    * Optional

    Path to the directory containing the images to load. Relative paths are assumed to be under the server's home.
    Drop your artists' images or logos for default containers here and they are displayed as thumbnail when browsing with a compatible client.
    If the image is not found in that location, it is also searched in the physical folder itself.

    ::

        parentCount="..."

    * Optional

    This setting allows to increase the number of levels which the fanart of a media file can be propagated upwards (examples refer to basic layout /Root/Audio/Artist/Album/song).
    A value of 1 adds the fanart only to the direct parent container when a media file is added (e.g. the Album container).
    A value of 2 means you propagate that image to the parent container as well (e.g. the Artist container).
    A value of 0 blocks propagation completely.

    ::

        minDepth="..."

    * Optional

    Depending on the virtual layout propagating thumbnails can reach containers like Video or Audio. This settings forces a minimal depth for propagation to apply.
    It is setting the minimum number of path elements for container using fanart from media files (e.g. /Root/Audio/Artist has level 3 so the image can be set).

@ermingol23
Copy link
Author

ermingol23 commented Dec 2, 2022 via email

@ermingol23
Copy link
Author

I do not understand how #2759 fixes this issue? I am a bit surprised that this issue got closed as I have neither got answers to my questions nor confirmed that the suggested configuration file changes fixes my issue. Can you please reopen this issue?

@KarlStraussberger
Copy link
Member

#2939

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants