Professional Web Applications Themes

MP3::Archive - namespace advice - PERL Modules

Hello world, I've written a perl module to handle parsing and creation of filenames containing music metadata. For instance, with the default configuration, given a filename like: 01 - Talk Talk - Spirit of Eden - The Rainbow.mp3 methods called artist(), album(), etc. return the correct information. Given the metadata, it can also construct a filename. At the moment, it lives under MP3::Archive. Is this namespace acceptable? It could be considered slightly misleading, as within the context of CPAN, Archive (at least within the Archive:: namespace) means files containing collections of files (zip, tar, etc) rather than an organised filesystem ...

  1. #1

    Default MP3::Archive - namespace advice

    Hello world,

    I've written a perl module to handle parsing and creation of filenames
    containing music metadata. For instance, with the default
    configuration, given a filename like:

    01 - Talk Talk - Spirit of Eden - The Rainbow.mp3

    methods called artist(), album(), etc. return the correct information.
    Given the metadata, it can also construct a filename.

    At the moment, it lives under MP3::Archive. Is this namespace
    acceptable?

    It could be considered slightly misleading, as within the context of
    CPAN, Archive (at least within the Archive:: namespace) means files
    containing collections of files (zip, tar, etc) rather than an
    organised filesystem tree of files. Also, it works with other audio
    formats, not just mp3 (in fact the contents of the file are irrelevant).

    So, any better suggestions? I should have asked this before finishing
    coding, but it shouldn't be too much hassle to change.

    The module is generic enough for me to have used it in several scripts
    of varying sizes (the biggest, mp3lint, uses the MP3::Archive::Lint
    namespace). So, is it worth uploading to CPAN and registering it with
    the module list?

    The code is at

    [url]http://nessie.mcc.ac.uk/~ianb/projects/libmp3-archive-perl/[/url]

    It also has links to the scripts that use it.

    Comments welcome.

    Ian.

    PS My earlier post to this newsgroup had an incorrect From: header.
    This one should be correct, or see my .sig

    --
    Ian Beckwith - [email]ianbnessie.mcc.ac.uk[/email] - [url]http://nessie.mcc.ac.uk/~ianb/[/url]
    GPG fingerprint: AF6C C0F1 1E74 424B BCD5 4814 40EC C154 A8BA C1EA
    Listening to: Swans - Various Failures (Red) - God Damn The Sun
    Ian Beckwith Guest

  2. #2

    Default Re: MP3::Archive - namespace advice

    Also sprach Ian Beckwith:
    > I've written a perl module to handle parsing and creation of filenames
    > containing music metadata. For instance, with the default
    > configuration, given a filename like:
    >
    > 01 - Talk Talk - Spirit of Eden - The Rainbow.mp3
    >
    > methods called artist(), album(), etc. return the correct information.
    > Given the metadata, it can also construct a filename.
    >
    > At the moment, it lives under MP3::Archive. Is this namespace
    > acceptable?
    It is probably better placed under the AudioFile:: namespace. Your
    module is not MP3-specific. I suppose it could equally well be applied
    to .ogg files for instance.
    > It could be considered slightly misleading, as within the context of
    > CPAN, Archive (at least within the Archive:: namespace) means files
    > containing collections of files (zip, tar, etc) rather than an
    > organised filesystem tree of files. Also, it works with other audio
    > formats, not just mp3 (in fact the contents of the file are irrelevant).
    I don't like the Archive bit very much either. The name should make
    clear that it somehow deals with filenames. It's not easy to come up
    with a short name that it makes it clear, though.
    > So, any better suggestions? I should have asked this before finishing
    > coding, but it shouldn't be too much hassle to change.
    >
    > The module is generic enough for me to have used it in several scripts
    > of varying sizes (the biggest, mp3lint, uses the MP3::Archive::Lint
    > namespace). So, is it worth uploading to CPAN and registering it with
    > the module list?
    >
    > The code is at
    >
    > [url]http://nessie.mcc.ac.uk/~ianb/projects/libmp3-archive-perl/[/url]
    >
    > It also has links to the scripts that use it.
    >
    > Comments welcome.
    Maybe something for a later release: it would be nice if the module
    could fill in the tags of the audiofile according to the information it
    was able to extract from the filename (and vice versa).

    Tassilo
    --
    $_=q#",}])!JAPH!qq(tsuJ[{"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
    pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus}) !JAPH!qq(rehtona{tsuJbus#;
    $_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+ii ixesixeseg;y~\n~~dddd;eval
    Tassilo v. Parseval Guest

  3. #3

    Default Re: MP3::Archive - namespace advice

    In article <brudt6$o2g$1nets3.rz.RWTH-Aachen.DE>,
    Tassilo v. Pval <tassilo.pvalpost.rwth-aachen.de> wrote:
    >Also sprach Ian Beckwith:
    > > At the moment, it lives under MP3::Archive. Is this namespace
    > > acceptable?
    >
    > It is probably better placed under the AudioFile:: namespace. Your
    > module is not MP3-specific. I suppose it could equally well be applied
    > to .ogg files for instance.
    Yes, it could. I didn't know about AudioFile::, the module list
    doesn't mention it.

    Hmm.. how about AudioFile::Name?

    It doesn't convey that it handles pathnames too, but it's probably an
    improvement.
    > could fill in the tags of the audiofile according to the information it
    > was able to extract from the filename (and vice versa).
    The module doesn't, but a couple of the tools that use it do.

    Maybe I should have mentioned this in the last post, I was never any
    good at marketing :)

    at [url]http://nessie.mcc.ac.uk/~ianb/projects/mp3-archive-tools/[/url]

    there is:

    mp3id - View/change id3 metadata. Supports ID3v2 and extended
    frames (pictures, etc).
    filenametoid3 - Update id3 metadata from filenames.
    id3tofilename - Rename files based on id3 metadata.
    freedbtofilename - Rename files based on data from freedb
    webpages ([url]www.freedb.org[/url]).
    cddbtofilename - Rename files based on data from cddb
    webpages ([url]www.gracenote.com[/url]).
    movemusic - Move music files to their correct place in
    your archive.
    update-music-symlinks - Maintain a central link farm pointing to music
    in various places.
    pmv - Rename files using arbitrary perl code. Comes
    with a set of useful example commands.

    and at [url]http://nessie.mcc.ac.uk/~ianb/projects/mp3lint/[/url]
    there is mp3lint:

    mp3lint is a tool to check collections of audio files for various
    problems. It is highly configurable, allowing you to specify your
    preferred format for filenames, minimum bitrate, tests to ignore,
    etc. Formats checked are currently mp3, ogg, wav, flac, au, and m3u
    playlists. mp3lint is implemented as separate tools (perl modules),
    each of which implements a set of tests. There are a total of 33
    different tests.

    (Yes, they were cut and pasted from readmes)

    Anyway, filenametoid3 and id3tofilename will do what you want.

    Of course, mp3lint is misnamed too, but it originally only handled
    mp3s, then grew.

    Incidently, are there any conventions for namespace for modules
    private to applications? (Private in the sense of not useful outside
    that app).

    mp3lint modules currently live under MP3::Archive::Lint.

    I suppose it doesn't matter as long as it doesn't clash with anything.

    thanks,

    Ian.

    --
    Ian Beckwith - [email]ianbnessie.mcc.ac.uk[/email] - [url]http://nessie.mcc.ac.uk/~ianb/[/url]
    GPG fingerprint: AF6C C0F1 1E74 424B BCD5 4814 40EC C154 A8BA C1EA
    Listening to: Swans - Various Failures (Red) - Picture Of Maryanne
    Ian Beckwith Guest

  4. #4

    Default Re: MP3::Archive - namespace advice

    In article <brvaro$30rd$1godfrey.mcc.ac.uk>,
    Ian Beckwith <ianbnessie.mcc.ac.uk> wrote:
    > In article <brudt6$o2g$1nets3.rz.RWTH-Aachen.DE>,
    > Tassilo v. Pval <tassilo.pvalpost.rwth-aachen.de> wrote:
    > >Also sprach Ian Beckwith:
    > > > At the moment, it lives under MP3::Archive. Is this namespace
    > > > acceptable?
    > >
    > > It is probably better placed under the AudioFile:: namespace. Your
    > > module is not MP3-specific. I suppose it could equally well be applied
    > > to .ogg files for instance.
    >
    > Yes, it could. I didn't know about AudioFile::, the module list
    > doesn't mention it.
    >
    > Hmm.. how about AudioFile::Name?
    Maybe AudioFile::NameP? (cf Lingua::En::NameP)

    big

    --
    'When I first met Katho, she had a meat cleaver in one hand and
    half a sheep in the other. "Come in", she says, "Hammo's not here.
    I hope you like meat.' Sharkey in aus.moto
    Iain Chalmers Guest

  5. #5

    Default Re: MP3::Archive - namespace advice

    [A complimentary Cc of this posting was sent to
    Ian Beckwith
    <ianbnessie.mcc.ac.uk>], who wrote in article <brtj03$2r4h$1godfrey.mcc.ac.uk>:
    > I've written a perl module to handle parsing and creation of filenames
    > containing music metadata. For instance, with the default
    > configuration, given a filename like:
    >
    > 01 - Talk Talk - Spirit of Eden - The Rainbow.mp3
    >
    > methods called artist(), album(), etc. return the correct information.
    "Correct"?!

    Note that this (minus the album info, which is not that often a part
    of filename) is a part of MP3::Tag functionality. [There is an
    ongoing discussion on this newgroup now.]

    Yours,
    Ilya
    Ilya Zakharevich Guest

  6. #6

    Default Re: MP3::Archive - namespace advice

    In article <bs6fjf$2b48$1agate.berkeley.edu>,
    Ilya Zakharevich <nospam-abuseilyaz.org> wrote:
    > <ianbnessie.mcc.ac.uk>], who wrote in article <brtj03$2r4h$1godfrey.mcc.ac.uk>:
    > > I've written a perl module to handle parsing and creation of filenames
    > > containing music metadata. For instance, with the default
    > > configuration, given a filename like:
    > >
    > > 01 - Talk Talk - Spirit of Eden - The Rainbow.mp3
    > >
    > > methods called artist(), album(), etc. return the correct information.
    >
    > "Correct"?!
    Well, hopefully.
    > Note that this (minus the album info, which is not that often a part
    > of filename) is a part of MP3::Tag functionality.
    Yes, but I use a different approach. MP3::Tag tries to guess the info
    from the filename with various heuristics (as well as ID3 tags). From
    a quick look, your patch does the same, but is more cunning and uses
    other sources too.

    MP3::Archive (or AudioFile::NameP, or whatever it ends up being
    called), uses a config file (currently .mp3archiverc or
    /etc/mp3archiverc, unless overridden by the application), in which the
    user specifies lists of valid formats for album/non-album tracks and
    directories, and how to p them.

    Ian.

    --
    Ian Beckwith - [email]ianbnessie.mcc.ac.uk[/email] - [url]http://nessie.mcc.ac.uk/~ianb/[/url]
    GPG fingerprint: AF6C C0F1 1E74 424B BCD5 4814 40EC C154 A8BA C1EA
    Listening to: Sisterhood - The Gift - Finland Red, Egypt White
    Ian Beckwith Guest

  7. #7

    Default Re: MP3::Archive - namespace advice

    [A complimentary Cc of this posting was sent to
    Ian Beckwith
    <ianbnessie.mcc.ac.uk>], who wrote in article <bs906p$2ai0$1godfrey.mcc.ac.uk>:
    > > > 01 - Talk Talk - Spirit of Eden - The Rainbow.mp3
    > > > methods called artist(), album(), etc. return the correct information.
    > > "Correct"?!
    > Well, hopefully.
    Still have no idea what can you mean. Unless all calls
    artist()/album()/title() return the same string

    Talk Talk - Spirit of Eden - The Rainbow

    Oh, I see: it is explained below...
    > Yes, but I use a different approach. MP3::Tag tries to guess the info
    > from the filename with various heuristics (as well as ID3 tags). From
    > a quick look, your patch does the same, but is more cunning and uses
    > other sources too.
    No. There are many "handlers" like MP3::Tag::Filename (which is a
    horrible misnomer, since it has nothing to do with tags, mp3, etc ;-),
    MP3::Tag::CDDB_File etc which can do one thing at a time.

    There is also a "parent" (MP3::Tag) which can query several handlers,
    and get the answer combining the obtained info.
    > MP3::Archive (or AudioFile::NameP, or whatever it ends up being
    > called), uses a config file (currently .mp3archiverc or
    > /etc/mp3archiverc, unless overridden by the application), in which the
    > user specifies lists of valid formats for album/non-album tracks and
    > directories, and how to p them.
    This is a great stuff. Should not it be merged into MP3::Tag (if we
    can reach the author)?

    Thanks,
    Ilya

    P.S. Is there a nice module to get the query from FreeDB given the
    cddb ID (and, optionally, a list of track offsets)? I spent a lot of
    time trying to convince CPAN modules I know to do this; it turned out
    that it was easier to write the code myself than to use these
    modules...
    Ilya Zakharevich Guest

Similar Threads

  1. Replies: 1
    Last Post: March 25th, 08:55 AM
  2. MI::TD - namespace advice
    By Tom McGlynn in forum PERL Modules
    Replies: 0
    Last Post: February 8th, 10:52 PM
  3. IPTables namespace - how to commandeer namespace
    By Derrik Pates in forum PERL Modules
    Replies: 1
    Last Post: January 20th, 08:52 AM
  4. using Archive::Zip
    By Geoff Cox in forum PERL Modules
    Replies: 1
    Last Post: August 23rd, 05:27 PM
  5. Replies: 1
    Last Post: July 29th, 04:31 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139