User Tools

Site Tools


script_music_metadata

**This is an old revision of the document!** ----

A PCRE internal error occured. This might be caused by a faulty plugin

====== About the script ====== * Purpose : This script collects metadata from music apps * Author : [[https://plus.google.com/+LukasMorawietz|LM13]] * Current Version : 2.0 * Link : https://plus.google.com/115366157037831519359/posts/4iVMvZKcUoc ====== Changelog ====== * Version 1.0 (25/7/2015): initial release in wiki * Version 2.0 (24/5/2016): Rewrite using JavaAdapter ====== How to use the script ====== * Set this script in the load event of your desktop * Add the intent actions of your music player in the first line of the script * You can now use the following bindings at your will: $track, $album, $artist ====== Tested with ====== * Poweramp * Spotify ====== Issues and Hints ====== //please report all bugs in the g+ community!// ====== Script ====== <sxh javascript;>var intents=["com.maxmpz.audioplayer.TRACK_CHANGED","com.maxmpz.audioplayer.STATUS_CHANGED","com.spotify.music.metadatachanged"] LL.bindClass("android.content.IntentFilter"); LL.bindClass("android.os.Bundle"); LL.bindClass("android.content.BroadcastReceiver"); var receiver=new JavaAdapter(BroadcastReceiver,{ onReceive:function(c,i){ var e=i.getExtras(); var v=LL.getVariables().edit(); if(e.containsKey("track")){ var track=e.get("track"); if(track instanceof Bundle){ v.setString("track",track.getString("title")); v.setString("album",track.getString("album")); v.setString("artist",track.getString("artist")); } else if(typeof track =="string"){ v.setString("track",track); if(e.containsKey("album")) v.setString("album",e.getString("album")); if(e.containsKey("artist")) v.setString("artist",e.getString("artist")); } } v.commit(); } }); var f = new IntentFilter(); for(var i=0;i<intents.length;i++) f.addAction(intents[i]); LL.getContext().registerReceiver(receiver,f); </sxh>

script_music_metadata.1464044164.txt.gz · Last modified: 2016/05/23 22:56 by lm13