Discussion:
[RFC] cdda plugin
Johannes Weißl
2011-05-05 01:38:21 UTC
Permalink
Hello list!

I quickly wrote an experimental cdda plugin based on the XMMS2 plugin:
http://cmus.sourceforge.net/wiki/doku.php?id=cdda_support

It would be cool if you could test it and give feedback! CD-Text support
is missing, as I don't have any audio discs with CD-Text... it is
currently outputted as debug message. What do you think?


Greetings,
Johannes
Gregory Petrosyan
2011-05-05 13:29:42 UTC
Permalink
Post by Johannes Weißl
Hello list!
http://cmus.sourceforge.net/wiki/doku.php?id=cdda_support
It would be cool if you could test it and give feedback! CD-Text support
is missing, as I don't have any audio discs with CD-Text... it is
currently outputted as debug message. What do you think?
Wow, great! Unfortunately, I can't test it right now -- I have no PCs with
working CD-ROMs available :-( I'll try to get access to one, and report my
experience.

Gregory
Johannes Weißl
2011-05-05 13:48:16 UTC
Permalink
Post by Gregory Petrosyan
Post by Johannes Weißl
http://cmus.sourceforge.net/wiki/doku.php?id=cdda_support
Wow, great! Unfortunately, I can't test it right now -- I have no PCs with
working CD-ROMs available :-( I'll try to get access to one, and report my
experience.
Yeah, I guess the plugin comes 5 years too late... Vinyl and MP3 might
supersede CDDA's.

But testing is possible even without a CD-ROM drive, libcdio supports
cue/toc/nrg cdda images as well, e.g.:
:add cdda:///home/user/cd.cue/7

But then there is the problem of getting these images :-).


Johannes
Gregory Petrosyan
2011-05-05 13:54:17 UTC
Permalink
Post by Johannes Weißl
Post by Gregory Petrosyan
Post by Johannes Weißl
http://cmus.sourceforge.net/wiki/doku.php?id=cdda_support
Wow, great! Unfortunately, I can't test it right now -- I have no PCs with
working CD-ROMs available :-( I'll try to get access to one, and report my
experience.
Yeah, I guess the plugin comes 5 years too late... Vinyl and MP3 might
supersede CDDA's.
But testing is possible even without a CD-ROM drive, libcdio supports
:add cdda:///home/user/cd.cue/7
But then there is the problem of getting these images :-).
Oh, not really! CD images are very popular among audiophiles, and one can find
tons of them on various BitTorrent trackers like rutracker.org. So I'll
definitely check it out!

Gregory
Jason Woofenden
2011-05-10 05:19:33 UTC
Permalink
Post by Johannes Weißl
Hello list!
http://cmus.sourceforge.net/wiki/doku.php?id=cdda_support
Awesome!

I finally got around to trying this. I tried the latest from your
cdda branch (c098d7532db8c);

Once I remembered to add the CONFIG_CDIO=y things started going
pretty well.

I did :add -p cdda:// and after some (rather long) spinning and
seeking noises (oh, drives) all the tracks showed up with full
metadata! Cool.

But when I pressed enter on the first track, I got this:

Error: reading file cdda://1t.ZN.KxnGkAd4seXEg7BEztBH8-/1:
Socket operation on non-socket

Then after pasting that into this e-mail I pressed enter on it
again, and played just fine.

I've fiddled with pressing enter a lot, pausing, restarting, etc.,
and I can't reproduce the error.

The auto-resume feature worked as expected. Very cool for audio
books!


When I removed the CD, and tried to play one of the tracks from it
(the tracks remained in my playlist of course) I got this message:

Error: opening file `cdda://1t.ZN.KxnGkAd4seXEg7BEztBH8-/1':
internal error

If you feel like implementing it, it might be cool to have pretty
error messages for these two common errors:

1) there's no media

2) there's a different disk


Take care, - Jason
Johannes Weißl
2011-05-10 06:32:47 UTC
Permalink
Hello Jason,
Post by Jason Woofenden
Post by Johannes Weißl
http://cmus.sourceforge.net/wiki/doku.php?id=cdda_support
Awesome!
I finally got around to trying this. I tried the latest from your
cdda branch (c098d7532db8c);
Thanks a lot for testing :-)!
Post by Jason Woofenden
I did :add -p cdda:// and after some (rather long) spinning and
seeking noises (oh, drives) all the tracks showed up with full
metadata! Cool.
Probably because of cddb lookup! Do you think there should be an option
- to disable lookup (could be handled by setting cddb_url to "")
- prefer lookup over CD-Text (or should this be the default?)

For the (rather long) spinning: This is because the CD is read for every
track, fix already commited! This means you have to eject the CD using
the "eject" command...
Post by Jason Woofenden
Socket operation on non-socket
Then after pasting that into this e-mail I pressed enter on it
again, and played just fine.
I've fiddled with pressing enter a lot, pausing, restarting, etc.,
and I can't reproduce the error.
Ha, I also get this error sometimes (it seems only when CD is newly
inserted and cmus hasn't played any CDDA tracks), but I could not
figure it out... probably have to look at the libcdio source code...
Post by Jason Woofenden
The auto-resume feature worked as expected. Very cool for audio
books!
Yes, this I was also surprised! And it worked right out of the box!
Post by Jason Woofenden
When I removed the CD, and tried to play one of the tracks from it
internal error
If you feel like implementing it, it might be cool to have pretty
1) there's no media
Ok, changed!
Post by Jason Woofenden
2) there's a different disk
This should have been already implemented... I can't test it because I
own only one CD :-).


Greetings,
Johannes
Jason Woofenden
2011-05-14 01:35:16 UTC
Permalink
I tested the latest on Johannes' cdda branch (ff1161edea63)

It seemed a little faster at getting the track names, but it's been
a week, so I'm not sure. It's hard to do side-by-side comparison,
because I have very few CDs and the track names are cached
somewhere.

I get the nice new error message if I try to play a track with no
CD in the drive.

It even sucks the drive tray in if I try to play a CD track with
the drive open.

I did once manage to get it to play a track from the wrong CD (I
was telling it to play tracks from CD-a while I had CD-b in the
drive, and it started playing a track from CD-b). But I couldn't
reproduce this (every other time I got the "wrong disk" message.
This is a very very minor issue.

So I vote that this branch is ready to be merged into pu and/or
master.

Take care, - Jason
Post by Johannes Weißl
http://cmus.sourceforge.net/wiki/doku.php?id=cdda_support
Gregory Petrosyan
2011-05-15 09:01:48 UTC
Permalink
Post by Jason Woofenden
I tested the latest on Johannes' cdda branch (ff1161edea63)
It seemed a little faster at getting the track names, but it's been
a week, so I'm not sure. It's hard to do side-by-side comparison,
because I have very few CDs and the track names are cached
somewhere.
I get the nice new error message if I try to play a track with no
CD in the drive.
It even sucks the drive tray in if I try to play a CD track with
the drive open.
I did once manage to get it to play a track from the wrong CD (I
was telling it to play tracks from CD-a while I had CD-b in the
drive, and it started playing a track from CD-b). But I couldn't
reproduce this (every other time I got the "wrong disk" message.
This is a very very minor issue.
So I vote that this branch is ready to be merged into pu and/or
master.
Thanks a ton for the testing, I've merged this branch to pu (transformed all
commits into one, though)!

Gregory
Johannes Weißl
2011-05-15 22:19:15 UTC
Permalink
Post by Gregory Petrosyan
Thanks a ton for the testing, I've merged this branch to pu (transformed all
commits into one, though)!
Thanks! I pushed a few more changes to my cdda branch! You can transform
everything to a single commit once you push it to master!


Johannes
Jason Woofenden
2011-05-16 04:10:28 UTC
Permalink
Post by Johannes Weißl
Post by Gregory Petrosyan
Thanks a ton for the testing, I've merged this branch to pu (transformed all
commits into one, though)!
Thanks! I pushed a few more changes to my cdda branch! You can transform
everything to a single commit once you push it to master!
I did some more testing, and didn't see any regressions.

This time when scrounging for another CD, I ran across a
mix CD that my sister burned for me. So needless to say the
trackname lookup thing didn't work. cmus never displayed the tracks
from the cd, or let me play them. I'm assuming that this is happens
for any disk that fails the lookup, and might even make it so you
can't play a new CD when offline (eek!)

It would be awesome if they could show up somehow, perhaps

disk-9ak98ao98a94 Track 1
disk-9ak98ao98a94 Track 2
disk-9ak98ao98a94 Track 3
disk-9ak98ao98a94 Track 4

Or something. Showing [part of] the cdda disk id is kinda ugly, but
would probably by by far the easiest way to keep the album name
unique.

Other things that would be very cool if somebody wanted to spend
time on them:

1) would be cool if the CD's tracks showed up (eg as shown above)
as soon as the number of tracks on the disk is known. And then
when/if the metadata lookup thing completes, it'd update the
album/track names

2) If you have un-named tracks from a cd in your playlist/library
(because the metadata lookup failed, eg because of network issues)
it would be cool if :update-cache could try the lookup again.

cool... but not necessary.


Take care, - Jason
Jason Woofenden
2011-05-17 16:31:38 UTC
Permalink
I tried that CD again, and everything seems to be working fine.
Must have been some fluke with trying it before the CD drive was
ready or something.

I got a copy to Johannes, and he tested with various things
disabled, so it'd show up without metadata and with.

So don't mind me... the cdda code is awesome.

Take care, - Jason
Post by Jason Woofenden
Post by Johannes Weißl
Post by Gregory Petrosyan
Thanks a ton for the testing, I've merged this branch to pu (transformed all
commits into one, though)!
Thanks! I pushed a few more changes to my cdda branch! You can transform
everything to a single commit once you push it to master!
I did some more testing, and didn't see any regressions.
This time when scrounging for another CD, I ran across a
mix CD that my sister burned for me. So needless to say the
trackname lookup thing didn't work. cmus never displayed the tracks
from the cd, or let me play them. I'm assuming that this is happens
for any disk that fails the lookup, and might even make it so you
can't play a new CD when offline (eek!)
It would be awesome if they could show up somehow, perhaps
disk-9ak98ao98a94 Track 1
disk-9ak98ao98a94 Track 2
disk-9ak98ao98a94 Track 3
disk-9ak98ao98a94 Track 4
Or something. Showing [part of] the cdda disk id is kinda ugly, but
would probably by by far the easiest way to keep the album name
unique.
Other things that would be very cool if somebody wanted to spend
1) would be cool if the CD's tracks showed up (eg as shown above)
as soon as the number of tracks on the disk is known. And then
when/if the metadata lookup thing completes, it'd update the
album/track names
2) If you have un-named tracks from a cd in your playlist/library
(because the metadata lookup failed, eg because of network issues)
it would be cool if :update-cache could try the lookup again.
cool... but not necessary.
Take care, - Jason
Johannes Weißl
2011-05-17 18:07:28 UTC
Permalink
Post by Jason Woofenden
I tried that CD again, and everything seems to be working fine.
Must have been some fluke with trying it before the CD drive was
ready or something.
I got a copy to Johannes, and he tested with various things
disabled, so it'd show up without metadata and with.
So don't mind me... the cdda code is awesome.
Thanks a lot for testing! The hardware makes it difficult to
reproduce things...

I've created a "Bugs" section:
http://cmus.sourceforge.net/wiki/doku.php?id=cdda_support#bugs


Johannes
Jason Woofenden
2011-06-01 08:29:07 UTC
Permalink
Johannes has updated his cdda branch, and I finally got around to
more testing.

There's instructions for testing and bugs and such here:

http://cmus.sourceforge.net/wiki/doku.php?id=cdda_support

I spent quite a while inserting and removing a few CDs and adding
and removing and playing, etc. in cmus.

I was unable to reproduce any of the bugs that came up before.

It displayed the correct error messages at the correct times. The
message for "wrong disk", "no media inserted" messages were right
on. I removed a disk while it was playing (with the eject shell
command) and cmus (after the buffer ran out) said something like
"failed to read disk" which seemed appropriate.

I did get one new bug once though: somehow, cmus got into a state
where it would not play the last 5 tracks (track 12-16) of one
particular disk. Giving an error message like "invalid URL". Adding
a new disk, then putting the failing disk back in made no
difference (it still always gave the "invalid URL" message for the
last 5 tracks.) I quit cmus and started up again, and then all
tracks played perfectly. I spent a while longer trying to reproduce
the error, and I can't seem to. So I can't get the exact error
message.


I added a note about this bug and a feature request (for instant
:adds with the meta-data being added later) to the cdda wiki page:

http://cmus.sourceforge.net/wiki/doku.php?id=cdda_support#bugs


On the whole, it seems to work pretty well. Certainly a lot better
than not having cdda support at all.

I've experienced no bugs that make cmus any worse at playing files
(such as crashes or long delays.)

Seems to me that CD drives are fairly unreliable, and I have no
idea how solid libcdio is, so think:

1) It's hard to tell if any odd/buggy behavior is because of cmus

2) Many people will not blame cmus when CD playing is a little
buggy, because they have had issues playing CDs before in other
programs.


Take care, - Jason
Johannes Weißl
2011-06-01 12:28:30 UTC
Permalink
Hi Jason,
Post by Jason Woofenden
I spent quite a while inserting and removing a few CDs and adding
and removing and playing, etc. in cmus.
Thanks a lot (again) for the thorough testing :-)!
Post by Jason Woofenden
I did get one new bug once though: somehow, cmus got into a state
where it would not play the last 5 tracks (track 12-16) of one
particular disk. Giving an error message like "invalid URL". Adding
a new disk, then putting the failing disk back in made no
difference (it still always gave the "invalid URL" message for the
last 5 tracks.)
Strange... I looked at the parts where the error message is emitted, and
they look pretty innocent. The cmus-debug.txt would be interesting to
exactly locate the position, but this is difficult if you can't
reproduce it.
Post by Jason Woofenden
I quit cmus and started up again, and then all tracks played
perfectly. I spent a while longer trying to reproduce the error, and I
can't seem to. So I can't get the exact error message.
Did you re-add the CD? If not, this would indicate that the url-parsing
code is not buggy.
Post by Jason Woofenden
I added a note about this bug and a feature request (for instant
Thanks! This feature is not easy to do for just CDDA, it would have to
be implemented for all input plugins (but could of course be disabled
for non urls). There has been such a request (because of slow network
file system). The problem is it would make adding tracks a little silly
(first, they are all stored in "<No Name>", and then resorted. Because
of the constant resorting, it might even be difficult to play tracks in
advance (before tag loading), which is the wanted feature...

But of course, if someone writes a prototype we can test it and discuss
further!
Post by Jason Woofenden
On the whole, it seems to work pretty well. Certainly a lot better
than not having cdda support at all.
I've experienced no bugs that make cmus any worse at playing files
(such as crashes or long delays.)
Seems to me that CD drives are fairly unreliable, and I have no
1) It's hard to tell if any odd/buggy behavior is because of cmus
2) Many people will not blame cmus when CD playing is a little
buggy, because they have had issues playing CDs before in other
programs.
Agreed, so lets push it to master!


Johannes
Gregory Petrosyan
2011-06-01 13:12:29 UTC
Permalink
Post by Johannes Weißl
Post by Jason Woofenden
On the whole, it seems to work pretty well. Certainly a lot better
than not having cdda support at all.
I've experienced no bugs that make cmus any worse at playing files
(such as crashes or long delays.)
Seems to me that CD drives are fairly unreliable, and I have no
1) It's hard to tell if any odd/buggy behavior is because of cmus
2) Many people will not blame cmus when CD playing is a little
buggy, because they have had issues playing CDs before in other
programs.
Agreed, so lets push it to master!
So be it!

Thanks a lot for writing and testing!

Gregory
Jason Woofenden
2011-06-01 18:13:09 UTC
Permalink
Post by Johannes Weißl
Post by Jason Woofenden
I did get one new bug once though: somehow, cmus got into a state
where it would not play the last 5 tracks (track 12-16) of one
particular disk. Giving an error message like "invalid URL". Adding
a new disk, then putting the failing disk back in made no
difference (it still always gave the "invalid URL" message for the
last 5 tracks.)
Strange... I looked at the parts where the error message is emitted, and
they look pretty innocent. The cmus-debug.txt would be interesting to
exactly locate the position, but this is difficult if you can't
reproduce it.
Post by Jason Woofenden
I quit cmus and started up again, and then all tracks played
perfectly. I spent a while longer trying to reproduce the error, and I
can't seem to. So I can't get the exact error message.
Did you re-add the CD? If not, this would indicate that the url-parsing
code is not buggy.
I did not re-add between:

1) failing to play (invalid url message)
2) quit cmus
3) start cmus
4) play (success)

So the url should not have changed, and looked just fine in the
invalid url message. I suspect libcdio was rejecting it for some
reason.

Later (when trying to reproduce) I did remove and re-add the tracks
a couple times, but couldn't get it to fail again.
Post by Johannes Weißl
Post by Jason Woofenden
I added a note about this bug and a feature request (for instant
Thanks! This feature is not easy to do for just CDDA, it would have to
be implemented for all input plugins (but could of course be disabled
for non urls). There has been such a request (because of slow network
file system). The problem is it would make adding tracks a little silly
(first, they are all stored in "<No Name>", and then resorted. Because
of the constant resorting, it might even be difficult to play tracks in
advance (before tag loading), which is the wanted feature...
But of course, if someone writes a prototype we can test it and discuss
further!
Ahh, I hadn't thought of re-sorting. That would be annoying. I was
working just in the playlist view (:add -p) so didn't think of
sorting.


Thanks again!

Take care, - Jason

Gregory Petrosyan
2011-05-16 12:49:53 UTC
Permalink
Post by Johannes Weißl
Post by Gregory Petrosyan
Thanks a ton for the testing, I've merged this branch to pu (transformed all
commits into one, though)!
Thanks! I pushed a few more changes to my cdda branch! You can transform
everything to a single commit once you push it to master!
BTW, can you please add a small section to the manual explaining how
to use cdda:// stuff?

                Gregory
Johannes Weißl
2011-05-16 14:12:04 UTC
Permalink
Post by Gregory Petrosyan
BTW, can you please add a small section to the manual explaining how
to use cdda:// stuff?
I added a small section (pushed to my branch). Is that ok?


Johannes
Gregory Petrosyan
2011-05-16 15:42:13 UTC
Permalink
Post by Johannes Weißl
Post by Gregory Petrosyan
BTW, can you please add a small section to the manual explaining how
to use cdda:// stuff?
I added a small section (pushed to my branch). Is that ok?
Perfect, thanks!

                Gregory
Johannes Weißl
2011-05-15 22:17:38 UTC
Permalink
Hello Jason,
Post by Jason Woofenden
I tested the latest on Johannes' cdda branch (ff1161edea63)
Thanks a lot!
Post by Jason Woofenden
It seemed a little faster at getting the track names, but it's been
a week, so I'm not sure. It's hard to do side-by-side comparison,
because I have very few CDs and the track names are cached
somewhere.
Hmm, it should be about n times faster (n == number of tracks). The
metadata is cached at the normal place (~/.cmus/cache). So "update-cache
-f" should reread the CD. The cddb lookup is cached in ~/.cddbslave!
Post by Jason Woofenden
I get the nice new error message if I try to play a track with no
CD in the drive.
Great!
Post by Jason Woofenden
It even sucks the drive tray in if I try to play a CD track with
the drive open.
Great, I never tried this!
Post by Jason Woofenden
I did once manage to get it to play a track from the wrong CD (I
was telling it to play tracks from CD-a while I had CD-b in the
drive, and it started playing a track from CD-b). But I couldn't
reproduce this (every other time I got the "wrong disk" message.
This is a very very minor issue.
Strange, this should not happen! But I guess since it's a minor issue,
a solution can be found faster if it is in pu/master!


Johannes
Loading...