Posted in Computers, Music, Programming

Writing Some Python Code

I’ve written a neat little program using Python 2.6.4, which allows me to list the folders in a directory that match a specific criteria that I’ve set.

Here is a bit of history and reason for the program, before I describe it.

When I began ripping my CD collection with EAC and iTunesEncode, I was still fairly new to EAC, and had very, very little previous exposure and experience with the program. To make a long story short, I ripped some CDs, which – without taking notice right away – need to be re-ripped due to incorrect settings in EAC and iTunesEncode, since I was still playing with the different settings and parameters.

When I went back to add these to iTunes for properly tagging, adding an album art and organizing them in my Lossless Library, I discovered that I had quite a few of these “ripped” CDs that didn’t play, so I labeled the folder name “Artist Name – Album Name + ‘Needs RE-RIP’, with the idea of later going back to these CDs and ripping them again.

But instead of going through the folder and manually picking out which ones I had earlier tagged to be re-ripped, I wrote some Python code to help me do this.
The program is quite simple: Lists the folders in the EAC – Ripped directory that have the word “RIP” anywhere in the directory name; a process that I would have had to do manually. Instead, the small program picks out those which need ripping again, puts them on a list, and saves this list to a file! Now it’s much easier to pick out the ones that I need, instead of manually going through the directory.

Now – I haven’t got much programming experience – just some Python, C, C++ stuff that I’ve learned in school and studied/practiced on my own. I used the Internet as a refresher to help me remember how to open a file, and write to it, and how to list the contents of a directory. Besides that, the rest I coded by using previous examples and experience.

Anyways, without much further blabber, here is the code and the output. Feel free to leave some comments, use it and change it a bit if need.

*******************************************************************************************************************************

# listFolders.py

import os, io

def main():
count = 0
countLine = 0
musicDir = os.listdir(“/Volumes/MUSIC/EAC Ripped/EAC Ripped – Needs Tagging/”)
musicDirPath = “/Volumes/MUSIC/EAC Ripped/EAC Ripped – Needs Tagging/”
outFile = open(“/Volumes/Mac HD/Users/Juan/Desktop/Needs Rip.txt”,”w”)

print “*” * 60
print musicDirPath
print “*” * 60
print

outFile.write(“*”*60+”\n”+musicDirPath+”\n”+”*”*60+”\n”)

for needsRip in musicDir:
if “RIP” in needsRip:
count = count + 1
if (count < 10):
print "0"+str(count), "-",needsRip
outFile.write("\n0"+str(count)+" "+needsRip)
else:
print str(count), "-",needsRip
outFile.write("\n"+str(count)+" "+needsRip)

print "\n*** CDs that need to be re-ripped: "+str(count)+" ***"

outFile.close()

main()

*******************************************************************************************************************************
Here is the output:
*******************************************************************************************************************************
************************************************************
/Volumes/MUSIC/EAC Ripped/EAC Ripped – Needs Tagging/
************************************************************

