Advertisement
Guest User

Fancy unfinished script for random gifs

a guest
Jun 15th, 2013
717
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. import random
  2. import commands
  3. import platform
  4. import sys
  5. # DEFS      #
  6. def pickgif():
  7.     ls = "%s slashbslash%sgifs%s" % (lscmd,seperator,seperator)
  8.     print "doing %s" % ls
  9.     ls = commands.getoutput(ls)
  10.     items = ls.split("\n")
  11.     gifs = {}
  12.     i = 1
  13.     for item in items:
  14.         gifs[i] = item     
  15.         i = i + 1
  16.     r = random.randrange(1,i,1)
  17.     output = gifs[r]
  18.     return output
  19. # ENDDEFS
  20. os = False
  21. osversion = platform.system()
  22. if osversion == "Darwin":
  23.     lscmd = "ls"
  24.     seperator = "/"
  25.     opcmd = "open "
  26.     os = True
  27. if osversion == "Windows":
  28.     lscmd = "dir"
  29.     seperator = "\\"
  30.     opcmd = ""
  31.     os = True
  32. if os == True:
  33.     gif = pickgif()
  34. if os == False:
  35.     print "unsupported OS, Exitting"
  36.     sys.exit()
  37.  
  38. command = "%s\"slashbslash%sgifs%s%s\"" % (opcmd,seperator,seperator,gif)
  39.  
  40. print command
  41.  
  42. commands.getoutput(command)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement