From f2ceb03d0ce91b311d898f289de30c9f1da3e362 Mon Sep 17 00:00:00 2001 From: Thomas Gideon Date: Thu, 16 Sep 2010 17:51:12 -0400 Subject: [PATCH] Finished m4a support. --- append.py | 40 +++++++++++++++++++++++++++++++++++++--- cmdln_m4a.xml | 33 +-------------------------------- 2 files changed, 38 insertions(+), 35 deletions(-) diff --git a/append.py b/append.py index 09d08b2..1568190 100644 --- a/append.py +++ b/append.py @@ -4,6 +4,7 @@ import urllib2 from urllib2 import HTTPError, URLError import logging import re +from BeautifulSoup import BeautifulSoup def __fetch_feed(url): try: @@ -18,7 +19,7 @@ def __fetch_feed(url): logging.debug('Network failure reason, %s.' % e.reason) return None -def __append(entry, suffix, append_fn): +def __append(entry, suffix, append_fn, args=None): latest = __fetch_feed('cmdln_%s.xml' % suffix) if entry.title.find(latest.title) != -1: logging.info('Up to date.') @@ -29,14 +30,14 @@ def __append(entry, suffix, append_fn): try: for line in f: if line.find('') != -1 and not first: - append_fn(entry, o, suffix) + append_fn(entry, o, suffix, args) first = True o.write(line) finally: f.close() -def __append_non_itunes(entry, output, suffix): +def __append_non_itunes(entry, output, suffix, args): (url, mime_type, size) = __enclosure(entry.enclosures, 'http://cmdln.evenflow.nl/mp3', suffix) output.write(""" %(title)s (Comment Line 240-949-2638) @@ -57,6 +58,38 @@ def __append_non_itunes(entry, output, suffix): logging.info('Inserted new %s item.' % suffix) +def __append_itunes(entry, output, suffix, args): + description = __description(entry.content) + soup = BeautifulSoup(description) + summary = '\n\n'.join([''.join(p.findAll(text=True)) for p in soup.findAll('p')]) + (url, mime_type, size) = __enclosure(entry.enclosures, 'http://traffic.libsyn.com/cmdln', suffix) + output.write(""" + %(title)s (Comment Line 240-949-2638) + %(link)s + + %(pubDate)s + + %(permalink)s + Thomas Gideon + %(subtitle)s + %(summary)s + no + %(duration)s + +""" % { 'title': entry.title, + 'link': entry.link, + 'description': description, + 'pubDate' : entry.date, + 'permalink' : __permalink(entry.title), + 'url' : url, + 'mime_type' : mime_type, + 'size' : size, + 'subtitle' : ''.join(soup.contents[0].findAll(text = True)), + 'summary' : summary, + 'duration' : args[1] }) + logging.info('Inserted new %s item.' % suffix) + + def __permalink(title): permalink = title.lower() permalink = re.sub('-', '', permalink) @@ -97,6 +130,7 @@ def main(): __append(entry, 'mp3', __append_non_itunes) __append(entry, 'ogg', __append_non_itunes) + __append(entry, 'm4a', __append_itunes, sys.argv) if __name__ == "__main__": diff --git a/cmdln_m4a.xml b/cmdln_m4a.xml index 60ee4ad..ad27e85 100644 --- a/cmdln_m4a.xml +++ b/cmdln_m4a.xml @@ -32,37 +32,6 @@ http://feeds2.feedburner.com/cmdln-enhanced no - - TCLP 2010-09-15 Interview: Randy Chertkow of Beatnik Turtle (Comment Line 240-949-2638) - http://thecommandline.net/2010/09/15/beatnik_turtle4/ - This is a feature cast, an episode of The Command Line Podcast.

- -

There is no new hacker word of the week this week.

- -

The feature this week is the interview I recorded with Randy Chertkow of Beatnik Turtle. If you are interested, here are the 2007, 2008, and 2009 interviews as well. In the interview, we mention the Indie Guide web site, Randy and Jason's columns at Electronic Musician, and TrackMyDisc.com.

- -

More news and commentary and alternate feeds available at http://thecommandline.net/. View the detailed show notes online. You can grab the flac encoded audio from the Internet Archive.

- -

Creative Commons License

- -

This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

]]>
- Wed, 15 Sep 2010 21:29:57 -0400 - - tclp-20100915-interview-randy-chertkow-of-beatn - Thomas Gideon - This is a feature cast, an episode of The Command Line Podcast. - This is a feature cast, an episode of The Command Line Podcast. - -There is no new hacker word of the week this week. - -The feature this week is the interview I recorded with Randy Chertkow of Beatnik Turtle. If you are interested, here are the 2007, 2008, and 2009 interviews as well. In the interview, we mention the Indie Guide web site, Randy and Jason's columns at Electronic Musician, and TrackMyDisc.com. - -More news and commentary and alternate feeds available at http://thecommandline.net/. View the detailed show notes online. You can grab the flac encoded audio from the Internet Archive. - -This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License. - no - 1:06:44 -
TCLP 2010-09-08 Creative Commons, Legal Issue Panel from Dragon*Con 2010 (Comment Line 240-949-2638) http://thecommandline.net/2010/09/08/dragoncon_cc_4/ @@ -3600,4 +3569,4 @@ This work is licensed under a Creative Commons Attribution-Noncommercial-Share A 20:03 - \ No newline at end of file +