This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Something wrong with cover urls for 2 and 1 level StreamItem

Tags: None
(comma "," separated)
jiallombardo
Registered Member
Posts
5
Karma
0
Greetings!
I was trying to modify an existing script (the vk_search script, to be exact) to show not only people and their tracks, but their albums as well. Thus, I used a 3-layer tree to display everything.

While the hierarchy appears to be correct now, I'm having difficulties in understanding how to set pictures to objects.
For instance, I have this code:
Code: Select all
item.level = 2;
                item.callbackData = callback;
                item.itemName = first_name+" "+last_name+" ("+screen_name+")";
                item.playableUrl = "";
                item.coverUrl = photo;
      
                script.insertItem(item);

And when I push the "photo" variable into an alert window, it presents a valid link to a photo. However, Amarok displays the default picture (as I understood, level 2 is for authors, so it displays the default author picture).
On the other hand, this code
Code: Select all
item.level = 1;
      item.callbackData = callback;
      item.itemName = albumName;
      item.playableUrl = "";
      item.coverUrl = "";
      script.insertItem(item);

behaves somewhat erratically, as it sometimes produces an item with a picture on it.

Perhaps, there is a certain best practice of setting images, or am I just doing something wrong? I tried downloading the object inspector, but can't figure out how to use it :(

Thanks in advance!
DarthCodus
Registered Member
Posts
9
Karma
1
Code: Select all
item.level = 1;
      item.coverUrl = "";

Why don't you set the cover pic here?
jiallombardo
Registered Member
Posts
5
Karma
0
Well, that was the idea: level 2 items are users, so I wanted their avatars to show up through coverUrl; level 1 items are albums (which are essentially no more than groups of music created by the users, so they don't require any picture) and level 0 items are records. I explicitly wanted no pictures on the 1 level items.
DarthCodus
Registered Member
Posts
9
Karma
1
Sorry, AFAICS you can't set an image at level 2 with the current API, the levels are hard coded as Genre[3], Artist[2], Album[1], and only the album displays a cover.
Hopefully I can improve things some time next week, though the changes won't make it to a public release until 2.9 .
jiallombardo
Registered Member
Posts
5
Karma
0
Uh-huh, I thought that there was at least some special field for level-2 items, but there isn't. Yeah, it'd be good to have something in alternative to the default pictures:)

If some efforts will be done, might I ask for a patch?

And also a question about covers suddenly appearing on level 1 items (when I specifically set the links to empty) - is that some sort of glitch, or how is that possible?
DarthCodus
Registered Member
Posts
9
Karma
1
You don't have to ask for a patch, it'll be pushed to my gsocScripting2 branch on quickgit.kde.org.
And as for those covers suddenly appearing, try clearing your albumcovers cache.
jiallombardo
Registered Member
Posts
5
Karma
0
I'm a bit of a newbie to linux - got openSUSE 12.3 running right now - how would I be able to obtain the changes?

And as for the albums - that worked like a charm, thanks :) Still had to reboot, since amarok was segmentation faulting on startup, but it's fine now.
DarthCodus
Registered Member
Posts
9
Karma
1
I'm assuming you already have the Amarok source.
Add a new remote:
Code: Select all
git remote add  <remotename>  git://anongit.kde.org/clones/amarok/anmolahuja/amarok.git

And then pull gsocScripting2 from <remotename>.
There's other new scripting API stuff, so please do try it :P

You might find these useful:
Check here for a local build: http://blogs.fsfe.org/myriam/2009/09/co ... l-summary/
A detailed information about git can be found here: http://techbase.kde.org/Getting_Started ... t-tutorial
[thanks to Mamarok for these]
DarthCodus
Registered Member
Posts
9
Karma
1
And segfaulting is not normal. You should generate a backtrace and file a bug report.
jiallombardo
Registered Member
Posts
5
Karma
0
Thanks for details and links - I'll try to straighten it out. Though I don't have the sources (I just dabbled in the js script of one particular... erm, script), I'll be sure to get them - get familiar with git and all that.

Segfaulting happened a lot during my experiments with the aforementioned script. To get rid of it, I usually renamed the scripts/ directory. So I assumed the scripts to be responsible. Last time I lauched amarok, I did observe a heavy CPU increase on its part after some time, but again - no errors. So I again assume it must be the script I modified (and screwed up the search function).


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot], Sogou [Bot]