Add-on:Artist Slideshow

From Official Kodi Wiki
Revision as of 16:24, 24 April 2012 by >Pkscout
Jump to navigation Jump to search

Artist Slideshow
http://mirrors.xbmc.org/addons/eden/script.artistslideshow/icon.png

See this add-on on the kodi.tv showcase

Author: ronie/kyleejohnson (pkscuot)

Type: Program
Repo: Kodi.tv repo v20
Kodi.tv repo v19

Summary: Download images and additional info of the currently playing artist
Home icon grey.png   ▶ Add-ons ▶ Artist Slideshow

Addon to download images and additional information from Last.FM and htbackdrops.com of the currently playing artist. The images, along with local artists' images, and info can be used by the skin to create a slideshow for the artist being listened to.

Installing

This add-on is installed from the Add-on browser located in Kodi as follows:

  1. Settings
  2. Add-ons
  3. Install from repository
  4. Program Add-ons
  5. Artist Slideshow
  6. Install

Version 0.1.0 is the last version available for Dharma. The information below is for version 1.3.1.

Features

  • displays slideshow as background for music visualization (must use a compatible skin or update skin using the instructions below)
    • option to have artist images downloaded and/or use a local directory of artist images
    • option for a fallback slideshow if no local or remote images are found
    • option to have a single slideshow displayed regardless of artist playing
  • downloads artwork from htbackdrops.com and/or last.fm to display as background for music visualization
    • option to download artist bio and other additional information (skin must support display of this information)
    • option to download only images larger than a given length and width
    • option to download only images with 16:9 aspect ratio
    • option to limit size of download cache
  • support for internet streams that put the artist name in the XBMC title field (experimental)
  • support for other addons using Artist Slideshow to provide the background (experimental)

If you are using the default Confluence skin (or Confluence Vertical), you can download the modified files from here

Limitations

  • local artist images must be on a local drive (mapping a local drive letter or mount point in your OS may allow you to get around this)
  • Artist Slideshow shows images behind any running visualization. If you choose to use a visualization, please select one with a significant amount of transparent area or you may not see much of anything.
  • On AppleTV the PAPlayer sometimes stops after each song and restarts at the beginning of a new one. That, by default, causes Artist Slideshow to stop. Once that happens, artist background images no longer update. Please see Changes to MusicVisualisation.xml below for a workaround.

Addon settings

There are three groupings of settings: Download, Slideshow, and Advanced.

Download

Download images from last.fm: (default true)
(self explanatory)

Download images from htbackdrops.com: (default false)
(self explanatory)

Minimal image width and height: (default 0,0)
any images smaller than the set dimensions will not be downloaded.

Download only 16:9 images: (default false)
will discard any images that aren't really, really close to a 16:9 aspect ratio.

Download additional artist info: (default false)
includes information like the artist's bio and artists similar to the one to which you are listening. includes option to select download language. skin must support this extra information, or nothing will be displayed.

Slideshow

Local artist folder: (default none)
path to a directory that has artist images. Images must be organized in artist/extrafanart/

Fallback slideshow folder: (default none)
path to a directory of images that should be used if no local or remote images can be found.

Priority: (default remote first)
three options: remote first, local first, both
remote first will try and download images from remote sites. if none found will use local images. if none found will use fallback slideshow
local first will use local images. if none found will try and download remote images. if none found will use fallback slideshow
both will check for local images first. if they exist the downloaded images will be placed in the same directory as the local images. if not remote images will be stored in normal cache dir.

Override slideshow folder: (default none)
path to a directory of images that should be used intead of artist artwork. With this set no artwork will ever be downloaded.

Advanced

Limit size of download cache: (default false)
if enabled, the download cache will be trimmed (oldest first) to keep the size below the specified minimum

Maximum cache size (in megabytes): (default 1024)
if Limit size of download cache is set to true, this allows the user to specify the maximum size of the cache

How to use this addon in your skin

Changes to MusicVisualisation.xml

To run the script:

<onload>RunScript(script.artistslideshow)</onload>

On AppleTV if ArtistSlideshow isn't updating after the first artist, use this instead:

<onload>RunScript(script.artistslideshow, daemon=True)</onload>

To add a multiimage conrol:

<control type="multiimage">
    <posx>0</posx>
    <posy>0</posy>
    <width>1280</width>
    <height>720</height>
    <imagepath background="true">$INFO[Window(Visualisation).Property(ArtistSlideshow)]</imagepath>
    <aspectratio>keep</aspectratio>
    <timeperimage>10000</timeperimage>
    <fadetime>2000</fadetime>
    <randomize>true</randomize>
