My build of nnn with minor changes
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

moclyrics 1.1 KiB

il y a 5 ans
il y a 5 ans
il y a 4 ans
il y a 5 ans
123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env sh
  2. # Description: Fetches the lyrics of the track currently playing in MOC
  3. # Requires ddgr (https://github.com/jarun/ddgr)
  4. #
  5. # Shell: POSIX compliant
  6. # Author: Arun Prakash Jana
  7. # Check if MOC server is running
  8. cmd=$(pgrep -x mocp 2>/dev/null)
  9. ret=$cmd
  10. if [ -z "$ret" ]; then
  11. exit
  12. fi
  13. # Grab the output
  14. out="$(mocp -i)"
  15. # Check if anything is playing
  16. state=$(echo "$out" | grep "State:" | cut -d' ' -f2)
  17. if ! [ "$state" = 'PLAY' ]; then
  18. exit
  19. fi
  20. # Try by Artist and Song Title first
  21. ARTIST="$(echo "$out" | grep 'Artist:' | cut -d':' -f2 | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')"
  22. TITLE="$(echo "$out" | grep 'SongTitle:' | cut -d':' -f2 | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')"
  23. if ! [ -z "$ARTIST" ] && ! [ -z "$TITLE" ]; then
  24. ddgr -w azlyrics.com --ducky "$ARTIST" "$TITLE"
  25. else
  26. # Try by file name
  27. FILENAME="$(basename "$(echo "$out" | grep 'File:' | cut -d':' -f2)")"
  28. FILENAME="$(echo "${FILENAME%%.*}" | tr -d -)"
  29. if ! [ -z "$FILENAME" ]; then
  30. ddgr -w azlyrics.com --ducky "$FILENAME"
  31. fi
  32. fi