A man who broke into a car and stole hard drives containing unreleased music by Beyoncé has been sentenced to two years in prison.