Added management command to tag mp3s

This commit is contained in:
Fergal Moran
2013-06-22 17:06:56 +01:00
parent 3241e32a8f
commit e5c10f099e
781 changed files with 79 additions and 35 deletions

0
.gitignore vendored Normal file → Executable file
View File

0
LICENSE Normal file → Executable file
View File

0
README Normal file → Executable file
View File

0
_working/create Normal file → Executable file
View File

0
_working/get_downloads.sql Normal file → Executable file
View File

0
_working/get_plays.sql Normal file → Executable file
View File

0
apache/django_live.wsgi Normal file → Executable file
View File

0
core/__init__.py Normal file → Executable file
View File

0
core/analytics/__init__.py Normal file → Executable file
View File

0
core/analytics/google.py Normal file → Executable file
View File

0
core/decorators.py Normal file → Executable file
View File

0
core/serialisers/__init__.py Normal file → Executable file
View File

0
core/serialisers/json.py Normal file → Executable file
View File

View File

@@ -1,3 +0,0 @@
from core.social._Social import _Social
class Facebook(_Social):
pass

View File

@@ -1,2 +0,0 @@
class _Social:
pass

View File

@@ -1 +0,0 @@
__author__ = 'fergalm'

0
core/tasks.py Normal file → Executable file
View File

0
core/tests/__init__.py Normal file → Executable file
View File

0
core/tests/mix.py Normal file → Executable file
View File

0
core/utils/__init__.py Normal file → Executable file
View File

0
core/utils/audio/__init__.py Normal file → Executable file
View File

30
core/utils/audio/mp3.py Normal file → Executable file
View File

@@ -1,3 +1,4 @@
from mutagen.easyid3 import EasyID3, mutagen
from mutagen.mp3 import MP3 from mutagen.mp3 import MP3
from core.utils.audio import Mp3FileNotFoundException from core.utils.audio import Mp3FileNotFoundException
@@ -7,4 +8,31 @@ def mp3_length(source_file):
audio = MP3(source_file) audio = MP3(source_file)
return audio.info.length return audio.info.length
except IOError: except IOError:
raise Mp3FileNotFoundException("Audio file not found: %s" % source_file) raise Mp3FileNotFoundException("Audio file not found: %s" % source_file)
def tag_mp3(source_file, artist, title, album="", year="", comment="", image_file="", genre=[]):
#mp3Object.tags.add(APIC(encoding=3, mime=image[1], type=3, desc=u'Cover', data=open(image[0]).read()))
info = EasyID3(source_file)
info['artist'] = unicode(artist)
info['title'] = unicode(title)
info['album'] = unicode(album)
info['genre'] = unicode("Deep House")
#info['year'] = unicode(year)
info.save()
id3 = mutagen.id3.ID3(source_file)
frame = mutagen.id3.COMM(encoding=3, lang='XXX', desc=u'', text=[unicode(comment)])
id3.add(frame)
image = mutagen.id3.APIC(
encoding=3,
mime='image/jpeg',
type=2,
desc=u'Cover',
data=open(image_file, 'rb').read()
)
id3.add(image)
id3.save()

0
core/utils/file.py Normal file → Executable file
View File

0
core/utils/html.py Normal file → Executable file
View File

0
core/utils/live.py Normal file → Executable file
View File

0
core/utils/string.py Normal file → Executable file
View File

0
core/utils/url.py Normal file → Executable file
View File

0
core/utils/waveform.py Normal file → Executable file
View File

0
core/widgets/__init__.py Normal file → Executable file
View File

0
core/widgets/upload.py Normal file → Executable file
View File

0
dss/__init__.py Normal file → Executable file
View File

0
dss/localsettings.initial.py Normal file → Executable file
View File

0
dss/logsettings.py Normal file → Executable file
View File

2
dss/settings.py Normal file → Executable file
View File

@@ -52,7 +52,7 @@ USE_TZ = True
SITE_ROOT = here('') SITE_ROOT = here('')
MEDIA_ROOT = localsettings.MEDIA_ROOT MEDIA_ROOT = localsettings.MEDIA_ROOT
STATIC_ROOT = here('static') #'/var/www/deepsouthsounds.com/static' # here('static') #localsettings.STATIC_ROOT if hasattr(localsettings, 'STATIC_ROOT') else '' STATIC_ROOT = here('static')
CACHE_ROOT = localsettings.CACHE_ROOT CACHE_ROOT = localsettings.CACHE_ROOT
if DEBUG: if DEBUG:

0
dss/urls.py Normal file → Executable file
View File

0
dss/warning_settings.py Normal file → Executable file
View File

