MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    MMM-Spotify

    Scheduled Pinned Locked Moved Entertainment
    249 Posts 51 Posters 276.0k Views 54 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M Offline
      mmmmh Project Sponsor
      last edited by

      @Bugsounet I noticed in my pihole logs that there were at least 10 DNS queries for Spotify per second, something is not right. The actual refresh rate for the module is set to 3000 ms. I had to disable the module.

      1 Reply Last reply Reply Quote 0
      • ? Offline
        A Former User
        last edited by A Former User

        i correct it with last update :)

        1.3.2 (2020-05-15)
        Modified: onStart script (Now launched if Spotify initialized)
        Added: "Cast" Icons
        1.3.1 (2020-05-14)
        Modified: 'progress bar'
        Fixed: number of request on idle (depend now of updateInterval config)
        
        1 Reply Last reply Reply Quote 0
        • ? Offline
          A Former User
          last edited by A Former User

          @mmmmh :

          sorry, I take over the project … and its bugs!
          I correct little by little :)

          note: after … I understand why my mirror crashed with this module!
          now it’s better :)

          thinking to @eouia who love when I fixed bugs

          1 Reply Last reply Reply Quote 2
          • M Offline
            mmmmh Project Sponsor
            last edited by

            @Bugsounet, thanks for fixing it. From the changelog, should I expect that many requests again when not on idle?

            1 Reply Last reply Reply Quote 0
            • ? Offline
              A Former User
              last edited by A Former User

              I will try to improve it…
              actually i’m working arround another bug …
              multi account and connected / disconnected notification …

              with one account it’s works correctly but not with multi :(

              bouah !

              it’s horrible, in multi-account mode, MMM-Spotify tries to connect to all accounts to send news live

              I really wonder if the multi-account mode is really a good feature

              and of course … wow it spam like it can not connect to the account that we do not use

              humm, how to manage this mess !?
              i will impect …

              Note:

              • with multi account, I think It can crash the RPI … (so so so so … more loop)
              • in my dev platform (desktop with debian linux):
                • in idle: CPU 3%
                • with buggy playing multi-account : CPU 36%

              It’s very very high !!!

              1 Reply Last reply Reply Quote 0
              • ? Offline
                A Former User
                last edited by

                So…

                I propose this (and i have already coded a part of it in other dev) :

                • a single account checking and displaying (default account in config)
                • Changing account is by vocal (like Jarvis ... Spotify account name)

                name is the USERNAME defined in the spotify.config.json file
                Of course, i will add this function in AMk2 Spotify recipe

                Result:
                Less CPU time, Less DNS request, Less Loop for Checking … More Free Memory and RPI will be better

                what do you think about this ?

                Z 1 Reply Last reply Reply Quote 0
                • ? Offline
                  A Former User
                  last edited by

                  v1.4.0 (2020-05-16)

                  • Added & Modified: Multi-account management by notification SPOTIFY_ACCOUNT
                  • Fixed: Loop CONNECTED/DISCONNECTED on multi-account
                  • Fixed: Less CPU time, Less DNS request
                  • Fixed: Maybe RPI crashed when using multi-account (memory leaks)
                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    mmmmh Project Sponsor
                    last edited by

                    Regrettably, DNS requests are still too many. I see 1000 in 10 minutes (purple is a fresh install of MagicMirror with just the clock and the Spotify module):

                    40ae5d0e-c676-43c6-b947-ef74e2640cad-image.png

                    1 Reply Last reply Reply Quote 0
                    • ? Offline
                      A Former User
                      last edited by

                      I think the best solution is Don’t use it
                      (like my other modules)

                      ? 1 Reply Last reply Reply Quote 0
                      • ? Offline
                        A Former User @Guest
                        last edited by

                        Sorry for bothering you guys with my kinky ex-module.

                        The problem is; There is no server-pushed way to get current playback in RPI with spotify api.
                        So to get current playing data, frequent api callings are needed.

                        Possible solution under current condition is; removing some features - like progress bar, displaying playtime… So then too many requests are not needed.

                        In other platforms like desktop PC, Google Chrome has widevine/DRM so we can use “web playback api”, it can make direct playing spotify on browser level, and get playback data directly. But not possible in rpi natively.

                        Some hacks for widevine exist for RPI chromium, but our MM’s electron still miss that feature.

                        But! I’ve heard newest Electron(9.0) has a new Chromium(80? 83?) and it might have widevine supported (I haven’t tested yet, or never…)
                        I’m not sure it would be supported in rpi or not but if who has interest, worthy to try. If supported, you can build a new module which can play spotify directly without raspotify instead this poor module.

                        M 2 Replies Last reply Reply Quote 0
                        • M Offline
                          mmmmh Project Sponsor @Guest
                          last edited by

                          @Sean Thank you for chiming in and for providing a more elaborate response. I thought that the constant polling might be the reason. If I may comment, for other users it may be helpful to put it in the documentation that using the module leads to increased network traffic.

                          I for one would be happy with a display of the static per-title information and the controls, I will observe what happens when I crank the refresh rate up to 30000 milliseconds.

                          1 Reply Last reply Reply Quote 0
                          • M Offline
                            mmmmh Project Sponsor @Guest
                            last edited by

                            @Sean I hacked together a simple bash script (dnssaver.sh) that fetches IPs and stores them in the hosts file. If I call it with ‘api.spotify.com’ as argument and put it in my crontab it should take a load of the dns server. I’ll keep an eye on it.

                            1 Reply Last reply Reply Quote 0
                            • Cr4z33C Offline
                              Cr4z33
                              last edited by

                              @Bugsounet either I am doing something wrong or there’s a bug.

                              I added onStart: null, in the module config, but the big Spotify logo keeps displaying all the time.

                              1 Reply Last reply Reply Quote 0
                              • ? Offline
                                A Former User
                                last edited by A Former User

                                if Soptify logo not hidden after start, it’s means :
                                token missing or token error

                                you should have in console something like that :

                                [SPOTIFY:ERROR] USERNAME: [your username]
                                [SPOTIFY:ERROR] Token Error ! ./[token name].json
                                

                                if you have set a token … verify the exact name
                                and report it to your account username specified in spotify.config.json -> “TOKEN” field

                                S 1 Reply Last reply Reply Quote 0
                                • ? Offline
                                  A Former User
                                  last edited by

                                  when ok It display :

                                  • default style
                                    253eaa12-c844-4296-8b73-1d107fdb504a-image.png

                                  • mini style
                                    108abf52-5ca1-41c3-983c-7c3bc2abe3e7-image.png

                                  • when bottom_bar position is set
                                    56ab36ca-b72b-463d-8a90-37fae6d6bbc4-image.png

                                  1 Reply Last reply Reply Quote 1
                                  • ? Offline
                                    A Former User
                                    last edited by A Former User

                                    @mmmmh :

                                    ec2c8523-54a4-4a39-a78a-db4e95a007de-image.png

                                    now idleInterval is set to 30000 (scan is Spotify is playing every 30 sec)
                                    if playing : updateInterval is set by default to 1000 (1sec)

                                    Attention it’s means that with idleInterval : when Spotify is playing to take 30 sec to display it in mirror !by default !

                                    1 Reply Last reply Reply Quote 0
                                    • M Offline
                                      mmmmh Project Sponsor
                                      last edited by

                                      @Bugsounet Thanks. Do I understand this correctly. As long as the module is idle it will only check for updates every 30 seconds and when it is active (music is being played) it updates every second?

                                      1 Reply Last reply Reply Quote 0
                                      • ? Offline
                                        A Former User
                                        last edited by

                                        Right,

                                        I hope this suits you, because it starts to take head ;)

                                        1 Reply Last reply Reply Quote 0
                                        • S Offline
                                          sbonn13
                                          last edited by sbonn13

                                          Somehow the authorization process does not work.

                                          ...node first auth.js
                                          [SPOTIFY] Initialized
                                          

                                          Browser opened and the log in was succesful as well as accepting the app, but then instead of creating the token.js I receive an error:

                                          [SPOTIFY] Error in authentication flow!
                                          [SPOTIFY] ERROR: undefined
                                          [SPOTIFY] Authorization process finished!
                                          

                                          In spotify I can see that I have the mirror app available in approved apps, but there is not token in the modules folder. Therefore the connection does not work.

                                          Does anybody have an idea?
                                          Thanks

                                          S 1 Reply Last reply Reply Quote 0
                                          • S Do not disturb
                                            sdetweil @sbonn13
                                            last edited by sdetweil

                                            @sbonn13 there will be a message popup on the browser with a code (press the copy icon)
                                            then return to the terminal window and paste the code in at the little app prompt, and hit enter
                                            (make sure u don’t hit enter on that window before the browser opens, as the little app will take you enter key as the ‘token’ and not wait)

                                            you run the node auth… app
                                            and see

                                            Opening OAuth URL. Return here with your code.
                                            Paste your code: 
                                            

                                            then the browser opens, you pick your userid, then it asks for allow, then presents this screen

                                            Screenshot at 2020-06-07 08-54-43.png

                                            where u need to copy that and then return to app

                                            Sam

                                            How to add modules

                                            learning how to use browser developers window for css changes

                                            S 1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 6
                                            • 7
                                            • 8
                                            • 9
                                            • 10
                                            • 11
                                            • 12
                                            • 13
                                            • 8 / 13
                                            • First post
                                              Last post
                                            Enjoying MagicMirror? Please consider a donation!
                                            MagicMirror created by Michael Teeuw.
                                            Forum managed by Sam, technical setup by Karsten.
                                            This forum is using NodeBB as its core | Contributors
                                            Contact | Privacy Policy