🏗 Added Windows support

This commit is contained in:
2021-04-11 02:37:39 +03:00
parent b27ce5ed56
commit 93a37a8cbd
2 changed files with 27 additions and 12 deletions

20
main.py
View File

@@ -1,14 +1,19 @@
from rich.console import Console from rich.console import Console
#from rich import inspect #from rich import inspect
import platform
from pathlib import Path from pathlib import Path
import os import os
import json import json
import argparse import argparse
from getch import getch
import youtube_dl import youtube_dl
from get_channels import retrieve_youtube_subscriptions from get_channels import retrieve_youtube_subscriptions
from print_logo import print_logo from print_logo import print_logo
if platform.system() == 'Windows':
import msvcrt
else:
from getch import getch
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
parser.add_argument('-i', '--input', action='store', type=str, parser.add_argument('-i', '--input', action='store', type=str,
help='Path to json file generated by previously running this program.') help='Path to json file generated by previously running this program.')
@@ -45,6 +50,17 @@ else:
curr_channel += 1 curr_channel += 1
c.print(f'[dim][{curr_channel}/{len(all_channels)}]:[/dim] {ch["title"]} [cyan]\[y/n]') c.print(f'[dim][{curr_channel}/{len(all_channels)}]:[/dim] {ch["title"]} [cyan]\[y/n]')
while True: while True:
if platform.system() == 'Windows':
key = str(msvcrt.getch())
if key == "b'y'":
ch['download'] = True
break
elif key == "b'n'":
ch['download'] = False
break
else:
c.print('Press "y" or "n"', style='yellow')
else:
key = getch() key = getch()
if key == "y": if key == "y":
ch['download'] = True ch['download'] = True
@@ -53,7 +69,7 @@ else:
ch['download'] = False ch['download'] = False
break break
else: else:
c.print('Press "y" or "n"', style='orange') c.print('Press "y" or "n"', style='yellow')
c.print('All done! 🎉') c.print('All done! 🎉')
c.print('Saving to download_list.json...', style='italic') c.print('Saving to download_list.json...', style='italic')

View File

@@ -8,5 +8,4 @@ __ ______ __ __________ ______ ______ __________ __
\ / / / / / / / / / / / / / __ / __/______/ / / / / / / \ / / / / / / / / / / / / / __ / __/______/ / / / / / /
/ / /_/ / /_/ / / / / /_/ / /_/ / /__/_____/ /___/ /_/ / /___ / / /_/ / /_/ / / / / /_/ / /_/ / /__/_____/ /___/ /_/ / /___
/_/\____/\____/ /_/ \____/_____/_____/ \____/_____/_____/ /_/\____/\____/ /_/ \____/_____/_____/ \____/_____/_____/
""", style='magenta') """, style='magenta')