Skip to content
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

Update to MP3, FLAC, Ogg and WMA Formats to use BPM tags. #708

Merged
merged 2 commits into from Dec 16, 2021

Conversation

kwarklabs
Copy link
Contributor

Changes to 4 files in Slim/Formats to enable slimserver to use Beat-Per-Minute (BPM) tempo tag information in MP3, FLAC, Ogg and WMA files. The Linux package BPM-TOOLS can be used to tag files with BPM information and this PR enables slimserver to take advantage of this.

Copy link
Member

@michaelherger michaelherger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition, thanks!

But could you please simplify the conversion to an integer? There's int() in Perl to do this. Did I miss something?

Comment on lines 253 to 258
if (defined $tags->{BPM}) {
# Make the BPM an integer by dropping digits after decimal point.
if ($tags->{BPM} =~ m|^\d+\.\d+$|) {
($tags->{BPM} = $tags->{BPM}) =~ s/^(\d+)(\.\d+)$/$1/;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this something simpler like:

$tags->{BPM} = int($tags->{BPM}) if defined $tags->{BPM};

Comment on lines 411 to 416
if (defined $tags->{BPM}) {
# Make the BPM an integer by dropping digits after decimal point.
if ($tags->{BPM} =~ m|^\d+\.\d+$|) {
($tags->{BPM} = $tags->{BPM}) =~ s/^(\d+)(\.\d+)$/$1/;
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int()

Comment on lines 100 to 106
if (defined $tags->{BPM}) {
# Make the BPM an integer by dropping digits after decimal point.
if ($tags->{BPM} =~ m|^\d+\.\d+$|) {
($tags->{BPM} = $tags->{BPM}) =~ s/^(\d+)(\.\d+)$/$1/;
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int()

Comment on lines 71 to 77
if (defined $tags->{BPM}) {
# Make the BPM an integer by dropping digits after decimal point.
if ($tags->{BPM} =~ m|^\d+\.\d+$|) {
($tags->{BPM} = $tags->{BPM}) =~ s/^(\d+)(\.\d+)$/$1/;
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int()

@terual
Copy link
Member

terual commented Dec 16, 2021

Could you also include APE in your change? APE also uses the BPM tag (see https://picard-docs.musicbrainz.org/v2.6/en/appendices/tag_mapping.html#bpm-4). I was also wondering why BPM should be a whole number? Is there a use case for integer BPMs instead of the decimal number?

@michaelherger
Copy link
Member

I was also wondering why BPM should be a whole number? Is there a use case for integer BPMs instead of the decimal number?

I don't know for the initial reason. But the database schema defines it as smallint. A schema change would require a full wipe & rescan on an update. I usually try to avoid this without very good reason. Floating point BPM isn't good enough in my opinion...

@terual
Copy link
Member

terual commented Dec 16, 2021

I was also wondering why BPM should be a whole number? Is there a use case for integer BPMs instead of the decimal number?

I don't know for the initial reason. But the database schema defines it as smallint. A schema change would require a full wipe & rescan on an update. I usually try to avoid this without very good reason. Floating point BPM isn't good enough in my opinion...

That makes it clear, thanks

@kwarklabs
Copy link
Contributor Author

Thank you for the comments and suggestions. We've updated the PR to include APE file format and changed the integer conversion as suggested.

@mherger
Copy link
Contributor

mherger commented Dec 16, 2021

Thanks!

@mherger mherger merged commit e74e569 into LMS-Community:public/8.3 Dec 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants