actions, move parse_decimal

This commit is contained in:
j 2010-12-22 20:47:38 +05:30
commit 07dcc77950
7 changed files with 44 additions and 33 deletions

View file

@ -5,7 +5,6 @@ from datetime import datetime
import os.path
import random
import re
from decimal import Decimal
import time
from django.db import models
@ -28,13 +27,6 @@ from item.models import Item
import extract
def parse_decimal(string):
string = string.replace(':', '/')
if '/' not in string:
string = '%s/1' % string
d = string.split('/')
return Decimal(d[0]) / Decimal(d[1])
class File(models.Model):
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
@ -117,7 +109,7 @@ class File(models.Model):
self.is_audio = False
if self.framerate:
self.pixels = int(self.width * self.height * float(parse_decimal(self.framerate)) * self.duration)
self.pixels = int(self.width * self.height * float(utils.parse_decimal(self.framerate)) * self.duration)
if not self.is_audio and not self.is_video and self.name.endswith('.srt'):
self.is_subtitle = True