def onChange(filename): filename = fixZfsMount(filename) for root, sync in syncs.items(): if filename.startswith(root): # this one reads .n3 files into sesame log.info("rdf data sync on %r", filename) sync.someChange(filename, doubleCheckMtime=True) break if filename.startswith('/my/pic') and '/.hide/' not in filename: # this one wants to hear about image files for path/exif data if filename.startswith('/my/pic/upload'): fixSftpPerms() log.info("scanFs and scanExif on %r", filename) picUri = scanFs.fileChanged(filename) log.info('picUri is %r', picUri) if picUri is not None: # this will fail on videos (though i wish i could get the Pre metadata out of them) scanExif.addPic(picUri, rerunScans=True) mr = MediaResource(graph, picUri) if mr.isVideo(): mr.videoProgress() # todo: freshen thumbs here too? that should be on a lower # priority queue than getting the exif/file data v2.imageset.client.changed(picUri)
def onChange(filename): for root, sync in syncs.items(): if filename.startswith(root): # this one reads .n3 files into sesame log.info("rdf data sync on %r", filename) sync.someChange(filename, doubleCheckMtime=True) break if filename.startswith('/my/pic') and '/.hide/' not in filename: # this one wants to hear about image files for path/exif data if filename.startswith('/my/pic/upload'): fixSftpPerms() log.info("scanFs and scanExif on %r", filename) picUri = scanFs.fileChanged(filename) log.info('picUri is %r', picUri) if picUri is not None: # this will fail on videos (though i wish i could get the Pre metadata out of them) scanExif.addPic(picUri, rerunScans=True) mr = MediaResource(graph, picUri) if mr.isVideo(): mr.videoProgress()
def featured(self): current = self.desc.currentPhoto() if current is None: return '' currentLocal = localSite(current) _, nextUri = self.prevNext() feat = MediaResource(self.graph, current) if feat.isVideo(): progress = feat.videoProgress() if progress is Done: w, h = feat.getSize(Video2) return dict(video=dict(sources=[ dict(src=currentLocal + "?size=video2", type='video/webm'), dict(src=currentLocal + "?size=video2&type=mp4", type='video/mp4') ], width=600, height=600 / w * h)) else: return dict(videoNotReady=dict(progress=progress, failed=isinstance( progress, FailedStatus))) else: try: size = feat.getSize(sizes["large"]) except (ValueError, IOError) as e: log.warn('current=%r', current) import traceback traceback.print_exc() size = (0, 0) marg = (602 - 2 - size[0]) // 2 return dict(image=dict( nextClick=self.desc.otherImageUrl(nextUri), src=currentLocal + "?size=large", w=size[0], h=size[1], marg=marg, alt=self.graph.label(current), ))
def featured(self): current = self.desc.currentPhoto() if current is None: return '' currentLocal = localSite(current) _, nextUri = self.prevNext() feat = MediaResource(self.graph, current) if feat.isVideo(): progress = feat.videoProgress() if progress is Done: w, h = feat.getSize(Video2) return dict( video=dict( sources=[ dict(src=currentLocal+"?size=video2", type='video/webm'), dict(src=currentLocal+"?size=video2&type=mp4", type='video/mp4') ], width=600, height=600 / w * h)) else: return dict(videoNotReady=dict( progress=progress, failed=isinstance(progress, FailedStatus))) else: try: size = feat.getSize(sizes["large"]) except (ValueError, IOError) as e: log.warn('current=%r', current) import traceback;traceback.print_exc() size = (0,0) marg = (602 - 2 - size[0]) // 2 return dict(image=dict( nextClick=self.desc.otherImageUrl(nextUri), src=currentLocal+"?size=large", w=size[0], h=size[1], marg=marg, alt=self.graph.label(current), ))