Jump to content

ID3 UDF ID3v1 & ID3v2 MP3 Tags


joeyb1275
 Share

Recommended Posts

I try to install AutoIt Previous Versions but demo (ID3_Example_GUI_v3.4.au3cannot write id3v2

my system: window 8.1 32bit

Ok, this is it, my final attempt to get through.

o:)

You are not really telling us anything we don't know about your circumstance.

We NEED your EXACT code, that you used, and by that, I don't mean the example script, just the code you adjusted for your circumstance, of the example script.

I'll take it, that you are using the latest non-beta of AutoIt.

I'll also take it that you also failed with previous versions of AutoIt, though the use of the word 'try' is misleading.

I expect, that you are not really using the functions to write (or possibly read) Id3v2 in the right way, but until we see your code, we won't know.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

@htclub - The usual method, is to post the EXACT relevant section(s) of code, not a FULL largish script, where we no doubt have to search for the sections in question. There is also a button, two to the left from the paw print button (in the Post editor), which will encase your code in AutoIt tags (with formatting), which makes things even more helpful for us.

P.S. Some of us are on here, on our phones or other device, that doesn't have an editor (i.e. SciTE) installed.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

  • Developers

2 issues:

This line should read:

$PIC_Filename = @ScriptDir & "\test.png"

And you need to rename image.png to test.png

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

The Image is added as you could easily check with the Mp3TAG utility.

The UDF defaults to ID3v2.4 in stead of ID3v2.3 which seems to be the reason.

Need to dig into why it does that.

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Looks like the UDF can't cope with your original MP3 which has an ID3V1 TAG.

It works fine when you update it to an TAG ID3V2.3

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

@Jos - I haven't used the latest version of this UDF yet (requires me to do a rewrite of at least one of my programs), but it has always coped with both ID3v1 and ID3v2 in the past ... reading & writing.

In my usage with it, I always write to both, and read what I need, which sometimes is only ID3V1.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Issues I've had in the past, have been related to existing Ape tags plus not coping with Unicode.

Both of those issues were apparently fixed ... or maybe not completely?

