def slotTransfer(self, session, fileName, source): dstSession = (self.session, self.session_2)[(session != self.session) ^ source] srcSession = (self.session_2, self.session)[(session != self.session) ^ source] srcKurl = KUrl(srcSession.kurl) srcKurl.addPath(fileName) dstKurl = KUrl(dstSession.kurl) dstKurl.addPath(fileName) print "transfer " + srcKurl.prettyUrl() + " to " + dstKurl.prettyUrl() session.copyFile(srcKurl, dstKurl)
def updateFileTags(self, filename, post, skip=False): res = self.getResource(filename) if skip and res.hasProperty(Soprano.Vocabulary.NAO.personalIdentifier()): return #remove all current tags res.removeProperty(res.tagUri()) #res.removeProperty(Soprano.Vocabulary.NAO.isRelated()) #res.removeProperty(Soprano.Vocabulary.NAO.rating()) #res.removeProperty(Soprano.Vocabulary.NAO.contributor()) #res.removeProperty(Soprano.Vocabulary.NAO.personalIdentifier()) for tag in post.tags: self._addTag(res, tag.name) url = KUrl(post.board_url) url_res = Nepomuk.Resource(url) url_res.addType(Nepomuk.Vocabulary.NFO.Website()) url_res.setLabel(url.prettyUrl()) res.addIsRelated(url_res) if post.source: res.setDescription("Source: %s" % KUrl(post.source).prettyUrl()) if post.score: res.addProperty(Soprano.Vocabulary.NAO.rating(), Nepomuk.Variant(post.score)) if post.author: res.addProperty(Soprano.Vocabulary.NAO.contributor(), Nepomuk.Variant(post.author)) if post.rating: self._addTag(res, "rating-%s" % post.rating) res.addProperty(Soprano.Vocabulary.NAO.personalIdentifier(), Nepomuk.Variant(str(post.id)))