sudo aptitude install python python-django python-xml python-mysqldb mysql-server \
python-ctypes python-setuptools python-support python-docutils \
- python-libxml2 python-django-registration
+ python-libxml2 python-django-registration python-lxml
To get MP3 reading and writing, just add these lines to your /etc/apt/sources-list::
file.set_mime_type()
file.save()
if not file.title and file.url:
- file.title = file.url
+ try:
+ from lxml import etree
+ parser = etree.HTMLParser()
+ tree = etree.parse(file.url, parser)
+ title = tree.find(".//title").text
+ title = title.replace('\n', '').strip()
+ file.title = title
+ except:
+ file.title = file.url
file.save()
return render(request, template,