When I have an issue (and take in mind I'm not using the latest UDF, only my modified version of an earlier version), I open the MP3 in MP3Tag, and check for and remove any Ape tags found, plus save as ID3v2.3.

In particular, I found that artwork would not display in my program (using older UDF) when Ape tags existed.

Other related issues, were Year not being updated or removable ... appearing as though it had two Year tags, with one of those not visible to my program, and therefor not editable. This last, may be what Jos might be confusing as an ID3v1 issue?

Another thing I do with both my program (and MP3Tag if required), is remove all Extended tags, which will fix (seemingly) some apparent clashes.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

  • 2 months later...
  • 4 weeks later...

Great udf ... been using it for years.  I have a block of code which sets tags using _ID3SetTagField but I only want to _ID3WriteTag if any of them have changed.  So, if I assign the return value of the initial _ID3ReadTag call, how can I check to see if it changed after all the calls to _ID3SetTagField?

$tag = _ID3ReadTag($thatfile) ;must read in existing tag first to ensure other fields are saved


_ID3SetTagField("Artist", $artist)
_ID3SetTagField("Album", $albtit)
_ID3SetTagField("Year", $y[0])
_ID3SetTagField("Title", $title)
_ID3SetTagField("Track", $track)
_ID3SetTagField("TPE1", $artist)
_ID3SetTagField("TPE2", $artist)
_ID3SetTagField("TALB", $album)
_ID3SetTagField("TIT2", $title)
_ID3SetTagField("TRCK", $track)
_ID3SetTagField("TYER", $y[0])
_ID3SetTagField("TDAT", $y[1] & $y[2])
_ID3SetTagField("TPUB", "© " & $y[0] & '-' & $y[1] & '-' & $y[2] & " me ")
_ID3SetTagField("TCOP", "© " & $y[0] & '-' & $y[1] & '-' & $y[2] & " me ")
_ID3SetTagField("WCOP", "© " & $y[0] & '-' & $y[1] & '-' & $y[2] & " me ")


If $tag <> ??? Then _ID3WriteTag($thatfile)
Link to comment
Share on other sites

When you do a _ID3ReadTag all the values are returned in a single string or array (one variable), you could copy that to another variable, and then do a comparison after you've updated the original, using array functions. Either that, or create a comparison variable for each tag (field). There are a few ways to do either approach, but the first may require you to investigate the UDF include file.

I'd probably do a little of both methods, and assign all elements as they are read, to a pipe delimited string as a single variable value, and then use _StringSplit with it later, to do a comparison. That's the easiest method without requiring investigation.

i.e.

$prevtags = $artist & "|" & $albtit & "|" & $title & "|" & etc

$prevtag = _StringSplit($prevtags, "|", 1)

If $artist <> $prevtag[1] Then $tag = "changed"

If $albtit <> $prevtag[2] Then $tag = "changed"

etc

Obviously you need to fine tune that to your needs.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

How do you get your tags now, before you update them?

I'm presuming you read them into something, input fields etc, before updating them and writing them?

In a sense, when you read the tags for an mp3, you are getting a return value, that is stored in one variable, that is much like a section in an INI file. Then you read that section, using keys (TPE1, TALB, TIT2, TRCK, etc) to get the value for each. When you write the tags, first you update the keys of that section (with same or new values), then send that section (same variable) back to the mp3.

I don't know the code required, off the top of my head, but I remember it being pretty self-evident, and going by your early words, I presume you do all the basics already?

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

In the meantime, I coded a routine to do this for me using two global variables, $tags1 and $tags2.  If they are different, I write the tags.

Func _myID3SetTagField($tag,$val)

   $tags1 &= "|"&_ID3GetTagField($tag,$val)

   _ID3SetTagField($tag,$val)

   $tags2 &= "|"&_ID3GetTagField($tag,$val)

EndFunc


  :   :   :   :   :   :   :   :   :   :   :   :   :   :   :


Global $tags1 = ''
Global $tags2 = ''
_myID3SetTagField( "Artist", $artist)
_myID3SetTagField( "Album",  $albtit)
_myID3SetTagField( "Year",   $y[0])
_myID3SetTagField( "Title",  $title)
_myID3SetTagField( "Track", $track)
_myID3SetTagField( "TPE1", $artist)
_myID3SetTagField( "TPE2", $artist)
_myID3SetTagField( "TALB", $albtit)
_myID3SetTagField( "TIT2", $title)
_myID3SetTagField( "TRCK", $track)
_myID3SetTagField( "TYER", $y[0])
_myID3SetTagField( "TDAT", $y[1] & $y[2])
_myID3SetTagField( "TPUB", "© " & $y[0] & '-' & $y[1] & '-' & $y[2] & " me")
_myID3SetTagField( "TCOP", "© " & $y[0] & '-' & $y[1] & '-' & $y[2] & " me")
_myID3SetTagField( "WCOP", "© " & $y[0] & '-' & $y[1] & '-' & $y[2] & " me")


If $tags1 <> $tags2 Then _ID3WriteTag($thatfile)
 
Link to comment
Share on other sites

In your function last post, you are reading twice. Why?

Don't you already have the new values before you set them.

You are manually setting them and reading them from somewhere (i.e. Input field).

You should be able to build $tags2 up prior to setting to $tag the second time.

In fact, you only set to $tag the second time, and then write to file, if $tags2 <> $tags1

You can do it the way you have, but it seems unintuitive to me, and extra unnecessary steps.

Here's what I'd do.

I read all the tags from an mp3 file, and they are in $tags1.

I then read each element of $tags1 and fill in Input fields for each.

One or more of those input fields (or none) is modified (manual typing, web query, etc).

When you click an update button or something like that, then you read back the values from each input field.

As you read them back, you compare each one, with the appropriate entry in $tags1, setting an update flag if any are different, and updating that element .... with that flag getting reset after each file is fully processed.

If the update flag is set appropriately, you then finish up by writing to file.

Personally though, I make my changes and then click update, without bothering with testing, as I know what changes I've just made. I'm gathering that you are somehow updating without making manual changes ... web query perhaps?

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

I've seen very little of your code, to tailor something specific just for you, so I would most likely just be repeating what is already being done in the provided example from the topic's first post.

I suggest you step through that code, using MsgBox's to check on various values for variables, so that you gain a more complete understanding. Take it apart, and work with chunks of code at a time.

If you do the above, and run into difficulty, and then provide enough code here (or the Help forum if more general help is needed), then you should get the help from myself or others. It needs to be targeted help though, as we need to see where you've gone wrong and help you with that.

My personal belief, is that I help someone to help them self, rather than just code something for them, especially when an example is already available. Teach rather than provide.

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...