resYTfromCLI.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/bash
  2. mkdir -p ~/.config/ytprofiles/
  3. touch ~/.config/ytprofiles/config
  4. setup() {
  5. read -p "Did you already setuped profiles for mpv?(Yes/No): " profile
  6. if [[ $profile == "Yes" ]]
  7. then
  8. ready=1
  9. elif [[ $profile == "yes" ]]
  10. then
  11. ready=1
  12. elif [[ $profile == "Y" ]]
  13. then
  14. ready=1
  15. elif [[ $profile == "YES" ]]
  16. then
  17. ready=1
  18. else
  19. echo Then setup them, here is link https://notabug.org/phloryglow/resYTfromCLI/src/master/Profiles.conf
  20. fi
  21. if [[ $ready == "1" ]]
  22. then
  23. echo "Fine, this script will never ask you again" && echo "profile=ok" >> ~/.config/ytprofiles/config
  24. fi
  25. }
  26. if [[ $(grep 'profile' ~/.config/ytprofiles/config ) == "profile=ok" ]]
  27. then
  28. echo 1 >> /dev/null
  29. else
  30. echo "Created some files"
  31. setup
  32. fi
  33. if [[ $1 == "360" ]]
  34. then
  35. mpv --profile="360p" $2
  36. elif [[ $1 == "480" ]]
  37. then
  38. mpv --profile="480p" $2
  39. elif [[ $1 == "720" ]]
  40. then
  41. mpv --profile="720p" $2
  42. elif [[ $1 == "1080" ]]
  43. then
  44. mpv --profile="1080p" $2
  45. elif [[ $1 == "360p" ]]
  46. then
  47. mpv --profile="360p" $2
  48. elif [[ $1 == "480p" ]]
  49. then
  50. mpv --profile="480p" $2
  51. elif [[ $1 == "720p" ]]
  52. then
  53. mpv --profile="720p" $2
  54. elif [[ $1 == "1080p" ]]
  55. then
  56. mpv --profile="720p" $2
  57. else
  58. echo Something wrong
  59. fi