A burglar was caught after leaving blood in two places when he broke into a house in Newsome.
Leeds Crown Court heard the occupier returned at 8.45pm on September 24 to discover a brick had been thrown through a downstairs window.
Bashir Ahmed, prosecuting, said the intruder had stolen a tablet computer worth £100 but had left bloodstains on the wall inside.
The blind on the window had also been removed and left in the garden and it too was found to have blood on it and a DNA match was traced to burglar Thomas Michael Roberts.
The court was told he had 49 convictions for 97 offences on his record, mainly for dishonesty including theft and three previous convictions for burglary.
Richard Holland, representing Roberts, said his previous offending stemmed from his abuse of drugs.
He suffered from epilepsy and earlier in the week of the burglary had ended up in Huddersfield Royal Infirmary because he was fitting.
He had discharged himself, with Mr Holland adding “demonstrating the chaotic lifestyle he leads.” His benefit was stopped, he found himself homeless and he had become involved again with drugs.
Mr Holland said the burglary “was certainly not the most professional if you leave your blood behind in two separate places.”
He said Roberts was suffering two to three fits a week in prison “which in a custodial sentence is unpleasant.”
Roberts, 31 formerly of Ashenhurst Close, Newsome , admitted burglary and was jailed for 876 days.
Recorder Kate Tulk said that was the minimum sentence she could impose and told him: “If you don’t want to continue spending time in prison I suggest you don’t go out breaking into house when you come out.”
Roberts told her: “There will be no more of that and I am sorry for what I have done.”