get defaults to None
This commit is contained in:
parent
de0977d3b9
commit
ad4ed30dd6
7 changed files with 12 additions and 12 deletions
|
@ -37,7 +37,7 @@ def api(request):
|
||||||
#FIXME: possible to do this in f
|
#FIXME: possible to do this in f
|
||||||
#data = json.loads(request.POST['data'])
|
#data = json.loads(request.POST['data'])
|
||||||
|
|
||||||
f = actions.get(function, None)
|
f = actions.get(function)
|
||||||
if f:
|
if f:
|
||||||
response = f(request)
|
response = f(request)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -316,7 +316,7 @@ class File(models.Model):
|
||||||
director = u'; '.join(director)
|
director = u'; '.join(director)
|
||||||
director = re.sub(r'[:\\/]', '_', director)
|
director = re.sub(r'[:\\/]', '_', director)
|
||||||
name = os.path.join(director, name)
|
name = os.path.join(director, name)
|
||||||
year = self.item.get('year', None)
|
year = self.item.get('year')
|
||||||
if year:
|
if year:
|
||||||
name += u' (%s)' % year
|
name += u' (%s)' % year
|
||||||
name = os.path.join(name[0].upper(), name)
|
name = os.path.join(name[0].upper(), name)
|
||||||
|
|
|
@ -26,7 +26,7 @@ def parseCondition(condition):
|
||||||
if not k:
|
if not k:
|
||||||
k = 'all'
|
k = 'all'
|
||||||
v = condition['value']
|
v = condition['value']
|
||||||
op = condition.get('operator', None)
|
op = condition.get('operator')
|
||||||
if not op:
|
if not op:
|
||||||
op = ''
|
op = ''
|
||||||
if op.startswith('!'):
|
if op.startswith('!'):
|
||||||
|
|
|
@ -232,7 +232,7 @@ class Item(models.Model):
|
||||||
if self.poster_frame == -1 and self.sort.duration:
|
if self.poster_frame == -1 and self.sort.duration:
|
||||||
self.poster_frame = self.sort.duration/2
|
self.poster_frame = self.sort.duration/2
|
||||||
update_poster = True
|
update_poster = True
|
||||||
if not self.get('runtime', None) and self.sort.duration:
|
if not self.get('runtime') and self.sort.duration:
|
||||||
self.data['runtime'] = self.sort.duration
|
self.data['runtime'] = self.sort.duration
|
||||||
self.update_sort()
|
self.update_sort()
|
||||||
self.json = self.get_json()
|
self.json = self.get_json()
|
||||||
|
@ -361,7 +361,7 @@ class Item(models.Model):
|
||||||
def oxdb_id(self):
|
def oxdb_id(self):
|
||||||
if not settings.USE_IMDB:
|
if not settings.USE_IMDB:
|
||||||
return self.itemId
|
return self.itemId
|
||||||
if not self.get('title', None) and not self.get('director', None):
|
if not self.get('title') and not self.get('director'):
|
||||||
return None
|
return None
|
||||||
return utils.oxdb_id(self.get('title', ''), self.get('director', []), str(self.get('year', '')),
|
return utils.oxdb_id(self.get('title', ''), self.get('director', []), str(self.get('year', '')),
|
||||||
self.get('season', ''), self.get('episode', ''),
|
self.get('season', ''), self.get('episode', ''),
|
||||||
|
@ -478,22 +478,22 @@ class Item(models.Model):
|
||||||
set_value(s, name, value)
|
set_value(s, name, value)
|
||||||
elif sort_type in ('length', 'integer', 'float'):
|
elif sort_type in ('length', 'integer', 'float'):
|
||||||
#can be length of strings or length of arrays, i.e. keywords
|
#can be length of strings or length of arrays, i.e. keywords
|
||||||
value = self.get(source, None)
|
value = self.get(source)
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
value = len(value)
|
value = len(value)
|
||||||
set_value(s, name, value)
|
set_value(s, name, value)
|
||||||
elif sort_type == 'words':
|
elif sort_type == 'words':
|
||||||
value = self.get(source, None)
|
value = self.get(source)
|
||||||
if isinstance(value, list):
|
if isinstance(value, list):
|
||||||
value = '\n'.join(value)
|
value = '\n'.join(value)
|
||||||
if value:
|
if value:
|
||||||
value = len(value.split(' '))
|
value = len(value.split(' '))
|
||||||
set_value(s, name, value)
|
set_value(s, name, value)
|
||||||
elif sort_type == 'year':
|
elif sort_type == 'year':
|
||||||
value = self.get(source, None)
|
value = self.get(source)
|
||||||
set_value(s, name, value)
|
set_value(s, name, value)
|
||||||
elif sort_type == 'date':
|
elif sort_type == 'date':
|
||||||
value = self.get(source, None)
|
value = self.get(source)
|
||||||
if isinstance(value, basestring):
|
if isinstance(value, basestring):
|
||||||
value = datetime.strptime(value, '%Y-%m-%d')
|
value = datetime.strptime(value, '%Y-%m-%d')
|
||||||
set_value(s, name, value)
|
set_value(s, name, value)
|
||||||
|
|
|
@ -528,7 +528,7 @@ def video(request, id, profile):
|
||||||
path = stream.video.path
|
path = stream.video.path
|
||||||
content_type = path.endswith('.mp4') and 'video/mp4' or 'video/webm'
|
content_type = path.endswith('.mp4') and 'video/mp4' or 'video/webm'
|
||||||
#server side cutting
|
#server side cutting
|
||||||
t = request.GET.get('t', None)
|
t = request.GET.get('t')
|
||||||
if t:
|
if t:
|
||||||
t = map(float, t.split(','))
|
t = map(float, t.split(','))
|
||||||
ext = os.path.splitext(profile)[1]
|
ext = os.path.splitext(profile)[1]
|
||||||
|
|
|
@ -28,7 +28,7 @@ def parseCondition(condition, user):
|
||||||
if not k:
|
if not k:
|
||||||
k = 'name'
|
k = 'name'
|
||||||
v = condition['value']
|
v = condition['value']
|
||||||
op = condition.get('operator', None)
|
op = condition.get('operator')
|
||||||
if not op:
|
if not op:
|
||||||
op = ''
|
op = ''
|
||||||
if op.startswith('!'):
|
if op.startswith('!'):
|
||||||
|
|
|
@ -23,7 +23,7 @@ def parseCondition(condition, user):
|
||||||
if not k:
|
if not k:
|
||||||
k = 'name'
|
k = 'name'
|
||||||
v = condition['value']
|
v = condition['value']
|
||||||
op = condition.get('operator', None)
|
op = condition.get('operator')
|
||||||
if not op:
|
if not op:
|
||||||
op = ''
|
op = ''
|
||||||
if op.startswith('!'):
|
if op.startswith('!'):
|
||||||
|
|
Loading…
Reference in a new issue