Kodi Community Forum
[RELEASE] Artist Slideshow addon (for skin integration) - Printable Version

+- Kodi Community Forum (http://forum.kodi.tv)
+-- Forum: Help and Support (/forumdisplay.php?fid=33)
+--- Forum: Add-ons Help and Support (/forumdisplay.php?fid=27)
+---- Forum: Program Add-ons (/forumdisplay.php?fid=151)
+---- Thread: [RELEASE] Artist Slideshow addon (for skin integration) (/showthread.php?tid=102703)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19


- pkscout - 2012-02-24 15:46

kiboy6 Wrote:One further request for the Advanced Options: Is there any chance of adding the option to show a slideshow comprising BOTH local and downloaded images. (ie not using one as a fallback for the other). That would be my perfect scenario.

I'm not sure that's going to be feasible. What the script is doing (both the original and my updates) is using the slideshow options available to a skin to show a bunch of images. That skin function (from what I can tell) requires all the files to be in a single directory. The only way to show both local and remote stuff would be to either copy both sets to a third directory and use that or copy the contents on one directory to the other (i.e. copy all the downloaded files to your extrafanart directory). I'll look at it, but it could really get messy.

Quote:If this is an issue you were able to lend your expertise to it would be a massive help Smile

That one may be beyond my ability. While I've been programming awhile, I only picked up python a couple of months ago. If Ronnie hasn't been able to figure that one out, I don't know that I can do any better. But I'll do some poking.


- kiboy6 - 2012-02-24 17:12

pkscuot Wrote:The only way to show both local and remote stuff would be to either copy both sets to a third directory and use that or copy the contents on one directory to the other (i.e. copy all the downloaded files to your extrafanart directory). I'll look at it, but it could really get messy.

The most logical way I could think of would be to change the location of the scripts' downloaded images to be \MusicFolder\artist\extrafanart. In other words to make the script download images directly to the local extrafanart folders. This probably isn't feasible for some reason, but it would be great if it were.

Quote:That one may be beyond my ability. While I've been programming awhile, I only picked up python a couple of months ago. If Ronnie hasn't been able to figure that one out, I don't know that I can do any better. But I'll do some poking.

No worries..hope you have some fruitful poking anyway Wink

Thanks again for all your work on tweaking this awesome script


- ronie - 2012-02-24 20:32

pkscuot Wrote:The one exception is that the first time a download cache directory is created the slideshow will only show the first image downloaded until the artist plays again. I walked the code by hand, and I see where the refresh is suppose to happen, and I even see it happen on my screen (you see black for a second). But it just doesn't budge that first image.

try increasing the sleep time in the script.
it's currently set to 1 second (iirc), some users reported they have better luck when setting it to three seconds.

on my end, i've never had any issues with it. i'm clueless as to why it works for some, but doesn't for others.

pkscuot Wrote:I made one change to the GENERAL tab. In looking through the code, it looks like last.fm doesn't let you do minimum image size, so I set the min height and width options to show only if you select htbackdrops as a download option.

it's correct that last.fm doesn't let you specify the images size, so it's handled by the script instead in this case. it will filter out all images below the specified width/height

pkscuot Wrote:The only other thing I'd like to do is have the script set the fade time and image time for the slideshow, but that would require skin changes.

i'm not sure if it can be done... so just give it a shot. :-)

pkscuot Wrote:I think I'll wait until Ronnie has a chance to look at what I've done before I take on anything else.

feel free to make whatever changes you like.
i'm always pleased when someone picks up my code and improves it ;-)


- pkscout - 2012-02-24 23:26

ronie Wrote:try increasing the sleep time in the script.
it's currently set to 1 second (iirc), some users reported they have better luck when setting it to three seconds.

I'll try that.

Quote:it's correct that last.fm doesn't let you specify the images size, so it's handled by the script instead in this case. it will filter out all images below the specified width/height

OK, I'll move the size mins back where they were then. It didn't seem to be working for me when I was using last.fm, but I'll try again. I had min height set to 720 and min width to 1280, but it would download an 800x800 image from last.fm. At least that's what I think it did. As I said, I'll check it again.


- pkscout - 2012-02-24 23:33

I found what I would consider an edge case bug. htbackdrops.com went down briefly today. I was testing something and noticed the script had failed with an error. When I restarted and tried again with a different artist, the script did not fail even though htbackdrops.com was still down.

The difference was the artist causing the failure had a valid .nfo file in the cache directory, and the other artist had nothing. It looks like the script checks for connection errors when generating the .nfo, but not when you download the actual images. So if there is a valid .nfo file, the script doesn't notice that the site is down until it errors out.

I added another try/except clause around the actual image download to fix that. I wasn't sure if Ronnie would want to patch that separately, so I went ahead and added a patch file to my github site for just this bug. It's at:

https://github.com/pkscout/script.artistslideshow/blob/master/downloaderror.patch

My forked branch now includes that patch, and the full patchfile has been updated as well. If you're being brave and trying this out, you should download the zip file again from:

https://github.com/pkscout/script.artistslideshow/

The only thing you really have to replace is default.py.


- ronie - 2012-02-24 23:37

pkscuot Wrote:OK, I'll move the size mins back where they were then. It didn't seem to be working for me when I was using last.fm, but I'll try again. I had min height set to 720 and min width to 1280, but it would download an 800x800 image from last.fm. At least that's what I think it did. As I said, I'll check it again.
here's the piece of code responsible for the filtering:
Code:
if site == "lastfm":
    if element.tag == "size":
        if element.attrib.get('name') == "original":
            width = element.attrib.get('width')
            height = element.attrib.get('height')
            [b]if ( int(width) >= self.minwidth ) and ( int(height) >= self.minheight )[/b]:
                data.append(element.text)



- pkscout - 2012-02-25 01:44

ronie Wrote:here's the piece of code responsible for the filtering:

Oh sure. After you point out the correctly functioning code, it works fine. Big Grin


- pkscout - 2012-02-25 04:25

kiboy6 Wrote:One further request for the Advanced Options: Is there any chance of adding the option to show a slideshow comprising BOTH local and downloaded images. (ie not using one as a fallback for the other). That would be my perfect scenario.

I have branched my work and now have this included. You can get a zip file of the branch at:

https://github.com/pkscout/script.artistslideshow/zipball/comboview

It's had limited testing, so I don't want to merge it in yet.

There are now three priority options to choose from when you set a local image path.

1- use remote images first (default)
2- use local images first
3- use both local and remote images

If you choose the third option, all downloaded files, the .nfo files generated, etc. will be stored in the extrafanart folder for the artist. If the script has downloaded stuff before that will NOT be moved over.

There is one thing about this that make me a little twitchy. I have no idea what will happen if you already have a fan art named the same as a downloaded image. But given the downloaded stuff is hashed and has a .tbn extension, I'm betting there's a small likelihood of that. I generally get nervous when a script starts writing stuff to a directory in which a user has placed other stuff. So please backup your extrafanart before trying this one.


- Vrok - 2012-02-25 14:24

ronie Wrote:try increasing the sleep time in the script.
it's currently set to 1 second (iirc), some users reported they have better luck when setting it to three seconds.

I've got the same problem

Using aeon nox and beta 3 eden

Whenever a new artist gets played the slideshow stops and i have to double click tab to make it start again


- pkscout - 2012-02-25 16:46

bossanova808 Wrote:While we're doing requests - being able to call the script with a supplied artist name would mean the script would be callable in other contexts rather than just when the XBMC player is playing...I could just add the skin control and call the script using data from an info label set by my other script...

(e.g. I could use it in my XSqueeze add on Wink - http://forum.xbmc.org/showthread.php?tid=122199

Check your PM. I have a branch that should support this, but I didn't want to clog the thread up with development support. We can work on this in PMs.


New Experimental Version Available - pkscout - 2012-02-26 16:27

I have a new version of the add-on available at my github site:

https://github.com/pkscout/script.artistslideshow

At this point I believe it includes all the things folks have asked about to date (except passing the artist as an argument, we're working on that separately). I've also updated the readme and changelog. For skinners please note that testing for:
Code:
Window(Visualisation).Property(ArtistSlideshowRefresh)
is no longer needed (see below for explanation). If you leave it in it won't hurt anything, you just don't need it.

I found a different way to do the refresh after download that, I believe, should work more consistently (it certainly does for me). It mirrors what happens when you change artists. Instead of trying to do a refresh via the skin, when the image downloads are done, the script switches to an "empty" directory, pauses, and then switches back to the correct directory. Switching into or out of a truly empty directory caused a jarring transition, so the empty directory actually as a black image that is 16x9 pixels. That allows for a nicer fade out and in.

There are now two groupings of settings: Download and Slideshow.

Download
Download images from last.fm (default true)
(self expanitory)

Download images from htbackdrops.com (default false)
(self expanitory)

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 first. if none found will use local images. if none found will use fallback slideshow
local first will use local images first. 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. if nothing found will use fallback slideshow.

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.

Fade time after all images loaded: (default 2 seconds)
when the addon starts downloading images, it shows the first one while it downloads all the others. When it refreshes the directory it fades out and back in. For the most seamless experience, set this to the same fade time as your skin uses.

Refresh slideshow after every image download: (default false)
if set to true, the slideshow will refresh after every image instead of after all the images are downloaded. includes option to have the slideshow refresh only after x number of seconds. This is really only useful for slow connections.


Let me know if you find issues. I'm going to let this burn in for a week or so and then talk to Ronie about merging all this into the official add-on.


- Vrok - 2012-02-26 17:23

This seems to work but it stays in the first image for quite some time.

Also is there a setting not to cache any of the images at all? (Don't want to fill my SSD with images)

EDIT1: Can you perhaps do the dircetory trick after each download finishes and not when all of them do?

EDIT2: oh just found out there's a setting for this. Sweet Smile

EDIT3: Unfortunately the refresh after each download doesn't work all that well because it changes images instantly when downloaded. Can you put a minimum refresh threshold?


- pkscout - 2012-02-26 18:08

Vrok Wrote:Also is there a setting not to cache any of the images at all? (Don't want to fill my SSD with images)
The images have to be downloaded or XBMC's slideshow function can't show them. I suppose you could delete the last directory created upon an artist switch, but I think that will cause some ugly transitions, and I would likely have to delete the old directory before switching to the new one.

I might be able to set a limit to the cache size and delete the oldest stuff first, but I'm not sure. I'll look though.

Quote:EDIT3: Unfortunately the refresh after each download doesn't work all that well because it changes images instantly when downloaded. Can you put a minimum refresh threshold?
Yea, I envisioned it for really slow connections. I'll look at trying to set a minimum refresh time.


- pkscout - 2012-02-26 18:55

Vrok Wrote:Unfortunately the refresh after each download doesn't work all that well because it changes images instantly when downloaded. Can you put a minimum refresh threshold?

OK, that option is in there now. Re-download and give it a try. The option to limit the cache size is going to take a bit longer.


- ronie - 2012-02-27 01:24

pkscuot Wrote:
Code:
Window(Visualisation).Property(ArtistSlideshowRefresh)
is no longer needed (see below for explanation). If you leave it in it won't hurt anything, you just don't need it.

I found a different way to do the refresh after download that, I believe, should work more consistently (it certainly does for me). It mirrors what happens when you change artists. Instead of trying to do a refresh via the skin, when the image downloads are done, the script switches to an "empty" directory, pauses, and then switches back to the correct directory. Switching into or out of a truly empty directory caused a jarring transition, so the empty directory actually as a black image that is 16x9 pixels. That allows for a nicer fade out and in.

nice find!
this indeed works great :-)

besides not needing the refresh property anymore, would this also fix the issue some users are having with the slideshow not refreshing after all images are downloaded?

pkscuot Wrote:Fade time after all images loaded: (default 2 seconds)
when the addon starts downloading images, it shows the first one while it downloads all the others. When it refreshes the directory it fades out and back in. For the most seamless experience, set this to the same fade time as your skin uses.

if not strictly needed (as per my comment above), i'd say just hard-code it to 1 second.

we don't want users have to dig through skin xml files to figure out what fadetime their skin uses.

imo, the addon sets the standard and skins should adopt to it.

pkscuot Wrote:Let me know if you find issues. I'm going to let this burn in for a week or so and then talk to Ronie about merging all this into the official add-on.

i'm perfectly fine if you want to maintain the addon from this point on.
if so, just submit a pull request on the addon mailing list as soon as you think things are stable enough for inclusion in the addon repo.


oh btw , i've updated the skin integration info on the first post, you may want to make the same changes in the readme file.