<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Internal Server Error on Get Playback State in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/Internal-Server-Error-on-Get-Playback-State/m-p/5421830#M5687</link>
    <description>&lt;P&gt;&lt;STRONG&gt;Plan&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Free&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Country&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Italy&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Device&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;PC&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Operating System&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Windows 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My Issue&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hello, i just created a java software that should count the time i spend listening music on spotify, it requests every second the playback state and then update the time with an algorithm, it works very well, but just sometimes, (it seems when im not listening spotify) it throws internal server error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: I just noticed that sometimes throws a Service Unavailable and Bad Gateway error too&lt;/P&gt;</description>
    <pubDate>Fri, 26 Aug 2022 23:00:52 GMT</pubDate>
    <dc:creator>Dani_210</dc:creator>
    <dc:date>2022-08-26T23:00:52Z</dc:date>
    <item>
      <title>Internal Server Error on Get Playback State</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Internal-Server-Error-on-Get-Playback-State/m-p/5421830#M5687</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Plan&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Free&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Country&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Italy&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Device&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;PC&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Operating System&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Windows 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My Issue&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hello, i just created a java software that should count the time i spend listening music on spotify, it requests every second the playback state and then update the time with an algorithm, it works very well, but just sometimes, (it seems when im not listening spotify) it throws internal server error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: I just noticed that sometimes throws a Service Unavailable and Bad Gateway error too&lt;/P&gt;</description>
      <pubDate>Fri, 26 Aug 2022 23:00:52 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Internal-Server-Error-on-Get-Playback-State/m-p/5421830#M5687</guid>
      <dc:creator>Dani_210</dc:creator>
      <dc:date>2022-08-26T23:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Internal Server Error on Get Playback State</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Internal-Server-Error-on-Get-Playback-State/m-p/5423616#M5823</link>
      <description>&lt;P&gt;Could you provide some more information on what exactly are you doing with the data you are providing?&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 09:27:08 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Internal-Server-Error-on-Get-Playback-State/m-p/5423616#M5823</guid>
      <dc:creator>Yazzowski</dc:creator>
      <dc:date>2022-08-31T09:27:08Z</dc:date>
    </item>
    <item>
      <title>Re: Internal Server Error on Get Playback State</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Internal-Server-Error-on-Get-Playback-State/m-p/5423678#M5833</link>
      <description>&lt;P&gt;Sure, so this is the code that i use in a Runnable that runs every second&lt;/P&gt;&lt;LI-CODE lang="java"&gt;CurrentlyPlayingContext ctx = api.getInformationAboutUsersCurrentPlayback().build().execute();

            if(ctx == null)
                return;

            if(!ctx.getIs_playing()) {
                current = new SavingTrack(ctx.getItem().getId());
                current.setProgress(ctx.getProgress_ms());
                return;
            }
            if(ctx.getItem() == null) return;

            String id = ctx.getItem().getId();
            if(current != null){
                if(current.getId().equals(id)){
                    if(current.getProgress() &amp;lt; ctx.getProgress_ms())
                        current.setProgress(ctx.getProgress_ms());
                    return;
                } else {
                    total += current.getProgress();

                    writeTotal();
                }
            }

            current = new SavingTrack(ctx.getItem().getId());
            current.setProgress(ctx.getProgress_ms());&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Saving track is just a class with the id of the song and the progress in milliseconds, i use it for save the current track playing, when the track that i get from the request is different from the track in memory (current), i save the time on the file and change the current track.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The CurrentPlayingContext comes from&amp;nbsp;&lt;A href="https://github.com/spotify-web-api-java/spotify-web-api-java" target="_blank" rel="noopener"&gt;this&lt;/A&gt;&amp;nbsp;library&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 31 Aug 2022 12:26:57 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Internal-Server-Error-on-Get-Playback-State/m-p/5423678#M5833</guid>
      <dc:creator>Dani_210</dc:creator>
      <dc:date>2022-08-31T12:26:57Z</dc:date>
    </item>
  </channel>
</rss>

