A book that has personally helped me is Kick the Drink....Easily! The idea is that there is no such thing as will power. The more you fight it, the more the psychological crutches grow, and then its difficult to jump off.
What the upper thread mentions is very true for porn addicts. They do this all the time. Program the router to shut off at certain times. Does it work? I doubt it.
Distraction is a very real thing. Hell, distraction is recommended as an aid for anxiety disorder :)
Get distracted, be human. Get back to work.