Bug 179732 - Access the image cover from script API
Summary: Access the image cover from script API
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Tools/Script Manager (show other bugs)
Version: 2.0-SVN
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-01-05 19:29 UTC by Simon ESNEAULT
Modified: 2009-12-09 11:29 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
(not exactly) patch for the file scriptengine/MetaTypeExporter.h (735 bytes, patch)
2009-01-05 19:31 UTC, Simon ESNEAULT
Details
(not exactly) patch for the file scriptengine/MetaTypeExporter.cpp (621 bytes, patch)
2009-01-05 19:31 UTC, Simon ESNEAULT
Details
Patch for retrieving cover url from script (755 bytes, patch)
2009-01-09 19:20 UTC, Simon ESNEAULT
Details
Patch for retrieving cover url from script (646 bytes, patch)
2009-01-09 19:21 UTC, Simon ESNEAULT
Details

Note You need to log in before you can comment on or make changes to this bug.
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.