Size of a binary item

10 views
Skip to first unread message

Andy Drop

unread,
Apr 9, 2013, 6:11:38 AM4/9/13
to na...@googlegroups.com
Hi,
 
 i just ran in a problem, to which i see no solution
 
I have some *.WAV file which i convert to *.MP3 via a binary filter. So far no problem.
 
Now i want to include this MP3 file into an RSS Feed to create a Podcast-Feed. The enclosure Tag needs to give the size of that MP3 file.
How do i get the size of that file?
 
I could use the filesystem libs, if i would know the routed path of that output file, and if it would be sure, that the outputfile already exists, when the rss feed is created.
 
Is that sure?
Can i do something to ensure that?
 
Andy
 
 

Denis Defreyne

unread,
Apr 28, 2013, 7:53:35 AM4/28/13
to na...@googlegroups.com
Hi Andy,

This is a situation for which nanoc doesn’t have convenience methods yet :)

In your RSS feed, you need to create a hard dependency on all the MP3 files. You’d do this by starting the RSS feed with this:

# Create dependencies
mp3_items.each do |item|
Nanoc::NotificationCenter.post(:visit_started, item)
Nanoc::NotificationCenter.post(:visit_ended, item)
end

# Require compilation
mp3_items.each do |item|
rep = item.reps.find { |r| !r.compiled? }
raise Nanoc::Errors::UnmetDependency.new(rep) if rep
end

(Assuming mp3_items contains all items included in the RSS feed.)

I’ll see about adding a much nicer built-in way of doing this in nanoc by default!

Denis
> --
> --
> You received this message because you are subscribed to the nanoc discusssion group.
>
> To post to this group, send email to na...@googlegroups.com
> To unsubscribe from this group, send email to
> nanoc+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nanoc?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups "nanoc" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to nanoc+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Reply all
Reply to author
Forward
0 new messages