01 – Alejandro Fernandez – Me Estoy Enamorando RE-RIP
02 – Coldplay – X&Y – RE-RIP
03 – – Universal Religion 2004 (Live from Armada at Ibiza) RE-RIP
04 – Armin van Buuren – Transparance – CD1 RE-RIP
05 – Armin van Buuren – Transparance – CD2 RE-RIP
06 – Astor Piazzolla – La Camorra RE-RIP
07 – Celine Dion – All The Way… A Decade Of Song RE-RIP
08 – Coldplay – Parachutes RE-RIP
09 – Coldplay – Viva La Vida Or Death And All His Friends RE-RIP
10 – Deep Dish – Global Underground #021- Moscow – Deep Dish (Disc 1) RE-RIP
11 – Deep Dish – Global Underground #021- Moscow – Deep Dish (Disc 2) RE-RIP
12 – Godsmack – Faceless RE-RIP
13 – Godsmack – IV RE-RIP
14 – Jonny Lang Lie to Me RE-RIP
15 – Jose Padilla – Cafe del Mar – Volumen Seis RE-RIP
16 – Counting Crows – August And Everything After – RE-RIP
17 – Michael Buble – Crazy Love – RE-RIP
18 – Ulrich Schnauss – A Strangely Isolated Place RE-RIP
19 – Led Zeppelin – Led Zeppelin II RE-RIP
20 – Led Zeppelin – Led Zeppelin III RE-RIP
21 – Nick Warren – Global Underground 011- Budapest [1] – RE-RIP
22 – Nick Warren – Nick Warren – Global Underground 011- Budapest [2]- RE-RIP
23 – Oakenfold Anthems – The Classic Perfecto Mix (Disc 3) – RE-RIP
24 – Yo-Yo Ma – Vivaldi's Cello RE-RIP
25 – zerO One – psy-fi RE-RIP
26 – Yo-Yo Ma & Friends – Songs Of Joy & Peace [Deluxe Edition] RE-RIP
27 – Paul Oakenfold – Oakenfold Anthems – The Classic Perfecto Mix (Disc 1) – RE-RIP
28 – Paul Oakenfold – Oakenfold Anthems – The Classic Perfecto Mix (Disc 2)- RE-RIP
29 – Yo-Yo Ma – Super Hits RE-RIP
30 – Zero One – Re-RIP
31 – Yo-Yo Ma – Appassionato RE-RIP
32 – 3 Doors Down – 3 Doors Down – WAV ONLY needs RE-RIP
33 – Coldplay – A Rush of Blood To The Head – RE-RIP
34 – Sarah Brightman – Harem RE-RIP
35 – Yo-Yo Ma – Obrigado Brazil RE-RIP
36 – Ricardo Arjona – Animal Nocturno RE-RIP
37 – Sarah McLachlan – Fumbling Towards Ecstasy RE-RIP
38 – Sarah McLachlan – Surfacing RE-RIP
39 – Staind – 14 Shades of Grey RE-RIP
40 – Staind – Dysfunction RE-RIP
41 – Staind – The Illusion of Progress RE-RIP
42 – Yo-Yo Ma – Soul of the Tango RE-RIP
43 – Boundaries Of Imagination – RE-RIP, errors

*** CDs that need to be re-ripped: 43 ***

*******************************************************************************************************************************
Again – this is quite a basic program, but it does two things for me: Saves me some time, and, more importantly – gives me some more needed coding experience!

Additional Note: The spacing and indentation is not set correctly – not sure why it was not displayed correctly. Also, this was created on a Mac, so the directory paths are different if the program were to run in a PC.

Advertisements
Posted in Computers, Networking, Technology

Getting a NAS

I’ve been looking into the idea of getting a NAS (Network Attached Storage). This would greatly help me in the aid of keeping all the files in one place, as well as the backup for my Mac.
I currently use two to three external hard drives to store data: A Western Digital MyBook, which is where I keep my Time Machine backups, as well as other application files, music, movies, and anything else that I don’t need access to on the go. I also use an internal 3.5″ EIDE hard drive connected to a USB to Sata & EIDE adapter that I purchased from Newegg a while ago. While this helps me switch hard drives quickly, it’s quite cumbersome because of the need to carry the hard drive, plus the adapter box with all its cables. Many times I’m away from home and wish I had “a file” with me, only to realize it’s sitting on my desk at home – unplugged and offline on my external MyBook drive.

I’ve known about NAS for a while, but never really cared much to have one. It was until recently that I discovered this specific one, from Netgear – the ReadyNas Duo

I’ve been considering a diskless setup, which allows me to select the hard drive of my choice. It’s likely that I will be purchasing Western Digital Caviar Green hard drives, which allow me to select the maximum capacity available and know which hard drive my system is using.

Such device running on a fast wireless and ethernet network would be a great way to keep everything centralized and in one place. I could wirelessly backup my Mac and my wife’s laptop, as well as stream music to any stereo in the house using the Apple Airport Express, and watch my digital movies in the big TV.

The possibilities are endless, and I’m sure with great planning, documentation and implementation such system would be of great benefit. The idea of a NAS just came to mind – nothing concrete yet, no plans to purchase; but it would be a great way to be more organized and centralized in this digital world of ours.

Posted in All Mac Stuff, Technology

Macbook Pro Matte vs Glossy

I am on the verge of purchasing a new Macbook Pro to replace my almost 3-year old Macbook Pro. When glossy where first introduced on the Apple products, I was disgusted that they had gone so mainstream, but quickly said to myself: “They’ll never do it to the rest of the line or the rest of the ‘Pro’ series!” Boy, was I wrong. They did, and it now has consumers confused more than ever before. Yours truly is typing from a matte screen. My wife has an HP laptop which has a glossy screen. I have used it and try to “see” the reflections, and while they ARE there, they are only there when you focus on them. If your eyes stay on your work and you don’t shift focus, the reflection isn’t that bad – at least not on this HP laptop. I am very confused, for I am not sure whether I want matte or glossy. I thought I would never consider a glossy screen, but after a few trips to the Apple store, man – glossy looks pretty good and sharp! But after countless hours of reading reviews and seeing how upset many people are regarding the glossy screens on the Macbook Pro’s, it makes me want to wonder and reconsider my blind choice of going glossy. I compared them, side-by-side, and matte definitely looks sharper and more saturated. The matte screen looks washed out. (these were machines at the Apple Store). There was also a lot of reflection from the fluorescent lighting from the store on the glossy screen, while none on the matte. This was, distracting when looked directly at – but after a few minutes I was able to ignore the reflections. I think it all comes down to personal preference. I am, indeed, glad that Apple brought back the matte on the Macbook Pro’s, but they should also extend the option to the rest of their displays, including the iMac & Cinemas. Without any further ado, I close my rant with the following: Try them both, ask questions and see for yourself. No one can make these decisions for you. Reading more about matte vs glossy online just adds to the confusion because there always are two sides to the coin.
It’s still not time for me to upgrade, but hopefully in the near future I’ll be getting the new Macbook Pro with a 17″ glossy display.

Posted in All Mac Stuff, Technology

Setting up Airport Extreme (802.11n)

So I recently took the plunge and decided it was time to update my existing home network, and to once and for all rid it of the nuisances and inconsistencies that were occurring on a daily basis. The old setup consisted of a Belkin 802.11n router with wi-fi turned off, and two PC’s connected to its ethernet ports, plus an Airport Express (802.11n) to create and share a wireless network.

“Why not use the Belkin’s built-in wi-fi?” – you may ask. Performance. The wireless capabilities of this router were very disappointing, causing occasional drops, hangs, and poor speed. Unplugging the Belkin from the wall for about 10 seconds seemed to do the trick, and shortly after it was all back to normal. This grew old, however, and after a while of dealing with this, configuring the device on a weekly basis and trying everything I could think of, I was glad to get rid of it.

I was looking for different routers and options to upgrade. For a while, the D-Link DIR-825 seemed like a good choice, however, I went with a new Apple Airport Extreme Base Station. I don’t have the newer model with the improved antenna, which was released in November 2009, but the one before it.

The network now consists of: DSL Modem in bridged mode > Airport Extreme Base Station > Belkin Router (used as an access point), > and an Airport Expressed connected via Ethernet to another room. I have wider coverage at home, and have also noticed that performance is faster.

Something that I am still debating is whether to have two networks: 2.4 GHz for the “g” devices, and a 5 Ghz for the “n” devices. I also have to draw a sketch of my network and makes notes, and document all the settings. That will be another day – as I am still not finished with the setup.

Posted in Baby

Nicholas James 7 months old

Times goes by so fast… It’s nearly impossible to believe that it was only yesterday when Nicholas was born, and today – seven months and a few days later, we look back and say “where has the time gone!?”

Over the past several months, we’ve been quite busy with the little one. We’ve seen him do his first roll from his back to his tummy, from his tummy to his back, discover his hands and feet, start grabbing things, smiling, laughing, learning to get on his knees, doing his first crawling steps, and now he’s even standing up!

We can no longer leave him alone in our bed like we used to – put a few pillows on the side and walk out of the room to get his milk, get a diaper – or whatever it is. He is SO fast and mobile, that he crawls and scurries around on our bed, his crib, his playground, pretty much anywhere! He’s very active, is learning to say “mama”, “papa”, “poof”; and is learning to turn to the sound of his name.

My wife and I look at him now, and think of him when he was a newborn, and are just overwhelmed by the changes that he’s gone through in the past few months. He is now eating some solids – absolutely loves banana and apples, drinks water and his formula, and even snacks on crackers, froot loops, or anything that we may think that could catch his attention.

Hopefully, I will post some pictures soon.