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

Using Pictures in Amarok 2.0 Script

Tags: None
(comma "," separated)
User avatar
gaillou
Registered Member
Posts
22
Karma
0
OS

Using Pictures in Amarok 2.0 Script

Sun Feb 01, 2009 4:04 am
Hi I'd like to know if it's possible to use the reply of the Downloader inside a QPixmap. Thanks.
User avatar
markey
KDE Developer
Posts
2286
Karma
3
OS
I'm not sure I fully understand the question, but generally: Yes, it should be possible to put the data in a QPixmap.


--
Mark Kretschmann - Amarok Developer
User avatar
gaillou
Registered Member
Posts
22
Karma
0
OS
Ok but I actually didn't manage to do it. I tried
Code: Select all
img=new QPixmap;
img.loadFromData(dat);


But then
Code: Select all
img.isNull();

returns true.
Is it necessary to pass additional args to the function or is the problem somewhere else?
User avatar
gaillou
Registered Member
Posts
22
Karma
0
OS
Maybe I didn't make myself clear. I'm trying to use a distant picture . So I use your Downloader object :
Code: Select all
 new Downloader( pic_url , onFinished)


But in the onFinished function I don't know how to use the argument since it's javascript and the type isn't explicit. I wrote a lyrics script and the data recovered can be used as a simple string so when it's a jpeg file how can I use it inside a QPixmap?
User avatar
markey
KDE Developer
Posts
2286
Karma
3
OS
No, you did make yourself clear. I did actually give the problem some thought already, but didn't really reach a solution.

In theory what you tried should "just work" I think, so I'm not sure what's going on there. Some additional debugging output might be helpful. Start Amarok from the shell with: "amarok --debug"

Maybe, if we're lucky, Qt is gonna print some useful error message.


--
Mark Kretschmann - Amarok Developer
User avatar
eean
KDE Developer
Posts
1016
Karma
0
OS
Well you can use the normal Qt network apis for sure. I'll poke at this.


Amarok Developer
User avatar
eean
KDE Developer
Posts
1016
Karma
0
OS
Hey Galliou. I agree that this was a major problem with our "Downloader" api.

I've updated Amarok in SVN to have a new prototype called "DataDownloader". Its pretty much exactly like the old Downloader except the result is a QByteArray instead of a String.

(The old downloader is now named both Downloader and StringDownloader to keep things consistent but backwards compat.)

So this won't be available until Amarok 2.1. If you want to release a script for Amarok 2.0 users, you'll have to use the Qt Network apis.


Amarok Developer
User avatar
gaillou
Registered Member
Posts
22
Karma
0
OS
Ok thanks a lot but I think I'll wait for Amarok 2.1 to release my script since it's a script that retrieves tags on discogs and in the current version it's not possible to save changes to the mp3 file directly it's necessary to modify tags manually after otherwise they're not written to the file and I think it would be boring for users having to do this every time. Anyway I've seen this issue is fixed in the SVN version.
Thanks for your great work !
By the way is there a method/attribute to set the cover once it has been saved to disk? I've guessed a lot of attributes but I can't find this one.
User avatar
eean
KDE Developer
Posts
1016
Karma
0
OS
gaillou wrote:Ok thanks a lot but I think I'll wait for Amarok 2.1 to release my script since it's a script that retrieves tags on discogs and in the current version it's not possible to save changes to the mp3 file directly it's necessary to modify tags manually after otherwise they're not written to the file and I think it would be boring for users having to do this every time. Anyway I've seen this issue is fixed in the SVN version.
Thanks for your great work !

Your welcome. I appreciate your reports of issues that you face scripting Amarok.
By the way is there a method/attribute to set the cover once it has been saved to disk? I've guessed a lot of attributes but I can't find this one.

The imageUrl property is read/write.


Amarok Developer


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], daret, Evergrowing, Google [Bot], lockheed, sandyvee, Sogou [Bot]