Take a close look at the caps and then the housing....which looks melted more? If the caps, then replace...if the housing...replace motor.
Another question,....how do you control the speed on the motor? If your not using the proper controller...that would cause the motor to overheat and bad things to happen. I have found a router speed control (especially, but not limited to, Harbor freight) to cause damage when ran long term on a motor, but a PWM controller...the motor runs fine for any amount of time.
Another consideration is, is there a fan to cool the motor? Similar to a treadmill motor has? DC motors will build heat up much more so than an AC motor especially under a load of slow rpms, in my experiences.
****edit...Is that a sewing machine motor??? It looks like it could be, and if so, those aren't built for long term running, more like short bursts of about 30 seconds to 1 minute, then a couple minutes to cool. Ditch it and get a windshield wiper motor and a computer power supply. It'll run all night.Dave