0
dss/wsgi.py Normal file → Executable file
View File

0
index.html Normal file → Executable file
View File

0
manage.py Normal file → Executable file
View File

0
pip_upgrade.py Normal file → Executable file
View File

0
requirements.txt Normal file → Executable file
View File

0
spa/__init__.py Normal file → Executable file
View File

0
spa/admin.py Normal file → Executable file
View File

0
spa/ajax.py Normal file → Executable file
View File

0
spa/api/__init__.py Normal file → Executable file
View File

0
spa/api/v1/ActivityResource.py Normal file → Executable file
View File

0
spa/api/v1/BackboneCompatibleResource.py Normal file → Executable file
View File

0
spa/api/v1/ChatResource.py Normal file → Executable file
View File

0
spa/api/v1/CommentResource.py Normal file → Executable file
View File

0
spa/api/v1/EventResource.py Normal file → Executable file
View File

0
spa/api/v1/MixResource.py Normal file → Executable file
View File

0
spa/api/v1/ReleaseAudioResource.py Normal file → Executable file
View File

0
spa/api/v1/ReleaseResource.py Normal file → Executable file
View File

0
spa/api/v1/UserResource.py Normal file → Executable file
View File

0
spa/api/v1/__init__.py Normal file → Executable file
View File

0
spa/api/v1/tests.py Normal file → Executable file
View File

0
spa/audio.py Normal file → Executable file
View File

0
spa/context_processors.py Normal file → Executable file
View File

0
spa/forms.py Normal file → Executable file
View File

0
spa/management/__init__.py Normal file → Executable file
View File

0
spa/management/commands/__init__.py Normal file → Executable file
View File

0
spa/management/commands/debug.py Normal file → Executable file
View File

0
spa/management/commands/deletefailed.py Normal file → Executable file
View File

0
spa/management/commands/deleteorphanmp3.py Normal file → Executable file
View File

0
spa/management/commands/drop.py Normal file → Executable file
View File

0
spa/management/commands/importdownloads.py Normal file → Executable file
View File

0
spa/management/commands/importplays.py Normal file → Executable file
View File

0
spa/management/commands/processmix.py Normal file → Executable file
View File

0
spa/management/commands/processuser.py Normal file → Executable file
View File

0
spa/management/commands/purchaselinks.py Normal file → Executable file
View File

View File

@@ -0,0 +1,16 @@
from django.core.management.base import NoArgsCommand
from spa.models.mix import Mix
class Command(NoArgsCommand):
help = "Create tracklists for all mixes"
def handle_noargs(self, **options):
print "Tagging audio files"
mixes = Mix.objects.all()
for mix in mixes:
print "Tagging: %s" % mix.title
mix.create_mp3_tags()
print "Finished tagging"

0
spa/management/commands/tracklists.py Normal file → Executable file
View File

0
spa/management/commands/waveforms.py Normal file → Executable file
View File

0
spa/middleware/__init__.py Normal file → Executable file
View File

0
spa/middleware/sqlprinter.py Normal file → Executable file
View File

0
spa/middleware/stripwhitespace.py Normal file → Executable file
View File

0
spa/middleware/uploadify.py Normal file → Executable file
View File

0
spa/migrations/0001_initial.py Normal file → Executable file
View File

0
spa/migrations/0002_auto__add_userfollows.py Normal file → Executable file
View File

0
spa/migrations/0003_auto__add_field_mix_duration.py Normal file → Executable file
View File

0
spa/migrations/0004_auto__add_field_mix_slug.py Normal file → Executable file
View File

View File

0
spa/migrations/0006_auto__chg_field_mix_title.py Normal file → Executable file
View File

View File

View File

0
spa/migrations/0010_auto.py Normal file → Executable file
View File

0
spa/migrations/0011_auto__del_field__activity_user.py Normal file → Executable file
View File

0
spa/migrations/0012_auto__add_field__activity_user.py Normal file → Executable file
View File

View File

View File

View File

0
spa/migrations/0016_auto__del_mixlike.py Normal file → Executable file
View File

0
spa/migrations/0017_auto__add_mixlike.py Normal file → Executable file
View File

0
spa/migrations/0019_auto__add_activityfavourite.py Normal file → Executable file
View File

0
spa/migrations/0020_auto__add_activityplay.py Normal file → Executable file
View File

0
spa/migrations/0021_auto__add_activitylike.py Normal file → Executable file
View File

0
spa/migrations/0022_auto__add_activitydownload.py Normal file → Executable file
View File

Some files were not shown because too many files have changed in this diff Show More