# This has to be a subset of EXTENSIONS.
# e.g., add ?type=image to the browse-URL ...
FILEBROWSER_SELECT_FORMATS = {
- 'file': ['Folder', 'Image', 'Document', 'Video', 'Audio'],
+ 'File': ['Folder', 'Document'],
+ 'Image': ['Image'],
+ 'Media': ['Video', 'Audio'],
+ 'Audio': ['Audio'],
+ 'Document': ['Document'],
+ # for TinyMCE we can also define lower-case items
'image': ['Image'],
- 'document': ['Document'],
+ 'file': ['Folder', 'Image', 'Document'],
'media': ['Video', 'Audio'],
'audio': ['Audio'],
- }
-
+}
###################
# DEPLOY SETTINGS #
# Sequence of value/name pairs for types of product options,
# eg Size, Colour. NOTE: Increasing the number of these will
# require database migrations!
-# SHOP_OPTION_TYPE_CHOICES = (
-# (1, "Size"),
-# (2, "Colour"),
-# )
+SHOP_OPTION_TYPE_CHOICES = (
+ (1, "Cover condition"),
+ (2, "Vinyl condition"),
+ )
# Sequence of indexes from the SHOP_OPTION_TYPE_CHOICES setting that
# control how the options should be ordered in the admin,
-# eg for "Colour" then "Size" given the above:
-# SHOP_OPTION_ADMIN_ORDER = (2, 1)
+# SHOP_OPTION_ADMIN_ORDER = (1, 2)
######################
--- /dev/null
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('records', '0003_auto_20150827_1634'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='gallery',
+ options={'managed': False, 'verbose_name': 'OLD_Gallery'},
+ ),
+ migrations.AlterModelOptions(
+ name='grading',
+ options={'managed': False, 'verbose_name': 'OLD_Grading'},
+ ),
+ migrations.AlterModelOptions(
+ name='link',
+ options={'managed': False, 'verbose_name': 'OLD_Link'},
+ ),
+ migrations.AlterModelOptions(
+ name='mix',
+ options={'managed': False, 'verbose_name': 'OLD_Mix', 'verbose_name_plural': 'OLD_Mixes'},
+ ),
+ migrations.AlterModelOptions(
+ name='news',
+ options={'managed': False, 'verbose_name': 'OLD_News', 'verbose_name_plural': 'OLD_News'},
+ ),
+ migrations.AlterModelOptions(
+ name='shop',
+ options={'managed': False, 'verbose_name': 'OLD_Shop'},
+ ),
+ migrations.AlterModelOptions(
+ name='theme',
+ options={'managed': False, 'verbose_name': 'OLD_Theme'},
+ ),
+ migrations.AlterModelOptions(
+ name='user',
+ options={'managed': False, 'verbose_name_plural': 'OLD_User'},
+ ),
+ migrations.AddField(
+ model_name='podcast',
+ name='genre',
+ field=models.CharField(max_length=128, null=True),
+ ),
+ migrations.AddField(
+ model_name='podcast',
+ name='mix_cloud_url',
+ field=models.URLField(null=True),
+ ),
+ migrations.AddField(
+ model_name='podcast',
+ name='old_date',
+ field=models.CharField(max_length=64, null=True),
+ ),
+ ]
--- /dev/null
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('records', '0004_auto_20150828_1342'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='record',
+ name='cover_state',
+ ),
+ migrations.RemoveField(
+ model_name='record',
+ name='vinyl_state',
+ ),
+ ]
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
from __future__ import unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
-from cartridge.shop.models import Product
-
from mezzanine.core.fields import FileField
from mezzanine.core.models import CONTENT_STATUS_DRAFT, CONTENT_STATUS_PUBLISHED
from mezzanine.blog.models import BlogPost
published = models.IntegerField()
class Meta:
- verbose_name = 'OLD_Links'
+ verbose_name = 'OLD_Link'
managed = False
db_table = 'links'
label = models.ForeignKey(Label, verbose_name=_('label'), related_name='records', null=True, on_delete=models.SET_NULL)
release_date = models.DateField(_('release date'), null=True)
country = models.ForeignKey(Country, verbose_name=_('country'), related_name='records', null=True, on_delete=models.SET_NULL)
- cover_state = models.ForeignKey(ConditionGrading, verbose_name=_('cover condition'), related_name='records_cover_condition', null=True, on_delete=models.SET_NULL)
- vinyl_state = models.ForeignKey(ConditionGrading, verbose_name=_('vinyl condition'), related_name='records_vinyl_condition', null=True, on_delete=models.SET_NULL)
+ #cover_state = models.ForeignKey(ConditionGrading, verbose_name=_('cover condition'), related_name='records_cover_condition', null=True, on_delete=models.SET_NULL)
+ #vinyl_state = models.ForeignKey(ConditionGrading, verbose_name=_('vinyl condition'), related_name='records_vinyl_condition', null=True, on_delete=models.SET_NULL)
audio_file = FileField(_("audio file"), max_length=1024, format="audio",
upload_to=upload_to("records.Record.audio", "audio/records"), null=True)
return " - ".join([self.artist, self.title])
class Podcast(BlogPost):
- audio = FileField(verbose_name=_("Audio File"), max_length=200, format="audio",
+ audio = FileField(verbose_name=_("Audio File"), max_length=200, format="Audio",
upload_to=upload_to("records.Podcast.audio", "audio/mixes"))
+ genre = models.CharField(max_length=128, null=True)
+ # titre --> title
+ old_date = models.CharField(max_length=64, null=True)
+ mix_cloud_url = models.URLField(null=True)
+ # desc --> description
+ # mp3 --> audio
+ #visu1 = models.IntegerField()
+ # ordre : on laisse tombé ?
+ # published --> status / 0 --> CONTENT_STATUS_DRAFT = 1 / 1 CONTENT_STATUS_PUBLISHED = 2
from diggersdigest import settings
+import HTMLParser
+parser = HTMLParser.HTMLParser()
# Label
if created:
print "Create new Label : %s" % obj.name
count += 1
-print "%d fiches label créées" % count
+
+print '--------------------------------------'
+print "%d created label objects" % count
+print "%d label in new db / %d in old db" % (len(rec_models.Label.objects.all()), len(label_set))
+print '--------------------------------------'
+
# Artist
artist_set = set([shop.artiste for shop in rec_models.Shop.objects.all()])
print "Create new Artist : %s" % obj.name
count += 1
-print "%d fiches artiste créées" % count
+print '--------------------------------------'
+print "%d created artist object" % count
+print "%d artist in new db / %d in old db" % (len(rec_models.Artist.objects.all()), len(artist_set))
+print '--------------------------------------'
+
# Pays
country_set = set([shop.pays for shop in rec_models.Shop.objects.all()])
print "Create new Country : %s" % obj.name
count += 1
-print "%d fiches pays créées" % count
+print '--------------------------------------'
+print "%d created country object" % count
+print "%d country in new db / %d in old db" % (len(rec_models.Country.objects.all()), len(country_set))
+print '--------------------------------------'
+
# Theme
[theme for theme in rec_models.Theme.objects.all()]
MIX_PATH = os.path.join(AUDIO_PATH, 'mixes')
RECORDS_PATH = os.path.join(AUDIO_PATH, "records")
+
# Check mp3 in media upload path
def check_mp3(file_list, file_path):
file_exists = [os.path.exists(os.path.join(file_path, file_name))
return missing_files
-check_mp3(mp3_mix_list, MIX_PATH)
+check_mp3(mp3_mix_list, MIX_PATH)
+
+
+# PODCAST FROM MIX
+PODCAST_IMG_PATH = os.path.join('uploads/blog/mixes')
+PODCAST_AUDIO_PATH = os.path.join('uploads/audio/mixes')
+from django.contrib.auth import models as auth_models
+digger = auth_models.User.objects.get(username='digger')
+
+
+
+for mix in rec_models.Mix.objects.all():
+ if mix.visu1:
+ img_file = str(mix.id) + '.jpg'
+ img_path = os.path.join(PODCAST_IMG_PATH, img_file)
+ else:
+ img_path = ''
+
+ print '---------------------------'
+ print 'pk :\t %d' % mix.pk
+ print 'audio :\t %s' % os.path.join(PODCAST_AUDIO_PATH, mix.mp3)
+ print 'genre :\t %s' % mix.genre
+ print "old_date :\t %s" % mix.date
+ print "title :\t %s" % parser.unescape(mix.titre)
+ #status=mix.published+1,
+ #featured_image=img_path,
+ #user=digger)
+ obj, created = rec_models.Podcast.objects.get_or_create(
+ pk=mix.pk,
+ audio=os.path.join(PODCAST_AUDIO_PATH, mix.mp3),
+ genre=mix.genre,
+ old_date=mix.date,
+ title=parser.unescape(mix.titre),
+ description=parser.unescape(mix.desc),
+ status=mix.published+1,
+ featured_image=img_path,
+ user=digger)
+
+ ## audio = FileField(verbose_name=_("Audio File"), max_length=200, format="audio",
+ ## upload_to=upload_to("records.Podcast.audio", "audio/mixes"))
+ ## genre = models.CharField(max_length=128)
+ ## # titre --> title
+ ## date = models.CharField(max_length=64)
+ ## # desc --> description
+ ## # mp3 --> audio
+ ## #visu1 = models.IntegerField() si 1 --> featured_image
+ ## # ordre : on laisse tombé ?
+ ## # published --> status / 0 --> CONTENT_STATUS_DRAFT = 1 / 1 CONTENT_STATUS_PUBLISHED = 2
+
+
+
check_mp3(mp3_shop_list, RECORDS_PATH)
# SHOPS TO RECORDS
-import HTMLParser
-parser = HTMLParser.HTMLParser()
shop_list = rec_models.Shop.objects.all()
for shop in shop_list:
print "-----------"