<?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>eval.nu blog &#187; music</title>
	<atom:link href="http://eval.nu/blog/tag/music/feed/" rel="self" type="application/rss+xml" />
	<link>http://eval.nu/blog</link>
	<description></description>
	<lastBuildDate>Tue, 07 Sep 2010 08:38:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Managing your music library and digital audio player with musync</title>
		<link>http://eval.nu/blog/2010/03/05/managing-your-music-library-and-digital-audio-player-with-musync/</link>
		<comments>http://eval.nu/blog/2010/03/05/managing-your-music-library-and-digital-audio-player-with-musync/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 10:56:24 +0000</pubDate>
		<dc:creator><span property="dc:creator" resource="http://eval.nu/blog/2010/03/05/managing-your-music-library-and-digital-audio-player-with-musync/">Albin</span></dc:creator>
				<category><![CDATA[in English]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[musync]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://eval.nu/blog/?p=274</guid>
		<description><![CDATA[One of my few (or rather: my only) successful programming projects is musync. It began as a weekend hack to solve the growing problem of how to selectively synchronize music to my portable digital audio player into a somewhat coherent file/directory structure. Shortly after musync became practically usable, however, udoprog started hacking on it, and [...]]]></description>
			<content:encoded><![CDATA[<p>One of my few (or rather: my <em>only</em>) successful programming projects is musync. It began as a weekend hack to solve the growing problem of how to selectively synchronize music to my portable digital audio player into a somewhat coherent file/directory structure.</p>

<p>Shortly after musync became practically usable, however, <a href="http://github.com/udoprog">udoprog</a> started hacking on it, and <a href="http://github.com/udoprog/musync">the current version</a> is only loosely related to my old code (that was, for all I know, lost &#8212; for the better I believe). My current role in musync&#8217;s development is more or less reduced to finding bugs and hammering udo on IRC until he fixes them.</p>

<p>So, what musync does is it takes a number of music files (or folders if running in recursive mode) runs a specified command to add them to the file/folder structure according to a given rule, optionally filtering and/or replacing non-wanted characters in the process. The file-folder structure may for example be »artist/album/NN-title.ext«, and the add command could be simply copying the files.</p>

<p>But starting with recent musync versions, commands are Python lambda expressions, and can thus mean running several commands in sequence per file; I, for example, have my add command set to both copying the files to their calculated targets and then telling <a href="http://wiki.xmms2.xmms.se/wiki/Main_Page">xmms2</a>, my music player, to add them to its database. Here&#8217;s a code snippet for the relevant parts of musync.conf:
<code> </code>
<pre>[site]
root:           "/var/storage/Musik"
xmms2_sync_lib: lambda file: m.execute("/usr/bin/nyxmms2", "server", "import", file)
add:            lambda src, dest: (sh.copy(src, dest), xmms2_sync_lib(dest))</pre>
The rest of the file is, more or less, <a href="http://github.com/udoprog/musync/blob/master/share/musync.conf">the sample configuration file</a>; <code>sh</code> and <code>m</code> are imported in the <code>[import]</code> section as explained there, among other things, and they provide musync&#8217;s helper functions and the Python <code>shutil</code> library respectively.</p>

<p>To add newly ripped or downloaded music to my collection with musync, all I now need to do is running <code>musync -c site add &lt;files or directories&gt;</code>.</p>

<p>Other uses would include transferring music files (or directories) to a music player, optionally transcoding them to a format of choice in the process  (I keep my collection mostly in FLAC but transcode it to vorbis to save space when I put it on my DAP), maintaining multiple different directory structures of the same music files using (symbolic-) links or making a »shadow root« with sorted symbolic links to unsorted originals still left in the downloads/incoming directory.</p>
]]></content:encoded>
			<wfw:commentRss>http://eval.nu/blog/2010/03/05/managing-your-music-library-and-digital-audio-player-with-musync/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.339 seconds -->
