Skip to content
This repository was archived by the owner on May 7, 2020. It is now read-only.

[sonos] Exchanged file extensions to existing constants #3598

Merged
merged 1 commit into from
Jun 7, 2017
Merged

[sonos] Exchanged file extensions to existing constants #3598

merged 1 commit into from
Jun 7, 2017

Conversation

cweitkamp
Copy link
Contributor

Signed-off-by: Christoph Weitkamp [email protected]

@kaikreuzer kaikreuzer merged commit 3d7f34d into eclipse-archived:master Jun 7, 2017
@cweitkamp cweitkamp deleted the feature-sonos branch June 7, 2017 12:27
} else if (AudioFormat.MP3.isCompatible(format)) {
handler.playNotificationSoundURI(new StringType(url + ".mp3"));
handler.playNotificationSoundURI(new StringType(url + FileAudioStream.MP3_EXTENSION));
Copy link
Contributor

Choose a reason for hiding this comment

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

I really don't know, but isn't it a little bit unexpected that an "extension" constant contains the "filename-extension-separator" (the dot)?

Copy link
Contributor Author

@cweitkamp cweitkamp Jun 7, 2017

Choose a reason for hiding this comment

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

Hm ... probably not.
The constant(s) is/are used in the getAudioFormat(File file) method to determine the audio format. Maybe we should refactor those lines to compare file extensions using the FilenameUtils.isExtension(String filename, String extension) method from Apache Commons IO. And additionally use FilenameUtils.EXTENSION_SEPARATOR_STR to concat again. wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I mean ... probably yes. Which changes the statement of my reply.

Copy link
Contributor

Choose a reason for hiding this comment

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

Wikipedia uses this summary for Filename extension:


A filename extension is an identifier specified as a suffix to the name of a computer file. The extension indicates a characteristic of the file contents or its intended use. A file extension is typically delimited from the filename with a full stop (period), but in some systems it is separated with spaces.


We can also life with the fact that our extension constants contains the separator already but I don't think this is a good practice to use stuff different then expected.

The constant(s) is/are used in the getAudioFormat(File file) method to determine the audio format. Maybe we should refactor those lines to compare file extensions using the FilenameUtils.isExtension(String filename, String extension) method from Apache Commons IO. And additionally use FilenameUtils.EXTENSION_SEPARATOR_STR to concat again. wdyt?

I would at least expect that a filename, a filename extension and the separator are handled separately and not mixed.
If Apache Commons IO is already used by our bundles, I am fine with using constants and methods it provides. Otherwise we can also fix it in our code base without Commons IO.

If we drop the dot from the extension then we will potential break some bindings...

@kaikreuzer WDYT about using the common name handling in our code base?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, this should be changed.
I'd prefer doing it without Apache commons though - the less dependencies we have, the better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PR #3837

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants