"""
TODO:
  - Test timers, then GO!
  - Set up git repo with .gitignore to keep out binaries and imgur_secrets, alreadyhadem, queue
  ? Make a Tumblr/Integrate post to Tumblr
  X Make gallery available directly at http://img.whistlingfish.org/spelunky/
  X Develop custom color palettes to lay over the greyscale (e.g. cave/jungle/ice/temple/hell palettes. or less specific?)
"""

from death_extractor import youtube as yt
from death_extractor import set_interval
    
def death_as_a_service(vid_path = 'vids', post_interval=3600*2, search_interval=3600*12, dl_interval=3600*6, max_downloads=5):
  """Run periodic search/download/extract_and_upload operations"""
  #print "Fetching new videos and consolidating queue..."
  #yt.populate_queue()
  #print "Downloading up to",max_downloads,"videos..."
  #yt.dl(max_downloads)
  death_extractor.extract_and_imgur(vid_path)
  
  if search_interval:
    search_timer = set_interval(search_interval, yt.populate_queue)
  if dl_interval:
    dl_timer = set_interval(dl_interval, yt.dl, max_downloads)
  if post_interval:
    post_timer = set_interval(post_interval, extract_and_imgur, vid_path)
     
if __name__ == '__main__':
  print "Running from console..."
  #death_as_a_service()
  death_as_a_service(post_interval=None, search_interval=None, dl_interval=None)

@@ -457,16 +457,62 @@
 nterval%0A
+from death_extractor import extract_and_imgur%0A
     %0Adef
@@ -704,17 +704,16 @@
 ns%22%22%22%0A  
-#
 print %22F
@@ -761,17 +761,16 @@
 e...%22%0A  
-#
 yt.popul
@@ -783,17 +783,16 @@
 eue()%0A  
-#
 print %22D
@@ -837,17 +837,16 @@
 s...%22%0A  
-#
 yt.dl(ma
@@ -864,24 +864,8 @@
 )%0A  
-death_extractor.
 extr
@@ -1229,9 +1229,8 @@
 %22%0A  
-#
 deat
@@ -1250,85 +1250,4 @@
 e()%0A
-  death_as_a_service(post_interval=None, search_interval=None, dl_interval=None)%0A

use intervals when running daas.py