Created
September 25, 2011 21:48
-
-
Save xeBuz/1241210 to your computer and use it in GitHub Desktop.
Random caps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2.7 | |
# -*- coding: utf-8 -*- | |
import os | |
import sys | |
import random | |
### | |
# To Do | |
# - Agregar por Temporada. | |
# - Que se apague la PC una vez terminado. | |
### | |
# Aca guarda los caps | |
caps = [] | |
# App para ver videos | |
command = 'smplayer -fullscreen -close-at-end ' | |
# En caso de no pasarle parametros, pone una cantidad por defecto | |
if len(sys.argv) >= 2: | |
cant = int(sys.argv[1]) | |
else: | |
cant = 5 | |
# Carga una lista con todos los episodios | |
for root, dirs, files in os.walk('/home/xebuz/Simpsons'): | |
for name in files: | |
if name.endswith('.avi'): | |
filename = os.path.join(root, name) | |
caps.append('"'+filename+'"') | |
# Toma X al azar, donde X es 5 por defecto o el parametro que se le pase | |
for i in range(cant): | |
command = command + ' ' + random.choice(caps) | |
os.system(command) | |
#print command |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment