Given a list of files in a certain directory,
        updates to the given status
        If status is ST_UPTODATE, and no files given
        will go through current DB and push files
        with the "A" flag
        service: If none, assumes all services, looks for matching service

def UpdateStatus(self,directory,files,status,service):
        """Given a list of files in a certain directory,
        updates to the given status
        If status is ST_UPTODATE, and no files given
        will go through current DB and push files
        with the "A" flag
        service: If none, assumes all services, looks for matching service
        """

        # First get a list of all files in dir
        # as well as current status
        dfiles,db=self.GetStatus(directory,files)

        # If no file list given and asked to 
        # bring files up to date, go through files in DB
        # with "A" or M status
        if not files and status==self.ST_UPTODATE:
            files=[]
            logger.debug('No files given, finding all that needs uploading')
            for fn in dfiles:
                if dfiles[fn]['status']==self.ST_ADDED\
                        or dfiles[fn]['status']==self.ST_MODIFIED\
                        or dfiles[fn]['status']==self.ST_COMPLICATED\
                        or dfiles[fn]['status']==self.ST_DELETED:
                    files.append(fn)
                    logger.debug('Adding %s to list with status %s'\
                            %(fn,dfiles[fn]['status']))

        # Go through list of files given, see if they
        # actually exist
        files_that_exist=[]
        for fn in files:
            if fn in dfiles:
                files_that_exist.append(fn)
            else:
                logger.debug("%s - Skipping, does not exist"%(fn))

        files_that_exist.sort()

        # FIXME: This is bad, but flickr needs to upload
        # media files first, then meta data files. Here
        # we ensure this happens
        if service is None or service is 'flickr':
            sobj=self.sman.GetServiceObj('flickr')
            files_hack_media=[]
            files_hack_config=[]
            files_hack_other=[]
            for filename in files_that_exist:
                if sobj._isMediaFile(filename):
                    files_hack_media.append(filename)
                elif sobj._isConfigFile(filename):
                    files_hack_config.append(filename)
                else:
                    files_hack_other.append(filename)


            #Now organize as we'd like it, media first, then config, then others
            files_that_exist=[]
            files_that_exist.append(files_hack_media)
            files_that_exist.append(files_hack_config)
            files_that_exist.append(files_hack_other)
            # Flatten list
            files_that_exist=list(chain.from_iterable(files_that_exist))

        for fn in files_that_exist:
            if status==self.ST_ADDED:
                self._updateToAdded(directory,fn,dfiles[fn],db,service)
            elif status==self.ST_UPTODATE:
                if not db.has_key(fn):
                    print("%s - Not in db, did you do an 'add' first?"%(fn))
                    continue
                if service:
                    servicelist=[service]
                else:
                    servicelist=db[fn]['services'].keys()

                for sn in servicelist:
                    if not db[fn]['services'].has_key(sn):
                        print("%s - Service [%s] unknown, skipping"\
                                %(fn,sn))
                        continue
                    # If push request and file is marked for
                    # deletion, delete it rather from remote
                    if db[fn]['services'][sn]['status']==self.ST_DELETED:
                        self._deleteFile(directory,fn,dfiles[fn],db,sn)
                    else:
                        self._uploadFile(directory,fn,dfiles[fn],db,sn)

            elif status==self.ST_DELETED:
                self._updateToDeleted(directory,fn,dfiles[fn],db,service)
            # Save for every upload, so we can easily resume
            self._saveDB(directory,db)

        # Always save when status is updated
        self._saveDB(directory,db)

        # Now print out updated status
        self.PrintStatus(directory,files)