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 : 1.0 * Link : https://plus.google.com/115366157037831519359/posts/4iVMvZKcUoc ====== Changelog ====== * Version 1.0 (25/7/2015): initial release in wiki ====== How to use the script ====== * Install the Multitool APK (Download in Repository) (you do not have to import 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 ====== Issues and Hints ====== //please report all bugs in the g+ community!// ====== Script ====== <sxh javascript;>====== About the script ====== * Purpose : This script create a new desktop * Author : [[https://plus.google.com/+LukasMorawietz|LM13]] * Current Version : 1.0 * Link : https://plus.google.com/115366157037831519359/posts/4iVMvZKcUoc ====== Changelog ====== * Version 1.0 (15/2/2015): initial release in wiki ====== How to use the script ====== * Run from anywhere an dpass the name for the new desktop as data ====== Issues and Hints ====== * The launcher gets restarted in the process //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("java.lang.Runnable"); LL.bindClass("android.content.IntentFilter"); LL.bindClass("java.lang.Class"); LL.bindClass("dalvik.system.PathClassLoader"); LL.bindClass("android.os.Bundle"); var r=new Runnable(){ run:function(){ var i=receiver.getIntent(); //LL.writeToLogFile("\n"+i,true); 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 c = LL.getContext(); var apk = c.getPackageManager().getApplicationInfo("com.faendir.lightning_launcher.multitool",0).sourceDir; var clsLoader=new PathClassLoader(apk,PathClassLoader.getSystemClassLoader()); var cls=Class.forName("com.faendir.lightning_launcher.multitool.scripting.ScriptableBroadcastReceiver",true,clsLoader); var receiver=cls.newInstance(); receiver.setCallback(r); var f = new IntentFilter(); for(var i=0;i<intents.length;i++) f.addAction(intents[i]); c.registerReceiver(receiver,f); </sxh>

script_music_metadata.1437845596.txt.gz · Last modified: 2015/07/25 17:33 by lm13