def main():
    print_info()
    
    wp = WallpaperPicker()
    
    while True:
        # if you modify the config file, this script doesn't have to be restarted
        reload(cfg)
        cfg.self_verify()
        
        wp.collect_images()
        
        nb_images = wp.get_nb_images()
        
        if nb_images == 0:
            # there are no images in the directory => do nothing
            pass
        
        if nb_images == 1:
            # there is only one image => easy choice
            wallpaper = wp.get_first_image()
            
        if nb_images > 1:
            # there are several images => choose a different image than the previous pick
            wallpaper = wp.get_random_image()
            gnome.set_wallpaper_image(wallpaper)
            
        try:
            sleep(float(cfg.DURATION))
        except KeyboardInterrupt:
            sys.exit()
def main():
    """Control block."""
    cfg.self_verify()
    directories.check_base_dir()
    db.init()
    
    save_choice = cfg.CURRENT_CHOICE
    
    for site_key in cfg.MULTIPLE_CHOICE:
        get_images_from_site(site_key)
        
    cfg.set_current_choice(save_choice)
    
    print "#"
    print "# total number of resized images: {cnt}".format(cnt=cnt_resized_images)
def main():
    """Control block."""
    cfg.self_verify()
    directories.check_base_dir()
    db.init()

    save_choice = cfg.CURRENT_CHOICE

    for site_key in cfg.MULTIPLE_CHOICE:
        get_images_from_site(site_key)

    cfg.set_current_choice(save_choice)

    print "#"
    print "# total number of resized images: {cnt}".format(
        cnt=cnt_resized_images)
def main():
    """Control block."""
    cfg.self_verify()
    directories.check_base_dir()
    db.init()

    while  True:
        save_choice = cfg.CURRENT_CHOICE

        for site_key in cfg.MULTIPLE_CHOICE:
            get_images_from_site(site_key)

        cfg.set_current_choice(save_choice)

        print "#"
        print "# total number of resized images: {cnt}".format(cnt=cnt_resized_images)
        try:
            sleep(float(60*60*6)) #every 6 hours
        except KeyboardInterrupt:
            sys.exit()
def main():
    print_info()

    wp = WallpaperPicker()

    while True:
        # if you modify the config file, this script doesn't have to be restarted
        reload(cfg)
        cfg.self_verify()

        # The list of images is re-read in each iteration because Wallpaper Downloader
        # is supposed to work parallelly. Thus, newly downloaded images will have a
        # chance to appear on the desktop.
        wp.collect_images()

        nb_images = wp.get_nb_images()

        if nb_images == 0:
            # there are no images in the directory => do nothing
            pass

        if nb_images == 1:
            # there is only one image => easy choice
            wallpaper = wp.get_first_image()

        if nb_images > 1:
            # there are several images => choose a different image than the previous pick
            wallpaper = wp.get_random_image()
            gnome.set_wallpaper_image(wallpaper)

        wp.free_memory()

        try:
            sleep(float(cfg.DURATION))
        except KeyboardInterrupt:
            sys.exit()
def main():
    print_info()
    
    wp = WallpaperPicker()
    
    while True:
        # if you modify the config file, this script doesn't have to be restarted
        reload(cfg)
        cfg.self_verify()
        
        # The list of images is re-read in each iteration because Wallpaper Downloader
        # is supposed to work parallelly. Thus, newly downloaded images will have a 
        # chance to appear on the desktop. 
        wp.collect_images()
        
        nb_images = wp.get_nb_images()
        
        if nb_images == 0:
            # there are no images in the directory => do nothing
            pass
        
        if nb_images == 1:
            # there is only one image => easy choice
            wallpaper = wp.get_first_image()
            
        if nb_images > 1:
            # there are several images => choose a different image than the previous pick
            wallpaper = wp.get_random_image()
            gnome.set_wallpaper_image(wallpaper)
            
        wp.free_memory()
            
        try:
            sleep(float(cfg.DURATION))
        except KeyboardInterrupt:
            sys.exit()