[PATCH] Fixes for UTF-8 metadata
dinkypumpkin
dinkypumpkin at gmail.com
Sun Oct 9 10:20:09 EDT 2011
This patch addresses problems in get_iplayer 2.80 first reported here:
http://lists.infradead.org/pipermail/get_iplayer/2011-October/002063.html
The patch should prevent this warning:
Wide character in print at get_iplayer.pl line 3530.
This warning is generated when writing an entry containing text encoded
in UTF-8 to the download history file.
The patch should also prevent this error:
Cannot decode string with wide characters at Encode.pm line 162.
(The error location will differ slightly between platforms)
This error is generated by an erroneous attempt to convert to UTF-8 some
text already encoded in UTF-8. This error will prevent MP4/M4A files
from being tagged, though the files should still be playable. My apologies
for the inconvenience.
This patch has been incorporated into the get_iplayer Git repo.
Instructions for updating are here:
https://github.com/dinkypumpkin/get_iplayer/wiki/instructions
PATCH:
1. Added UTF-8 output I/O layer to history file handle (History::add)
2. Removed unnecessary call to Encode::decode (Tagger::tag_metadata)
3. Fixed typo in --tag-utf8 description
---
get_iplayer | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/get_iplayer b/get_iplayer
index 340d005..640c66b 100755
--- a/get_iplayer
+++ b/get_iplayer
@@ -251,7 +251,7 @@ my $opt_format = {
tag_podcast => [ 1, "tagpodcast|tag-podcast!", 'Tagging', '--tag-podcast', "Tag downloaded radio and tv programmes as iTunes podcasts (requires MP3::Tag module for AAC/MP3 files)"],
tag_podcast_radio => [ 1, "tagpodcastradio|tag-podcast-radio!", 'Tagging', '--tag-podcast-radio', "Tag only downloaded radio programmes as iTunes podcasts (requires MP3::Tag module for AAC/MP3 files)"],
tag_podcast_tv => [ 1, "tagpodcasttv|tag-podcast-tv!", 'Tagging', '--tag-podcast-tv', "Tag only downloaded tv programmes as iTunes podcasts"],
- tag_utf8 => [ 1, "tagutf8|tag-utf8!", 'Tagging', '--tag-utf8', "AtomicParsley expects UTF-8 input"],
+ tag_utf8 => [ 1, "tagutf8|tag-utf8!", 'Tagging', '--tag-utf8', "AtomicParsley accepts UTF-8 input"],
# Deprecated
@@ -3520,7 +3520,7 @@ sub add {
return 0 if $opt->{nowrite};
# Add to history
- if ( ! open(HIST, ">> $historyfile") ) {
+ if ( ! open(HIST, ">>:utf8", $historyfile) ) {
main::logger "ERROR: Cannot write or append to $historyfile\n";
exit 11;
}
@@ -4282,10 +4282,6 @@ sub tag_metadata {
$meta->{$key} = $val;
}
}
- # expect input in UTF-8
- while ( my ($key, $val) = each %{$meta} ) {
- $meta->{$key} = decode("utf8", $val);
- }
return $meta;
}
--
1.7.7
More information about the get_iplayer
mailing list