<?xml version="1.0" encoding="UTF-8"?>
<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>blog.humaneguitarist.org &#187; Python</title>
	<atom:link href="http://blog.humaneguitarist.org/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.humaneguitarist.org</link>
	<description>discoveries in digital audio, music notation, and information encoding</description>
	<lastBuildDate>Tue, 07 Feb 2012 03:33:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>AudioRegent 1.3.1 released</title>
		<link>http://blog.humaneguitarist.org/2011/07/28/audioregent-1-3-1-released/</link>
		<comments>http://blog.humaneguitarist.org/2011/07/28/audioregent-1-3-1-released/#comments</comments>
		<pubDate>Thu, 28 Jul 2011 22:31:52 +0000</pubDate>
		<dc:creator>nitin</dc:creator>
				<category><![CDATA[digital audio]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[apathy]]></category>
		<category><![CDATA[AudioRegent]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.humaneguitarist.org/?p=2954</guid>
		<description><![CDATA[I&#39;ve updated AudioRegent to version 1.3.1. You can read an overview of the software and get the download link to the new version here. The only reason I updated the software is because, as I&#39;ve mentioned before, I&#39;ve been having problems with Windows (and only recently at that) in terms of calling executables from the [...]]]></description>
			<content:encoded><![CDATA[<p>I&#39;ve updated AudioRegent to version 1.3.1.</p>
<p>You can read an overview of the software and get the download link to the new version <a href="http://blog.humaneguitarist.org/projects/audioregent/">here</a>.</p>
<p>The only reason I updated the software is because, as I&#39;ve mentioned <a href="http://blog.humaneguitarist.org/2011/04/26/dot-dot-slash-slash/">before</a>, I&#39;ve been having problems with Windows (and only recently at that) in terms of calling executables from the command line.</p>
<p>What seems to have helped is to no longer pass a command as a string a la:</p>
<pre class="brush:python">RunSoxString = SoxPath + &quot; ./outWavs/&quot; + OggArray[cnt] + ws + &quot;--comment-file comment.txt ./outOggs/&quot; + str(OggArray[cnt])[:-4] + &quot;.&quot; + outputType + ws + SoxOptions
RunSox = subprocess.Popen([RunSoxString], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
RunSox.wait() #wait until the subprocess finishes
</pre>
<p>Now, it seems I have to pass it as a Python list (aka an array):</p>
<pre class="brush:python">RunSoxString = SoxPath + &quot; ./outWavs/&quot; + OggArray[cnt] + ws + &quot;--comment-file comment.txt ./outOggs/&quot; + str(OggArray[cnt])[:-4] + &quot;.&quot; + outputType + ws + SoxOptions
import shlex
RunSoxList = shlex.split(RunSoxString)
RunSox = subprocess.Popen(RunSoxList, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
RunSox.wait() #wait until the subprocess finishes
</pre>
<p>By the way, I totally haven&#39;t tested this new version enough to distribute it and I haven&#39;t tested it at all on a Linux box. But since no one&#39;s using it, I&#39;m not too worried.</p>
<p><img alt="" src="http://blog.humaneguitarist.org/wp-content/plugins/fckeditor-for-wordpress-plugin/ckeditor/plugins/smiley/images/devil_smile.gif" title="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.humaneguitarist.org/2011/07/28/audioregent-1-3-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>fun with lxml</title>
		<link>http://blog.humaneguitarist.org/2011/03/07/fun-with-libxml/</link>
		<comments>http://blog.humaneguitarist.org/2011/03/07/fun-with-libxml/#comments</comments>
		<pubDate>Mon, 07 Mar 2011 17:13:08 +0000</pubDate>
		<dc:creator>nitin</dc:creator>
				<category><![CDATA[scripts]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[libxml]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[xml parsing]]></category>

		<guid isPermaLink="false">http://blog.humaneguitarist.org/?p=2271</guid>
		<description><![CDATA[First off, I don&#39;t consider myself a programmer. I just know enough to dabble even though I try and learn new stuff all the time in the hope that I &#8211; as someone in digital libraries &#8211; can occasionally write something that can serve the needs of others, rather than serving my ego. Don&#39;t get [...]]]></description>
			<content:encoded><![CDATA[<p>First off, I don&#39;t consider myself a programmer. I just know enough to dabble even though I try and learn new stuff all the time in the hope that I &#8211; as someone in digital libraries &#8211; can occasionally write something that can serve the needs of others, rather than serving my ego. Don&#39;t get me started on people who try and write software that has no utility other than patting themselves on the back &#8230;</p>
<p>Anyway, that&#39;s another post for another time.</p>
<p>So, the other day I got some questions/feature requests for <a href="http://vimeo.com/15098984">PubMed2XL</a> and so I started thinking about ways to tackle a few of the issues. It kinda makes me feel like a real programmer when people in the real world are asking about the software &#8211; but only for a few minutes before I make myself come back down to earth.</p>
<p><img alt=":/" src="http://blog.humaneguitarist.org/wp-content/plugins/fckeditor-for-wordpress-plugin/ckeditor/plugins/smiley/images/confused_smile.gif" title=":/" /></p>
<p>Currently, the software places into a spreadsheet cell the value of one XML element, the position of which is defined by the user in the <a href="http://blog.humaneguitarist.org/projects/pubmed2xl/#Changing">setup file</a>. But there may potentially be a need it seems to be able to concatenate ALL the values for a given element into one spreadsheet cell. So I wrote a little function to help me get started with that.</p>
<p>The code uses <a href="http://www.w3schools.com/xml/simple.xml">this</a> simple restaurant-based XML file from W3Schools and uses the awesome <a href="http://lxml.de/">lxml</a> Python library.</p>
<p>When run, it yields the following:</p>
<p><samp>&gt;&gt;&gt; <br />
	Calories for the first entree:<br />
	650<br />
	Calories for all entrees:<br />
	650; 900; 900; 600; 950<br />
	</samp></p>
<p>And here&#39;s the code:</p>
<pre class="brush:python">#import required modules (lxml is non-standard; it likely needs to be installed)
import urllib #makes it easy to read documents from the web!
from lxml import etree #great XML parser and more!
                       #see: http://lxml.de/

#retrieve values from an XML file
def ElementCherryPicker(xpathArg, positionArg):
    &#39;&#39;&#39;
    This places all the element values for the element passed as the
    &quot;xpathArg&quot; argument into a list called &quot;elementBox&quot;. It then returns
    the list item preceeding the one specified by the &quot;positionArg&quot; argument.
    This means passing a &quot;1&quot; equates to the first item in the list instead
    of the traditional &quot;0&quot;. If &quot;0&quot; is passed then the entire list will be
    returned as a string with a delimiter of &#39;; &#39;.
    &#39;&#39;&#39;
    positionArg = positionArg - 1
    elements = parseUrl.findall(xpathArg) #make list of all matching elements
    elementBox = [] #create empty list
    for element in elements:
        elementBox.append(element.text) #place element values into the list
    if positionArg != -1:
        try:
            elementBox = elementBox[positionArg]
        except:
            elementBox = [] #if no element at stated position exists,
                            #then make the list empty again
    else:
        delimiter = &#39;; &#39;
        elementBox = delimiter.join(elementBox)
    return elementBox

#define, open, read, and parse an XML file
url= &#39;http://www.w3schools.com/xml/simple.xml&#39;
readUrl = urllib.urlopen(url).read()
parseUrl = etree.XML(readUrl)

#print header and the values returned from ElementCherryPicker()
print &#39;Calories for the first entree:&#39;
print ElementCherryPicker(&#39;.//calories&#39;, 1)
print &#39;Calories for all entrees:&#39;
print ElementCherryPicker(&#39;.//calories&#39;, 0)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.humaneguitarist.org/2011/03/07/fun-with-libxml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>on adding an update checker to my Python programs</title>
		<link>http://blog.humaneguitarist.org/2010/11/05/adding-and-update-checker-to-my-python-programs/</link>
		<comments>http://blog.humaneguitarist.org/2010/11/05/adding-and-update-checker-to-my-python-programs/#comments</comments>
		<pubDate>Sat, 06 Nov 2010 01:59:27 +0000</pubDate>
		<dc:creator>nitin</dc:creator>
				<category><![CDATA[scripts]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[update checker]]></category>

		<guid isPermaLink="false">http://blog.humaneguitarist.org/?p=1855</guid>
		<description><![CDATA[As I&#39;ve been writing a few Python applications to share, I&#39;ve been wondering the last day or so about how to have the application check, upon startup, for updates. This is a pretty common feature in a lot of programs, so I&#39;ve been wondering how to do it. Here&#39;s what I came up for now. [...]]]></description>
			<content:encoded><![CDATA[<p>As I&#39;ve been writing a few <a href="http://blog.humaneguitarist.org/projects/">Python applications to share</a>, I&#39;ve been wondering the last day or so about how to have the application check, upon startup, for updates. This is a pretty common feature in a lot of programs, so I&#39;ve been wondering how to do it.</p>
<p>Here&#39;s what I came up for now. It should work.</p>
<p>Say I have an application called FooPython<span style="font-family: Arial,Verdana,sans-serif;"> </span>and its project folder is http://blog.humaneguitarist.org/uploads/FooPython/.</p>
<p>I can just maintain a small XML file in that directory called update.xml that would look like this:</p>
<p><code>&lt;versionInfo&gt;<br />
	&nbsp;&nbsp;&nbsp; &lt;currentVersion&gt;0.9.1&lt;/currentVersion&gt;<br />
	&nbsp;&nbsp;&nbsp; &lt;message&gt;Version 0.9.1 is now available!&lt;/message&gt;<br />
	&lt;/</code><code>versionInfo</code><code>&gt;<br />
	</code></p>
<p>Now all I&#39;d have to do is add code similar to that below in my application to alert the user of an update:</p>
<pre class="brush:python">import urllib
from lxml import etree #see: http://codespeak.net/lxml/

url = &quot;http://blog.humaneguitarist.org/uploads/FooPython/update.xml&quot; #not a real URL
update = urllib.urlopen(url).read()
root = etree.XML(update)
currentVersion = root.find(&quot;.//currentVersion&quot;)
currentVersionValue = currentVersion.text
message = root.find(&quot;.//message&quot;)
messageValue = message.text

if currentVersionValue != &quot;0.9.0&quot;: #assuming this code is for version 0.9.0
   print messageValue
</pre>
<p>All this does is go to the update.xml file and read the element values. If the &lt;currentVersion&gt; doesn&#39;t match the version specified within the source code itself then it will print the value of the &lt;message&gt; element.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.humaneguitarist.org/2010/11/05/adding-and-update-checker-to-my-python-programs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>South Park Launcher: Python and VB editions</title>
		<link>http://blog.humaneguitarist.org/2009/11/27/on-programming-and-south-park/</link>
		<comments>http://blog.humaneguitarist.org/2009/11/27/on-programming-and-south-park/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 14:12:34 +0000</pubDate>
		<dc:creator>nitin</dc:creator>
				<category><![CDATA[scripts]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[South Park]]></category>
		<category><![CDATA[Visual Basic]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://blog.humaneguitarist.org/?p=609</guid>
		<description><![CDATA[It seems that about a year ago, the creators of South Park started freely offering their episodes online at southparkstudios.com. The move was made, in part, to offer a legal way for fans without television access or even televisions (that&#39;s me!) to watch the show. As the creators stated,&#160; &#34;(we got) really sick of having [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">It seems that about a year ago, the creators of South Park started freely offering their episodes online at <a href="http://www.southparkstudios.com/">southparkstudios.com</a>.</p>
<p>The move was made, in part, to offer a legal way for fans without television access or even televisions (that&#39;s me!) to watch the show. As the creators stated,&nbsp;</p>
<blockquote>
<p><a href="http://www.wired.com/underwire/2008/03/south-park-to-o/">&quot;(we got) really sick of having to download our own show illegally all the time.&nbsp; So we gave ourselves a legal alternative.&quot;</a></p>
</blockquote>
<p>This was great for me because I admittedly was downloading those shows as well. One of the other great things about it is the <a href="http://www.southparkstudios.com/episodes/random.php">Random Episode</a> link which, you guessed it, launches a random episode of the show.</p>
<p>The only thing that makes it less than perfect is that I&nbsp;can&#39;t set it to repeatedly play more random episodes.</p>
<p>Until now.</p>
<p>I&nbsp;decided to sit down and write the most important code I may ever write:&nbsp;a program that leverages the Random Episode feature to launch successive random episodes of the great social commentary, courtesy of Matt and Trey.</p>
<p>Here&#39;s the core of the code, from a Python perspective:</p>
<pre class="brush:python">import sys, webbrowser, time

url = &#39;http://www.southparkstudios.com/episodes/random.php&#39;

i=1

while i &lt;= 5:
      webbrowser.open(url)
      time.sleep(1440) # 1440 seconds = 24 minutes, the average length of an episode plus ads.
      i=i+1
sys.exit()
</pre>
<p>Basically this is a loop that keeps launching a episode every 24 minutes while the variable &quot;i&quot; is less than or equal to 5. After every episode, &quot;i&quot; grows by one so when &quot;i&quot; equals 6, the program shuts down. BTW:&nbsp;after the program starts, the user does have to manually initiate playback of the first episode, but the last 4 episodes play automatically.</p>
<p>Now, this works fine and I even embellished the code so that the user can select from 2 to 10 episodes to launch. But I&nbsp;was still thinking, &quot;This would be great to share with my friends, but they aren&#39;t going to run software from the command line!&quot;</p>
<p>So I wrote a version using <a href="http://www.microsoft.com/express/download/">Microsoft&#39;s Visual Studio Express</a>, a free version of their software that allows one to create GUI applications with a mixture of visual tools and the Visual Basic language. It&#39;s a really great tool that I&nbsp;hope to use more in the future although I&nbsp;do worry about the extra time required just to make software have a graphical interface.</p>
<p><a name="ZIP"></a><strike>Anyway, <a href="http://blog.humaneguitarist.org/uploads/SouthParkLauncher.zip">here&#39;s a ZIP file</a> that contains both the installer for the Windows version of South Park Launcher as well as the Python version for Windows and other platforms. Make sure to read the ReadMe.txt file first!</strike></p>
<p><strong>You assume all responsibility for use</strong>.</p>
<p><strong>Update, March 14, 2010: </strong>Looks like the South Park site now requires one to click the &quot;play&quot; button to start each and every episode, so South Park Launcher isn&#39;t very useful anymore.</p>
<p>Oh well. It was fun while it lasted.</p>
<p><strong>Update, September, 2011:</strong> I&#39;ve removed the link to the ZIP file as it wasn&#39;t a good program nor should I have been distributing code so early in my coding experience. &nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.humaneguitarist.org/2009/11/27/on-programming-and-south-park/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MusicSQL: initial thoughts</title>
		<link>http://blog.humaneguitarist.org/2009/11/15/musicsql-initial-thoughts/</link>
		<comments>http://blog.humaneguitarist.org/2009/11/15/musicsql-initial-thoughts/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 20:54:25 +0000</pubDate>
		<dc:creator>nitin</dc:creator>
				<category><![CDATA[information retrieval]]></category>
		<category><![CDATA[music notation]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[Lilypond]]></category>
		<category><![CDATA[MusicSQL]]></category>
		<category><![CDATA[MusicXML]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.humaneguitarist.org/?p=493</guid>
		<description><![CDATA[One of the nice things about an emerging standard, namely MusicXML, having a command center (Recordare LLC) is having a central place to learn about what&#8217;s new. On Friday, I was looking at Recordare&#8217;s page of MusicXML related software for software that worked from the command line and noticed something new and really interesting: MusicSQL. [...]]]></description>
			<content:encoded><![CDATA[<p>One of the nice things about an emerging standard, namely MusicXML, having a command center (<a href="http://www.recordare.com/">Recordare LLC</a>) is having a central place to learn about what&rsquo;s new. </p>
<p>	On Friday, I was looking at Recordare&rsquo;s page of <a href="http://www.recordare.com/xml/software.html">MusicXML related software</a> for software that worked from the command line and noticed something new and really interesting: <a href="http://code.google.com/p/musicsql/">MusicSQL</a>.</p>
<p>	According the the Goodle Code page that hosts this project, MusicSQL is:</p>
<blockquote><p>&#8230; a system for conducting complex searches of symbolic music databases. The database can import and export MusicXML files. In the current version searches are constructed using a command line interface or through simple Python scripting tools.</p></blockquote>
<p>
	Basically, at least as I understand it, MusicSQL is a Python program that sits on top of a <a href="http://www.mysql.com/">MySQL</a> database &#8211; now I <strong>really</strong> hope Oracle doesn&rsquo;t kill MySQL <a href="http://news.cnet.com/the-iconoclast/8300-13578_3-38.html?keyword=Sun+Microsystems">if it buys Sun</a>. </p>
<p>	I was so excited to get MusicSQL working that I didn&rsquo;t notate all the little problems I had along the way. The <a href="http://musicsql.googlecode.com/files/ReadMe-0.1.2.pdf">documentation for MusicSQL</a> is very good and is written for Windows, Mac, and Linux (Ubuntu) users. But I&rsquo;m inconceivably impatient, so I just mowed through the installation with little care for remembering what I was doing. </p>
<p>	I do remember that I had to install Python 2.5, whereas I already have Python 2.6 installed &#8211; now I have both. I put/installed all the dependencies in my Python 2.5 directory just to compartmentalized everything &#8211; the exception being MySQL, which I installed wherever the default is. </p>
<p>	So far, I only ran the first query in the documentation that uses &quot;scientific&quot; musical notation in the form Nx, where &quot;N&quot; is the alphabetical note name, say C, and &quot;x&quot; is an integer that denotes what octave the note is a member of. In other words, a C-Major scale would be &quot;Cx Dx Ex Fx Gx Ax Bx Cx+1&quot;, something like &quot;C5 D5 &hellip; B5 C6&quot;, etc. You can place an integer <em>before </em>the note name to denote its duration. </p>
<p>	Running the query from the command line, I was really happy with the speed and the output of MusicSQL for the test query. </p>
<p>	One problem I did have, though, is I kept getting errors for another great feature of MusicSQL. Basically, after you run your query, you can see a PDF of the results (i.e. the music excerpt pertaining to the query results). The PDF is made by <a href="http://lilypond.org/">Lilypond</a>, a text-based notation software that produces &#8211; in my opinion &#8211; the absolute best looking engraving out there, that&rsquo;s why I use it (and yes, it&rsquo;s free). </p>
<p>	Now Lilypond doesn&rsquo;t natively read MusicXML, it uses its own encoding. So MusicSQL takes advantage of a Python script that comes with the Lilypond install called &quot;xml2ly&quot; that converts MusicXML to Lilypond format. I left a message on the project forum for MusicSQL, so I&rsquo;m hoping I can figure out what I need to do to get the Lilypond outout of the query results to work. At any rate, I do wonder how effective it can be since the conversion from MusicXML to Lilypond can sometimes get ugly. </p>
<p>	I wonder if an alternative solution is to use the <a href="http://www.musescore.org/en/developers-handbook/command-line-options">command line options for the MuseScore notation software</a> to generate a PDF of the query results. Musescore can also convert MusicXML to other graphics formats (PNG) and even audio (WAV, FLAC, OGG), so theoretically it could be leveraged to make audio files for the corresponding query results. </p>
<p>	At any rate, I&rsquo;m really looking forward to the future developments of MusicSQL. </p>
<p>	And as for using MuseScore&rsquo;s command line in conjunction with MusicXML and how it can add value to a web collection of MusicXML docs &#8211; there will be more to that later &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.humaneguitarist.org/2009/11/15/musicsql-initial-thoughts/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>an ID3 tag reporter: MyMusicReporter.py</title>
		<link>http://blog.humaneguitarist.org/2009/10/17/an-id3-tag-reporter-mymusicreporterpy/</link>
		<comments>http://blog.humaneguitarist.org/2009/10/17/an-id3-tag-reporter-mymusicreporterpy/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 01:12:48 +0000</pubDate>
		<dc:creator>nitin</dc:creator>
				<category><![CDATA[scripts]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[ID3]]></category>
		<category><![CDATA[MP3]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[XSL]]></category>

		<guid isPermaLink="false">http://blog.humaneguitarist.org/?p=361</guid>
		<description><![CDATA[I usually try to post to this blog once a week on average. That forces me to try to learn something or learn about something during the week that I&#160;can post about. Sometimes though I&#160;have to resort to things that I&#39;ve been sitting on for a while, like this Python script I&#160;wrote called MyMusicReporter. This [...]]]></description>
			<content:encoded><![CDATA[<p>I usually try to post to this blog once a week on average. That forces me to try to learn something or learn about something during the week that I&nbsp;can post about.</p>
<p>Sometimes though I&nbsp;have to resort to things that I&#39;ve been sitting on for a while, like this Python script I&nbsp;wrote called MyMusicReporter.</p>
<p>This program makes use of the id3reader module available <a href="http://nedbatchelder.com/code/modules/id3reader.html">here</a>. In other words, the program won&#39;t function without this module.</p>
<p>For those unfamiliar with Python, it supports the use of <a href="http://docs.python.org/tutorial/modules.html">modules</a>, which &#8211; as the name implies &#8211; is basically allowing the current Python program to take advantage of another, pre-existing Python program. At least that&#39;s how I&nbsp;understand it for now &#8230;</p>
<p>Anyway, MyMusicReporter does the following:</p>
<ol>
<li>it asks you to point it to a root directory on your computer,</li>
<li>it then finds all the MP3s in that folder and its subfolders,</li>
<li>it makes an XML file in the same directory as MyMusicReporter called MyMusicReport.xml which contains the Title, Performer, Track #, Year, and relative file path for each MP3,</li>
<li>it makes an XML stylesheet in the same directory as MyMusicReporter called MyMusicReport.xsl which makes MyMusicReport.xml look pretty in your web browser.&nbsp;</li>
</ol>
<p>Here&#39;s an example of how the XML looks with my home-grown schema:<span style="color: rgb(128, 128, 128);"><span class="pi"><br />
	</span></span></p>
<pre class="brush:xml">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;?xml-stylesheet type=&quot;text/xsl&quot; href=&quot;MyMusicReport.xsl&quot;?&gt;
&lt;MyMusicReport&gt;
    &lt;mp3&gt;
        &lt;title&gt;R2-DVD2&lt;/title&gt;
        &lt;performer&gt;Nitin Arora&lt;/performer&gt;
        &lt;track&gt;1&lt;/track&gt;
        &lt;year&gt;2008&lt;/year&gt;
        &lt;path&gt;r2_dvd2.mp3&lt;/path&gt;
    &lt;/mp3&gt;
&lt;/MyMusicReport&gt;</pre>
<p>Anyway, <a href="http://blog.humaneguitarist.org/uploads/MyMusicReporter.txt">here&#39;s the source code</a> for MyMusicReporter.py.</p>
<p><strong>You assume all responsibility for use</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.humaneguitarist.org/2009/10/17/an-id3-tag-reporter-mymusicreporterpy/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>something completely different: MyFolderMaker.py</title>
		<link>http://blog.humaneguitarist.org/2009/09/26/baby-python-script-myfoldermaker/</link>
		<comments>http://blog.humaneguitarist.org/2009/09/26/baby-python-script-myfoldermaker/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 18:34:35 +0000</pubDate>
		<dc:creator>nitin</dc:creator>
				<category><![CDATA[scripts]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[batch]]></category>
		<category><![CDATA[Monty Python]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://blog.humaneguitarist.org/?p=275</guid>
		<description><![CDATA[I haven&#39;t hidden the fact that this blog exists, in part, as a resume builder. And I&#160;think that programming skills are a valuable asset in digital libraries. Frankly, LIS programs need to address this to keep their graduates competitive. But that&#39;s another post altogether &#8230; Anyway, at work yesterday (Friday) I&#160;made a little Windows .bat [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#39;t hidden the fact that this blog exists, in part, as a resume builder. And I&nbsp;think that programming skills are a valuable asset in digital libraries. Frankly, LIS programs need to address this to keep their graduates competitive. But that&#39;s another post altogether &#8230;</p>
<p>Anyway, at work yesterday (Friday) I&nbsp;made a little <a href="http://en.wikipedia.org/wiki/Batch_file#Windows_NT">Windows .bat file</a> that creates a folder named after every line in a given plain text file.</p>
<p>When I&nbsp;came home, I&nbsp;napped until nearly midnight and woke up in an odd, creative state:&nbsp;when I&#39;m mostly mind and hardly any body. Whether I&#39;m hardly <em>anybody</em> is a matter of opinion.</p>
<p>I&nbsp;decided to make a fancier version of the batch file using <a href="http://www.python.org/about/">Python</a>, which is named after <a href="http://pythonline.com/">Monty Python&#39;s Flying Circus</a>. In all seriousness, that&#39;s a huge part of the reason I&nbsp;decided to start learning Python.</p>
<p>The program can do one of the following:</p>
<ol>
<li>Ask you to supply a path and then mimick the folder structure (all new folders are created inside a folder called &quot;MyFolderListFolder&quot; to prevent accidental messes).</li>
<li>Read from a plain text file of yours called &quot;MyFolderList.txt&quot; and make folders named for each line in the text file (all new folders are created inside a folder called &quot;MyFolderListFolder&quot; to prevent accidental messes). Subfolders can be made using this format (Unix/Linux users need to use forward slashes, Windows users can use either):</li>
</ol>
<p style="margin-left: 80px;">folder1</p>
<p style="margin-left: 80px;">folder1\subfolder</p>
<p style="margin-left: 80px;">folder2</p>
<ol start="3">
<li>Take you to this page if you&#39;d simply like to see the source code and learn more about it. Of course, .py files can be opened in a text editor so this is only really useful for the Windows .exe version I&nbsp;compiled with <a href="http://cx-freeze.sourceforge.net/">cx_Freeze</a>.</li>
</ol>
<p>The program has some error checking built in. For example, if your text file has blank rows or duplicates, it will alert you under most situations that there&#39;s a problem you need to fix.</p>
<p>The source code link is below if anyone is interested &#8230; real programmers likely will &#8211; and should &#8211; laugh, but I&#39;m still learning.</p>
<p>A text file of the program (i.e. source code) is available <a href="http://blog.humaneguitarist.org/uploads/MyFolderMaker.txt">here</a>.</p>
<p><strong>You assume all responsibility for use</strong>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.humaneguitarist.org/2009/09/26/baby-python-script-myfoldermaker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

