Ejemplo n.º 1
0
def main():
    logging.basicConfig(level=logging.DEBUG,
                format='%(asctime)s %(levelname)s %(message)s',
                filename='debug.log',
                filemode='w')
    logging.debug('Started')
    console = logging.FileHandler('error.log')
    console.setLevel(logging.ERROR)
    logging.getLogger('').addHandler(console)

    flickr = Uploadr()
    if ( not flickr.checkToken() ):
        flickr.authenticate()

    images = flickr.grabNewImages()
    logging.debug("Uploading images: %s"  % (str(images)))

    #uploads all images that are in folders and not in history file
    uploaded_now = []
    for uploaded in flickr.upload(images):
        uploaded_now.append(uploaded)
        if len(uploaded_now) > 20:
            tags2set.createSets(uploaded_now, HISTORY_FILE)
            uploaded_now = []
    if len(uploaded_now) > 0:
        tags2set.createSets(uploaded_now, HISTORY_FILE)
Ejemplo n.º 2
0
def main():
    logging.basicConfig(level=logging.DEBUG,
                format='%(asctime)s %(levelname)s %(message)s',
                filename='debug.log',
                filemode='w')
    logging.debug('Started')
    console = logging.FileHandler('error.log')
    console.setLevel(logging.ERROR)
    logging.getLogger('').addHandler(console)

    flickr = Uploadr()
    if ( not flickr.checkToken() ):
        flickr.authenticate()

    images = flickr.grabNewImages()
    logging.debug("Uploading images: %s"  % (str(images)))
    #this is just double checking if everything is on Flickr what is in the history file
    # in another words it will restore history file if deleted by comparing flickr with folders
    # this takes too frickin long
    #flickr2history.reshelf(images, IMAGE_DIR, HISTORY_FILE)

    #uploads all images that are in folders and not in history file
    uploaded_now = []
    for uploaded in flickr.upload(images):
        uploaded_now.append(uploaded)
        if len(uploaded_now) > 20:
            tags2set.createSets(uploaded_now, HISTORY_FILE)
            uploaded_now = []
    if len(uploaded_now) > 0:
        tags2set.createSets(uploaded_now, HISTORY_FILE)
Ejemplo n.º 3
0
        logging.debug("Exiting UploadThread %d " % self.threadID)


if __name__ == "__main__":
    logging.basicConfig(level=logging.DEBUG,
                        format='%(asctime)s %(levelname)s %(message)s',
                        filename='debug.log',
                        filemode='w')
    logging.debug('Started')
    console = logging.FileHandler('error.log')
    console.setLevel(logging.ERROR)
    logging.getLogger('').addHandler(console)

    flickr = Uploadr()
    if (not flickr.checkToken()):
        flickr.authenticate()

    #see if we need to wipe flickr account first

    if (configdict.defaults()['remove_all_pics_first'].startswith('true')):
        deleteAll.deleteAllPics()
        os._exit(
            1
        )  ## STOP HERE after deleting all media so user has chance to turn off switch before next start

    images = flickr.grabNewImages()
    #this is just double checking if everything is on Flickr what is in the history file
    # in another words it will restore history file if deleted by comparing flickr with folders
    flickr2history.reshelf(images, IMAGE_DIR, HISTORY_FILE, NUM_THREADS)

    #uploads all images that are in folders and not in history file
Ejemplo n.º 4
0
                break
        logging.debug("Exiting UploadThread %d " % self.threadID)


if __name__ == "__main__":
    logging.basicConfig(
        level=logging.DEBUG, format="%(asctime)s %(levelname)s %(message)s", filename="debug.log", filemode="w"
    )
    logging.debug("Started")
    console = logging.FileHandler("error.log")
    console.setLevel(logging.ERROR)
    logging.getLogger("").addHandler(console)

    flickr = Uploadr()
    if not flickr.checkToken():
        flickr.authenticate()

    # see if we need to wipe flickr account first

    if configdict.defaults()["remove_all_pics_first"].startswith("true"):
        deleteAll.deleteAllPics()
        os._exit(1)  ## STOP HERE after deleting all media so user has chance to turn off switch before next start

    images = flickr.grabNewImages()
    # this is just double checking if everything is on Flickr what is in the history file
    # in another words it will restore history file if deleted by comparing flickr with folders
    flickr2history.reshelf(images, IMAGE_DIR, HISTORY_FILE, NUM_THREADS)

    # uploads all images that are in folders and not in history file
    flickr.upload()  # uploads all new images to flickr