Author Topic: Embedding tags when ripping CDs  (Read 12088 times)

PeteK

  • Guru
  • ****
  • Posts: 408
    • View Profile
Embedding tags when ripping CDs
« on: May 31, 2007, 08:46:05 am »
Hi-

I'd like to use LinuxMCE to rip my CDs to flac.  I tried a few, and it looks like LinuxMCE uses the ripDiskWrapper.sh script to manage the ripping and encoding of CD audio. From digging into this file, it looks like it calls cdparanoia and pipes the output directly to the chosen encoder (in my case the flac encoder).  Unfortunately, this method doesn't tag the files with artist, album information, etc. LinuxMCE obviously does access cddb to get the information to generate file names and to load the database. I would like to use that information to tag the  files as well.  This would avoid having to re-rip if I wanted to reload LinuxMCE or use the files elsewhere.

I was wondering if anyone understands and could explain the exact sequence of events in getting CD information.  I was thinking of using a tool like xmcd to get cddb information, but I would like to use the same source of information that is used for populating the database. I'll keep digging until I can understand it, but I'd appreciate any advice.
 
Thanks!

-Pete

PeteK

  • Guru
  • ****
  • Posts: 408
    • View Profile
Re: Embedding tags when ripping CDs
« Reply #1 on: June 04, 2007, 07:54:53 am »
Hey gang.  I was able to get LinuxMCE to embed Artist/Album/Track/Genre/Date information into the music files when ripping a CD.  You can now see the information on the Squeezebox when playing back ripped files from the core.  After digging around inside LinuxMCE, I've modified the shell file that performs the ripping.  I modified ripDiskWrapper.sh to include calls to abcde's cd-id utilities to identify disc information and pass it to the encoder.  I used the cddb_id.sh script in the src/CDDB_Identifier directory as a guide.  So far I've got it working for the Ogg and Flac encoders.  I hope to get it working for WAV and MP3 files shortly. 

I'd appreciate it if anyone was interested in trying it out and letting me know how it works for them.  I'm not a scripting expert by any means, so any input would be appreciated.  I don't think this is the ideal solution, as it requires another CDDB lookup in addition to the one perfomed by UpdateMedia, but it works for now while I try to understand exactly the process the Pluto gang put in place for ripping a CD.  I hope to move on to getting Pluto to work with a more modern (6.5.x) version of Slimserver next.

The following file goes in your /usr/pluto/bin directory.  Please remember to save the existing ripDiskWrapper.sh to a different name first, so you can go back if it gets screwy.

This is my first time actually contributing to Open Source Software, so I'm kind of (nerdily) excited.

Thanks everyone,
-Pete


PeteK

  • Guru
  • ****
  • Posts: 408
    • View Profile
Re: Embedding tags when ripping CDs
« Reply #2 on: June 05, 2007, 07:34:18 am »
Hmm.  After playing with ripping to .mp3, it looks like UpdateMedia is
writing .id3 tags for MP3 files. My script modifications write Title,
Artist, Album, Year, Track Number and Genre information.  UpdateMedia
writes Title, Artist, Album and Composter information, but doesn't
include Track Number or Genre information, which I think is worth
having.  I'm guessing UpdateMedia is where all tag information should
be written.  I should be able to get it to use Metaflac to edit the
tag for .flac files, and obviously UpdateMedia can edit .id3 tags, but
I don't know of a good simple ogg comment editor.  Does anyone know of
one?

Incidentally, the ripping script doesn't use the quality settings for
MP3 or Ogg rips.  I don't know if a Mantis report has been filed, but
I'm guessing it was on the Pluto guy's todo list. I recommend ripping to Flac (no options) until that gets fixed.  That way you know what you're getting.

In any case, the script should now work correctly for MP3, FLAC, and Ogg rips.  Again, paste the
included ripDiskWrapper.sh in your /pluto/bin directory.  Save your
existing copy.

Also, make sure you set the execute permissions correctly. If you
don't know what I'm talking about, after copying type chmod a+x
ripDiskWrapper.sh
Please let me know if you have any issues.

On another note, Lame wasn't installed by default, so ripping to MP3
failed outright. I'm surprised it wasn't installed by default by
LinuxMCE.  Can anyone else confirm this?

Zaerc

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 2256
  • Department of Redundancy Department.
    • View Profile
Re: Embedding tags when ripping CDs
« Reply #3 on: July 22, 2007, 05:04:57 pm »
...
On another note, Lame wasn't installed by default, so ripping to MP3
failed outright. I'm surprised it wasn't installed by default by
LinuxMCE.  Can anyone else confirm this?

I haven't tried using MP3s, but this is what's installed on my Kubuntu-7.04 + LMCE-1.1B2 machine:

zaerc@dcerouter:~$ dpkg -l | grep -i lame
ii  liblame0                                3.96.1-2ubuntu1                                                   LAME Ain't an MP3 Encoder

I hope that answers your question.  Thanks for the updated script, I was wondering why that seemed messed up a bit so I'll give it a spin.
"Change is inevitable. Progress is optional."
-- Anonymous


1audio

  • Addicted
  • *
  • Posts: 552
    • View Profile
Re: Embedding tags when ripping CDs
« Reply #4 on: July 22, 2007, 05:54:01 pm »
Where would the revised script go?

PeteK

  • Guru
  • ****
  • Posts: 408
    • View Profile
