add more extensions, make extension accessible

This commit is contained in:
j 2012-08-16 18:57:57 +02:00
parent 4336c19378
commit a4304fd8b9

View file

@ -13,6 +13,19 @@ from text import get_sort_name, findRe
__all__ = ['parse_movie_path', 'create_movie_path', 'get_oxid'] __all__ = ['parse_movie_path', 'create_movie_path', 'get_oxid']
extensions = {
'audio': [
'aac', 'flac', 'm4a', 'mp3', 'oga', 'ogg', 'wav', 'wma'
],
'subtitle': [
'idx', 'srt', 'sub'
],
'video': [
'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4',
'mpeg', 'mpg', 'mts', 'ogm', 'ogv', 'rm', 'webm', 'wmv'
],
}
''' '''
Naming scheme: Naming scheme:
X/[Group, The; Lastname, Firstname/]The Title[ (YEAR[-YEAR])]/ X/[Group, The; Lastname, Firstname/]The Title[ (YEAR[-YEAR])]/
@ -60,15 +73,10 @@ def parse_path(path):
def parse_title(string): def parse_title(string):
return title, year return title, year
def parse_type(string): def parse_type(string):
if string in ['aac', 'm4a', 'mp3', 'ogg']: for type in extensions:
type = 'audio' if string in extensions[type]:
elif string in ['idx', 'srt', 'sub']:
type = 'subtitle'
elif string in ['avi', 'divx', 'm4v', 'mkv', 'mov', 'mpg', 'ogv', 'rm']:
type = 'video'
else:
type = None
return type return type
return None
def parse_underscores(string): def parse_underscores(string):
string = re.sub('^_', '.', string) string = re.sub('^_', '.', string)
string = re.sub('_$', '.', string) string = re.sub('_$', '.', string)