</control>

New skin properties

Window(Visualisation).Property(ArtistSlideshow)

This is the path to the directory containing the downloaded images for the currently playing artist


Window(Visualisation).Property(ArtistSlideshowRunning)

This one is used internally by the script to check if it is already running. There's no need to use this property in your skin.


Window(Visualisation).Property(ArtistSlideshow.ArtistBiography)

Artist biography from last.fm


Window(Visualisation).Property(ArtistSlideshow.%d.SimilarName)
Window(Visualisation).Property(ArtistSlideshow.%d.SimilarThumb)

Similar artists


Window(Visualisation).Property(ArtistSlideshow.%d.AlbumName)
Window(Visualisation).Property(ArtistSlideshow.%d.AlbumThumb)

Albums by the artist

How to call this addon from another addon

To use this addon to provide the background for another addon, the calling addon must create a window that uses a multimage control:

<control type="multiimage">
    <posx>0</posx>
    <posy>0</posy>
    <width>1280</width>
    <height>720</height>
    <imagepath background="true">$INFO[Window.Property(ArtistSlideshow)]</imagepath>
    <aspectratio>keep</aspectratio>
    <timeperimage>10000</timeperimage>
    <fadetime>2000</fadetime>
    <randomize>true</randomize>
    <animation effect="fade" start="0" end="100" time="300">Visible</animation>
    <animation effect="fade" start="100" end="0" time="300">Hidden</animation>
</control>

That window must have an infolabel in which the currently playing artist is stored (suggested name is CURRENTARTIST). It is the responsibility of the calling addon to change that infolabel when the artist changes.

Additional script/skin properties available

Window.Property(ArtistSlideshow)

This is the path to the directory containing the downloaded images for the currently playing artist.


Window.Property(ArtistSlideshow.ArtistBiography)

Artist biography from last.fm


Window.Property(ArtistSlideshow.%d.SimilarName)
Window.Property(ArtistSlideshow.%d.SimilarThumb)

Similar artists


Window.Property(ArtistSlideshow.%d.AlbumName)
Window.Property(ArtistSlideshow.%d.AlbumThumb)

Albums by the artist


Window.Property(ArtistSlideshowRunning)

This one is used internally by Artist Slideshow to check if it is already running. There's no need to use this property in the calling addon's skin.


Window.Property(ArtistSlideshow.ExternalCall)

An external addon needs to set this to True so that Artist Slideshow will run properly when called by an external script. This property should be cleared to tell ArtistSlideshow to stop running.


Window.Property(ArtistSlideshow.CleanupComplete)

This one is used internally by Artist Slideshow to tell an external script that ArtistSlideshow is done running and is exiting.


Calling the addon

Artist Slideshow does not exit after being called. It continues to run to check for changes in the artist infolabel. Becasue of that, the calling addon will have to create another thread for Artist Slideshow. The calling addon needs to import the python theading module for this to work.

def runArtistSlideshow(self):
    #startup artistslideshow
    xbmcgui.Window(xbmcgui.getCurrentWindowId()).setProperty("ArtistSlideshow.ExternalCall", "True")
    #assumes addon is using suggested infolabel name of CURRENTARTIST
    artistslideshow = "RunScript(script.artistslideshow,windowid=%s&artistfield=%s)" % (xbmcgui.getCurrentWindowId(), "CURRENTARTIST")
    xbmc.executebuiltin(artistslideshow)

self.thread = threading.Thread(target=self.runArtistSlideshow)
self.thread.setDaemon(True)
self.thread.start()

The suggestion is for the addon to spawn this thread right after it spawns the window.

Exiting the addon

When the calling addon is preparing to exit, it must tell Artist Slideshow to stop and wait until it has. This logic should be added *before* the addon's window is destroyed. Failure to include this step will likely cause XBMC to crash.

#tell ArtistSlideshow to exit
xbmcgui.Window(xbmcgui.getCurrentWindowId()).clearProperty("ArtistSlideshow.ExternalCall")
#wait until ArtistSlideshow exits
while (not xbmcgui.Window(xbmcgui.getCurrentWindowId()).getProperty("ArtistSlideshow.CleanupComplete") == "True"):
    time.sleep(1)

Getting help

If you need assistance using Artist Slideshow, integrating it a skin, or calling it using another addon, please see the support thread on the XBMC forums.

http://forum.xbmc.org/showthread.php?t=124880