About Me · E-mail · Twitter
At GROSSWEBER we practice what we preach. We offer trainings for modern software technologies like Behavior Driven Development, Clean Code and Git. Our staff is fluent in a variety of languages, including English.
Time to release a major update for my Now Playing Plugin for Windows Live Writer. Over the last weeks some minor bugs surfaced, these have been fixed with the current release.
One thing that has been bugging me was that metadata placeholders were included into the resulting markup regardless of the actual content. Imagine you have the Amazon plugin enabled and the %AmazonAlbumUrl% placeholder somewhere in your markup template:
%AmazonAlbumUrl%
<a href="%AmazonAlbumUrl%">%Album%</a>
Later, while you're writing a new blog post you're listening to a mixtape that's not listed on Amazon. Because the Amazon plugin cannot find information about your mixtape, Now Playing will leave the placeholder as-is, resulting in bad markup taking your visitors into HTTP Hell™ filled with lots of peculiar errors messages (I've already seen this happening).
<a href="%AmazonAlbumUrl%">My Mixtape</a>
The new %if statement helps eliminating this shortcoming: Wrap any content that is linked to the availability of a particular placeholder in an %if statement and Now Playing will create perfectly valid markup. The syntax is pretty easy:
%if
%if(%placeholder%<content to insert if the placeholder holds a value>)
The example above, restructured to
%if(%AmazonAlbumUrl%<a href="%AmazonAlbumUrl%">)My Mixtape%if(%AmazonAlbumUrl%</a>)
yields
My Mixtape
<a href="http://www.amazon.com/…">My Mixtape</a>
Of course you can nest if statements to create dynamic templates. I work now with the following template:
<p class="nowPlaying"> Now Playing [<a title="Find out about Now Playing" href="http://therightstuff.de/Projects/NowPlaying/" rel="previewlink">?</a>]: %if(%MusicMapArtistUrl%<a href="%MusicMapArtistUrl%" title="Display relations of %Artist% to other artists">)%Artist%%if(%MusicMapArtistUrl%</a>) – %if(%Album%%if(%AmazonAlbumUrl%<a href="%AmazonAlbumUrl%" title="Display Amazon page of the %Album% album">)%Album%%if(%AmazonAlbumUrl%</a>) – ) %Title% </p>
See the %if(%Album%%if(%AmazonAlbumUrl%… nested if statements in line 4? I use this to get rid of the whole album part if I'm listening to a song from my mixed playlist where the music has no album tag.
%if(%Album%%if(%AmazonAlbumUrl%…
Now Playing's markup preview currently handles all placeholders as if they're holding values, so you may have to try a little the get your template working as you wish. In case you're having problems with the syntax, please leave a comment and I'll try to explain.
Other little things I've fixed:
Download Now Playing 2.3 Windows Live Writer Plugin Setup
Download Now Playing 2.3 Windows Live Writer Plugin
Download Now Playing 2.3 Source Code
Now Playing [?]: Wir sind Helden – Von hier an blind – Wütend genug
BTW, there's a new version available (NP 2.5) here.
I figure you would either have to back up and restore your registry and profile or re-enter everything (which is bad). I'm thinking about adding an export/import feature.
a@href@title, blockquote@cite, em, strike, strong, sub, sup, u