====== Differences ====== This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
script_music_metadata [2016/05/23 22:56] lm13 |
script_music_metadata [2016/06/28 12:12] (current) f43nd1r |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== About the script ====== | ====== About the script ====== | ||
| * Purpose : This script collects metadata from music apps | * Purpose : This script collects metadata from music apps | ||
| - | * Author : [[https://plus.google.com/+LukasMorawietz|LM13]] | + | * Author : F43nd1r |
| - | * Current Version : 2.0 | + | * Current Version : 2.1 |
| * Link : https://plus.google.com/115366157037831519359/posts/4iVMvZKcUoc | * Link : https://plus.google.com/115366157037831519359/posts/4iVMvZKcUoc | ||
| Line 8: | Line 8: | ||
| * Version 1.0 (25/7/2015): initial release in wiki | * Version 1.0 (25/7/2015): initial release in wiki | ||
| * Version 2.0 (24/5/2016): Rewrite using JavaAdapter | * Version 2.0 (24/5/2016): Rewrite using JavaAdapter | ||
| + | * Version 2.1 (26/5/1026): More players, albumcover support | ||
| Line 13: | Line 14: | ||
| ====== How to use the script ====== | ====== How to use the script ====== | ||
| * Set this script in the load event of your desktop | * 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(, $albumcover, $aachanged) |
| - | * You can now use the following bindings at your will: $track, $album, $artist | + | |
| - | ====== Tested with ====== | + | ====== Runs with ====== |
| - | * Poweramp | + | * Poweramp (with albumcover) |
| - | * Spotify | + | * Spotify |
| + | * AIMP | ||
| + | * Rocket Player | ||
| + | * Neutron | ||
| + | * BlackPlayer | ||
| + | * PlayerPro | ||
| + | * Samsung (can't test without Samsung device, but should work) | ||
| + | |||
| + | Other players may or may not work. | ||
| ====== Issues and Hints ====== | ====== Issues and Hints ====== | ||
| Line 25: | Line 33: | ||
| ====== Script ====== | ====== Script ====== | ||
| - | <sxh javascript;>var intents=["com.maxmpz.audioplayer.TRACK_CHANGED","com.maxmpz.audioplayer.STATUS_CHANGED","com.spotify.music.metadatachanged"] | + | <sxh javascript;>var intents=["com.maxmpz.audioplayer.TRACK_CHANGED","com.maxmpz.audioplayer.STATUS_CHANGED","com.spotify.music.metadatachanged","com.maxmpz.audioplayer.AA_CHANGED","com.android.music.metachanged","com.jrtstudio.AnotherMusicPlayer.metachanged","com.tbig.playerpro.metachanged","com.tbig.playerprotrial.metachanged","com.sec.android.app.music.metachanged"]; |
| + | var defaultAlbumArt="/storage/sdcard0/download/default-albumart.png"; | ||
| Line 31: | Line 40: | ||
| LL.bindClass("android.os.Bundle"); | LL.bindClass("android.os.Bundle"); | ||
| LL.bindClass("android.content.BroadcastReceiver"); | LL.bindClass("android.content.BroadcastReceiver"); | ||
| + | LL.bindClass("android.graphics.Bitmap"); | ||
| + | LL.bindClass("java.io.FileOutputStream"); | ||
| var receiver=new JavaAdapter(BroadcastReceiver,{ | var receiver=new JavaAdapter(BroadcastReceiver,{ | ||
| Line 50: | Line 61: | ||
| v.setString("artist",e.getString("artist")); | v.setString("artist",e.getString("artist")); | ||
| } | } | ||
| + | } | ||
| + | if(e.containsKey("aaPath")){ | ||
| + | v. setString("albumart",e.getString("aaPath")); | ||
| + | v.setFloat("aachange",Math.random()); | ||
| + | } | ||
| + | else if(e.containsKey("aaBitmap")){ | ||
| + | var bmp=e.getParcelable("aaBitmap"); | ||
| + | var path=LL.getContext().getFilesDir()+"/albumart.png"; | ||
| + | var out=new FileOutputStream(path); | ||
| + | bmp.compress(Bitmap.CompressFormat.PNG,100,out); | ||
| + | out.close(); | ||
| + | v.setString("albumart",path); | ||
| + | v.setFloat("aachange",Math.random()); | ||
| + | } | ||
| + | else if(i.getAction().indexOf("AA_CHANGE")!=-1){ | ||
| + | v. setString("albumart",defaultAlbumArt); | ||
| + | v.setFloat("aachange",Math.random()); | ||
| } | } | ||
| v.commit(); | v.commit(); | ||