danmcb has asked for the wisdom of the Perl Monks concerning the following question:
I am writing a wma to mp3 converter, which preserves tags by using Audio::WMA and MP3::Tag
towards the end of the code, I have this:
$mp3->update_tags( $mp3_tags ); # write tags to tmp.mp3 . . copy( 'tmp.mp3', $target);
(I am using File::Copy copy because some files have all kinds of quotes and so on which make backticks, system, etc awkward. I guess I could have escaped them, but I went this way instead ... that's what modules are for, right?)
Here's the weird thing. My target file (in this case test.mp3) doesn't have tags, but tmp.mp3 does. the files are also a bit different in size:
root@trekulbollox:~/convert_wma# ls -l total 57864 -rwxr-x--- 1 root root 2595 2011-10-31 03:37 convert_wma.pl -rw-r--r-- 1 root root 0 2011-10-31 03:37 errors -rwxr-xr-x 1 root root 9913921 2011-10-31 03:01 original.wma -rw-r--r-- 1 root root 24627199 2011-10-31 03:38 test.mp3 -rw-r--r-- 1 root root 24627327 2011-10-31 03:38 tmp.mp3 root@trekulbollox:~/convert_wma# id3v2 -l tmp.mp3 id3v1 tag info for tmp.mp3: Title : Big Foot Artist: Stephen Riley Album : Easy to Remember Year: 2007, Genre: Jazz (8) Comment: Track: 2 tmp.mp3: No ID3v2 tag root@trekulbollox:~/convert_wma# id3v2 -l test.mp3 test.mp3: No ID3 tag
There is really nothing between the writing of tags and the copy that can do this. Is it possible that there is some kind of weird timing issue, where the tag is not flushed to the file before the copy happens?
I am sitting here thinking this must be a late night issue ... but there are no file operations at all between the two points. What is going on ... ?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: strange File::Copy issue
by mbethke (Hermit) on Oct 31, 2011 at 03:52 UTC | |
by MVS (Monk) on Oct 31, 2011 at 04:06 UTC | |
|
Re: strange File::Copy issue
by johnny_carlos (Scribe) on Oct 31, 2011 at 03:46 UTC | |
by rovf (Priest) on Oct 31, 2011 at 12:51 UTC | |
|
Re: strange File::Copy issue
by JavaFan (Canon) on Oct 31, 2011 at 09:39 UTC |