{"id":13448805,"url":"https://github.com/areski/django-audiofield","last_synced_at":"2025-08-17T10:34:50.081Z","repository":{"id":2007563,"uuid":"2941495","full_name":"areski/django-audiofield","owner":"areski","description":"Django-Audiofield is a simple app that allows Audio files upload, management and conversion to different audio format (mp3, wav \u0026 ogg), which also makes it easy to play audio files into your Django application.","archived":false,"fork":false,"pushed_at":"2023-02-20T08:03:23.000Z","size":1345,"stargazers_count":174,"open_issues_count":15,"forks_count":51,"subscribers_count":20,"default_branch":"develop","last_synced_at":"2025-08-12T21:58:44.572Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/areski.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"MIT-LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2011-12-08T16:53:48.000Z","updated_at":"2024-11-01T09:14:49.000Z","dependencies_parsed_at":"2023-07-05T18:02:20.852Z","dependency_job_id":null,"html_url":"https://github.com/areski/django-audiofield","commit_stats":{"total_commits":156,"total_committers":13,"mean_commits":12.0,"dds":0.3012820512820513,"last_synced_commit":"80334c95a3444c133a4452df990eba20ab0f4789"},"previous_names":["star2billing/django-audiofield"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/areski/django-audiofield","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/areski%2Fdjango-audiofield","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/areski%2Fdjango-audiofield/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/areski%2Fdjango-audiofield/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/areski%2Fdjango-audiofield/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/areski","download_url":"https://codeload.github.com/areski/django-audiofield/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/areski%2Fdjango-audiofield/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270837400,"owners_count":24654374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T06:00:21.519Z","updated_at":"2025-08-17T10:34:50.055Z","avatar_url":"https://github.com/areski.png","language":"JavaScript","funding_links":[],"categories":["Fields","JavaScript","数据项"],"sub_categories":[],"readme":"Django-Audiofield\n=================\n\n:Description: Django Audio Management Tools\n:Maintainer: Areski_\n:Contributors: `list of contributors \u003chttps://github.com/areski/django-audiofield/graphs/contributors\u003e`_\n\n.. _Areski: https://github.com/areski/\n\n.. image:: https://img.shields.io/pypi/v/django-audiofield.svg\n  :target: https://pypi.python.org/pypi/django-audiofield/\n  :alt: Latest Version\n\n.. image:: https://img.shields.io/pypi/dm/django-audiofield.svg\n  :target: https://pypi.python.org/pypi/django-audiofield/\n  :alt: Downloads\n\n.. image:: https://img.shields.io/pypi/pyversions/django-audiofield.svg\n  :target: https://pypi.python.org/pypi/django-audiofield/\n  :alt: Supported Python versions\n\n.. image:: https://img.shields.io/pypi/l/django-audiofield.svg\n  :target: https://pypi.python.org/pypi/django-audiofield/\n  :alt: License\n\n\nDjango-Audiofield is a simple app that allows Audio files upload, management and conversion to different audio format (mp3, wav \u0026 ogg), which also makes it easy to play audio files into your Django application.\n\nWe are using the HTML5 and Flash audio player SoundManager2_\n\n.. _SoundManager2: http://www.schillmania.com/projects/soundmanager2/\n\n.. image:: https://github.com/Star2Billing/django-audiofield/raw/master/docs/source/_static/django-admin-audiofield.png\n\n.. image:: https://github.com/Star2Billing/django-audiofield/raw/master/docs/source/_static/django-admin-audiofield-upload.png\n\n\nInstallation\n============\n\nInstall Django-Audiofield::\n\n    python setup.py install\n\n\nDependencies\n------------\n\nInstall dependencies on Debian::\n\n    apt-get -y install libsox-fmt-mp3 libsox-fmt-all mpg321 dir2ogg ffmpeg\n\nNote: For Debian version 7 (Wheezy) and older, replace `ffmpeg` with `libav-tools`\n\n\nInstall dependencies on Redhat/CentOS::\n\n    yum -y install python-setuptools libsox-fmt-mp3 libsox-fmt-all mpg321 dir2ogg\n\n\nInstall avconv on Redhat/CentOS::\n\n    git clone git://git.libav.org/libav.git\n    cd libav\n    sudo ./configure --disable-yasm\n    sudo make\n    sudo make install\n\n\nSettings\n========\n\nin your settings.py file::\n\n    # Set Following variable\n    MEDIA_ROOT = ''\n    MEDIA_URL = ''\n\n    In MIDDLEWARE_CLASSES add 'audiofield.middleware.threadlocals.ThreadLocals'\n\n    In INSTALLED_APPS add 'audiofield'\n\n    # Frontend widget values\n    # 0-Keep original, 1-Mono, 2-Stereo\n    CHANNEL_TYPE_VALUE = 0\n\n    # 0-Keep original, 8000-8000Hz, 16000-16000Hz, 22050-22050Hz,\n    # 44100-44100Hz, 48000-48000Hz, 96000-96000Hz\n    FREQ_TYPE_VALUE = 8000\n\n    # 0-Keep original, 1-Convert to MP3, 2-Convert to WAV, 3-Convert to OGG\n    CONVERT_TYPE_VALUE = 0\n\n\nUsage\n=====\n\nAdd the following lines in your models.py file::\n\n    from django.conf import settings\n    from audiofield.fields import AudioField\n    import os.path\n\n    # Add the audio field to your model\n    audio_file = AudioField(upload_to='your/upload/dir', blank=True,\n                            ext_whitelist=(\".mp3\", \".wav\", \".ogg\"),\n                            help_text=(\"Allowed type - .mp3, .wav, .ogg\"))\n\n    # Add this method to your model\n    def audio_file_player(self):\n        \"\"\"audio player tag for admin\"\"\"\n        if self.audio_file:\n            file_url = settings.MEDIA_URL + str(self.audio_file)\n            player_string = '\u003caudio src=\"%s\" controls\u003eYour browser does not support the audio element.\u003c/audio\u003e' % (file_url)\n            return player_string\n\n    audio_file_player.allow_tags = True\n    audio_file_player.short_description = ('Audio file player')\n\n\nAdd the following lines in your admin.py::\n\n    from your_app.models import your_model_name\n\n    # add 'audio_file_player' tag to your admin view\n    list_display = (..., 'audio_file_player', ...)\n    actions = ['custom_delete_selected']\n\n    def custom_delete_selected(self, request, queryset):\n        #custom delete code\n        n = queryset.count()\n        for i in queryset:\n            if i.audio_file:\n                if os.path.exists(i.audio_file.path):\n                    os.remove(i.audio_file.path)\n            i.delete()\n        self.message_user(request, (\"Successfully deleted %d audio files.\") % n)\n    custom_delete_selected.short_description = \"Delete selected items\"\n\n    def get_actions(self, request):\n        actions = super(AudioFileAdmin, self).get_actions(request)\n        del actions['delete_selected']\n        return actions\n\n\nThen perform following commands to create the table and collect the static files::\n\n    ./manage.py syncdb\n    ./manage.py collectstatic\n\n\nCreate audiofield.log file::\n\n    touch /var/log/audio-field.log\n\n\nContributing\n============\n\nIf you've found a bug, implemented a feature or customized the template and\nthink it is useful then please consider contributing. Patches, pull requests or\njust suggestions are welcome!\n\nSource code: http://github.com/Star2Billing/django-audiofield\n\nBug tracker: https://github.com/Star2Billing/django-audiofield/issues\n\n\nDocumentation\n=============\n\nDocumentation is available on 'Read the Docs':\nhttp://django-audiofield.readthedocs.org\n\n\nCredit\n======\n\nDjango-audiofield is a Star2Billing-Sponsored Community Project, for more information visit http://www.star2billing.com or email us at info@star2billing.com\n\n\nLicense\n=======\n\nDjango-Audiofield is licensed under MIT, see `MIT-LICENSE.txt`.\n\n\nTODO\n====\n\n- Use pydub (http://pydub.com) to lift the audio conversion away from django-audiofield\n\n- integrate with django-storage (http://django-storages.readthedocs.org/)\n\n- support more formats\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fareski%2Fdjango-audiofield","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fareski%2Fdjango-audiofield","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fareski%2Fdjango-audiofield/lists"}