Skip to content

Instantly share code, notes, and snippets.

@Mahrjose
Created February 13, 2022 11:54
Show Gist options
  • Save Mahrjose/e909ecac7ddbd455a209889e41366322 to your computer and use it in GitHub Desktop.
Save Mahrjose/e909ecac7ddbd455a209889e41366322 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
import os
import random
import time
def main():
while True:
choice = input(
"What do you want to Watch?\n1. Anime\t2.Movies\t3.TV Series\t4. Random\nAns: "
).upper()
if choice in ("4", "RANDOM"):
choice = str(random.randrange(1, 4))
if choice in ("1", "ANIME"):
path = "/home/mahrjose/Videos/Anime"
restricted_folders = ("1. エロアニメ (へんたい)", "2. Collections","3. Plan To Watch")
choosen_anime = random.choice(
[
anime
for anime in os.listdir(path)
if anime not in restricted_folders and not anime.startswith(".")
]
)
time.sleep(1)
print(f'\n[ANIME] You could watch "{choosen_anime}"\n')
break
elif choice in ("2", "MOVIES", "MOVIE"):
path = "/home/mahrjose/Videos/Movies"
restricted_folders = ()
choosen_movie = random.choice(
[
movie
for movie in os.listdir(path)
if movie not in restricted_folders and not movie.startswith(".")
]
)
if choosen_movie == "1. Animation":
choosen_movie = random.choice(
[
movie
for movie in os.listdir(f"{path}/1. Animation")
if movie not in restricted_folders and not movie.startswith(".")
]
)
time.sleep(1)
print(f'\n[MOVIE] You could watch "{choosen_movie}"\n')
break
elif choice in ("3", "TV-SERIES", "TV", "SERIES"):
path = "/home/mahrjose/Videos/TV-Series"
restricted_folders = ()
choosen_series = random.choice(
[
series
for series in os.listdir(path)
if series not in restricted_folders and not series.startswith(".")
]
)
time.sleep(1)
print(f'\n[SERIES] You could watch "{choosen_series}"\n')
break
else:
print("\nWrong Input! Please try Again.\n")
continue
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment