<itunes:duration> wrong on RSS feed created by Jekyll - rss

I have a Jekyll site that I have a podcast feed that I created.
---
---
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<atom:link href="http://mikewills.me/rss-podcast.xml" rel="self" type="application/rss+xml" />
<title>{{ site.name }}</title>
<description>{{ site.description }}</description>
<link>{{ site.url }}</link>
{% for post in site.categories.podcast limit:15 %}
<item>
<title>{{ post.title }}</title>
<description>
<![CDATA[
{{ post.content | xml_escape }}
]]>
</description>
<pubDate>{{ post.date | date: "%a, %d %b %Y %H:%M:%S %z" }}</pubDate>
<link>{{ site.url }}{{ post.url }}</link>
<guid isPermaLink="true">{{ site.url }}{{ post.url }}</guid>
{% if post.podcasturl %}<enclosure url="{{ post.podcasturl }}" length="{{ post.podcastsize }}" type="{{ post.podcasttype }}" />{% endif %}
</item>
{% endfor %}
</channel>
</rss>
Everything else works except for the <itunes:duration> tag. When I enter in podcastlength: 2:07 it outputs as <itunes:duration>127.0</itunes:duration>. Based on what I have researched, this is how everyone else is outputting the length. For some reason Jekyll seems to be breaking that down to seconds instead of 2 minutes and 7 seconds. What might I be doing wrong here?
If you are interested, full RSS source is here and an example post is here.

Hey from the far future.
I ran in to exactly this issue last week. Spotify reached out to me explaning i had somehow managed to get a decimal number (instead of a time-stamp) in my podcast feed.
Hey I had this exact issue!
In my post.markdown file I had written:
audio_mp3_duration: 35:56
---
The fun thing with the liquid programming language here is that it will somehow try to calculate the above, so I had to specifically wrap my string like so:
audio_mp3_duration: '43:01'
---
Turns out it was this exact problem ;)

What #Julien Genestoux suggested worked.
"What if you put commas around "2.07" to force Jekyll to think of it as a string and hence not convert it? – Julien Genestoux Jul 30 at 13:31"

The <itunes:duration> tag must contain data in this format:
HH:MM:SS
therefore, in your specific case, 2 minutes and 7 seconds should be
<itunes:duration>2:07</itunes:duration>
See also the official podcast specs by Apple.
In case Jekyll doesn't convert the duration to the proper format, it could be a bug and you should notify the developers.

Related

How to match a pattern and replace all files in a directory using salt states?

Salt stack state to recursively loop over a directory
Added single and multiple quotes, that didn't help. I don't wish to specify each file for a file replace. I want to loop all files under dir for replace.
{% for file in "/path/{{ to }}/dir" %}
{{ file }}:
file.replace:
- name: {{ file }}
- pattern: /from/
- repl: /{{ to }}/
- backup: False
{% endfor %}
I tried single quotes and multiple quotes, but see the error:
":"ERROR: Minions returned with non-zero exit code
d01xyz011:
Data failed to compile:
----------
Rendering SLS 'base:projects.xyz.p-ser' failed: Jinja syntax error: unexpected '/'; line 140
Can we specify a directory in FOR Loop where we have multiple files to be replaced? Is there additional code that I am missing in the above FOR Loop? Please advise.
You can specify a files list and then do a for loop on it, like
{% set file_list = ['foo', 'bar', 'baz'] %}
{% for f in file_list %}
...
{% endfor %}
But I don't think {% for file in "/path/{{ to }}/dir" %} will do what you think it does: it won't create a list of files in the directory, you will need to create this list elsewhere or in another way and then give it to your for loop in Jinja.

'for' loop in a SaltStack SLS file

I have a pillar file containing data:
zones:
['us-east-1a','us-east-1b']
Now I want to apply a loop in one of the sls files. This is what I am trying:
{% for zone in salt['pillar.get']('zones') %}<br>
- {{zone}}<br>
{ %endfor %}
But it is throwing an error:
Bad Request: Value (['us-west-1a', 'us-west-1b'])
Can you please help me with that?
Use:
zones:
- 'us-east-1a'
- 'us-east-1b'

POEdit doesn't extract string in HTML tags

I'm having a problem with Laravel's blade templating syntax.
When having something like:
<input placeholder="{{ __('My Tooltip') }}" />
that string won't be founded by POEdit. But on same file if I had this:
<span>{{ __('My Tooltip') }}</span>
that's OK.
I've already added a new extractor with follow configs but the problem persists.
Command: xgettext --language=Python --add-comments=TRANSLATORS: --force-po -o %o %C %K %F
An item in keywords list: -k%k
An item in input files list: %f
Source code charset: --from-code=%c
Anyone can help me?
You lie to Poedit about the content of these files, pretending they are Python, even when they are very clearly not. It’s not at all surprising that it doesn’t work to your liking. What would be surprising would be if it did. In this case, the reason seems to be clear: xgettext’s Python parser, naively trusting you and hopelessly confused as the result, sees the " in there as a start of a string literal not prefixed with __ and so skips over it.
Fix it by doing what the documentation says: use a dedicated tool to extract the string. In laravel-gettext's case that means using this command:
php artisan gettext:update
(Upcoming Poedit 2.0 will have direct support for template languages like this, but until then, you need to use the CLI tools.)

