justlinux.com
Mon, 13-Feb-2012 12:39:27 GMT

Forum: Registered Users: 75964, Online: 360
nhfs Here you can view your subscribed threads, work with private messages and edit your profile and preferences Registration is free! Calendar Find other members Frequently Asked Questions Search Home Home

Help File Library: Getting Your Diamond Rio to Work in Linux (For Lazy People)


Written By TheFly

I am a lazy person. I'll admit it. So, after one week of Linux experience, I decided that I wanted to use my Diamond RIO in Linux but didn't want to have to deal with the command line. Remember, this is only one way of doing this and if you can think of a better way, by all means, do it.

The Open Source Support for the Rio utility is fantastic and works remarkably well. But coming from pure GUI environment, I wanted to be able to automate the process of uploading, formatting, listing, etc. Until there is an X interface, I decided to do this through the use of links. Many thanks to Alex at http://www.mandrakeexpert.com.

The first thing you need to do it install the utility, which you can find steps for doing here. As Salmon suggested, I have moved the Rio utility. However, to keep things tidy, I put it in /usr/local/bin/Rio. You don't have to do the same, but adjust your file structure according to your setup. I also created a sub-folder which I called playlist. I'll explain that one in a moment.

For those of you familiar with Windows, you should understand the concept of batch files. A batch file is essentially a text file that contains command-line commands; one per line. When executed, the batch file goes, line-by-line, down the file executing each individual command. This is sort of what we're going to do.

Reading or Deleting the Contents of the Rio

Step 1: Creating The Batch Files
Rather than open a console window, CD'ing to the proper directory, and then typing ./rio -d every time I wanted to see what was on my Rio, I first created a batch file that would call all of the commands for me. I'm doing this in KDE, but you should be able to so something similar in any X client. Use KEdit, or any text editor, to create a new text file. We're going to call it rioread. This is what it should look like:

///////////////////////////////
cd /usr/local/bin/Rio #This takes you into the working directory.
./rio -d #This calls the RIO utility and tells it to read the memory.
echo Okay, I am done! #This is just cute. It tells you it's done :)
bash #This opens the shell back up and keeps the window open.
///////////////////////////////

Save rioread to /usr/local/bin/Rio

Now we have to chmod the file so it can be executed. Simply type: 

chmod u+x rioread

Step 2: Creating the Link (icon or KDE menu)
You can create either a folder with icons in it on your desktop, or within the KDE menu. Either way, you want to create a new application. 

Right-click on your KDE desktop and choose 'NEW'. Click on 'APPLICATION'. For this one, we'll call it Read Internal. (You may want to set the permissions if you're setting up the icons in the KDE menu.) Click on the 'EXECUTE' tab and enter the path as /usr/local/bin/Rio/rioread. Make sure to check the 'Run in terminal" option. Click 'OK'.

You should now have an icon. Click on it. Oh, wait. Make sure your Rio player is connected to your computer. Good. Now, click on it.

A console window should open up and list the contents of your Rio. It should then say "Okay, I am done!" You'll then have a prompt at the bottom. Good.

You'll notice that you only see the contents of the internal memory of your Rio. If you have expanded external memory, you'll have to add another variable to your batch file. Make your batch file look like this:

///////////////////////////////
cd /usr/local/bin/Rio #This takes you into the working directory.
./rio -x -d #This calls the RIO utility and tells it to read the external memory.
echo Okay, I am done! #This is just cute. It tells you it's done :)
bash #This opens the shell back up and keeps the window open.
///////////////////////////////

Let's save this one in /usr/local/bin/Rio as well and call it rioreadexternal. Now we have another file that will read the external directory. Create an icon for it just like we did in step two above.

Other Options:
You can also create batch file that will delete all the files in the memory by changing the flag on the second line of the file. Remember that if you want to affect the expansion memory, you need to include '-x' before any other flag. Examples:

Delete all songs on internal memory - ./rio -za
Delete all songs on external memory - ./rio -x -za

Uploading Your MP3's to your Rio (This gets a little tricky)

Uploading songs to your Rio using the command line utility can get really tedious. Normally, to upload six songs, you would have to enter the commands like this:

./rio -u songone.mp3 songtwo.mp3 song three.mp3 songfour.mp3 songfive.mp3 songsix.mp3

Get the idea? Luckily, the programmers included the variable -f, which allows you to write a text file with the songs you want to upload. But you would still have to write out a text file with the names of all the songs. It doesn't save you that much work.

Remember that /usr/local/bin/Rio/playlist directory we created? Put another copy of the rio utility in that folder as well. (Copy. Don't Move) We're going to play with a Linux concept known as pipes. Pipes will allow you to take the output of a console command and pipe it into a text file. Let's take those six songs again. Assume they're in the playlist directory. From that directory, do a ls command.:

ls /usr/local/bin/Rio/playlist
songone.mp3 songtwo.mp3 songthree.mp3 songfour.mp3 songfive.mp3 songsix.mp3

If we use the pipe and take that output and write it to a text file, it would save us a whole lot of typing. Let's try it:

ls /usr/local/bin/Rio/playlist >/usr/local/bin/Rio/playlist/playlistfile

You should now have a text file in your playlist directory. It should look like this

///////////////////////////////
playlistfile
rio
songone.mp3
songtwo.mp3
songthree.mp3
songfour.mp3
songfive.mp3
songsix.mp3
///////////////////////////////

Does it? Good. Now all we have to do is use the -f command to tell the rio utility to reference the playlistfile and upload those songs to the Rio:

./rio -f playlistfile

But did you notice that rio and playlistfile are on the list? That means they're going to get uploaded to the Rio. But since they're not MP3 files, that's not good! So we add two more lines to the script that will then delete them. They're small anyway.

./rio -z rio
./rio -z playlistfile

So the whole darn thing should look something like this:

/////////////////////////////// cd /usr/local/bin/Rio #This takes you into the working directory.
ls /usr/local/bin/Rio/playlist >/usr/local/bin/Rio/playlist/playlistfile #Uses pipe to create the playlistfile text file. 
./rio -f playlistfile #Tells the Rio utility what files to upload.
./rio -z rio #This cleans up the rio and playlistfile files.
./rio -z playlistfile # Ditto
echo Okay, I am done! #This is just cute. It tells you it's done :)
bash # This opens the shell back up.
///////////////////////////////

Save this file as uploadplaylist. Then create an icon or alias for this just like we did with the reading or deleting scripts. There. We just saved ourselves lots of typing. Now all you have to do is move the files that you want on your Rio into that directory, run that script using the icon and you're all set!

Check out the actual Readme for all the different kinds of variables and flags you can use. The basic premise should work for any of the commands, if you can figure out how to structure the scripts.

Of course, I make no guarantee that this will work. YMMV! :)