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
|
||||
#data = json.loads(request.POST['data'])
|
||||
|
||||
f = actions.get(function, None)
|
||||
f = actions.get(function)
|
||||
if f:
|
||||
response = f(request)
|
||||
else:
|
||||
|
|
|
@ -316,7 +316,7 @@ class File(models.Model):
|
|||
director = u'; '.join(director)
|
||||
director = re.sub(r'[:\\/]', '_', director)
|
||||
name = os.path.join(director, name)
|
||||
year = self.item.get('year', None)
|
||||
year = self.item.get('year')
|
||||
if year:
|
||||
name += u' (%s)' % year
|
||||
name = os.path.join(name[0].upper(), name)
|
||||
|
|
|
@ -26,7 +26,7 @@ def parseCondition(condition):
|
|||
if not k:
|
||||
k = 'all'
|
||||
v = condition['value']
|
||||
op = condition.get('operator', None)
|
||||
op = condition.get('operator')
|
||||
if not op:
|
||||
op = ''
|
||||
if op.startswith('!'):
|
||||
|
|
|
@ -232,7 +232,7 @@ class Item(models.Model):
|
|||
if self.poster_frame == -1 and self.sort.duration:
|
||||
self.poster_frame = self.sort.duration/2
|
||||
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.update_sort()
|
||||
self.json = self.get_json()
|
||||
|
@ -361,7 +361,7 @@ class Item(models.Model):
|
|||
def oxdb_id(self):
|
||||
if not settings.USE_IMDB:
|
||||
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 utils.oxdb_id(self.get('title', ''), self.get('director', []), str(self.get('year', '')),
|
||||
self.get('season', ''), self.get('episode', ''),
|
||||
|
@ -478,22 +478,22 @@ class Item(models.Model):
|
|||
set_value(s, name, value)
|
||||
elif sort_type in ('length', 'integer', 'float'):
|
||||
#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):
|
||||
value = len(value)
|
||||
set_value(s, name, value)
|
||||
elif sort_type == 'words':
|
||||
value = self.get(source, None)
|
||||
value = self.get(source)
|
||||
if isinstance(value, list):
|
||||
value = '\n'.join(value)
|
||||
if value:
|
||||
value = len(value.split(' '))
|
||||
set_value(s, name, value)
|
||||
elif sort_type == 'year':
|
||||
value = self.get(source, None)
|
||||
value = self.get(source)
|
||||
set_value(s, name, value)
|
||||
elif sort_type == 'date':
|
||||
value = self.get(source, None)
|
||||
value = self.get(source)
|
||||
if isinstance(value, basestring):
|
||||
value = datetime.strptime(value, '%Y-%m-%d')
|
||||
set_value(s, name, value)
|
||||
|
|
|
@ -528,7 +528,7 @@ def video(request, id, profile):
|
|||
path = stream.video.path
|
||||
content_type = path.endswith('.mp4') and 'video/mp4' or 'video/webm'
|
||||
#server side cutting
|
||||
t = request.GET.get('t', None)
|
||||
t = request.GET.get('t')
|
||||
if t:
|
||||
t = map(float, t.split(','))
|
||||
ext = os.path.splitext(profile)[1]
|
||||
|
|
|
@ -28,7 +28,7 @@ def parseCondition(condition, user):
|
|||
if not k:
|
||||
k = 'name'
|
||||
v = condition['value']
|
||||
op = condition.get('operator', None)
|
||||
op = condition.get('operator')
|
||||
if not op:
|
||||
op = ''
|
||||
if op.startswith('!'):
|
||||
|
|
|
@ -23,7 +23,7 @@ def parseCondition(condition, user):
|
|||
if not k:
|
||||
k = 'name'
|
||||
v = condition['value']
|
||||
op = condition.get('operator', None)
|
||||
op = condition.get('operator')
|
||||
if not op:
|
||||
op = ''
|
||||
if op.startswith('!'):
|
||||
|
|
Loading…
Reference in a new issue