Skip to main content

Topic: Tagging (Read 3412 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • metrom
  • [*]
Tagging
Im going to rip with EAC, and use CDDB for info.
But EAC isn't supporting the oggcommet system, (they say it will in the next release).
What other easy way is there to commet hole albums with the same comment?

  • YinYang
  • [*][*][*][*]
Tagging
Reply #1
Perl (or other programming language) scripts

A kind person on the Vorbis mailing list once sent me a small Perl-script that works perfect for me (after a bit of personal tweaking  )

Also made we want to change to Linux

I rip from EAC to wav in a folder and then let the script do the encoding, tagging, and deleting of source-files in that folder. Works like a charm.

  • metrom
  • [*]
Tagging
Reply #2
A Perl scrips sounds interresting.
Can you come up whit a link or something?
I guess the whole code is a bit large to paste into this forum.

  • YinYang
  • [*][*][*][*]
Tagging
Reply #3
If the writer of this nifty little script want to claim ownership, please do! Basically I only added the unlink line

*******

opendir DIR, '.' or die "Cannot open directory because $!n";

@initdir = readdir DIR;
closedir DIR;

foreach $me (@initdir) {
  push @dir, $me if ($me =~ /.wav$/)
}

foreach $_ (@dir) {
  $wavfile = $_;
  s/.wav$//;
  $filename = $_;
  s/^(.+) - (.+) - (d+) - //;
  $art = $1;
  $alb = $2;
  $num = $3;
  system '"C:Program FilesOgg Vorbis Encoderoggenc.exe"',
        ' -b ', '128',
        ' -N ', $num,
        ' -t ', '"'.$_.'"',
        ' -l ', '"'.$alb.'"',
        ' -a ', '"'.$art.'"',
        ' -d ', '2001',
        ' -o ', '"'.$filename.'.ogg"',
        ' "'.$wavfile.'"';
  unlink $wavfile;
}

closedir DIR;

*******

(I edit the bitrate and/or the year accordingly)

Unfortunately I've been too lazy to find out how (I'm a programming newbie without the programming bug) to get the data-output from oggenc (coding time, coding speed, bitrate) appended/sent to a text file. If I could do that it would be perfect for me

  • greycat
  • [*]
Tagging
Reply #4
The general way is with backquotes.

Code: [Select]
#!/usr/local/bin/perl -w



$foo = `mycommand`;

print $foo;


You'd use this instead of "system", to run your oggenc command and capture the output in a perl variable.  Then you can do whatever you like with the information.

If, however, all you want to do is append to a text file, then you can use the ">>" redirection operator (in a Unix shell).  "echo hello world >>file" will append to the end of "file".  I don't know whether the NT CMD.EXE has that operator, and I think that the DOS COMMAND.COM doesn't.

  • qristus
  • [*][*][*]
  • Members (Donating)
Tagging
Reply #5
Quote
Originally posted by greycat
If, however, all you want to do is append to a text file, then you can use the ">>" redirection operator (in a Unix shell).  "echo hello world >>file" will append to the end of "file".  I don't know whether the NT CMD.EXE has that operator, and I think that the DOS COMMAND.COM doesn't.


Both NT's CMD.EXE and DOS's COMMAND.COM support the redirection operators, I used to use them a lot in batch scripts 

Using >> to append will work fine.

  • YinYang
  • [*][*][*][*]
Tagging
Reply #6
Quote
Originally posted by greycat
The general way is with backquotes.

Code: [Select]
#!/usr/local/bin/perl -w



$foo = `mycommand`;

print $foo;


You'd use this instead of "system", to run your oggenc command and capture the output in a perl variable.  Then you can do whatever you like with the information.

If, however, all you want to do is append to a text file, then you can use the ">>" redirection operator (in a Unix shell).  "echo hello world >>file" will append to the end of "file".  I don't know whether the NT CMD.EXE has that operator, and I think that the DOS COMMAND.COM doesn't.


Thanks for the advice. Unfortunately, me being the Perl-idiot, I couldn't get it to work.
I tried something like (for adding to a textfile)

open(loggie, ">> Encoding.log");
and
$status = ` '"C:Program FilesOgg Vorbis Encoderoggenc.exe"',
' -b ', '128',
' -N ', $num,
' -t ', '"'.$_.'"',
' -l ', '"'.$alb.'"',
' -a ', '"'.$art.'"',
' -d ', '2001',
' -o ', '"'.$filename.'.ogg"',
' "'.$wavfile.'"' `;

print ($status);
close(loggie);

*****
Didn't work at all. Can somebody be as kind as to enlighten me as to what I'm doing wrong? Basically i just want the final output from each encoding to be appended in a textfile named "Encoding.log"

Tagging
Reply #7
Quote
print ($status);

ITYM print loggie, $status;

Quote
Didn't work at all. Can somebody be as kind as to enlighten me as to what I'm doing wrong?


Possibly nothing. The trouble is, oggenc doesn't use stdout, it uses stderr.

Somebody should probably patch oggenc and let the vorbis-dev people know about it.