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

Get music genre #1

Open
antoinefotso opened this issue May 11, 2021 · 5 comments
Open

Get music genre #1

antoinefotso opened this issue May 11, 2021 · 5 comments

Comments

@antoinefotso
Copy link

This package work well but Is there anyway to get music genre?

@marf
Copy link
Collaborator

marf commented May 11, 2021

Hello, with latest commit I should have added genreId and genreName for audio files. Please let me know if it works!

@antoinefotso
Copy link
Author

@marf i used yarn add react-native-mediastore and i it still installing old version in node_modules (0.1.0) without genre and genre_id

@marf
Copy link
Collaborator

marf commented May 11, 2021

@antoinefotso now we should have published 0.1.1 with the genres

@antoinefotso
Copy link
Author

antoinefotso commented May 11, 2021

@marf i got error for this new version

log:

Task :react-native-mediastore:compileDebugKotlin FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings
43 actionable tasks: 41 executed, 2 up-to-date
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: [2] Wrote GeneratedAppGlideModule with: [com.bumptech.glide.integration.okhttp3.OkHttpLibraryGlideModule, com.dylanvann.fastimage.FastImageOkHttpProgressGlideModule]
e: C:\Users\ATN PRO\projects\reactmusic\node_modules\react-native-mediastore\android\src\main\java\com\reactnativemediastore\MediastoreModule.kt: (30, 24): Unresolved reference: Strimg (i renamed to String but still getting error bellow)
e: C:\Users\ATN PRO\projects\reactmusic\node_modules\react-native-mediastore\android\src\main\java\com\reactnativemediastore\MediastoreModule.kt: (118, 32): Unresolved reference: GENRE_ID
e: C:\Users\ATN PRO\projects\reactmusic\node_modules\react-native-mediastore\android\src\main\java\com\reactnativemediastore\MediastoreModule.kt: (119, 32): Unresolved reference: GENRE
e: C:\Users\ATN PRO\projects\reactmusic\node_modules\react-native-mediastore\android\src\main\java\com\reactnativemediastore\MediastoreModule.kt: (139, 9): Null can not be a value of a non-null type String

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':react-native-mediastore:compileDebugKotlin'.

Compilation error. See log for more details

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 1m 23s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Note: Some input files use or override a deprecated API.

@marf
Copy link
Collaborator

marf commented May 12, 2021

@antoinefotso we fixed the bug, but unfortunately, we canno't retrieve genre from music files.

To do so I suggest you something like this:

MediaMetadataRetriever mr = new MediaMetadataRetriever();

Uri trackUri = ContentUris.withAppendedId(
    android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,song_id);

mr.setDataSource(mContext, trackUri);

String thisGenre = mr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_GENRE);

If you find some solution and could patch the code to get the GENRE directly from the query of media store medias please let us know and we will accept a PR :)

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

No branches or pull requests

2 participants