Eric Gillespie [Sun, 4 Nov 2018 02:20:58 +0000 (19:20 -0700)]
Commit a bunch of state sitting around in the old bzr checkout!
I sent some of what's in here to a old-bzr branch. I think this was an
older copy of what evolved on my laptop, and then I started hacking
on top of this again on another computer running FreeBSD, what a mess...
Because of that, some of this may be going backwards (e.g. dependent on
my horrible old utility library I hacked out at some point (see old-bzr)).
Rewrote and stop taglib from re-encoding as UTF-16.
The rewrite wasn't actually necessary, but I ended up doing so while trying to
figure out what was happening to the text frames.
Finally figured out that taglib rudely writes out UTF-16 even though it read in
latin1 and I didn't tell it to change anything. You have to tell it for each
frame which encoding to use.
Eliminates the last compiled module. I half wonder if this flag were there
from the beginning and my stupid flac module was never needed, but I'm not
going digging for the answer to that right now.
- read: support a tag appearing with the same value on a subset of tracks and
nowhere else; previously this was ok if the value were differnet, but if say
only a few tracks had VERSION=radio and the rest had no VERSION, VERSION
would erroneously become a global tag
- write: support each track having own ALBUM with on global ALBUm (e.g. most
tracks are 'album=foo' but a few are 'album=foo extended'); previously broke
as ALBUm had to be global
- bonus: i noticed write was also missing ALBUMARTIST; added
When I switched from my crappy taglib module to using lame to add album art
(r162), I introduced a bug when album art is not present in the FLAC. Try to
fix it.
Add --id3v2-latin1. Default in newer lame is to transcode to UTF-16! Quite
wasteful on most of my files, and I don't have any that won't work fine in
latin1, so let's use that.
lame supports adding album art directly, it's just not very well documented
(still not in the man page in latest release), so switch to that instead of my
crappy taglib module
Move Tags class into new flac_archive package, fix a bug in it, and
test it. These stupid scripts will finally start sharing code and
getting some formal testing.
flac_archive/tags.py:
(Tags): Move here from flac2mp3, and rename ._tags to ._tracks .
The tag-loading loop from flac2mp3 get_tags becomes the new .load
method.
(Tags.get): Return all matching tag data instead of either global
or per-track (oops).
(Tags.gets): Adapt to that change, and allow other separators than
just '\n', which becomes a default.
(Tags.all, Tags.track): New methods for getting a tag block for
all tags (whole disc) or just a track, respectively. To be used
by fa-flacd in single-file and per-track modes, respectively.
flac2mp3:
Use flac_archive.tags.Tags. Use Tags.load in get_tags .
setup.py:
Note MIT license and install flac_archive package.
epg [Tue, 7 Nov 2006 09:07:28 +0000 (09:07 +0000)]
Add hack to pull down musicbrainz info without having a disc; useful
when you're away from home and rip WAVs into itunes... This should be
a separate program.
epg [Thu, 2 Nov 2006 10:42:28 +0000 (10:42 +0000)]
Hm, why just copy front cover PICTUREs from flac to mp3? The flac
PICTURE metadata block has the exact same metadata as the mp3 ID3v2
APIC frame; just copy them all.
flac.c:
(flac_pictures): Return fields in the same order they're found in
the FLAC format. Convert the description to a unicode object
rather than returning a UTF-8 encoded str object.
taglib.cc:
(taglib_apic): Take a list of picture tuples and add them all as
APIC frames.
(add_apic_frame_to_mp3): Take the list of picture tuples and pass
them straight to taglib_apic.
flac2mp3:
(flac2mp3): Take a list of picture tuples instead of just one;
pass them all to add_apic_frame_to_mp3.
(find_pics): Rename from find_pic. Save all PICTURE metadata
blocks rather than just saving the first front cover picture.