diff --git a/addon.py b/addon.py index b9db8d2..ba95b43 100644 --- a/addon.py +++ b/addon.py @@ -113,6 +113,20 @@ def conduct_program(program_file, feature): for trailer in trailers: entry = {'type': 'video', 'data': trailer['location']} program.append(entry) + elif settings['source'] == 'rating': + rating = -1 + for s in feature['mpaa'].split(): + if s.isdigit(): + rating = int(s) + break + if rating > -1: + dirs, files = xbmcvfs.listdir(settings['location']) + for f in files: + if f.startswith(str(rating)+'.'): + location = settings['location'] + f + break + entry = {'type': 'video', 'data': location} + program.append(entry) elif settings['source'] == 'feature': entry = {'type': 'video', 'data': feature['file']} program.append(entry)