Re: Embedding tags when ripping CDs
« Reply #5 on: July 22, 2007, 06:04:04 pm »
The attached ripdiskWrapper.sh file goes in your /usr/pluto/bin directory.  Please remember to save the existing ripDiskWrapper.sh to a different name first, so you can go back if it gets screwy.

1audio

  • Addicted
  • *
  • Posts: 552
    • View Profile
Re: Embedding tags when ripping CDs
« Reply #6 on: July 22, 2007, 09:26:25 pm »
In my year of Pluto LMCE I have gone from zero to .1% Linux expert but I have managed to figure out a lot. However the following has me stumped:

linuxmce@dcerouter:/usr/pluto/bin$ rename ripDiskWrapper.sh ripDiskWrapper.old
Bareword "ripDiskWrapper" not allowed while "strict subs" in use at (eval 1) line 1.
Bareword "sh" not allowed while "strict subs" in use at (eval 1) line 1.
linuxmce@dcerouter:/usr/pluto/bin$ sudo rename ripDiskWrapper.sh ripDiskWrapper.old
Bareword "ripDiskWrapper" not allowed while "strict subs" in use at (eval 1) line 1.
Bareword "sh" not allowed while "strict subs" in use at (eval 1) line 1.
 
And I can't copy a new version over the old, don't have permissions even starting with sudo. I'm lost without a compass. Help!?

Thanks.

Zaerc

  • Alumni
  • LinuxMCE God
  • *
  • Posts: 2256
  • Department of Redundancy Department.
    • View Profile
Re: Embedding tags when ripping CDs
« Reply #7 on: July 23, 2007, 04:53:39 pm »
The command you're looking for is mv (short for move), this should do it:
Code: [Select]
sudo mv /usr/pluto/bin/ripDiskWrapper.sh /usr/pluto/bin/ripDiskWrapper.sh.oldThen copy the downloaded script over, supposing you are in the same directory as the file, and it already has the right name:
Code: [Select]
sudo cp ripDiskWrapper.sh /usr/pluto/bin/Or alternatively, for instance if it was put elsewhere or under a different name:
Code: [Select]
sudo cp [<path>/]<file-name> /usr/pluto/bin/ripDiskWrapper.shSetting the right permissions:
Code: [Select]
sudo chmod 755 /usr/pluto/bin/ripDiskWrapper.shAnd you should be done.

The script seems to be working fine for me, altho I haven't checked the actual tags yet.  If there's anything in particular you'd like me to try or look at to verify let me know.  I am using FLAC btw.

"Change is inevitable. Progress is optional."
-- Anonymous


1audio

  • Addicted
  • *
  • Posts: 552
    • View Profile
Re: Embedding tags when ripping CDs
« Reply #8 on: July 24, 2007, 06:41:19 am »
Thanks for the details. It worked for copying the script. I'm testing the script with a familiar disk and it captured the data. However it didn't make it to Slimserver until I told Slimserver to clear and reload. It probably would have if I had waited. Fortunately I don't have too much ripped yet. I am working with a changer and as soon as thats sorted out I will give it a major ripping chore. I only use flac so the mp3 issues won't affect me. Thanks for your efforts. For a classical music consumer like me the fix makes an enormous difference in the usability of the system.

PeteK

  • Guru
  • ****
  • Posts: 408
    • View Profile
Re: Embedding tags when ripping CDs
« Reply #9 on: July 25, 2007, 05:02:14 pm »
Thanks.  I'd like to improve the system as well. Please let me know if you have any difficulties. I'll talk to Paul about getting it into the next release in some form or another.  One issue I have right now is getting LMCE to recognize externally encoded FLAC files and insert them into the database.  I'll take a look and see what to do about that.

1audio

  • Addicted
  • *
  • Posts: 552
    • View Profile
Re: Embedding tags when ripping CDs
« Reply #10 on: July 29, 2007, 06:19:25 am »
More updates. The changer quickly and successfully copied 16 disks to the system. They all had proper ID and album details.

I then embarked on a bigger quest- upgrading Slimserver to the current version. It can be done and isn't too hard, however once done the control links between LMCE and Slimserver are broken. There have been changes between ver. 6.2.2 and 6.5.3 that broke the connection between the two systems and I don't see them in the changelog (not that I would if they were in front of me. . .).
To install the latest version, You must edit the etc/apt/sources.list. Add the slimserver repository second from the top and comment out the top entry:
Code: [Select]
# deb file:/usr/pluto/deb-cache/ ./
deb http://debian.slimdevices.com stable main

(sudo kate to access the text editor from commands at the KDE desktop)

And then:
Quote
sudo apt-get update
sudo apt-get install slimserver

I'm not sure what else this will break. And it has not been tried on the latest RC1. And it will break the connection between LMCE and Slimserver- you have been warned.

I found the docs, they are contained in the help file in the Slimserver itself. They don't suggest anything obvious but I hope someone (Paul?) will be able to look at it and fix the interface. it should then be stable as Slimserver upgrades. There is a new version of Slimserver with significant revisions around the corner (Ver. 7) so this may become more important.
« Last Edit: July 29, 2007, 06:44:28 am by 1audio »

1audio

  • Addicted
  • *
  • Posts: 552
    • View Profile
Re: Embedding tags when ripping CDs
« Reply #11 on: July 29, 2007, 08:32:52 am »
More update on Slimserver. I found the problem with the link. The slimserver default port for command line interface is 9090. LMCE expects to see this at 7890. Changing the setting in Slimserver's web page reconnected them. This seems to have fixed the connection between the systems.