Adjusted error messages.

This commit is contained in:
Hansly Saw 2022-04-30 17:00:47 +08:00 committed by GitHub
parent b7046507e2
commit 641f8eceb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 44 deletions

View File

@ -1,63 +1,31 @@
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Kpop'minal.ipynb",
"provenance": [],
"collapsed_sections": [],
"private_outputs": true,
"authorship_tag": "ABX9TyOKzpUDluOXYqmRr/JITg5H",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
},
"accelerator": "GPU"
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
"id": "TK6pOEjtZCFB"
},
"source": [
"<a href=\"https://colab.research.google.com/github/buzz-lightsnack-2007/Kpopminal/blob/main/Kpop'minal.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"source": [
"# Kpop'minal\n",
"Watch k-pop music videos in an ASCII format. \n",
"\n",
"_Uses [`video-to-ascii` by joelibaceta](https://github.com/joelibaceta/video-to-ascii)_. "
],
"metadata": {
"id": "TK6pOEjtZCFB"
}
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "NKYqnAEwCPYG",
"cellView": "form"
"cellView": "form",
"id": "NKYqnAEwCPYG"
},
"outputs": [],
"source": [
"# KPOP'MINAL\n",
"# Watch k-pop music videos in an ASCII format. \n",
"\n",
"import os\n",
"import subprocess\n",
"from google.colab import files\n",
"from google.colab import output\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",
@ -161,7 +129,7 @@
" selection.videoURL = musicvideos[selection.artist][selection.video]\n",
" \n",
" except:\n",
" info.err('The video that you are looking for does not exist. 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, you can safely assume that this script is not updated. ')\n",
" os.kill(os.getpid(), 1)\n",
" \n",
" def start_download():\n",
@ -177,7 +145,7 @@
" info.status('Downloading the music video…')\n",
"\n",
" if os.system('curl ' + selection.videoURL + ' -o video.mp4') > 0:\n",
" info.err('The download has failed, please re-run this script again. '); os.system('rm -rf video.mp4 -v')\n",
" info.err(formatting.font.bold + 'The download has failed, ' + formatting.clear + 'please re-run this script again. Kindly check the log for more details.'); os.system('rm -rf video.mp4 -v')\n",
" if check_exists(\"old\"): os.system('mv video.old.mp4 video.mp4 -v')\n",
" os.kill(os.getpid(), 1)\n",
" else:\n",
@ -205,7 +173,7 @@
" info.success('The music video has been successfully processed. ')\n",
" else:\n",
" if check_file_exists(\"old\"): os.system('mv output.old.sh output.sh -v')\n",
" info.err('Unfortunately, an error may have ocurred during processing, and we apologize for the inconvenience. Kindly check the log for full details.')\n",
" info.err('Unfortunately, an error may have ocurred during processing. Kindly check the log for full details.')\n",
" os.kill(os.getpid(), 1)\n",
"\n",
" attemptReplace()\n",
@ -221,7 +189,6 @@
" else:\n",
" info.success('The file was succesfully downloaded.')\n",
"\n",
"\n",
"def main():\n",
" get_dependencies()\n",
" download_video()\n",
@ -231,5 +198,25 @@
"main()"
]
}
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"authorship_tag": "ABX9TyOKzpUDluOXYqmRr/JITg5H",
"collapsed_sections": [],
"include_colab_link": true,
"name": "Kpop'minal.ipynb",
"private_outputs": true,
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 0
}