Giter Site home page Giter Site logo

kotify's People

Contributors

blad3mak3r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

kotify's Issues

Kotify not working on RELEASE MODE

I was implementing Kotify in an app and everything workedd correctly in debug mode. When i switched to release mode, it does not work. I have a try/catch that tris to do the code and then with an adapter i put it on the app and the catch returns another view in the app. In debug mode everything works correctly and the TRY is triggered. But in release, it triggers the CATCH meaning thatt the code has failed (api call)
CODE TRY CATCH

  lifecycleScope.launch {
        try {

                val kotify = Kotify(
                    clientID = "5ef1e8a612cb4f12b3343ad26427ec93",
                    clientSecret = "6752b38c773741ea8e15404e613bea83"
                )

                val playlist: List<PlaylistPagination.Item> =
                    kotify.playlists.get("37i9dQZEVXbMDoHDwVN2tF").tracks.items


                val tracks: ArrayList<Track> = playlist.map { it.track } as ArrayList<Track>

                for (i in 0 until tracks.count()) {


                    val SEVERALartistsname: ArrayList<Artist> =
                        tracks[i].artists as ArrayList<Artist>
                    for (o in 0 until SEVERALartistsname.count()) {
                        if (artistname == null) {
                            artistname = SEVERALartistsname[o].name
                        } else {
                            artistname = artistname + ", " + SEVERALartistsname[o].name
                        }
                    }


                    val SEVERALalbumimg: ArrayList<Image> =
                        tracks[i].album?.images as ArrayList<Image>
                    val artworkTrack = SEVERALalbumimg[2].url


                    val songname = tracks[i].name ?: "N/A"
                    val nameartist = songname + System.lineSeparator() + artistname


                    courseList2.add(namespoty(i + 1, nameartist, artworkTrack))
                    SEVERALartistsname.clear()
                    artistname = null


                }

            val courseRVAdapter2 = CourseRVAdapter2(courseList2, true)
            courseRV.adapter = courseRVAdapter2

            loadingPB.visibility = View.GONE

        } catch(e:Exception){
            Log.i("HELLO", "CATCH")
            loadingPB.visibility = View.GONE
            Log.i("HELLO", "CATCH2")
            courseList2.add(namespoty(null,"",""))
            val courseRVAdapter2 = CourseRVAdapter2(courseList2, false)
            Log.i("HELLO", "CATCH3")
            courseRV.adapter = courseRVAdapter2
            Log.i("HELLO", "CATCHEND")
        }

it has to do with the relase mode and a thing to mention is that i have the proguard rules activated and i dont now if i have to add a rule excluding and which one! I would help a lot!
Your work is awesome! (take into account that is release mode and i dont have the logcat to see wheres the error so im stuck)

uso de oauth scopes

tengo una pregunta. Cuando usas Kotify para pedir la playlist Top Global 50, se hace uso de los Oauth scopes o ni? Lo digo porque he pedido una extensión de la cuota de usuarios a la API de spotify y me dice que pueden haber mas de 1 Oauth Scopes en uso. Te dejo el codigo que uso.

val kotify = Kotify(
    clientID = "CLIENTID",
    clientSecret = "CLIENT SECRET"
)

val playlist: List<PlaylistPagination.Item> =
    kotify.playlists.get("37i9dQZEVXbMDoHDwVN2tF").tracks.items



val tracks: ArrayList<Track> = playlist.map { it.track } as ArrayList<Track>

for (i in 0 until tracks.count()) {


    val SEVERALartistsname: ArrayList<Artist> =
        tracks[i].artists as ArrayList<Artist>
    for (o in 0 until SEVERALartistsname.count()) {
        if (artistname == null) {
            artistname = SEVERALartistsname[o].name
        } else {
            artistname = artistname + ", " + SEVERALartistsname[o].name
        }
    }


    val SEVERALalbumimg: ArrayList<Image> =
        tracks[i].album?.images as ArrayList<Image>
    val artworkTrack = SEVERALalbumimg[2].url


    val songname = tracks[i].name ?: "N/A"
    val nameartist = songname + System.lineSeparator() + artistname


    courseList2.add(namespoty(i + 1, nameartist, artworkTrack))
    SEVERALartistsname.clear()
    artistname = null


}

JsonDecodingException when decoding playlist with id 0nXKVLwZ7yk7hkU6OWsFcw

When Kotify try to decode https://open.spotify.com/playlist/0nXKVLwZ7yk7hkU6OWsFcw?si=4eddfe0f414d4550 throw a KotifyException with the following log:

Caused by: tv.blademaker.kotify.exceptions.KotifyException: Unexpected JSON token at offset 338133: Expected string literal but 'null' literal was found.
Use 'coerceInputValues = true' in 'Json {}` builder to coerce nulls to default values.
JSON input: ..... : {
          "album_type" : null,
          "artists" : [ .....
        at tv.blademaker.kotify.request.Request$execute$2.invokeSuspend(Request.kt:77)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:279)
        at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
        at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
        at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
        at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
        at net.hugebot.audio.sources.spotify.providers.SpotifyPlaylistProvider.load(SpotifyPlaylistProvider.kt:22)
        at net.hugebot.audio.sources.spotify.SpotifyAudioSourceManager.loadItemOnce(SpotifyAudioSourceManager.kt:59)
        at net.hugebot.audio.sources.spotify.SpotifyAudioSourceManager.loadItem(SpotifyAudioSourceManager.kt:44)
        at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.checkSourcesForItemOnce(DefaultAudioPlayerManager.java:436)
        at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.checkSourcesForItem(DefaultAudioPlayerManager.java:418)
        at com.sedmelluq.discord.lavaplayer.player.DefaultAudioPlayerManager.lambda$createItemLoader$0(DefaultAudioPlayerManager.java:217)
        ... 6 common frames omitted
Caused by: kotlinx.serialization.json.internal.JsonDecodingException: Unexpected JSON token at offset 338133: Expected string literal but 'null' literal was found.
Use 'coerceInputValues = true' in 'Json {}` builder to coerce nulls to default values.
JSON input: ..... : {
          "album_type" : null,
          "artists" : [ .....
        at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:24)
        at kotlinx.serialization.json.internal.JsonExceptionsKt.JsonDecodingException(JsonExceptions.kt:32)
        at kotlinx.serialization.json.internal.AbstractJsonLexer.fail(AbstractJsonLexer.kt:524)
        at kotlinx.serialization.json.internal.AbstractJsonLexer.unexpectedToken(AbstractJsonLexer.kt:202)
        at kotlinx.serialization.json.internal.StringJsonLexer.consumeNextToken(StringJsonLexer.kt:74)
        at kotlinx.serialization.json.internal.StringJsonLexer.consumeKeyString(StringJsonLexer.kt:85)
        at kotlinx.serialization.json.internal.AbstractJsonLexer.consumeString(AbstractJsonLexer.kt:310)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeString(StreamingJsonDecoder.kt:256)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeStringElement(AbstractDecoder.kt:58)
        at tv.blademaker.kotify.models.PartialAlbum$$serializer.deserialize(Album.kt:24)
        at tv.blademaker.kotify.models.PartialAlbum$$serializer.deserialize(Album.kt:24)
        at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeNullableSerializableElement(AbstractDecoder.kt:79)
        at tv.blademaker.kotify.models.Track$$serializer.deserialize(Track.kt:6)
        at tv.blademaker.kotify.models.Track$$serializer.deserialize(Track.kt:6)
        at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
        at tv.blademaker.kotify.models.PlaylistPagination$Item$$serializer.deserialize(PlaylistPagination.kt:19)
        at tv.blademaker.kotify.models.PlaylistPagination$Item$$serializer.deserialize(PlaylistPagination.kt:19)
        at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
        at kotlinx.serialization.encoding.CompositeDecoder$DefaultImpls.decodeSerializableElement$default(Decoding.kt:535)
        at kotlinx.serialization.internal.ListLikeSerializer.readElement(CollectionSerializers.kt:80)
        at kotlinx.serialization.internal.AbstractCollectionSerializer.readElement$default(CollectionSerializers.kt:51)
        at kotlinx.serialization.internal.AbstractCollectionSerializer.merge(CollectionSerializers.kt:36)
        at kotlinx.serialization.internal.AbstractCollectionSerializer.deserialize(CollectionSerializers.kt:43)
        at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
        at tv.blademaker.kotify.models.PlaylistPagination$$serializer.deserialize(PlaylistPagination.kt:7)
        at tv.blademaker.kotify.models.PlaylistPagination$$serializer.deserialize(PlaylistPagination.kt:7)
        at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableValue(AbstractDecoder.kt:43)
        at kotlinx.serialization.encoding.AbstractDecoder.decodeSerializableElement(AbstractDecoder.kt:70)
        at tv.blademaker.kotify.models.Playlist$$serializer.deserialize(Playlist.kt:6)
        at tv.blademaker.kotify.models.Playlist$$serializer.deserialize(Playlist.kt:6)
        at kotlinx.serialization.json.internal.PolymorphicKt.decodeSerializableValuePolymorphic(Polymorphic.kt:59)
        at kotlinx.serialization.json.internal.StreamingJsonDecoder.decodeSerializableValue(StreamingJsonDecoder.kt:36)
        at kotlinx.serialization.json.Json.decodeFromString(Json.kt:100)
        at tv.blademaker.kotify.request.Request$execute$2.invokeSuspend(Request.kt:56)
        ... 20 common frames omitted

External urls

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.