Display alternative image if texture not found (1 Viewer)

kiwijunglist

Super Moderator
  • Team MediaPortal
  • June 10, 2008
    6,746
    1,751
    New Zealand
    Home Country
    New Zealand New Zealand
    Code:
        <control>
          <description>music background image</description>
          <type>image</type>
          <id>0</id>
          <posX>0</posX>
          <posY>0</posY>
          <width>1280</width>
          <height>720</height>
          [B]<texture>e:\Music\#Play.Current.Artist\folder.jpg</texture>[/B]
          <animation effect="fade" time="400" delay="0">WindowOpen</animation>
        </control>

    This is to add fanart to MyMusicPlayingNow.xml
    my music hidef fanart (if available) is stored as e:\music\%artist%\folder.jpg
    if folder.jpg doesn't exist I want to display an alternative image eg. \skin\media\nomusicfanart.png
    how do i do this?
     

    Dadeo

    Docs Group Manager
  • Premium Supporter
  • November 26, 2006
    5,340
    3,321
    Himalayas, India
    Home Country
    Canada Canada
    If I understand you correctly, you just need two controls. Put the control with the nomusicfanart.jpg first, then the fanart control. So if there is no fanart, the background control will display. You can even be more precise and tell the background control only to display when !control.has thumb(ID) where ID is the id of your fanart control. You will have to use a unique ID for each control (not ID 0)

    However, you have several other options. You could also display the #Play.Current.Thumb, or the artist image from the thumbs folder if you have used Audioscrobbler plugin to download all your artist images. They are often widescreen and look nice as backdrops, almost like fanart.

    I did something similar in aMPed using a common.window.backdrops.xml that sets #fanart as one texture, and #thumbnail as another and #backdrop as another. Then in each window I just use define codes to set what I want the for the fanart, thumbnail and backdrop in that window.

    Hope that helps, it's fun and looks great when you get it.
     

    kiwijunglist

    Super Moderator
  • Team MediaPortal
  • June 10, 2008
    6,746
    1,751
    New Zealand
    Home Country
    New Zealand New Zealand
    [collapse]
    <control>
    <description>music background fanart image</description>
    <type>image</type>
    <id>722</id>
    <posX>0</posX>
    <posY>0</posY>
    <width>1280</width>
    <height>720</height>
    <texture>e:\Music\#Play.Current.Artist\folder.jpg</texture>
    <animation effect="fade" time="400" delay="0">WindowOpen</animation>
    </control>

    <control>
    <description>music background image (no fanart available)</description>
    <type>image</type>
    <id>0</id>
    <posX>0</posX>
    <posY>0</posY>
    <width>1280</width>
    <height>720</height>
    <texture>.\nomusicfanart.jpg</texture>
    <visible>!Control.HasThumb(722)</visible>
    <animation effect="fade" time="400" delay="0">WindowOpen</animation>
    </control>
    [/collapse]

    Will the above work.
    First control attempts to display e:\music\%artist%\folder.jpg as background
    If first control has no image then 2nd control displays nomusicfanart.jpg as background
    I assume !Control.HasThumb(722) returns true if first control can display the texture and false if folder.jpg is missing.
     

    Dadeo

    Docs Group Manager
  • Premium Supporter
  • November 26, 2006
    5,340
    3,321
    Himalayas, India
    Home Country
    Canada Canada
    Looks good to me, though I would put the nomusicfanart.jpg first, just to be sure it never covers the artist folder.jpg.

    I assume !Control.HasThumb(722) returns true if first control can display the texture and false if folder.jpg is missing

    Yes it should do that, though it would be more accurate to say it returns true if the first control HAS a texture. Don't forget that you are using #Play.Current.Artist, so your control will only work once you start playing a track, but that should be OK in NowPlaying.

    If you have any trouble, let me know. I have it working very well in aMPed although my fanart is in skin\media\fanart\music\%artist%.jpg, but when I don't have fanart I have it display the artist images from my [userdata] thumbs folder which I downloaded using AudioScrobbler - 90% of them work well and I just used a zoomfromtop tag for the others. The few that don't work, I turn into fanart!

    It looks like this - 1. with fanart 2. with artist image (yes that is just an artist image from the thumbs folder)
     

    Attachments

    • NowPlayingFanart.jpg
      NowPlayingFanart.jpg
      70 KB
    • NowPlayingArtistImage.jpg
      NowPlayingArtistImage.jpg
      57.4 KB

    Users who are viewing this thread

    Top Bottom