from models import *
from djxml import xmlmodels
xml = xmlmodels.open('test.xml')
categories = xml.get('shop/categories')
for x in categories:
cat = Categorie(name=x.text(), id=x.attr('id'))
cat.save()
<shop>
<name>SHOP</name>
<currencies>
<currency id="RUB" rate="74.0000000000"/>
<currency id="USD" rate="1.0000000000"/>
</currencies>
<categories>
<category id="25" parentId="19">Одежды</category>
<category id="28" parentId="19">Машины</category>
<category id="29" parentId="19">Спорт</category>
</categories>
<offers>
<offer available="true" group_id="1245" id="6549">
<price>405</price>
<old_price>675</old_price>
<currencyId>USD</currencyId>
<name>Платье красное</name>
<description><![CDATA[<p>Стильное платье выполнено из натуральной ткани в яркой цветочной расцветке </p>]]></description>
<categoryId>25</categoryId>
<param name="Вид">Платья</param>
<param name="Размер">XS</param>
</offer>
</offers>
</shop>
class Categorie(models.Model):
name = models.CharField('categorie_name', max_length=50)
class Currency(models.Model):
name = models.CharField('currency_name', max_length=3)
price = models.IntegerField('currency_price')
class Param(models.Model):
name = models.CharField('name', max_length=50)
type = models.CharField('type', max_length=50)
class Offer(models.Model):
price = models.IntegerField('offer_price')
old_price = models.IntegerField('offer_old_price')
currencyId = models.ForeignKey(Currency)
categoryId = models.ForeignKey(Categorie)
name = models.CharField('offer_name', max_length=50)
description = models.CharField('offer_description', max_length=50)
param = models.ManyToManyField(Param, blank=True)
from converter import Converter
ffmpegPath = r"С:\Temp\Desktop\ffmpeg_full\1\bin\ffmpeg.exe"
ffprobePath = r"С:\Temp\Desktop\ffmpeg_full\1\bin\ffprobe.exe"
conv = Converter(ffmpegPath, ffprobePath)
info = conv.probe('test/test1.mp4')
convert = conv.convert('test/test1.mp4', 'test/test1.avi', {
'format': 'avi',
'audio': {
'codec': 'aac',
'samplerate': 11025,
'channels': 2
},
'video': {
'codec': 'hevc',
'width': 720,
'height': 400,
'fps': 25
}})
for timecode in convert:
print(f'\rConverting ({timecode:.2f}) ...')
signal.signal(signal.SIGVTALRM, on_sigvtalrm)
AttributeError: module 'signal' has no attribute 'SIGVTALRM'
1:{
id:1,
user:'user1',
'title':'TITLE 1',
'text':"TEXT 1",
'pud_date':"2020.01.11", # Старая дата не работает если есть более новая
'comment_article':{
id:2,
user:'user1',
"comment_title":'Com Title 2',
"comment_text":'Com TEXT 2',
"comment_pud_date""2020.05.11", # Новая дата комментария от нужного пользователя
}
Как его запустить?