I am attempting to change the ID tags on my MP3 files, but before I do that, I have to remove the Read Only permission from the file, so that I can write to it. The documentation that comes with Win32::File is very vague, and I was wondering if there's any monks out there who understand this module. Thanks.
#!C:\Perl\bin\perl -w
use strict;
use File::Slurp;
use Win32::File;
use MP3::ID3v1Tag;
my @Directories=("C:\\MP3Disc1","C:\\MP3Disc2","C:\\MP3Disc3","C:\\MP3
+Disc4");
my $Dir;
my @Files;
my $File;
my $attr;
my $path;
my $MP3;
foreach $Dir(@Directories){
@Files=read_dir($Dir);
foreach $File(@Files){
$path=$Dir."\\".$File;
Win32::File::GetAttributes($path,$attr);
Win32::File::SetAttributes($path,$attr|NORMAL);
$MP3=new MP3::ID3v1Tag($path);
my($artist,$title)=split " - ",$File;
$MP3->set_artist($artist);
$MP3->set_title($title);
$MP3->save();
}
}
This is being done with ActiveState Perl 5.6 Build 626 on a Windows 95 system.
TStanley
--------
There's an infinite number of monkeys outside who want to talk to us
about this script for Hamlet they've worked out
-- Douglas Adams/Hitchhiker's Guide to the Galaxy
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.