Automated music library format conversion with cuesheet detection, tagging support and configurable regex to obtain tags from filenames. Configuration with ini-files to support multiple locations with multiple quality requirements.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.8 KiB

  1. # -*- coding: utf-8 -*-
  2. """
  3. Name: str_utils.py (module)
  4. Porpose: module for cosmetic output console in ANSI sequences
  5. Writer: Gianluca Pernigoto <jeanlucperni@gmail.com>
  6. Copyright: (c) 2022 Gianluca Pernigoto <jeanlucperni@gmail.com>
  7. license: GPL3
  8. Rev: Jan 10 2022
  9. Code checker: flake8, pylint
  10. """
  11. def msgdebug(head='', info=None, warn=None, err=None, tail=''):
  12. """
  13. Print debug messages:
  14. ``head`` can be used for additionals custom string to use
  15. at the beginning of the string.
  16. ``tail`` can be used for additionals custom string to use
  17. at the end of the string.
  18. ``info`` print in blue color, ``warn`` print in yellow color
  19. ``err`` print in red color.
  20. """
  21. if info:
  22. print(f"{head}\033[32;1mINFO:\033[0m {info}{tail}")
  23. elif warn:
  24. print(f"{head}\033[33;1mWARNING:\033[0m {warn}{tail}")
  25. elif err:
  26. print(f"{head}\033[31;1mERROR:\033[0m {err}{tail}")
  27. def msgcolor(head='', orange=None, green=None, azure=None, tail=''):
  28. """
  29. Print information messages by explicitly
  30. choosing the name of the color to be displayed:
  31. ``head`` can be used for additionals custom string to use
  32. at the beginning of the string.
  33. ``tail`` can be used for additionals custom string to use
  34. at the end of the string.
  35. """
  36. if orange:
  37. print(f"{head}\033[33;1m{orange}\033[0m{tail}")
  38. elif green:
  39. print(f"{head}\033[32;1m{green}\033[0m{tail}")
  40. elif azure:
  41. print(f"{head}\033[34;1m{azure}\033[0m{tail}")
  42. def msgend(done=None, abort=None):
  43. """
  44. Print status messages at the end of the tasks
  45. """
  46. if done:
  47. print("\033[1m..Finished!\033[0m\n")
  48. elif abort:
  49. print("\033[1m..Abort!\033[0m\n")
  50. def msg(message):
  51. """
  52. Print any string messages
  53. """
  54. print(message)