Hi guys,

Me again. I'd like my application to link some file as an artwork for a Movie 
Type Resource.
The artwork consists in a .png file, stored in some directory (that's not the 
important point).

Here is how I "link" the file to the artwork "property" of the Movie Resource 
(Python code, but you'll understand) :

***

# self.artwork is a QPixmap containg the artwork.

if not self.artwork.isNull():
    # SNIP : saves the cover to `coverpath`.
    # `coverpath` is a KUrl instance.

    # Build a Resource of type NFO:image from the saved picture :
    img = Nepomuk.Resource(coverpath, OntologiesUrls.image())

    # "Links" that NFO:image Resource to the NMM:artwork property of my Movie 
Resource :
    resource.setProperty(OntologiesUrls.artwork(), Nepomuk.Variant(img))

***


The problem is to get the .png file back. Here is what I tried :


***

# Get the Resource linked by the NMM:artwork property :
artwork = resource.property(OntologiesUrls.artwork())

if artwork.isValid():
    imgResource = artwork.toResource()
    res.artwork = PictureLoader.load_pixmap(imgResource.toFile().url())

***

The problem is that `imgResource.toFile().url()` returns an empty KUrl.

Am I missing something ? What did I misunderstood ? How can I retrieve and load 
the linked artwork file ?

Thanks for your help :)

Cheers,

-- 
François
_______________________________________________
Nepomuk mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/nepomuk

Reply via email to