google prettify: ada syntax

I am currently trying to highlight Ada code on my website using google prettify and a file I have found here.
However, I am not able to use the later file with prettify, and the automatic language detection messes up attributes with ' characters (such as Array'first or integer'image), and highlights them as string delimiters.
for instance, I have the following sample code, and I would like to have it formatted correctly in my page:
procedure mergesort (V: in out TV_integer; iterations: in out integer) is
-- {} => {V is sorted}
m : integer := (V'first + V'last) / 2;
begin -- mergesort
if V'length > 1 then
mergesort(V(V'first..m), iterations);
mergesort(V(m+1..V'last), iterations);
merge(V(V'first..m),V(m+1..V'last),V,iterations);
end if;
end mergesort;
Any help would be appreciated.
EDIT: I tried using a pre class="prettyprint lang-ada" tag so that it would use the lang-ada custom script, but without success.
I'm the author of the Ada lexer for google code prettify. To use it, add this to your page:
<head>
<!-- ... -->
<link href="css/prettify.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/prettify.js"></script>
<script type="text/javascript" src="js/lang-ada.js"></script>
</head>
<body onload="prettyPrint()">
Do not use the auto-loader, it won't use custom lexers (change the paths to where you put the files of google code prettify). After you have done that, you can highlight code on your website like this:
<pre class="prettyprint lang-ada"><code>
-- Ada code
</code></pre>
or if you're using markdown or something else that prevents you from adding classes to your tags:
<?prettify lang=ada?>
<pre><code>
-- here goes your Ada code
</code></pre>
By the way, the Ada lexer will mark Ada attributes with the class atn (which is colored violet by default). If you want them to have the same color as other code, just edit prettify.css.
Ada is not supported. A lexer has been submitted by fordprefect86, but has not (yet) been included.
See Issue 312 for more information

XSL, comparing dates to exclude any past events

I have an RSS of an events feed. I would like to hide previous events.
Assuming XML data subset of
<Navigation Name="ItemList" Type="Children">
<Page ID="x32444" URL="..." Title="Class..."
EventStartDate="20090831T23:00:00" EventEndDate="20090904T23:00:00"
EventStartTime="20090830T15:30:00" EventEndTime="20090830T18:30:00" Changed="20090830T20:28:31" CategoryIds="" Schema="Event"
Name="Class of 2010 BAKE SALE"/>
<Page ID="x32443" URL="x32443.xml?Preview=true&Site=&UserAgent=&IncludeAllPages=true&tfrm=4" Title="Class of 2010 BAKE SALE"
Abstract="Treat yourself with our famous 10-star FRIED ICE CREAM!" EventStartDate="20090831T23:00:00" EventEndDate="20090904T23:00:00"
EventStartTime="20090830T15:30:00" EventEndTime="20090830T18:30:00" Changed="20090830T20:25:35" CategoryIds="" Schema="Event"
Name="Class of 2010 BAKE SALE"/>
<Page ID="x32426" URL="x32426.xml?Preview=true&Site=&UserAgent=&IncludeAllPages=true&tfrm=4" Title="Tribute to ..."
Abstract="Event to recognize and celebrate the lifetime of leadership and service ..."
EventStartDate="20091206T00:00:00" EventEndDate="20091206T00:00:00" EventStartTime="20090828T23:00:00" EventEndTime="20090828T04:00:00"
Changed="20090828T22:09:54" CategoryIds="" Schema="Event" Name="Tribute to ...."/>
</Navigation>
How would I not include anything past today's date
<xsl:apply-template select="Page[#EventStartDate=notBeforeToday()]"/>
Easiest with XSL parameters that you set from outside.
<xsl:param name="today" select="'undefined'" />
<!-- time passes... -->
<xsl:apply-templates select="Page[#EventStartDate < $today]"/>
Your date format is such that you can compare it using string comparison, unless there are different timezones involved. You would simply set
20091001T00:00:00
as the param value for $today. Have a look into your XSLT processor's documentation to see how.
The alternative would be to use an extension function. Here it depends on which extension functions your XSLT processor supports, so this approach won't be portable.
For this purpose, i usually add an extra date attribute in the XML which contains the day number since year 1900.
for example #dateid='9876543' or #seconds="9876675446545"
then i can can easily compare with today or another variable in the XSL.
You can also use this technique to compare times using "Unix time" for example

Resources