Bug 179732

Summary: Access the image cover from script API
Product: [Applications] amarok Reporter: Simon ESNEAULT <simon.esneault>
Component: Tools/Script ManagerAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: wishlist CC: peterzhoulei, simon.esneault, simon
Priority: NOR    
Version: 2.0-SVN   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: (not exactly) patch for the file scriptengine/MetaTypeExporter.h
(not exactly) patch for the file scriptengine/MetaTypeExporter.cpp
Patch for retrieving cover url from script
Patch for retrieving cover url from script

Description Simon ESNEAULT 2009-01-05 19:29:11 UTC
Version:           2.0-SVN (using Devel)
OS:                Linux
Installed from:    Compiled sources

Extend the script API in order to allow the access of the image cover

Attached 2 (not exactly) patch for the files
- scriptengine/MetaTypeExporter.h
- scriptengine/MetaTypeExporter.cpp

But it's not working !!!
Peter can you help us ??

After this, we should be able to write script like this :
function hasPicture()
{
    var TrackInfo = Amarok.Engine.currentTrack();
    if (TrackInfo.isValid)
    {
        var box = new QMessageBox("New Track " + TrackInfo.title + " - " +TrackInfo.artist);
        box.setIconPixmap(TrackInfo.image);
        box.show();		
    }
}

Which will be super great !!

Thanks in advance
Comment 1 Simon ESNEAULT 2009-01-05 19:31:09 UTC
Created attachment 29936 [details]
(not exactly) patch for the file scriptengine/MetaTypeExporter.h
Comment 2 Simon ESNEAULT 2009-01-05 19:31:26 UTC
Created attachment 29937 [details]
(not exactly) patch for the file scriptengine/MetaTypeExporter.cpp
Comment 3 Simon ESNEAULT 2009-01-09 19:12:07 UTC
Here is a patch, with this, we can access the current cover url using :

Amarok.Engine.currentTrack().imageUrl;

And we should be able able to change the cover of the current image using Amarok.Engine.currentTrack().imageUrl.setImageUrl("/the/new/url");

Read the cover url worls fine but not writing, can someone have a look ?
If we can find a way, it will be a read only parameter :o)



Comment 4 Simon ESNEAULT 2009-01-09 19:20:45 UTC
Created attachment 30067 [details]
Patch for retrieving cover url from script
Comment 5 Simon ESNEAULT 2009-01-09 19:21:22 UTC
Created attachment 30068 [details]
Patch for retrieving cover url from script
Comment 6 Seb Ruiz 2009-01-10 02:55:20 UTC
SVN commit 908640 by seb:

Cover art can get/set from the script API.
BUG: 179732

 M  +2 -0      ChangeLog  
 M  +13 -0     src/scriptengine/MetaTypeExporter.cpp  
 M  +4 -2      src/scriptengine/MetaTypeExporter.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=908640
Comment 7 Mark Kretschmann 2009-01-10 08:44:56 UTC
Could someone please remember to update our Wiki with the API information, once 2.1 gets released?

Thanks :)
Comment 8 Simon Lindgren 2009-01-12 21:42:20 UTC
Setting the cover image through Amarok.Engine.currentTrack().imageUrl = "/the/url/image.jpg"; seems to work for some collection types, though the "current track information" widget seems to not update the newly set image (any hints on how to address this?). For setting images also for streamed music, I've had some success changing the "image" method and adding setImage, hasImage methods to meta/stream/Stream_p.h file. If this seems a sensible approach, let me know and I'll post a patch for this as well.