plaintext
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| plaintext [2020/10/25 13:32] – ↷ Page moved from form:plaintext to plaintext rjt | plaintext [2024/03/02 18:03] (current) – Added some commands I use to work with playlists rjt | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Plaintext ====== | ====== Plaintext ====== | ||
| + | |||
| + | ===== My Use ===== | ||
| + | |||
| + | I mostly use [[mpd]] for playing digital music. This means the playlists are in a plaintext format (m3u), which I find really handy as I can easily modify them. Some examples: | ||
| + | |||
| + | Search playlists for a term, for example a song or artist name. | ||
| + | |||
| + | <code bash> | ||
| + | |||
| + | Replace term in playlists. For example if I move a directory or change a filename. You have to escape more non alphanumeric characters with a '' | ||
| + | |||
| + | <code bash>sed -i ' | ||
| + | |||
| + | I have a convoluted [[bash]] script to convert the paths in playlists formatted to work with [[mpd]] to ones that will works with, say, [[vlc]]. But hey, I learnt how to add arguments and do if/then statements in Bash so I'm very happy it works. (still have to add logging and show diff options) | ||
| + | |||
| + | <code bash> | ||
| + | #!/bin/bash | ||
| + | # Converts .M3U playlists generated in MPD into | ||
| + | # ones usable outside MPD—in VLC, for example—by | ||
| + | # | ||
| + | |||
| + | # options: | ||
| + | # | ||
| + | # By default it will convert all .M3U files in mpd directory | ||
| + | # | ||
| + | # | ||
| + | |||
| + | dir=true | ||
| + | abs=false | ||
| + | rel=false | ||
| + | |||
| + | while getopts :f:ard flag | ||
| + | do | ||
| + | case $flag in | ||
| + | f) | ||
| + | file=${OPTARG} | ||
| + | dir=false | ||
| + | ;; | ||
| + | a) | ||
| + | abs=true | ||
| + | ;; | ||
| + | r) | ||
| + | rel=true | ||
| + | ;; | ||
| + | esac | ||
| + | done | ||
| + | |||
| + | if [ " | ||
| + | then | ||
| + | if [ " | ||
| + | then | ||
| + | for pl in / | ||
| + | do | ||
| + | sed -e " | ||
| + | done | ||
| + | echo " | ||
| + | elif [ " | ||
| + | then | ||
| + | for pl in / | ||
| + | do | ||
| + | sed -e " | ||
| + | done | ||
| + | echo " | ||
| + | elif [ " | ||
| + | then | ||
| + | for pl in / | ||
| + | do | ||
| + | sed -e " | ||
| + | sed -e " | ||
| + | done | ||
| + | echo " | ||
| + | fi | ||
| + | elif [ " | ||
| + | then | ||
| + | if [ " | ||
| + | then | ||
| + | sed -e " | ||
| + | echo " | ||
| + | elif [ " | ||
| + | then | ||
| + | sed -e " | ||
| + | echo " | ||
| + | elif [ " | ||
| + | then | ||
| + | sed -e " | ||
| + | sed -e " | ||
| + | echo " | ||
| + | fi | ||
| + | fi | ||
| + | </ | ||
| ===== Metaforms ===== | ===== Metaforms ===== | ||
| Line 8: | Line 98: | ||
| ===== See Also ===== | ===== See Also ===== | ||
| + | |||
| + | {{tag> | ||
plaintext.1603593165.txt.gz · Last modified: 2020/10/25 13:32 by rjt
