[PATCH] Added --no-artwork option

dinkypumpkin dinkypumpkin at gmail.com
Fri Jul 27 09:40:25 EDT 2012


I've seen a few requests to have the ability to exclude artwork
(interferes with visualizations in Totem, etc.), so I thought I'd
make the small changes necessary.

This patch has been incorporated into the get_iplayer Git repo.
Instructions for updating are here:

https://github.com/dinkypumpkin/get_iplayer/wiki/githead

Commit message and patch follow.

When --no-artwork is specified, thumbnail image is not embedded in
output file.  All other metadata values are written.
---
 get_iplayer   |    7 ++++---
 get_iplayer.1 |    3 +++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/get_iplayer b/get_iplayer
index e0cc349..937b94f 100755
--- a/get_iplayer
+++ b/get_iplayer
@@ -245,6 +245,7 @@ my $opt_format = {
 	mplayer		=> [ 1, "mplayer=s", 'External Program', '--mplayer <path>', "Location of mplayer binary"],
 
 	# Tagging
+	noartwork => [ 1, "noartwork|no-artwork!", 'Tagging', '--no-artwork', "Do not embed thumbnail image in output file.  All other metadata values will be written."],
 	notag => [ 1, "notag|no-tag!", 'Tagging', '--no-tag', "Do not tag downloaded programmes"],
 	tag_cnid => [ 1, "tagcnid|tag-cnid!", 'Tagging', '--tag-cnid', "AtomicParsley supports --cnID argument to add catalog ID used for combining HD and SD versions in iTunes"],
 	tag_fulltitle => [ 1, "tagfulltitle|tag-fulltitle!", 'Tagging', '--tag-fulltitle', "Use complete title (including series) instead of shorter episode title"],
@@ -4309,7 +4310,7 @@ sub tag_file {
 	# return if file does not exist
 	return if ! -f $prog->{filename};
 	# download thumbnail if necessary
-	$prog->download_thumbnail if ( ! -f $prog->{thumbfile} );
+	$prog->download_thumbnail if ( ! -f $prog->{thumbfile} && ! $opt->{noartwork} );
 	# create metadata
 	my $meta = $prog->tag_metadata;
 	# tag file
@@ -9623,7 +9624,7 @@ sub tag_file_id3 {
 			$mp3->select_id3v2_frame_by_descr('TGID', $tags->{podcastGUID});
 		}
 		# add artwork if available
-		if ( -f $meta->{thumbfile} ) {
+		if ( -f $meta->{thumbfile}  && ! $opt->{noartwork} ) {
 			my $data;
 			open(THUMB, $meta->{thumbfile});
 			binmode(THUMB);
@@ -9768,7 +9769,7 @@ sub tag_file_mp4 {
 			);
 		}
 		# add artwork if available
-		push @cmd, ( '--artwork', $meta->{thumbfile} ) if -f $meta->{thumbfile};
+		push @cmd, ( '--artwork', $meta->{thumbfile} ) if ( -f $meta->{thumbfile} && ! $opt->{noartwork} );
 		# run atomicparsley command
 		if ( main::run_cmd( 'STDERR', @cmd ) ) {
 			main::logger "WARNING: Failed to tag \U$meta->{ext}\E file\n";
diff --git a/get_iplayer.1 b/get_iplayer.1
index 029e5de..f4f2dda 100644
--- a/get_iplayer.1
+++ b/get_iplayer.1
@@ -492,6 +492,9 @@ Location of mplayer binary
 Location of vlc or cvlc binary
 .SS "Tagging Options:"
 .TP
+\fB\-\-no\-artwork
+Do not embed thumbnail image in output file.  All other metadata values will be written.
+.TP
 \fB\-\-no\-tag
 Do not tag downloaded programmes
 .TP
-- 
1.7.9.6 (Apple Git-31.1)




More information about the get_iplayer mailing list