Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import commands
- import platform
- import sys
- # DEFS #
- def pickgif():
- ls = "%s slashbslash%sgifs%s" % (lscmd,seperator,seperator)
- print "doing %s" % ls
- ls = commands.getoutput(ls)
- items = ls.split("\n")
- gifs = {}
- i = 1
- for item in items:
- gifs[i] = item
- i = i + 1
- r = random.randrange(1,i,1)
- output = gifs[r]
- return output
- # ENDDEFS
- os = False
- osversion = platform.system()
- if osversion == "Darwin":
- lscmd = "ls"
- seperator = "/"
- opcmd = "open "
- os = True
- if osversion == "Windows":
- lscmd = "dir"
- seperator = "\\"
- opcmd = ""
- os = True
- if os == True:
- gif = pickgif()
- if os == False:
- print "unsupported OS, Exitting"
- sys.exit()
- command = "%s\"slashbslash%sgifs%s%s\"" % (opcmd,seperator,seperator,gif)
- print command
- commands.getoutput(command)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement