Uploaded using Google CoLaboratory.

This commit is contained in:
Hansly Saw 2022-05-03 17:57:39 +08:00
parent 2f23e4340c
commit 9e88053c37
1 changed files with 13 additions and 12 deletions

View File

@ -16,8 +16,8 @@
"cell_type": "code",
"execution_count": null,
"metadata": {
"cellView": "form",
"id": "NKYqnAEwCPYG"
"id": "NKYqnAEwCPYG",
"cellView": "form"
},
"outputs": [],
"source": [
@ -25,13 +25,12 @@
"# Watch k-pop music videos in an ASCII format. \n",
"\n",
"import os; import subprocess\n",
"from google.colab import files; from google.colab import output\n",
"from IPython.display import Audio\n",
"\n",
"# selections\n",
"class selection: \n",
" artist = \"Twice\" #@param [\"Twice\"]\n",
" video = \"MORE & MORE\" #@param {type:\"string\"}\n",
" video = \"\" #@param {type:\"string\"}\n",
" video = (video.strip()).lower()\n",
" videoURL = ''\n",
"\n",
@ -64,6 +63,12 @@
" def success(message):\n",
" print(formatting.font.bold + formatting.color.green + 'Success: \\t' + formatting.clear + formatting.clear + message)\n",
"\n",
"try: \n",
" from google.colab import files; from google.colab import output\n",
"except: \n",
" info.err(formatting.font.bold + 'Google CoLab is required to run this.' + formatting.clear + ' This requires components only available in Google CoLab servers.')\n",
" os.kill(os.getpid(), 1)\n",
"\n",
"# Install apt programs and python modules. \n",
"def get_dependencies(): \n",
" import subprocess\n",
@ -129,7 +134,7 @@
" selection.videoURL = musicvideos[selection.artist][selection.video]\n",
" \n",
" except:\n",
" info.err(formatting.font.bold + 'The video that you are looking for does not exist. ' + formatting.clear + 'Make sure you have typed it properly. If you did, you can safely assume that this script is not updated. ')\n",
" info.err(formatting.font.bold + 'The video that you are looking for does not exist. ' + formatting.clear + 'Make sure you have typed it properly. If you did, it was not possibly included. Check out the GitHub discussions for that.')\n",
" os.kill(os.getpid(), 1)\n",
" \n",
" def start_download():\n",
@ -166,7 +171,7 @@
" def process():\n",
" info.status('Processing the video. This will take some while.')\n",
" !video-to-ascii -f video.mp4 -o output.sh --strategy {configs.method}\n",
" \n",
"\n",
" def check_success():\n",
" if check_file_exists():\n",
" output.clear()\n",
@ -185,9 +190,7 @@
" try:\n",
" files.download('output.sh')\n",
" except:\n",
" info.err('The file could not be downloaded, but it is available for manual downloading at the files view in the sidebar.')\n",
" else:\n",
" info.success('The file was succesfully downloaded.')\n",
" info.err('The file could not be downloaded automatically, but it is available for at the files view in the sidebar.')\n",
"\n",
"def main():\n",
" get_dependencies()\n",
@ -202,9 +205,7 @@
"metadata": {
"accelerator": "GPU",
"colab": {
"authorship_tag": "ABX9TyOKzpUDluOXYqmRr/JITg5H",
"collapsed_sections": [],
"include_colab_link": true,
"name": "Kpop'minal.ipynb",
"private_outputs": true,
"provenance": []
@ -219,4 +220,4 @@
},
"nbformat": 4,
"nbformat_minor": 0
}
}