-
-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audiobook play time #2551
Open
joachimesque
wants to merge
26
commits into
bookwyrm-social:main
Choose a base branch
from
joachimesque:audiobook-play-time
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Audiobook play time #2551
Changes from 12 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
bfa64a9
Add audiobook_play_time field in edition model
joachimesque bee0f31
Add audiobook_play_time field in form
joachimesque 2cfbfe2
Display format in book page
joachimesque 0dbfff3
Let the DOM dance
joachimesque 647b3c6
Black
joachimesque 9f7d520
Fix lint
joachimesque 54a7931
Fix test
joachimesque d10abf4
Move duration localization to a filter
joachimesque 9925df1
Improve widget attributes readability
joachimesque 92c07f4
Display right field on load
joachimesque c0eb7d4
Fix lint error
joachimesque 4cfaba0
Add template tag test
joachimesque 791b65c
Use DurationField with custom widget and clean function
joachimesque 7e37086
Handle no-js option
joachimesque b550693
Move format logic to dedicated snippet
joachimesque bf32945
Add schema.org Book object duration
joachimesque 6fa56dc
Change activitypub audiobookPlayTime type
joachimesque b331271
Fix (some) tests, by allowing null/0/empty values
joachimesque 88ade64
Fix JS formating
joachimesque 024aeb9
Merge branch 'main' into audiobook-play-time
joachimesque 9c8f484
Merge branch 'main' into audiobook-play-time
jaschaurbach 65448ce
Merge branch 'main' into audiobook-play-time
jaschaurbach 6008f1f
Merge branch 'main' into audiobook-play-time
joachimesque bcedca5
Always store and display an absolute value of the duration
joachimesque 6c0a329
Fix migrations conflict
joachimesque e2b6efd
Merge branch 'main' into audiobook-play-time
mouse-reeve File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Generated by Django 3.2.16 on 2022-12-26 18:13 | ||
|
||
import bookwyrm.models.fields | ||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("bookwyrm", "0172_alter_user_preferred_language"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="edition", | ||
name="audiobook_play_time", | ||
field=bookwyrm.models.fields.PermissivePlayTime( | ||
blank=True, max_length=255, null=True | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of encoding
audiobookPlayTime
as an integer (seconds or minutes), or even better a time interval and interpreting it accordingly on the frontend? As a general principle, I find it's best if the data stored in the database is as unambiguous and as close to "ground truth" as possible, with any interpretation being done clientside.More briefly: I find it leads to less headaches if you are permissive on input, and strict on what you store.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One big question is: how will it federate? My transform (* 60 to the value at clean() time) would multiply an already correct value, coming from another server, and so on. Do you know how I can prevent that? Is it by making an activitypub-aware field with
field_to_activity
andfield_from_activity
transforms? That's a part I really don't know in the codebase.