Guest User

Fap Land Slideshow

a guest
Nov 8th, 2018
10,241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.92 KB | None | 0 0
  1. # Python file, to be saved in the same folder as videos
  2. # Requires mpv to be installed (https://mpv.io/installation/)
  3. # Requires mpv to be accessible from terminal/cmd (on Windows, add mpv folder to PATH :
  4. # https://stackoverflow.com/questions/44272416/how-to-add-a-folder-to-path-environment-variable-in-windows-10-with-screensho )
  5.  
  6. import os, random, time, datetime
  7.  
  8. def diceroll(currentval):
  9.     roll = random.randint(1, 6)
  10.     newval = currentval + roll
  11.     if ((currentval < 25) and (newval >= 25)):
  12.         newval = 25
  13.     if ((currentval < 50) and (newval >= 50)):
  14.         newval = 50
  15.     if ((currentval < 75) and (newval >= 75)):
  16.         newval = 75
  17.     if ((currentval < 100) and (newval >= 100)):
  18.         newval = 100
  19.        
  20.     print("Rolled a " + str(roll))
  21.     print("Position : " + str(newval))
  22.     return newval
  23.    
  24. def video(currentval):
  25.     os.system("mpv -msg-level=all=no " +str(currentval) + ".mp4")
  26.    
  27. def image():
  28.     #The Intervals folder below is relative to the starting location of this script, but you can replace it with an absolute filepath to anywhere else if you want
  29.     #eg. imageFolder = r"C:\Users\Anon\Documents\Pictures\\"
  30.     imageFolder = r"Intervals\\"
  31.     imageFile = os.listdir(imageFolder)
  32.     random_file = random.choice(imageFile)
  33.     fullImagePath = imageFolder + random_file
  34.     os.system("mpv -fs --image-display-duration=10 " + '"' + fullImagePath + '"')
  35.  
  36. def game():
  37.     print("Game start!")
  38.     pos = 1
  39.     video(pos)
  40.     print("")
  41.    
  42.     while (pos < 100):
  43.         pos = diceroll(pos)
  44.         video(pos)
  45.         if ((pos % 25) != 0):
  46.             print("10 seconds pause")
  47.             image()
  48.         else:
  49.             if pos != 100:        
  50.                 print("Checkpoint " + str(int(pos/25)))
  51.         print("")
  52.        
  53.     print("Congratulations, you've cleared the game!")
  54.  
  55. random.seed(int(datetime.datetime.now().strftime("%Y%m%d%H%M%S")))
  56. game()
Advertisement
Add Comment
Please, Sign In to add comment