[Tag Editor] Changed JAudioTagger to https://github.com/Kaned1as/jaudiotagger

- We should be able to read and write to opus files
- We should be able to set artwork to Flac and other files
This commit is contained in:
Prathamesh More 2021-12-13 15:01:44 +05:30
parent aaabd8a20a
commit 305b075365
3 changed files with 10 additions and 9 deletions

View file

@ -153,7 +153,7 @@ dependencies {
implementation 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:1.0.0' implementation 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:1.0.0'
implementation 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5' implementation 'org.eclipse.mylyn.github:org.eclipse.egit.github.core:2.1.5'
implementation 'com.github.AdrienPoupa:jaudiotagger:2.2.3' implementation 'com.github.Adonai:jaudiotagger:2.3.14'
implementation 'com.anjlab.android.iab.v3:library:2.0.3' implementation 'com.anjlab.android.iab.v3:library:2.0.3'
implementation 'com.r0adkll:slidableactivity:2.1.0' implementation 'com.r0adkll:slidableactivity:2.1.0'
implementation 'com.heinrichreimersoftware:material-intro:2.0.0' implementation 'com.heinrichreimersoftware:material-intro:2.0.0'

View file

@ -21,8 +21,8 @@ import org.jaudiotagger.audio.exceptions.CannotWriteException
import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException
import org.jaudiotagger.audio.exceptions.ReadOnlyFileException import org.jaudiotagger.audio.exceptions.ReadOnlyFileException
import org.jaudiotagger.tag.TagException import org.jaudiotagger.tag.TagException
import org.jaudiotagger.tag.images.AndroidArtwork
import org.jaudiotagger.tag.images.Artwork import org.jaudiotagger.tag.images.Artwork
import org.jaudiotagger.tag.images.ArtworkFactory
import java.io.File import java.io.File
import java.io.FileOutputStream import java.io.FileOutputStream
import java.io.IOException import java.io.IOException
@ -58,11 +58,11 @@ class TagWriter {
try { try {
albumArtFile = createAlbumArtFile(context).canonicalFile albumArtFile = createAlbumArtFile(context).canonicalFile
info.artworkInfo.artwork.compress( info.artworkInfo.artwork.compress(
Bitmap.CompressFormat.PNG, Bitmap.CompressFormat.JPEG,
0, 100,
FileOutputStream(albumArtFile) FileOutputStream(albumArtFile)
) )
artwork = ArtworkFactory.createArtworkFromFile(albumArtFile) artwork = AndroidArtwork.createArtworkFromFile(albumArtFile)
} catch (e: IOException) { } catch (e: IOException) {
e.printStackTrace() e.printStackTrace()
} }
@ -131,11 +131,11 @@ class TagWriter {
try { try {
albumArtFile = createAlbumArtFile(context).canonicalFile albumArtFile = createAlbumArtFile(context).canonicalFile
info.artworkInfo.artwork.compress( info.artworkInfo.artwork.compress(
Bitmap.CompressFormat.PNG, Bitmap.CompressFormat.JPEG,
0, 100,
FileOutputStream(albumArtFile) FileOutputStream(albumArtFile)
) )
artwork = ArtworkFactory.createArtworkFromFile(albumArtFile) artwork = AndroidArtwork.createArtworkFromFile(albumArtFile)
} catch (e: IOException) { } catch (e: IOException) {
e.printStackTrace() e.printStackTrace()
} }

View file

@ -14,6 +14,7 @@
package code.name.monkey.retromusic.glide.audiocover; package code.name.monkey.retromusic.glide.audiocover;
import org.jaudiotagger.audio.exceptions.CannotReadException;
import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException; import org.jaudiotagger.audio.exceptions.InvalidAudioFrameException;
import org.jaudiotagger.audio.exceptions.ReadOnlyFileException; import org.jaudiotagger.audio.exceptions.ReadOnlyFileException;
import org.jaudiotagger.audio.mp3.MP3File; import org.jaudiotagger.audio.mp3.MP3File;
@ -45,7 +46,7 @@ public class AudioFileCoverUtils {
} }
} }
// If there are any exceptions, we ignore them and continue to the other fallback method // If there are any exceptions, we ignore them and continue to the other fallback method
} catch (ReadOnlyFileException | InvalidAudioFrameException | TagException | IOException ignored) { } catch (ReadOnlyFileException | InvalidAudioFrameException | TagException | IOException | CannotReadException ignored) {
} }
// Method 2: look for album art in external files // Method 2: look for album art in external files