Plugins and module dependencies

Hi all,

I’m kinda super new to node_js and I’m trying to fiddle with a plugin but it has new dependencies.
It needs pylast to be exact, but how do I go around compiling/building/installing that? I know my way around .NET, I can get a shell script going and PHP is also no problem… but this is killing me :stuck_out_tongue:

How do I generate this module folder? I mean pip install just gives me a folder with an init.py-file. But if I open other modules I get at least:

  • package.json
  • index.js

But neither the pylast folder, nor the pylast-1.8.0 folder contains those files. Npm and/or pip seem to install the packages in /usr/local/lib/python2.7/dist-packages. But as said, those folders contain py-files, not index.js nor package.json, so I guess I can’t use those folders.

Then when I have this folder; for a pluging I need to include the dependant modules in the folder “node_modules”, but do I also need to place that module somewhere in the volumio root?

Please help me (the newbie I am) :blush:

pip is for python
npm is for node

If you need python modules, good luck :smiley:
But you might want to try this:
pythonwheels.com/
Basically you can produce archives of your dependencies, that you can then install.
In any case, if you don’t install plugins as globals, they should reside in the folder you launch the pip install from…
But maybe a more expert pythonista can jump in and help

Thanks! :slight_smile:

That clarifies a bit for me, I think it’s python, but not sure. The error I’m getting is:

import pylast ImportError: No module named pylast Failed to execute script loader

This sounds like a python problem to me (and google), namely I’m missing the pylast module. I’ve found a tutorial to creating a module… will look into that when I get the time :slight_smile:

That way I might be able to fulfill the LastFM plugin wish.

To be continued… :wink:

Update, I found that pylast should be in the root of the app-folder, the new error I’m getting is:

Traceback (most recent call last): File "loader.py", line 3, in <module> File "runpy.py", line 180, in run_module File "runpy.py", line 72, in _run_code File "/data/plugins/music_service/volspotconnect/spotify-connect-web/main.py", line 14, in <module> from connect import Connect File "/data/plugins/music_service/volspotconnect/spotify-connect-web/connect.py", line 9, in <module> from console_callbacks import audio_arg_parser, mixer, error_callback, connection_callbacks, debug_callbacks, playback_callbacks, playback_setup File "/data/plugins/music_service/volspotconnect/spotify-connect-web/console_callbacks.py", line 9, in <module> from lastfm import lastfm File "/data/plugins/music_service/volspotconnect/spotify-connect-web/lastfm.py", line 3, in <module> import pylast File "/data/plugins/music_service/volspotconnect/spotify-connect-web/pylast/__init__.py", line 24, in <module> from xml.dom import minidom, Node ImportError: No module named dom Failed to execute script loader

After some searching I found that this ‘should’ be a standard python module. One of the causes of this error could be if you named a file xml.py/xml.pyc.

However, I did no such thing :stuck_out_tongue: anyone got some tips for me? :slight_smile:

No tips, but a question. Do you want to log to lastfm?
You can use nodejs: github.com/maxkueng/node-lastfmapi :wink:

Maybe it will be easier

Oh wow, good one :slight_smile:

Just figured I’d patch the LastFM to the volspotconnect plugin: github.com/Fornoth/spotify-conn … 89c3dc33ba

It looked like a simple copy-paste operation, combine that with mpdscribble and you’d have pretty much full LastFM implementation.

Maybe its better if we handle this differently… Every plugin should do just one thing…
If we want scrobbling, we can easily make a scrobbler plugin by listening to player state with
getState()

Sounds like a better plan indeed, that would only need one integration. I will see if I can read into that :slight_smile: