Skip to content

Commit

Permalink
Updates to file helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
c-e-p committed Jun 11, 2023
1 parent e9cb393 commit 9c33215
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion local-dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Required:
```
check out [this](https://askubuntu.com/questions/1372562/how-to-install-libpq-dev-14-0-1-on-ubuntu-21-10)
3. For audio processing, install [ffmpeg](https://ffmpeg.org/download.html)
4. Log into postgres. Create a new database user and database according to the settings in settings.py. (Database name OURCHIVE_DB, database user ourchive, password generated by you.) Ensure that the ourchive user has correct permissions for the database (refer to [https://stackoverflow.com/questions/67276391/why-am-i-getting-a-permission-denied-error-for-schema-public-on-pgadmin-4](this) StackOverflow question for grants required.)
4. Log into postgres. Create a new database user and database according to the settings in settings.py. (Database name ourchive_db, database user ourchive, password generated by you.) Ensure that the ourchive user has correct permissions for the database (refer to [https://stackoverflow.com/questions/67276391/why-am-i-getting-a-permission-denied-error-for-schema-public-on-pgadmin-4](this) StackOverflow question for grants required.)
5. Django leverages `dotenv` for loading environment variables. Copy `ourchive/ourchive_app/ourchive_app/.env-sample` into a new file, `.env`, in the same directory.

`OURCHIVE_MAILGUN_API_KEY` can be left blank as it is not used for local development. `settings.py` sets the email backend to "file" for local development. Any emails the system sends will be saved as text in a `sent_emails` directory.
Expand Down
2 changes: 1 addition & 1 deletion ourchive_app/api/file_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@


logger = logging.getLogger(__name__)
audio_processing = (OurchiveSetting.objects.filter(name='Audio Processing').first() is not None and OurchiveSetting.objects.filter(name='Audio Processing').first().value == 'True')


class FileHelperService:
Expand All @@ -32,6 +31,7 @@ def get_filename(self, original_name):
return uuid_str + '_' + original_name + suffix

def calculate_audio_duration(self, filename):
audio_processing = (OurchiveSetting.objects.filter(name='Audio Processing').first() is not None and OurchiveSetting.objects.filter(name='Audio Processing').first().value == 'True')
if audio_processing:
try:
with audioread.audio_open(filename) as f:
Expand Down

0 comments on commit 9c33215

Please sign in to comment.