How to rename selected audio files based on their tags?

172 views
Skip to first unread message

Judah Richardson

unread,
Nov 30, 2017, 8:57:21 PM11/30/17
to Tasker

I'm trying to build functionality in Tasker that allows me to select 1 or more audio files (in the same folder) and rename them based on their (ID3 or other) tags.

What's the best way to go about this? Is it even possible?

Rich D

unread,
Nov 30, 2017, 9:43:32 PM11/30/17
to Tasker Google Groups Post



I'm trying to build functionality in Tasker that allows me to select 1 or more audio files (in the same folder) and rename them based on their (ID3 or other) tags.

What's the best way to go about this? Is it even possible?

There is a action / media  / test media -to get tag info.
 Could you give more details on what you are trying to do? 
It sounds like you will need to do a list files action then iterate through the list with a for loop and test each file.

Judah Richardson

unread,
Nov 30, 2017, 9:50:41 PM11/30/17
to Tasker
I often download new music and then want to add it to my library. When I do the latter, I typically rename each song using the format TrackArtist_Album_TrackTitle_Bitrate. I normally use MP3Tag on Windows for this, but haven't had the time to be at my PC a lot, so I've been looking for an Android option. So far I haven't found any, so I'm hoping to be able to do it in Tasker. Does that make better sense?

Rich D

unread,
Nov 30, 2017, 10:41:05 PM11/30/17
to Tasker Google Groups Post

I often download new music and then want to add it to my library. When I do the latter, I typically rename each song using the format TrackArtist_Album_TrackTitle_Bitrate. I normally use MP3Tag on Windows for this, but haven't had the time to be at my PC a lot, so I've been looking for an Android option. So far I haven't found any, so I'm hoping to be able to do it in Tasker. Does that make better sense?



Yes, unfortunately the Tasker action only can retrieve the info in the Screenshot. 

A quick search looks like the meta data could be available through a Java function or another type of script. You could also post a feature request to get the other info added to the Tasker action.

Try some Google searches and see if you can  find a plugin or a working script for this. Post back with you results. 

Hopefully someone with some Java experience will post if it is possible with the Java function. 

Judah Richardson

unread,
Nov 30, 2017, 10:44:42 PM11/30/17
to Tasker
I looked around a bit earlier today and this is the closest thing I could find: https://groups.google.com/forum/#!topic/tasker/nF7SguW1xtk

Rich D

unread,
Nov 30, 2017, 10:53:42 PM11/30/17
to Tasker Google Groups Post

--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.

Judah Richardson

unread,
Dec 1, 2017, 12:04:37 AM12/1/17
to tas...@googlegroups.com
Hmmm thanks. That hasn't been updated since 2013 & the G+ group says it's dead 😢

You received this message because you are subscribed to a topic in the Google Groups "Tasker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tasker/kVFtPvID8Og/unsubscribe.
To unsubscribe from this group and all its topics, send an email to tasker+unsubscribe@googlegroups.com.

Rich D

unread,
Dec 1, 2017, 7:54:38 AM12/1/17
to Tasker Google Groups Post
There is hope. I was able to get the EXFI data with a Java function so the metadata should be possible. It might take me sometime but I'll work on it.

Judah Richardson

unread,
Dec 1, 2017, 10:59:12 AM12/1/17
to Tasker
Thanks, much appreciated :)

Rich D

unread,
Dec 1, 2017, 6:55:27 PM12/1/17
to Tasker Google Groups Post
Here  ya go..  You need to replace the data for the %filename in the first action with the file path of the mp3.  To get more info go to 


Get the Constant Value number of the key you want. (13 in the attached screen shot) Then copy and paste action A7. Then change the Param (int) to your new Constant Value and make a new  variable name in the Return {string} category. 

Java functions can be difficult to create so I would recommend importing the attached task. 

Let me know if it works or if you have additional questions. 




Meta (402)
A1: Variable Set [ Name:%filename To:/storage/emulated/0/my music/lovestinks.mp3 ******replace this with your file path******* Recurse Variables:Off Do Maths:Off Append:Off ] 
A2: Java Function [ Return:mymetadata Class Or Object:MediaMetadataRetriever Function:new
{MediaMetadataRetriever} () Param: Param: Param: Param: Param: Param: Param: ] 
A3: Java Function [ Return: Class Or Object:mymetadata Function:setDataSource
{} (String) Param:%filename Param: Param: Param: Param: Param: Param: ] 
A4: Java Function [ Return:%artist Class Or Object:mymetadata Function:extractMetadata
{String} (int) Param:13 Param: Param: Param: Param: Param: Param: ] 
A5: Java Function [ Return:%album Class Or Object:mymetadata Function:extractMetadata
{String} (int) Param:1 Param: Param: Param: Param: Param: Param: ] 
A6: Java Function [ Return:%title Class Or Object:mymetadata Function:extractMetadata
{String} (int) Param:7 Param: Param: Param: Param: Param: Param: ] 
A7: Java Function [ Return:%bitrate Class Or Object:mymetadata Function:extractMetadata
{String} (int) Param:20 Param: Param: Param: Param: Param: Param: ] 
A8: Flash [ Text:%artist
%album
%title
%bitrate Long:On ] 



Screenshot_20171201-183439.png
Meta.tsk.xml

Rich D

unread,
Dec 1, 2017, 7:11:49 PM12/1/17
to Tasker Google Groups Post
To clarify -  the part about getting more info is just if you want to retrieve any other tags. The task I attached will give your requested tags with just editing action A1 for the file path. 

Judah Richardson

unread,
Dec 1, 2017, 9:52:21 PM12/1/17
to Tasker
Thanks so much, Rich! Much, much appreciated!
Reply all
Reply to author
Forward
0 new messages