Exemplo n.º 1
0
    def _do_command(self):
        album_id = None

        for root, dirs, files in os.walk("."):
            try:
                dirs.remove("SMUGMUG_INFO")
            except:
                pass
            li = LocalInformation(root)

            for file in files:
                if re.match(self.options.filter_regex, file):
                    if not li.exists():
                        title_file = path.join(root, "Title")
                        if path.isfile(title_file):
                            name = sm_wrapper.filename_get_line(title_file)
                        else:
                            name = root[2:] # strip off initial ./ or .\
                        # create(smugmug, name, root, opts)
                        album_id = self.smugmug.create_album(name, self.options)
                        li.create(album_id)
                    # update_dir(smugmug, root, opts, files)
                    to_upload = self._process_files(li, files)
                    if len(to_upload) > 0:
                        self.smugmug.upload_files(album_id, self.options,
                            to_upload, local_information=li)
                    break
Exemplo n.º 2
0
    def _do_command(self):
        album_id = None

        for root, dirs, files in os.walk("."):
            try:
                dirs.remove("SMUGMUG_INFO")
            except:
                pass
            li = LocalInformation(root)

            for f in files:
                if re.match(self.options.filter_regex, f):
                    if not li.exists():
                        title_file = path.join(root, "Title")
                        if path.isfile(title_file):
                            name = sm_wrapper.filename_get_line(title_file)
                        else:
                            name = root[2:]  # strip off initial ./ or .\
                        # create(smugmug, name, root, opts)
                        album_id = self.smugmug.create_album(
                            name, self.options)
                        li.create(album_id)
                    # update_dir(smugmug, root, opts, files)
                    to_upload = self._process_files(li, files)
                    if len(to_upload) > 0:
                        self.smugmug.upload_files(album_id,
                                                  self.options,
                                                  to_upload,
                                                  local_information=li)
                    break
Exemplo n.º 3
0
    def _do_command(self):
        name = self.args[1]
        # TODO: get options to album from CLI
        album_id = self.smugmug.create_album(name, self.options)
        print("[%s] created with id [%s]" % (name, album_id))

        # now upload/update any supplied files
        if self.options.upload:
            if len(self.args) > 2:
                to_upload = self.args[2:]
                self.smugmug.upload_files(album_id, self.options, to_upload)
        else:
            li = LocalInformation(".")
            li.create(album_id)

            # first 2 args are create & album name, the rest will
            # be optional files
            if len(self.args) > 2:
                to_upload = self._process_files(li, self.args[2:])
                if len(to_upload) > 0:
                    self.smugmug.upload_files(album_id, self.options,
                        to_upload, local_information=li)
Exemplo n.º 4
0
    def _do_command(self):
        name = self.args[1]
        # TODO: get options to album from CLI
        album_id = self.smugmug.create_album(name, self.options)
        print("[%s] created with id [%s]" % (name, album_id))

        # now upload/update any supplied files
        if self.options.upload:
            if len(self.args) > 2:
                to_upload = self.args[2:]
                self.smugmug.upload_files(album_id, self.options, to_upload)
        else:
            li = LocalInformation(".")
            li.create(album_id)

            # first 2 args are create & album name, the rest will
            # be optional files
            if len(self.args) > 2:
                to_upload = self._process_files(li, self.args[2:])
                if len(to_upload) > 0:
                    self.smugmug.upload_files(album_id,
                                              self.options,
                                              to_upload,
                                              local_information=li)