I feel you. I've been procrastinating a project for 3 years already (yes 3 years). I write code maybe half of one day each week. The rest of the time I do as you describe. I'm so ashamed of it I tell no one. Glad to have quite a bit of savings.
I don't mean to come off as a dick, but switch projects. I procrastinated for a month straight on something, as soon as I dropped the project the code flowed.
Talk to a doctor, it seems like you suffer from something along the lines of ADD. I have a friend that drastically improved his condition through medication.
I'm in the same kind of boat, though to a lesser degree. It's going in the wrong direction however. Perhaps we can try to help sort things out together. If you're interested, my email is in my profile.