Ryan Harrison My blog, portfolio and technology related ramblings

C# - MP3 Tag Renaming

After a recent migration away from iTunes (thankfully), I realised that a lot of the tags for my music files were pretty messy (thanks iTunes). Particularly the title tags for a few albums consisted of the artist name, a dash, and then the actual title of the song itself. For example album artist - song title. This quickly got annoying when scrolling through my library.

It seemed like a good opportunity to play with the Id3Lib library for C#.

This small C# utility app traverses through a directory structure looking for for all files within with the .mp3 extension. A new instance of Mp3File is then created which allows pretty comprehensive modification of the residing ID3 tags which can be accessed through the TagHandler property. In this example a small Regex is used to remove the artist from the title and update the file.

using System;  
using System.IO;  
using System.Text.RegularExpressions;  
using Id3Lib.Exceptions;  
using Mp3Lib;

namespace Mp3Renamer  
    class Program  
        static void Main()  


        static void IterateFiles(string path)  
            var files = Directory.GetFiles(path, "*.mp3″, SearchOption.AllDirectories);  
            var length = files.Length;  
            var count = 0;

            foreach (var file in files)  
                    var mp3 = new Mp3File(file);

                    var title = mp3.TagHandler.Title;  
                    var artist = mp3.TagHandler.Artist;

                    title = Regex.Replace(title, @"^" + artist + @"\s\*-\s\*", "", RegexOptions.IgnoreCase).Trim();

                    mp3.TagHandler.Title = title;


                    if (count % 100 == 0)  
                        Console.WriteLine("Done " + count + " files of " + length);

                catch (InvalidFrameException e)  

This is just one of the many uses of this library which is really easy to get to grips with. The only problem I’ve had so far is with `‘Invalid UTF-8 strings’ in some of my files. But I guess that’s a problem on my side and not with the library.

Check out the ID3Lib for C#.

Read More

[Link] Java 8 Lambda's - A Glossary of Terms

As a follow up to a previous post about the new features that Java 8 will bring to the table, here is another good link that covers some of the new terminology the update will introduce. As the new lambda expressions and streams API are likely to be the most used features of Java 8, it’s never too early to brush up on some of the new classes.

A conversational guide for JDK8′s lambdas - a glossary of terms

Read More

Free GitHub Micro Plan for Students

GitHub is a great service that I use often to host my personal projects. Their free accounts offer an unlimited number of public repositories where your code is visible to anyone visiting your profile. This is great for any open source work, but not so good for coursework projects where you really want to keep your source code private (at least until the deadline).

Handily though, if you are a student GitHub will give you a free Micro plan for a few years to help in your studies. This plan comes with 5 private repositories and of course you are still able to create an unlimited number of public ones.

All you need is a valid academic email address that has been added to your GitHub and you are good to go.

Sign yourself up here: https://github.com/edu

Read More

[Link] Everything About Java 8

As the release of Java 8 looms ever closer and closer, here is some good information about what new changes to expect. Unlike Java 7 this release does seem to actually include some useful features including lambda’s which can be neatly integrated with the new streams API and a much needed new date/time API.

Everything About Java 8

Read More

Chrome Resolving Host Fix

So recently I came up against the ‘Resolving Host’ problem in Chrome that temporarily grinds the browser to a complete halt. There seems to be a lot of people who are having the same problems, yet no real solution that works for any substantial amount of time.

The current fixes take the form of unchecking the ‘Predict network actions to improve page load performance’ checkbox under the advanced settings section of Chrome. On a completely updated system, for me however, this didn’t seem to work.

After a ton of searches and many trials I think I’ve found a solution that really works (well for me anyways):

Disable the ‘Built-in Asynchronous DNS’ functionality of Chrome by:

  1. Navigate to chrome://flags
  2. Find Built-in Asynchronous DNS (about halfway down the page)
  3. Disable it and then restart Chrome

I’ve been using this fix for over a month now and the problem seems to have disappeared completely.

Read More