This question is answered. Helpful answers available: 0. Correct answers available: 1.


Permlink Replies: 115 - Pages: 8 [ 1 2 3 4 5 | Next ] - Last Post: 15-Jun-2017 00:04 Last Post By: RobM
MarkusD

Posts: 514
Registered: 13-Apr-2006
Using ID3-Tags
Posted: 07-Jun-2017 21:49
 
  Click to reply to this thread Reply
Hi,

I created an album with just MP3 files, no pictures at all. I'm using JA 13.10 and Turtle 5.5.17. Everything works fine. My question is, how can I use the embedded id3-Tag information to show them together with the MP3 file, as a title or caption for example.

I already looked here http://lazaworx.com/static/help/ui/images.html for information about this. The "Caption template" looks good and I followed to http://jalbum.net/help/en/Variables. But I couldn't find any info here.

Any suggestions are welcome. I put this question in the general discussion forum, because I'm not sure if this is a question concerning the Turtle skin.

TIA, Markus
RobM

Posts: 3,227
Registered: 4-Aug-2006
Re: Using ID3-Tags
Posted: 07-Jun-2017 22:38   in response to: MarkusD in response to: MarkusD
Helpful
  Click to reply to this thread Reply
There doesn't seem to be anything in jAlbum's API and very little in previous forum posts about reading ID3 tags. I'm guessing that means you will need to use a third party Java library to read the tags, which you can then write to jAlbum's title/comment variable.

If you search the web for Java read ID3 tags you will find several libraries, such as for example http://www.beaglebuddy.com

If you want this to work with any skin then you would need to write a plugin or external tool.

Maybe some one else might have a better answer, or maybe post a feature request in Tiger and/or jAlbum's forum.
RobM

Posts: 3,227
Registered: 4-Aug-2006
Re: Using ID3-Tags
Posted: 07-Jun-2017 23:03   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
Just remembered that jAlbum 13 includes JavaFX which has a media player, though how that might be used is beyond me :(
MarkusD

Posts: 514
Registered: 13-Apr-2006
Re: Using ID3-Tags
Posted: 07-Jun-2017 23:10   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
Thanks for your suggestions. But as I don't have any programming knowledge with Java I'll wait and see if someone else has other solutions where I only have to use something which is already integrated in JA or in another skin.
RobM

Posts: 3,227
Registered: 4-Aug-2006
Re: Using ID3-Tags
Posted: 08-Jun-2017 14:16   in response to: MarkusD in response to: MarkusD
 
  Click to reply to this thread Reply
I have had a play and managed to read the tags in an external tool
import javafx.collections.ObservableMap;
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
import javax.script.ScriptException;
import sun.audio.AudioPlayer.player;
 
 
 
Media media;
media = new Media("file:///Users/robert/Desktop/test.mp3");
ObservableMap  metadata = media.getMetadata();
JOptionPane.showMessageDialog(window, metadata.get("album"), "MP3 title", JOptionPane.INFORMATION_MESSAGE);
More to do.
RobM

Posts: 3,227
Registered: 4-Aug-2006
Re: Using ID3-Tags
Posted: 08-Jun-2017 19:05   in response to: MarkusD in response to: MarkusD
Helpful
  Click to reply to this thread Reply
I have got a basic tool running, it sets the jAlbum title field to the ID3 title tag, if set.
I have tried it on a sample mp3 file and it worked for me.

Until this feature is included in jAlbum this might be enough for you ;)

Edited by: RobM File on 08-Jun-2017
removed file, see new attachment below
MarkusD

Posts: 514
Registered: 13-Apr-2006
Re: Using ID3-Tags
Posted: 08-Jun-2017 19:58   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
That sounds perfect! I tried to figure out where to put that bsh file, but found no traces of other bsh files in "C:\Program Files\jAlbum", So, where should I put this file and how do I then start it?

Thanks in advance, Markus
RobM

Posts: 3,227
Registered: 4-Aug-2006
Re: Using ID3-Tags
Posted: 08-Jun-2017 20:03   in response to: MarkusD in response to: MarkusD
 
  Click to reply to this thread Reply
MarkusD wrote:
That sounds perfect! I tried to figure out where to put that bsh file, but found no traces of other bsh files in "C:\Program Files\jAlbum", So, where should I put this file and how do I then start it?

Thanks in advance, Markus

See this external tools & plugin forum post

Edited by: RobM on 08-Jun-2017 19:04
And of course http://jalbum.net/help/en/External_tools ;)
MarkusD

Posts: 514
Registered: 13-Apr-2006
Re: Using ID3-Tags
Posted: 08-Jun-2017 20:41   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply

