Copy calculated bpm data from algoriddim djay to iTunes using Applescript

It’s been a long time since I’ve messed with Apple­script.

I mod­i­fied a script I found on the algo­rid­dim forums. This script would run through all tracks that were ana­lyzed in djay and try to write the bpm data to the mp3 tag in iTunes. If your library is large, this could take days.

My mod­i­fied script will take the cur­rent­ly select­ed tracks in iTunes and look for bpm data in the djay meta­da­ta plist file. Poten­tial­ly a much small­er and more focused task.

[UPDATED 29 Feb 2012]
I have includ­ed sup­port for man­u­al­ly-set bpm val­ues, which are stored by djay in a sep­a­rate plist file.

[UPDATED 29 Mar 2012]
I have includ­ed sup­port for copy­ing key data to iTunes, with trans­la­tion of djay’s inte­ger val­ue to string rep­re­sen­ta­tion

[UPDATED 23 Dec 2012]
Bug­fix: reset bpm vari­ables in script to pre­vent old val­ues from being held in mem­o­ry for the next track. Thanks, Kieron Thor­pe!

[UPDATED 22 Jan 2013]
Bug­fix: tracks with a key of 8B-C were being skipped. Thanks, recolton­Robert!
Enhance­ment: warn user if no tracks are select­ed in iTunes.

Down­load “Get bpm and key from Djay.scpt”

Solution to “display:table-row” causing pain and suffering with IE

I recent­ly came up against a sit­u­a­tion where I want­ed to add rows to a table via javascript.

Not a prob­lem with jQuery, EXCEPT that my table rows were being added with ‘style=“display:block“‘.

What’s wrong with that, you ask? Well, in Fire­fox the row was being append­ed to the table but it looked all scrunched into the first cell like so:

borkedtablerow

OK, fine. Let’s give it a dis­play prop­er­ty of “table-row.” That should work, right? Yes, it works here but not in IE. IE hates this, in fact. IE wants to get a dis­play of “block.”

The solu­tion turns out to be to set the dis­play val­ue to an emp­ty string. Then, each brows­er will give the row its default val­ue and every­one is hap­py.

source: http://cormacscode.wordpress.com/2008/11/28/show-hide-table-row-in-firefox-versus-ie/

Internet Explorer image resizing tip

Who knew?

Though it’s not best prac­tice to resize images in the brows­er this could real­ly be use­ful in the right sit­u­a­tion:

  1.  
  2. img { -ms-interpolation-mode: bicubic; }
  3.  

This lit­tle snip­pet will vast­ly improve the image resiz­ing abil­i­ties of ie — bring­ing it clos­er to the resized image qual­i­ty expe­ri­enced with Fire­fox or Safari.

exam­ple

[seen at devthought via css-tricks]

Problem with input focus on Safari

I had a javascript hic­cup, and I think the solu­tion may be help­ful to oth­ers.

The basic set­up is this:

Lim­it­ed space means no room for labels in a login form. So instead we used a pre­set val­ue in the input ele­ments, like so:

  1.  
  2. <input value="Username" name="username" type="text" />
  3. <input value="Password" name="password" type="text" />
  4.  

Which looks like this:



The easy way to blank out the descrip­tive text is to use the onfo­cus event like so:

  1.  
  2. onfocus="this.value=''"
  3.  

Con­tin­ue read­ing “Prob­lem with input focus on Safari”