-# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from django.db import models, migrations
import archive.utils
import archive.models
('source_file', models.FileField(verbose_name='source file', max_length=255, editable=False, upload_to=archive.models.source_upload_to)),
('source_sha1', models.CharField(max_length=40, editable=False)),
('title', models.CharField(max_length=255, verbose_name='title')),
- ('part_name', models.CharField(default=b'', help_text='eg. chapter in a novel', max_length=255, verbose_name='part name', blank=True)),
+ ('part_name', models.CharField(default='', help_text='eg. chapter in a novel', max_length=255, verbose_name='part name', blank=True)),
('index', models.IntegerField(default=0, verbose_name='index')),
('parts_count', models.IntegerField(default=1, verbose_name='parts count')),
('artist', models.CharField(max_length=255, verbose_name='artist')),
('mp3_status', models.SmallIntegerField(null=True, editable=False, choices=[(1, 'Waiting'), (2, 'Encoding'), (3, 'Tagging'), (4, 'Sending')])),
('mp3_task', models.CharField(max_length=64, null=True, editable=False)),
('mp3_tags', models.TextField(null=True, editable=False)),
- ('mp3_file', models.FileField(storage=archive.utils.OverwriteStorage(), upload_to=b'archive/final', null=True, editable=False)),
+ ('mp3_file', models.FileField(storage=archive.utils.OverwriteStorage(), upload_to='archive/final', null=True, editable=False)),
('mp3_published_tags', models.TextField(null=True, editable=False)),
('mp3_published', models.DateTimeField(null=True, editable=False)),
('ogg_status', models.SmallIntegerField(null=True, editable=False, choices=[(1, 'Waiting'), (2, 'Encoding'), (3, 'Tagging'), (4, 'Sending')])),
('ogg_task', models.CharField(max_length=64, null=True, editable=False)),
('ogg_tags', models.TextField(null=True, editable=False)),
- ('ogg_file', models.FileField(storage=archive.utils.OverwriteStorage(), upload_to=b'archive/final', null=True, editable=False)),
+ ('ogg_file', models.FileField(storage=archive.utils.OverwriteStorage(), upload_to='archive/final', null=True, editable=False)),
('ogg_published_tags', models.TextField(null=True, editable=False)),
('ogg_published', models.DateTimeField(null=True, editable=False)),
],
name='Project',
fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
- ('name', models.CharField(unique=True, max_length=128, verbose_name=b'Nazwa', db_index=True)),
- ('sponsors', models.TextField(null=True, verbose_name=b'Sponsorzy', blank=True)),
+ ('name', models.CharField(unique=True, max_length=128, verbose_name='Nazwa', db_index=True)),
+ ('sponsors', models.TextField(null=True, verbose_name='Sponsorzy', blank=True)),
],
options={
'ordering': ('name',),
-# -*- coding: utf-8 -*-
import os.path
from django.db import models
from archive.settings import FILES_SAVE_PATH, ADVERT, LICENSE, ORGANIZATION, PROJECT
from archive.utils import OverwriteStorage, sha1_file
-# Create your models here.
-
class Project(models.Model):
""" an audiobook project, needed for specyfing sponsors """
verbose_name_plural = _("projects")
ordering = ("name",)
- def __unicode__(self):
+ def __str__(self):
return self.name
verbose_name_plural = _("audiobooks")
ordering = ("title",)
- def __unicode__(self):
+ def __str__(self):
return self.title
def get_mp3_tags(self): return json.loads(self.mp3_tags) if self.mp3_tags else None
def new_publish_tags(self):
title = self.title
if self.translator:
- title += u' (tłum. %s)' % self.translator
+ title += ' (tłum. %s)' % self.translator
- copyright = u"%s %s. Licensed to the public under %s verify at %s" % (
+ copyright = "%s %s. Licensed to the public under %s verify at %s" % (
self.date, ORGANIZATION, LICENSE, self.url)
- comment = u"Audiobook nagrany w ramach projektu %s%s.\n%s" % (
+ comment = "Audiobook nagrany w ramach projektu %s%s.\n%s" % (
self.project.name,
- u" finansowanego przez %s" % self.project.sponsors if self.project.sponsors else "",
+ " finansowanego przez %s" % self.project.sponsors if self.project.sponsors else "",
ADVERT)
tags = {
'contact': self.url,
'copyright': copyright,
'date': self.date,
- 'genre': u'Speech',
- 'language': u'pol',
+ 'genre': 'Speech',
+ 'language': 'pol',
'license': LICENSE,
'organization': ORGANIZATION,
'title': title,
return tag(encoding=1, text=text)
def id3_url(tag, text):
return tag(url=text)
- def id3_comment(tag, text, lang=u'pol'):
- return tag(encoding=1, lang=lang, desc=u'', text=text)
- def id3_priv(tag, text, what=u''):
+ def id3_comment(tag, text, lang='pol'):
+ return tag(encoding=1, lang=lang, desc='', text=text)
+ def id3_priv(tag, text, what=''):
return tag(owner='wolnelektury.pl?%s' % what, data=text.encode('utf-8'))
TAG_MAP = {
if COVER_IMAGE:
mime = mimetypes.guess_type(COVER_IMAGE)
f = open(COVER_IMAGE)
- audio.add(id3.APIC(encoding=0, mime=mime, type=3, desc=u'', data=f.read()))
+ audio.add(id3.APIC(encoding=0, mime=mime, type=3, desc='', data=f.read()))
f.close()
audio.save()