<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Editing Media Tags from PowerShell</title>
	<atom:link href="http://huddledmasses.org/editing-media-tags-from-powershell/feed/" rel="self" type="application/rss+xml" />
	<link>http://HuddledMasses.org/editing-media-tags-from-powershell/</link>
	<description>You can do more than breathe for free...</description>
	<pubDate>Wed, 15 Oct 2008 02:07:58 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.2</generator>
		<item>
		<title>By: Zack</title>
		<link>http://HuddledMasses.org/editing-media-tags-from-powershell/#comment-151095</link>
		<dc:creator>Zack</dc:creator>
		<pubDate>Mon, 14 Apr 2008 01:17:38 +0000</pubDate>
		<guid isPermaLink="false">http://HuddledMasses.org/editing-media-tags-from-powershell/#comment-151095</guid>
		<description>I had a bunch of mp3 files that did not have the artist or song title marked on the file (correctly).  All the file names came over CollectionTrack#-Artist-SongTile (eq: 001 - Led Zeppelin - Stairway To Heaven).  Here is the code that I used to label this files correctly.  This would have a problem for files that have "-" somewhere in the artist or song title.  But it worked well enough.

[Reflection.Assembly]::Load("taglib-sharp, Version=2.0.3.0, Culture=neutral, PublicKeyToken=db62eba44689b5b0")
cd F:\Music\500Rock
foreach ($f in dir)
{	
	$media = [TagLib.File]::Create("F:\Music\500Rock\" + $f.ToString())
	$newName = $f.Name
	$splitName = $newName.Split("-")		
	
	$i = 1
	
	foreach($p in $splitName)
	{
		switch ($i)
		{
			2{$media.Tag.Performers= $p.ToString()}
			3{$media.Tag.Title= $p.ToString()}
		}
		$i++
	}
	$media.Tag.Album = ""
	$media.Save()
	Rename-Item $f -NewName ($splitName[2].ToString())
}</description>
		<content:encoded><![CDATA[<p>I had a bunch of mp3 files that did not have the artist or song title marked on the file (correctly).  All the file names came over CollectionTrack#-Artist-SongTile (eq: 001 &#8211; Led Zeppelin &#8211; Stairway To Heaven).  Here is the code that I used to label this files correctly.  This would have a problem for files that have &#8220;-&#8221; somewhere in the artist or song title.  But it worked well enough.</p>
<p>[Reflection.Assembly]::Load(&#8220;taglib-sharp, Version=2.0.3.0, Culture=neutral, PublicKeyToken=db62eba44689b5b0&#8221;)<br />
cd F:\Music\500Rock<br />
foreach ($f in dir)<br />
{<br />
	$media = [TagLib.File]::Create(&#8220;F:\Music\500Rock\&#8221; + $f.ToString())<br />
	$newName = $f.Name<br />
	$splitName = $newName.Split(&#8221;-&#8221;)		</p>
<p>	$i = 1</p>
<p>	foreach($p in $splitName)<br />
	{<br />
		switch ($i)<br />
		{<br />
			2{$media.Tag.Performers= $p.ToString()}<br />
			3{$media.Tag.Title= $p.ToString()}<br />
		}<br />
		$i++<br />
	}<br />
	$media.Tag.Album = &#8220;&#8221;<br />
	$media.Save()<br />
	Rename-Item $f -NewName ($splitName<sup class="footnote"><a href="#fn185698504448f5507edd55c">2</a></sup>.ToString())<br />
}</p>
]]></content:encoded>
	</item>
</channel>
</rss>
