<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>tools &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/tools/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Mon, 21 Apr 2025 07:58:13 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>tools &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[A love letter to electric power tools]]></title>
		<link>https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/</link>
					<comments>https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Mon, 25 Sep 2023 11:34:21 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[tools]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=47128</guid>

					<description><![CDATA[When I was seven or eight, I asked Santa to bring me a set of screwdrivers for Christmas. I wanted to take apart my toys to see how they worked. I also thought they might be useful on our upcoming holiday; if the aeroplane needed repairing mid-flight I&#039;d be able to help!  Santa heard my plea and delivered a set of screwdrivers. I used them for years. A few decades later and they&#039;re still in use - …]]></description>
										<content:encoded><![CDATA[<p>When I was seven or eight, I asked Santa to bring me a set of screwdrivers for Christmas. I wanted to take apart my toys to see how they worked<sup id="fnref:worked"><a href="https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#fn:worked" class="footnote-ref" title="Sadly, I never quite mastered the art of putting them back together again. So many R.A.T.S. never worked properly again after I'd finished with them." role="doc-noteref">0</a></sup>. I also thought they might be useful on our upcoming holiday; if the aeroplane needed repairing mid-flight I'd be able to help<sup id="fnref:help"><a href="https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#fn:help" class="footnote-ref" title="To this day I've never heard a plane's Captain announce over the tannoy &quot;Is there any one on board who has a screwdriver?&quot;" role="doc-noteref">1</a></sup>!</p>

<p>Santa heard my plea and delivered a set of screwdrivers<sup id="fnref:parents"><a href="https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#fn:parents" class="footnote-ref" title="It is also possible that my parents thought that screwdrivers were cheaper than whatever plastic junk was currently being advertised on TV." role="doc-noteref">2</a></sup>. I used them for years. A few decades later and they're still in use<sup id="fnref:use"><a href="https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#fn:use" class="footnote-ref" title="I honestly think they're the only birthday present from my pre-teen years I still have. All the He-Man toys slowly went to jumble-sales." role="doc-noteref">3</a></sup> - in fact, they're used a little <em>too</em> often.</p>

<p>For years I resisted the idea of an electric screwdriver. I don't know if it was pride, stubbornness, or a misplaced sense of machismo. I had two working hands, why <em>shouldn't</em> I exert my raw manly power and transform them into torque? Electric screwdrivers were for wimps!</p>

<p>And then, one day, I saw a <a href="https://amzn.to/46edz4t">USB-powered electric screwdriver</a> and though "fuck it, why not?"</p>

<p>It was a revelation!</p>

<p>All of a sudden the little jobs I'd been putting off for ages were easy to accomplish. When I was tired from a day of DIY, it was a breeze to screw things back together. My hands didn't hurt after grappling with a stuck screw. I became a full convert.</p>

<p>Last week I had to saw some fence panels to length. "No worries!" I thought, "I've got a hacksaw!"</p>

<p>Two hours of sweating in the hot sun, and with only half the panels cut, I gave in and got <a href="https://amzn.to/3Pp7Hi9">an electric jigsaw</a><sup id="fnref:jig"><a href="https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#fn:jig" class="footnote-ref" title="I also got a battery, extra blades, new gloves, eye protection, some masks, clamps, and a new drill. Oh, and a battery + charger. Because I am weak-willed and need all the toys." role="doc-noteref">4</a></sup>.  This weekend I did the rest in about 15 minutes with minimum sweating, swearing, and injury.</p>

<p>Why am I like this? Why do I struggle with the hard, manual way and only then reluctantly let tools help me?</p>

<p>I'm like this with computers as well. When I started programming in university, I was strictly a "type it in notepad" kinda guy. I couldn't afford an IDE<sup id="fnref:ide"><a href="https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#fn:ide" class="footnote-ref" title="Yes, that's how old I am. We had to pay for our C++ IDEs. And the compiler cost extra." role="doc-noteref">5</a></sup>. What did I need "syntax highlighting" for? Auto-complete was just for lazy programmers.</p>

<p>And then, one day, after banging my head against my desk once too often a class-mate induced me to switch.</p>

<p>The same happened with PHP. I spent ages hand-crafting things. Learning the hard way what worked and what didn't. Coming up with my own bespoke solutions until it was just too much for me to manage. And then <a href="https://shkspr.mobi/blog/2023/05/rewriting-openbenches-in-symfony/">I switched to the Symfony framework</a>.</p>

<p>In one sense, it is useful to do things manually. To learn what works and what doesn't. To understand where the limits of usefulness are. To be equipped to manage if you're stuck without tools.</p>

<p>And, it's helpful not to prematurely optimise. The British phrase "<a href="https://english.stackexchange.com/questions/257367/idiom-for-someone-who-buys-all-the-best-gear-to-do-something-before-they-even-ha">all the gear, no idea</a>" perfectly describes someone who grabs all the (expensive) tools without the faintest idea how they work and what to do with them<sup id="fnref:opp"><a href="https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#fn:opp" class="footnote-ref" title="Of course, I have the opposite problem. I spend months reading reviews and micro-optimising for the perfect cost/value ratio." role="doc-noteref">6</a></sup>.</p>

<p>I'm getting better, mind you. During my MSc, I asked for advice and started using <a href="https://shkspr.mobi/blog/2021/05/zotero-citations-to-markdown-via-csl/">Zotero</a> before getting too far down the manual route. That saved me a huge amount of time and heartache.</p>

<p>So, my plea to you - and to future me - remember that's it is OK to use tools. It isn't cheating. It isn't unseemly. Sometimes, it <em>isn't</em> about they journey you take, it <em>is</em> about the destination.</p>

<div id="footnotes" role="doc-endnotes">
<hr aria-label="Footnotes">
<ol start="0">

<li id="fn:worked">
<p>Sadly, I never quite mastered the art of putting them back together again. So many <a href="https://www.youtube.com/watch?v=OVUO5Mp2Flg">R.A.T.S.</a> never worked properly again after I'd finished with them.&nbsp;<a href="https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#fnref:worked" class="footnote-backref" role="doc-backlink">↩︎</a></p>
</li>

<li id="fn:help">
<p>To this day I've <em>never</em> heard a plane's Captain announce over the tannoy "Is there any one on board who has a screwdriver?"&nbsp;<a href="https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#fnref:help" class="footnote-backref" role="doc-backlink">↩︎</a></p>
</li>

<li id="fn:parents">
<p>It is also possible that my parents thought that screwdrivers were cheaper than whatever plastic junk was currently being advertised on TV.&nbsp;<a href="https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#fnref:parents" class="footnote-backref" role="doc-backlink">↩︎</a></p>
</li>

<li id="fn:use">
<p>I honestly think they're the only birthday present from my pre-teen years I still have. All the He-Man toys<sup id="fnref:toys"><a href="https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#fn:toys" class="footnote-ref" title="THEY'RE NOT DOLLS! THEY'RE ACTION FIGURES!" role="doc-noteref">7</a></sup> slowly went to jumble-sales.&nbsp;<a href="https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#fnref:use" class="footnote-backref" role="doc-backlink">↩︎</a></p>
</li>

<li id="fn:jig">
<p>I also got a battery, extra blades, new gloves, eye protection, some masks, clamps, and a new drill. Oh, and a battery + charger. Because I am weak-willed and need all the toys.&nbsp;<a href="https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#fnref:jig" class="footnote-backref" role="doc-backlink">↩︎</a></p>
</li>

<li id="fn:ide">
<p>Yes, that's how old I am. We had to <em>pay</em> for our C++ IDEs. And the compiler cost extra.&nbsp;<a href="https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#fnref:ide" class="footnote-backref" role="doc-backlink">↩︎</a></p>
</li>

<li id="fn:opp">
<p>Of course, I have the opposite problem. I spend months reading reviews and micro-optimising for the perfect cost/value ratio.&nbsp;<a href="https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#fnref:opp" class="footnote-backref" role="doc-backlink">↩︎</a></p>
</li>

<li id="fn:toys">
<p>THEY'RE NOT DOLLS! THEY'RE ACTION FIGURES!&nbsp;<a href="https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/#fnref:toys" class="footnote-backref" role="doc-backlink">↩︎</a></p>
</li>

</ol>
</div>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=47128&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2023/09/a-love-letter-to-electric-power-tools/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title><![CDATA[Screenscraping Album Artwork From The Linux Command Line]]></title>
		<link>https://shkspr.mobi/blog/2013/04/screenscraping-album-artwork-from-the-linux-command-line/</link>
					<comments>https://shkspr.mobi/blog/2013/04/screenscraping-album-artwork-from-the-linux-command-line/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Sun, 21 Apr 2013 09:23:28 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[album art]]></category>
		<category><![CDATA[cd]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tools]]></category>
		<guid isPermaLink="false">http://shkspr.mobi/blog/?p=8127</guid>

					<description><![CDATA[Like many people, I&#039;ve collected a fair number of CDs over the years.  As hard-drives and MicroSD cards have got larger and cheaper, I&#039;ve gradually been ripping them to FLAC.  Most CD rippers automatically tag the music files with the correct metadata and, nowadays, they will also download and embed album artwork as well.  (As an aside, it always boggled my mind that CDs don&#039;t come with metadata…]]></description>
										<content:encoded><![CDATA[<p>Like many people, I've collected a fair number of CDs over the years.  As hard-drives and MicroSD cards have got larger and cheaper, I've gradually been ripping them to FLAC.  Most CD rippers automatically tag the music files with the correct metadata and, nowadays, they will also download and embed album artwork as well.</p>

<p>(As an aside, it always boggled my mind that CDs don't come with metadata burned onto the disc. Even a single spare megabyte would be enough to hold detailed track listing, artwork, etc.)</p>

<p>Back when I started, there was no way to get album artwork.  Most media players will recognise that if a .jpg is in a folder with music, then it should be treated as the album artwork.  This file is usually called "cover.jpg" or "albumart.jpg" - but that's only convention; any name will do.</p>

<p>So, rather than re-rip all by CDs, I wrote a quick bash script to scrape the images from <a href="http://www.albumart.org">albumart.org</a>.  First the script and then some notes about the choices I made when writing it.</p>

<pre><code class="language-bash">#!/bin/bash -e
# get_coverart.sh
#
# This simple script will fetch the cover art for the album information provided on the command line.
# It will then download that cover image, and place it into the child directory.
#
# ./get_coverart.sh &lt;relative -path&gt;
#
# get_coverart Beatles/Sgt Pepper
#
# get_coverart Beatles/Sgt_Pepper
#
# get_coverart "Beatles - Sgt_Pepper"
#
# To auto-populate all directories in the current directory, run the following command
#
# find . -type d -exec ./get_coverart "{}" ;
albumpath="$1"

# Escape any problematic character
encoded="$(perl -MURI::Escape -e 'print uri_escape($ARGV[0]);' "$albumpath")"

# Skip if a cover.jpg exists in the directory
if [ -f "$albumpath/cover.jpg" ]
then
echo "$albumpath/cover.jpg already exists"
exit
fi

# Tell the user what is going on
echo ""
echo "Searching for: [$1]"

# scraping AlbumArt.org
url="http://www.albumart.org/index.php?skey=$encoded&amp;itempage=1&amp;newsearch=1&amp;searchindex=Music"
echo "Searching ... [$url]"

# Grab the first Amazon image without an underscore (usually the largest version)
coverurl=`wget -qO - "$url" | grep -m 1 -o 'http://ecx.images-amazon.com/images/I/*/[%0-9a-zA-Z.,-]*.jpg'`

echo "Cover URL: [$coverurl]"

# Save the imager
wget "$coverurl" -O "$albumpath/cover.jpg"
</code></pre>

<h2 id="notes"><a href="https://shkspr.mobi/blog/2013/04/screenscraping-album-artwork-from-the-linux-command-line/#notes">Notes</a></h2>

<p>I <a href="http://code.google.com/p/abcde/issues/detail?id=33#c8">originally suggested this as an enhancement</a> for the popular <a href="http://code.google.com/p/abcde/">ABCDE Linux ripper</a>.
It's based off <a href="https://web.archive.org/web/20150418143215/https://www.ludicrous-speed.com/wiki/index.php?title=How_To_Download_Album_Cover_Art">this older, now obsolete, script</a>.</p>

<h3 id="albumart-org-uses-images-from-amazon-com-why-not-just-use-the-amazon-api"><a href="https://shkspr.mobi/blog/2013/04/screenscraping-album-artwork-from-the-linux-command-line/#albumart-org-uses-images-from-amazon-com-why-not-just-use-the-amazon-api">AlbumArt.org uses images from Amazon.com - why not just use the Amazon API?</a></h3>

<p>The Amazon API is great but it requires that you <a href="https://web.archive.org/web/20130108015804/http://docs.aws.amazon.com/AWSECommerceService/2011-08-01/GSG/SubmittingYourFirstRequest.html">get an account with Amazon and include an API key with every request</a>.  That means you can't just dump the script on a box and start downloading - you'd need to configure it first?</p>

<h3 id="why-the-change-from-xpath"><a href="https://shkspr.mobi/blog/2013/04/screenscraping-album-artwork-from-the-linux-command-line/#why-the-change-from-xpath">Why the change from XPATH?</a></h3>

<p>I love XPATH and use it regularly.  What I found when deploying this script to a new Ubuntu install was that xmllint wasn't installed by default. On the other hand, grep is installed on every machine.  Seeing as how the Amazon images are a fixed pattern, a regular expression works just fine.</p>

<h3 id="what-if-there-are-multiple-results-from-a-search"><a href="https://shkspr.mobi/blog/2013/04/screenscraping-album-artwork-from-the-linux-command-line/#what-if-there-are-multiple-results-from-a-search">What if there are multiple results from a search?</a></h3>

<p>This will automatically download the first one.  As this is a command line tool, there's no practical way to display the various images.
I did look at ASCII art conversion, but that's problematic.
Some albums work well - e.g. Little Mix's DNA</p>

<pre>.=====+++O887?+++.+===~~INMNMMMMMN?~==~.
.=7I+=~~NMM8ND$=+.====~OMMMMMMMMMMMD~=~.
.~=+=ONMD8ZNNN88I.~~~~:MMMM=?MMMMMMMN=~.
.~==ZNN+:,,,N8ODO.:~~~=NMMZZ:$MMMMMMN=~.
.===NZNII..+O88ONI.=~:=,DM+$::7NMMMMN:~.
.+=7DD8,::~,,DD88O.OOIZOMMM~=7.+MMND+~,:
.=+8DND+,:~,=DD8DD~,8DZ+:NMZ?~?8MMMNNMO~
.==DNNNNI=++NDDNNDZ$MNOOOON7++IMMM8?==~M
.+?NMNNN78N8MNNNNNOI?+???I?I+=+IM8$+++I:
.=NMMMNDN==MNNMNMN$=+?8$I+?+==+???III==+
.8NMMMNN?=+M$IIII:I,77II7D?+~~=??:ONMNZ?
.MNMNMMZ7~+MO7~II:7=7???77$,......,:??=M
.MMMM8=.......,~=~=.I:I,7,I=+==+=====+=.
...,~=?8D878DO+~~~=?~=7++NNM8NNMD===+==.
.==~=~DD8DNNON8+7I=+?=78ND~:::~NNNI===~.
.==~~~NI:,,:I88+:~~~.~=8M?:,?,=+NOM7+=~.
.=~=~~8~,...,?8~~~~~.+=MDND:,I::8MMZ=+=.
.==~~~ZDD+.+7+$~~~~~,,~MM7:~=.,=DNNMI+=.
.~~~~:?:,~,,,7=:~::~~.+NMMI7:~:~NDNNN+=.
.~~==~:I,,,,~D::~:~~=.DMDNNI::O+NN8DN+=.
.====~=:,,,~N~:::~~==.N8NDDN+=~+DOODN$=.
.+====~D+,M~~,.,:====.ND8NNN+::=DD8OND=.
.??,++++I~,?+:,,:::~+87D8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Z+OD+NNNDN8DNDNNNN++I+$=ZDDDDDD8?
ONNDDNO8=D8NNNNDDZD8~NNNONNNNNN8NDDDDDD$
8D88ZNNNOONNNNNDDD$ODNDD8ZMNNDN8D8NNDDDI</pre>

<p>There are <a href="http://superuser.com/a/378787/140864">amazing tools like aview</a> - but again, that's an extra program which the user might not have.</p>

<p>If your album directories are sensibly named, the first hit is usually good enough.</p>

<h3 id="hang-on-theres-a-mistake"><a href="https://shkspr.mobi/blog/2013/04/screenscraping-album-artwork-from-the-linux-command-line/#hang-on-theres-a-mistake">Hang on! There's a mistake!</a></h3>

<p>Quite probably, this is a quick and dirty script. I'm sure there are lots of edge case and (no-doubt) some poor coding practices.  If you wish to contribute a patch, please drop it in the comments.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=8127&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2013/04/screenscraping-album-artwork-from-the-linux-command-line/feed/</wfw:commentRss>
			<slash:comments>9</slash:comments>
		
		
			</item>
	</channel>
</rss>