Did that and started it and received the error message:
bsh.EvalError: Sourced file: inline evaluation of: ``/* External tool to set object title to mp3 file ID3 title tag */  import se.dat . . . '' : The collection, array, map, iterator, or enumeration portion of a for statement cannot be null. : at Line: 16 : in file: inline evaluation of: ``/* External tool to set object title to mp3 file ID3 title tag */  import se.dat . . . '' : for ( AlbumObject ao : folder .getChildren ( ) ) { 
 in Set MP3 title to ID3 title tag.bsh at line number 16

After opening "Menu/Tools/Open Directories/Config direcotry" the folder showed no "tools" folder, so I created one and put into that folder your bsh file (The file is now in "C:\Users\MDrück\AppData\Roaming\jAlbum\tools\Set MP3 title to ID3 title tag.bsh"). I hope that this was correct?

Sorry to bother you but I have no idea what to do next. TIA, Markus
davidekholm

Posts: 3,398
Registered: 18-Oct-2002
Re: Using ID3-Tags
Posted: 08-Jun-2017 20:50   in response to: MarkusD in response to: MarkusD
 
  Click to reply to this thread Reply
That's correct. Check line 16 as the error indicates. The value you're iterating in the for loop is null
RobM

Posts: 3,227
Registered: 4-Aug-2006
Re: Using ID3-Tags
Posted: 08-Jun-2017 21:01   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Have you selected the project with the mp3 files?
RobM

Posts: 3,227
Registered: 4-Aug-2006
Re: Using ID3-Tags
Posted: 08-Jun-2017 21:42   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
David can you help me with this?
I am using the following code
Media media;
ObservableMap  metadata = null;
void processFolder(AlbumObject folder) {
	for (AlbumObject ao : folder.getChildren()) {
		if (ao.isFolder()) {
			processFolder(ao);
		} 
		else if (ao.getName().toLowerCase().endsWith(".mp3")) {
			media = new Media("file:///" + ao.getFile().toString().replaceAll(" ","%20"));
			metadata = media.getMetadata();
			if(metadata.get("title") != null) 
				ao.setTitle(metadata.get("title").toString());
But it doesn't always 'get' the metadata in time, so a title might not get set when it should. In the attached updated file I set metadata to null and loop until it is not null, but I'm sure there must be a better way of checking the metadata actually is there, and if an mp3 file has no ID3 tags at all.

Edited by: RobM on 09-Jun-2017 20:53
Deleted old file
RobM

Posts: 3,227
Registered: 4-Aug-2006
Re: Using ID3-Tags
Posted: 08-Jun-2017 23:05   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
RobM wrote:
David can you help me with this?

In the attached updated file I set metadata to null and loop until it is not null, but I'm sure there must be a better way of checking the metadata actually is there, and if an mp3 file has no ID3 tags at all.
I think I might have got it right now, at least for me it is working reliably.
I have included a MediaPlayer and check for it being ready (has the metadata) using
do {
continue;
  while (mediaPlayer.Status==UNKNOWN);
}
before setting the title.

Updated file attached.

Edited by: RobM on 09-Jun-2017 20:54
Deleted old file
MarkusD

Posts: 514
Registered: 13-Apr-2006
Re: Using ID3-Tags
Posted: 09-Jun-2017 00:32   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
I tried your last file, I opened my album with the MP3-files and started the script. I received this message:

bsh.TargetError: Sourced file: inline evaluation of: ``/* External tool to set object title to mp3 file ID3 title tag */  import se.dat . . . '' : Object constructor : at Line: 20 : in file: inline evaluation of: ``/* External tool to set object title to mp3 file ID3 title tag */  import se.dat . . . '' : new Media ( "file:///" + ao .getFile ( ) .toString ( ) .replaceAll ( " " , "%20" ) ) 
 
Target exception: java.lang.IllegalArgumentException: java.net.URISyntaxException: Illegal character in path at index 10: file:///D:\Eigene%20Dateien\MDrück\Music\Radio\bayern%202\2016\Bayern%202_radioJazznacht%20extra_Dec%2004%2000;03_293m.mp3
 in Set MP3 title to ID3 title tag.bsh at line number 20


I assume it's my fault ("Illegal character in path"). The original file name is "Bayern 2_radioJazznacht 2017 01 22 00;03_115m.mp3". Maybe the ";" is bad here. I'll clean up my file names and give that a new try tomorrow. Thanks a lot so far!
RobM

Posts: 3,227
Registered: 4-Aug-2006
Re: Using ID3-Tags
Posted: 09-Jun-2017 00:36   in response to: MarkusD in response to: MarkusD
 
  Click to reply to this thread Reply
MarkusD wrote:
I tried your last file, I opened my album with the MP3-files and started the script. I received this message

Maybe the ";" is bad here. I'll clean up my file names and give that a new try tomorrow. Thanks a lot so far!
Yes, I think that will be the problem, fingers crossed for tomorrow :)
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums