Be a Supporter!

DJ-RiDJ-Ri

Main News Favorites Reviews Stats 9 Fans
Follow DJ-Ri
DJ-Ri
  • Add Friend
Age / Gender:
25, Male
Location:
Cyberspace
Joined:
1/26/03
All Stats >

Credit to Abner Diaz for creating the original Shotgun Man

User Statshot

Community Stats
Level 9 Blank Slate
Normal Whistle
Ranked as Town Watch

Contact Info / Websites

Latest News

mp3reclaimer

2015-06-27 09:43:24 by DJ-Ri

So the other day my mom's iPod spontaneously lost the ability to play music for some stupid reason. She took it to one of those so-called "geniuses", who basically told her she needs to reformat the iPod. He told her that she could just transfer her songs from the iPod onto her computer, reformat the iPod, and then load her songs back onto it. Well, it turns out that it's not quite so easy to do that!

As it turns out, Apple don't actually offer any such feature to allow users to transfer their own music from their iPod onto their computer. I'm not entirely sure why this is, but I suspect it's some kind of half-assed measure to prevent people from pirating mp3s. Either way, I think it's pretty stupid and annoying that they don't offer this basic functionality.

After struggling to find a decent freeware solution for transferring music from an iPod onto a computer, I decided to take a crack at coding one myself. The iPod can be put into "disk mode" which allows you to access the filesystem on the iPod and retrieve the mp3 files. The only problem is that Apple renames the mp3s to a bunch of seemingly random filenames which makes it impossible to tell which songs are which unless you look at their ID3 tags.

Enter: mp3reclaimer.

This is a little bash script I wrote that utilizes id3v2 with a little bit of sed & awk magic to retrieve the mp3s on an iPod and rename them appropriately based on their ID3 tags. I spent a little bit of time troubleshooting some bugs with the script and managed to get it working well enough to transfer approximately 7,000 songs from my mom's iPod onto her computer and rename them accordingly. I have tested this script on Mac OSX 10.10 with success.

Currently, the script only supports mp3 files. I would like to update this and add support for other file formats in the near future. This script requires the id3v2 utility, which I believe is dependent on the id3lib package. These can be installed easily using homebrew.

If you have any feedback you'd like to give me regarding my script, please feel free to PM me or post a comment down below. I appreciate constructive criticism.

That's all folks!

:edit:

Doah! I just realized my check_path function doesn't do quite what I need it to.

The function checks if the path is a valid file or directory, but what I actually need it to do is to only check if the path is a valid directory, not a file! I suppose this is what happens when I re-use functions from my other scripts without carefully reviewing what they actually do!

Fortunately, it's a pretty easy fix. I just need to take out the "&& [ ! -f "$1" ]" and it will be fine. Either way, this shouldn't be much of an issue unless you get into the habit of supplying filenames instead of directories as arguments to the script. Lol.

 

 


Recent Game Medals

Chaos 5 Points Start playing. Medal Stats.
LOL 5 Points You cannot login to Administrator Medal Stats.


Total Medals Earned: 2 (From 2 different games.)