#!/usr/bin/python """ !/home/yo/.virtualenvs/sacrebleu/bin/python """ from sacrecommon import post_video, post_to_wall from moviecommon import push_video, render_video from cloudsmovement import last_hour_plot from sunsetplotter import brightness_plot import time import os # Find newest dir (hopefuly with photos) dirs = [f for f in os.listdir(os.getcwd()) if os.path.isdir(f)] newest = max(dirs, key = os.path.getmtime) # Upload to Youtube render_video(newest) video_id = push_video(newest) # Publish with current date as a message message = '_' + time.strftime('%d %B %Y, %H:%M') post_video(video_id, message) # Movement detection whole day plot plotname = last_hour_plot(newest, hour_only = False) post_to_wall(plotname, ' ') os.remove(plotname) # Brightness plot suntrace = brightness_plot(newest) post_to_wall(suntrace, ' ') os.remove(suntrace)
msg = 'tania przestrzen reklamowa' # FIXME - post every 20 minutes only, this should be prettier clock = picname[12:18] struct = time.strptime(clock, '%H%M%S') # Post periodically if (struct.tm_min==20 and struct.tm_hour%3==1): print 'dupa' api = get_api() post_to_album(picname, msg) # Post plot with recent movement detection if (struct.tm_min%30==2 and random() < 0.05): plotname = last_hour_plot(dirname) post_to_wall(plotname, ' ') os.remove(plotname) # Make pretty histograms of popular colors if (random() < 0.004 and struct.tm_min%40==13): picpath = dirname + '/' + picname plotname = make_histogram(picpath) post_to_wall(plotname, ' ') os.remove(plotname) # Post plot with sunrise rgb if (struct.tm_hour == 7 and struct.tm_min == 33): plotname = rgb_plot(dirname) post_to_wall(plotname, 'wschod') os.remove(plotname)