Skip navigation.

exploreopera

| Help

Sign up | Help

Arnaud

a blog about English and art (atm)

Posts tagged with "linux"

Handling my scattered music files... the beginning

Here's the situation:

I keep my music in a /data/music folder, /data is in its own filesystem.

I encode my albums into my home directory then I mv or cp it (according to my current mood) to the final location.
For any reason, I sometimes press C-c during the mv or cp operation... I'm getting bored, you say ? :smile: Morever, I don't always encode cd's sequentially and I don't maintain any database.

Weeks or months after, I have encoded many other albums and have aborted the operation many times in many different ways. Now, I'm worried ... :o:) What is in one side but not in he other ?

For instance ... my Bach collection (I'm proud of xD):

~$ shopt -s extglob nocaseglob; ls -ld @(*bach*) | wc -l
94

The destination is /data/music/bach.

I begin with: (the working directory is my home directory)

for rep in @(*Bach*); do diff -r {$PWD,/data/music/bach}/"$rep"; done

which outputs that kind of lines:

diff: /home/arnaud/Bach,_John_Sebastian-Harpsichord_Concertos_1052-1055: No such file or directory
Only in /data/music/bach/Bach,_J.S.-II-9,_Klavierwerke_1700-1710_Teil_3,_BWV_909,832,989,821,955,820,950,992: 7.BWV_950,_Fuge_über_ein_Thema_von_Tomaso_Albinoni,_in_A_major.ogg


For the next steps of the adventure, I'll do another post, soon. :smile:

Little shell tips

Below are some bash tips without any explanation, just read the reference1 for further information.

(for mpc users but one can customize bash completion for other uses)

$ mpc help | awk '$0 !~ /Displays status/ && $0 !~ /Usage/ && $0 !~ /mpc version/ && $0 !~ /For more/  {print $2}' > mpc.words 
$ complete -W "$(cat mpc.words)" mpc
$ mpc [TAB]
add          crossfade    enable       ls           next         play         random       save         shuffle      toggle       
clear        del          listall      lsplaylists  outputs      playlist     repeat       search       stats        update       
crop         disable      load         move         pause        prev         rm           seek         stop         volume       


Many people know C-r for a incremental backwards-search through history. There are other keys combinations like M-p which allows a non-incremental search for a string.
M-p, type a string then press Return and it will fill with a match.

$ cat > hostfile
google.fr
opera.com   
jamendo.com
$ export HOSTFILE=hostfile
$ @ [TAB]
@localhost  @localhost.localdomain  @google.fr  @jamendo.com @opera.com
$ complete -W "$(cat $HOSTFILE)" ping
$ ping [TAB]
google.fr    jamendo.com  opera.com    



---
1: $ man bash

What about switching to GNU/Linux ?

A starter can be that page:

Switching to GNU/Linux
October 2008
MTWTFSS
September 2008November 2008
12345
6789101112
13141516171819
20212223242526
2728293031