Ejemplo n.º 1
0
    def do_update(self, subcmd, opts, *path):
        """${cmd_name}: Update working copy with recent changes on flickr.

        This can be called on any path in a pics working copy and the *whole*
        working copy will be updated. Note: Currently this doesn't update the
        working copy with changes on flickr *before* the first checkout date.

        ${cmd_usage}
        ${cmd_option_list}
        """
        paths = path or [os.curdir]
        for wc, path in wcs_from_paths(paths):
            if wc is None:
                log.info("skipped '%s'", path)
            else:
                wc.update(dry_run=opts.dry_run)
Ejemplo n.º 2
0
    def do_list(self, subcmd, opts, *target):
        """${cmd_name}: List photo entries.

        ${cmd_usage}
        ${cmd_option_list}
        """
        targets = target or [os.curdir]
        for wc, path in wcs_from_paths(targets):
            if wc is None:
                if isdir(path):
                    log.error("'%s' is not a working copy", path)
                else:
                    log.error("'%s' is not in a working copy", path)
                break
            else:
                wc.list([path], format=opts.format, tags=opts.tags)
Ejemplo n.º 3
0
    def do_info(self, subcmd, opts, *target):
        """${cmd_name}: Display info about a photo.

        Currently this retrieves photo info from flickr rather than using
        the local cache. This is because not *all* photo data is currently
        being tracked by pics.

        ${cmd_usage}
        ${cmd_option_list}
        """
        targets = target or [os.curdir]
        for wc, path in wcs_from_paths(targets):
            if wc is None:
                if isdir(path):
                    log.error("'%s' is not a working copy", path)
                else:
                    log.error("'%s' is not in a working copy", path)
                break
            else:
                wc.info(path)
Ejemplo n.º 4
0
    def do_browse(self, subcmd, opts, target=None):
        """${cmd_name}: Open the given photo or dir URL in your browser.

        ${cmd_usage}
        ${cmd_option_list}
        Examples:
            pics browse ~/pics/2009-01  # opens month summary URL for Jan 2009
            pics browse 2009-01/155804574.small.jpg  # opens that photo's URL
            pics browse  # opens a URL appropriate for the current dir
        """
        if target is None:
            target = os.curdir
        for wc, path in wcs_from_paths([target]):
            if wc is None:
                if isdir(target):
                    log.error("'%s' is not a working copy", target)
                else:
                    log.error("'%s' is not in a working copy", target)
            else:
                url = wc.url_from_target(target)
                webbrowser.open(url)