View Single Post
Posts: 262 | Thanked: 232 times | Joined on Aug 2009
#15
Originally Posted by etuoyo View Post
Ah I see. That could be the problem. How do I run a shell command?
OK, take this with a grain of salt, since I don't have an N900 yet, and can't verify what is installed by default (you never know what they'll remove to save space).

1. Open the terminal application from the applications menu.
2. It will probably by default start in your home folder. Type pwd and press enter to check. It should output "/home/user".
3. If your music- and m3u-files are in subfolder Music, run:
cd Music
Capitalization matters. You can use `ls` to list files and subfolders.
4. Run the command I gave earlier, but you MUST adapt it to what the real paths and filenames are on your systems. I used examples. The paths may not include commas, because I used them as the separator for the regular expression.


IF this is the problem, you should try to find a setting that forces your music software to save m3u's with relative paths.

If you want to make sure the paths are being modified the right way, you can use the visual editor (vi) instead of the stream editor (sed). In this case, from step 4, again remembering to not use my example paths:
4. vi old.m3u
5. :1,$s,/home/etuoyo/Documents/Music,/home/user/music,
6. Look at what happened.
7. :wq! fixed.m3u


To read more about the commands use `man command`, but I'm 90% certain that won't work due to space saving, so see what you can find online.



Edit: I decided to explain what the commands do:

cd is change directory. Changing to directory .. will go to the parent directory, ~ to the home directory, and / to the root directory.

sed is a program that will perform a substitution command on each line.

The > at the end redirects the output of sed to a file. You'll note that I specify the input file directly, but I could also do:
cat file | command1 | command2 | command3 > file

cat outputs a file to standard output, and the pipe character connects the standard input of the next command to the standard output of the previous command.

A regular expression substitution is written s/old/new/
But really you can use any separator. Because paths contain slash, I decided to use comma. If you want to use slash anyway, you can escape the slashes in the path with backslash: \/. Regular expressions can be really complex and powerful.

vi is an advanced text editor. The command :1,$s instructs it to do the substitution on every line from 1 to the last line. :wq! filename instructs it to (w)rite the changes to a new file, and (q)uit even though the old file hasn't been changed (!).

If you want to edit the text in vi, you need to press i. To get back to command mode, press escape. This is not enough to get you going, though, so read the manual.

vi is virtually guaranteed to be available, but you should use the more advanced vim when you can.

Last edited by livefreeordie; 2009-11-30 at 21:59.