Advertisement
Guest User

gnu/linux cards for dummies

a guest
Apr 26th, 2020
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.42 KB | None | 0 0
  1. required software:
  2. https://wiki.archlinux.org/index.php/Xbindkeys
  3. https://wiki.archlinux.org/index.php/FFmpeg
  4. https://wiki.archlinux.org/index.php/PulseAudio
  5. https://wiki.archlinux.org/index.php/Screen_capture#maim
  6. https://github.com/astrand/xclip - can probably be installed with package manager on any major distro2
  7. *maybe something else i dont remember, probably not
  8.  
  9. recording audio:
  10. after installing ffmpeg and pulseaudio you open cml and type pacmd list-sinks | grep -e 'name:' -e 'index:' then choose which index is your soundcard (if you have more than one output source). in my case i only have my soundcard with index 0 as a default output source so i choose that. remember that number and open a text editor of your choice and create a bash script. paste this into it and save quit
  11.  
  12. #!/bin/bash
  13. #Script for checking if ffmpeg is running and either starting the recording or terminating it.
  14. SERVICE='ffmpeg'
  15.  
  16. if ps ax | grep -v grep | grep ${SERVICE} > /dev/null
  17. then
  18. pkill ${SERVICE}
  19. else
  20. timestamp=$(date +%s)
  21. echo -n "[sound:${timestamp}.mp3]" |xclip -sel cli
  22. ffmpeg -f pulse -i YOUROUTPUTSOURCEINDEX -map '0' ~/.local/share/Anki2/'User 1'/collection.media/${timestamp}.mp3
  23. fi
  24.  
  25. what does this script do? it checks if ffmpeg is running. if it is, it terminates it. if it doesn't, it creates a UNIX timestamp that's copied to your clipboard and starts recording sound to your anki media folder (make sure that your media folder is placed there, and change accordingly). also remember to switch YOUROUTPUTSOURCEINDEX for the index you've previously determined with pacmd command. after recording you simply paste the contents of your clipboard to desired field in anki.
  26.  
  27. screenshots:
  28. install maim and u can invoke screencapture of region of screen of ur choosing and copying to clipboard with maim -s | xclip -selection clipboard -t image/png in the cml
  29.  
  30. key shortcuts:
  31. if u want key shortcuts read the page on Xbindkeys and configure it accordingly, dunno what ur distro might be using to init the DE/WM so that's on u. just read the arch wiki on xbindkeys linked above and u should be fine probably it explains everything very well. below are the contents of my ~/.xbindkeysrc file
  32.  
  33. #record audio for anime cards with recordingsound.sh script
  34. "bash ~/bin/recordingsound.sh"
  35. Control + slash
  36.  
  37. #screenshot an area and copy to clipboard
  38. "maim -s | xclip -selection clipboard -t image/png"
  39. Control + period
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement