Jump to content

Recommended Posts

Posted (edited)

Thanks for contributing.

P.S. I haven't looked into your code changes, but they sound reasonable enough. My experience has shown me, that tags are often filled with junk, when coming from some sources, so I have just been in the habit of putting my files through MP3Tag anyway ... to fix version issues, remove APE tags and Extended tags. I'm not using the latest UDF from here though, as my program was built prior to that, and some of the later changes would be script breaking for me.

I'm happy enough with my approach -

[1] Clean up with MP3Tag.

[2] Automate tag and artwork updating with my program - Update MP3 Artwork. This is where most of the work occurs, and the features seem almost endless. Uses an older version of this UDF.

[3] Check tags and abbreviate filenames, using my Abbreviation Database program, followed by the excellent third party program Tagscanner.

[4] Create parent and child M3U playlists - Update MP3 Artwork.

[5] Test with foobar2000.

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

Posted

Hi,

i am not doing much with the UDF.

i just tried to scan my mp3 collection to create a list of all artists.

As the scan kept crashing i found the fixes i posted above, maybe it will help other users of the UDF.

 

  • 11 months later...
Posted

Hey, if anyone's still monitoring this post, I have some questions regarding this udf.  I too have a fairly broad collection of mp3s and I'm testing a program to apply info from a spreadsheet to all my old mp3 tags.  Many of these mp3s are original music so leveraging cddb will not help.

I've got it all working but I'm trying to add in some logic to not update the mp3 only when a tag has changed.  So, I wrote a simple shell around ID3SetTagField:

Func _myID3SetTagField($tag,$val)
    $tags1 &= "|" & $tag & "^" & _ID3GetTagField($tag)
    _ID3SetTagField($tag,$val)
    $tags2 &= "|" & $tag & "^" & _ID3GetTagField($tag)
EndFunc

So, I have a bunch of calls to _myID3SetTagField instead of ID3SetTagField.  Then I have the following:

If $tags1 <> $tags2 Then _ID3WriteTag($thatfile)

This was working for years but, suddenly, something's awry.  I must not be doing this correctly and, before I dig deeper, perhaps some who's more familiar with the udf can recommend a better way.

 

Thanks.

Posted (edited)
9 hours ago, jaja714 said:

Hey, if anyone's still monitoring this post, I have some questions regarding this udf.  I too have a fairly broad collection of mp3s and I'm testing a program to apply info from a spreadsheet to all my old mp3 tags.  Many of these mp3s are original music so leveraging cddb will not help.

I've got it all working but I'm trying to add in some logic to not update the mp3 only when a tag has changed.  So, I wrote a simple shell around ID3SetTagField:

Func _myID3SetTagField($tag,$val)
    $tags1 &= "|" & $tag & "^" & _ID3GetTagField($tag)
    _ID3SetTagField($tag,$val)
    $tags2 &= "|" & $tag & "^" & _ID3GetTagField($tag)
EndFunc

So, I have a bunch of calls to _myID3SetTagField instead of ID3SetTagField.  Then I have the following:

If $tags1 <> $tags2 Then _ID3WriteTag($thatfile)

This was working for years but, suddenly, something's awry.  I must not be doing this correctly and, before I dig deeper, perhaps some who's more familiar with the udf can recommend a better way.

 

Thanks.

I am too out of touch with this UDF now, but a quick look at your code, makes me think you are doing more than you need to ... and could be doing it wrong.

You should be able to simplify it down to read the whole tags string to $tags1 before, then add all your new tags, then read the whole tags string again to $tags2, then do the comparison (this is per mp3) ... not do a check for every tag that may be changed. The concatenating you are doing just seems unnecessary to me. If one tag has changed or many, then a match won't occur, and so you write to file. If you are wanting to check per tag, which doesn't make sense when you think about it, then concatenating is still not needed. If even just one tag has changed, then you are going to write to file anyway ... so what does it matter if some tags per mp3 are being replaced with identical data ... just a waste of cycles checking for that.

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

  • 2 weeks later...
Posted

Hi All - 

Thanks for all the posts with code fixes and updates.  I am looking to use this code again and I want to incorporate some of your suggestions, they look pretty good!

I am going to try to use git and github to work on this code that way we can work on things together or when I am slacking off (which can happen for awhile) some one else can fork it and run with it.

Below is the link.  I just upload and compiled it to make sure it all works.  I also post older version in case anybody wants those, but I have not tried compiling those yet, maybe I'll get to it this weekend.

https://github.com/joeyb1275/ID3_UDF

 

Posted
On 12/24/2015 at 10:32 AM, BrewManNH said:

I found the problem in the UDF. The function _APEv2Tag_ReadFromFile is missing a FileClose before it returns at the end. So if there's no APE tags found in the file, the handle doesn't get closed.

Add this line just before the return statement.

FileClose($hfile) ; <<<<<<<<<<<<<<<<<<<<<<<< Add this line
    Return $APEv2_TAGINFO

 

Thanks. Added to code.

  • 4 months later...
Posted

I was looking on how to improve the iTunes2Tag program and found this forum! If you guys ever recompile those elements into one fully functionnal iTunes2Tag, you'll be my heros!!

Posted

@TheDcoderI understand. And well, initially, iTunes2Tag was a compile of all those initial elements developed by @joeyb1275 that you are currently working on. That's why I was hoping that an updated version would be issued.

Btw, do you know any alternative program? I've been searching how to convert iTunes ratings into iTags, and beside iTunes2Tag, I did not find any other program to do that :(

Anyway, thank you very much for taking time to reply. Really!

 

 

Posted

Ah, I just realized that iTunes2Tag already exist. I thought it was a software request.

Seeing how the program is outdated, @joeyb1275 might consider updating it if he is still interested in it. His last visit to the forum was on April 7th, it might take time for him to notice your post. I personally think that there are very slim chances of this happening :(

1 hour ago, TyBaloo said:

Btw, do you know any alternative program? I've been searching how to convert iTunes ratings into iTags, and beside iTunes2Tag, I did not find any other program to do that :(

I personally have no idea what iTunes2Tag does... so I cannot suggest any alternatives. But I do recommend you to find them yourself at alternativeTo :)

1 hour ago, TyBaloo said:

Anyway, thank you very much for taking time to reply. Really!

My pleasure :D

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

  • 1 year later...
Posted

Hi, first thanks for the UDF. I was trying to write a script that would weed out duplicate mp3 files in my computer as I have about 3,000 and I know  there are definitely duplicates.

But i've been encountering a strange problem. I try to get the artist and title of MP3s using _ID3GetTagField("TPE1") and _ID3GetTagField("TIT2") and it works.

When I try to get the result into individual variables, they work ok.

$a = _ID3GetTagField("TPE1")
$b = _ID3GetTagField("TIT2")

But when I try to combine $a and $b into one variable, it doesn't work.

$all = $a & @CRLF & $b

The value of $all is always only the $a

Not sure where the problem is. I tried this with different MP3 files and same thing happens.

Here is the whole script that you can try out.

#include <ID3_v3.4.au3>

$Filename = FileOpenDialog ( "Select Mp3 File", "", "Muisc (*.mp3)")
_ID3ReadTag($Filename,3) ;read only ID3v1 and ID3v2 tags

;;;; all the following work

$a = _ID3GetTagField("TPE1")
MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @CRLF & '$a' & @CRLF & @CRLF & 'Return:' & @CRLF & $a) ;### Debug MSGBOX

$b = _ID3GetTagField("TIT2")
MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @CRLF & '$b' & @CRLF & @CRLF & 'Return:' & @CRLF & $b) ;### Debug MSGBOX

;;;; this does not work
;;;; when i try to combine all data into one var,
;;;; only the first data gets shown

$all = $a & @CRLF & $b
MsgBox(262144, 'Debug line ~' & @ScriptLineNumber, 'Selection:' & @CRLF & '$all' & @CRLF & @CRLF & 'Return:' & @CRLF & $all) ;### Debug MSGBOX

Please help. Thanks!

  • 4 months later...
Posted (edited)

The things you find out a bit late sometimes.

I have a program that uses my adaption of an earlier version of ID3.au3.

Some months ago, I got a new car stereo, and for the life of me I could not get the artwork in my MP3s to show.

Then a few weeks ago, I came across that U2 freebie that all Itunes accounts were given. It was in M4A format and so I tried that, and for the very first time I could see artwork when using the car player. Thinking it must be some iTunes specific tag, I preceded to narrow things down, but to no avail. Then I thought to use MP3Tag to first remove the artwork from an MP3 and then add it back again. That worked. Previously I had just saved existing with MP3Tag when troubleshooting, but with no success.

Anyway, today I decided to look deeper, and discovered that the issue had been caused by the wrong MIME Type being specified by ID3.au3. It was using 'image/jpg' when it should have been using 'image/jpeg'.

I only have a few thousand MP3s to correct now. :blink:

Thank Dog for Batch mode.

I notice the current ID3.au3 doesn't have that issue.

P.S. That said, this is the first player that I have used that has an issue with that wrong implementation. Fussy bugger.

EDIT

It seems very odd to me, that I seem to have never tried embedding the artwork with another program other than my own, especially as I use MP3Tag to finalize my files and check for and remove unwanted Tags like Ape tags. I also check my files with both Tagscanner and foobar2000.

In fact, if you had asked me back when I spent many hours and days troubleshooting this and other issues with the car player, I am sure I would have said, yes I tested that, several times. I certainly tested everything I could think of, even ridiculous things because of clues in the manual and online suggestions.

So I am not really convinced I didn't, just that maybe something changed with the player.

It was only two days before the car went in for its first (6 month) service, that I came upon the M4A iTunes files, and had artwork appear for the very first time. I'd been meaning to chase up such, after reading reports from other users, but didn't have a current install of iTunes and hadn't used it since grabbing that U2 freebie. I was gonna grab some files off one of my kids who do use iTunes, but they were never around when I thought of it.

So anyway, I never chased up why the M4A files worked, until after the car service, and who knows it probably got the latest firmware update at that time. I'd certainly sent an email to one of the reps prior, describing my issues with the player.

I've had Tag and Artwork issues before, always solved by importing the relevant files into MP3Tag and using one of its fixes and then saving.

Clearly MP3Tag does not correct the MIME Type during any of those processes though, but does display what MIME Type is set, so it gives visual confirmation now when fixing all my MP3s with my program and then additional doing the usual save with MP3Tag. With some of my MP3 files, even with the correct MIME type set, I still needed to save with MP3Tag, to get the artwork to display on my car player.

I guess it will just have to remain one of life's little mysteries.

 

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

  • 11 months later...
Posted

I'm confused on how this works.

As far as I can tell _ID3WriteTag() only takes a file as input and just magically pulls the tag from thin air.

What am I missing?

How do I specify what _ID3WriteTag() is to actually write to the file?

Posted (edited)

I seem to have figured out this unusual configuration and think that I've found a bug.

If you use

_ID3v2Frame_SetFields("TRCK",$TrackNum)

and $TrackNum is a number and not a string, _ID3v2Frame_SetFields() completely hangs.

All I know is that at line 1700 and 1705 in ID3_v3.4.au3, it explicitly checks for Arrays and Strings respectively. There doesn't appear to be any number handling.

Sorry if this has already been reported, I didn't really check.

Edited by Funtime60
I was too hasty and failed to fully explain things
Posted (edited)
On 3/20/2020 at 8:23 AM, Funtime60 said:

I'm confused on how this works.

As far as I can tell _ID3WriteTag() only takes a file as input and just magically pulls the tag from thin air.

What am I missing?

How do I specify what _ID3WriteTag() is to actually write to the file?

The ID tags are stored in the header portion of the MP3 file, is how I understand it.

They are read into an array, and need to be written back as an array.

The array is somewhat like the entries in an INI file, section name excluded.

So the general usage, is reading first to an array, even if elements are missing. Then modifying elements of that array, including adding new ones with the correct key names and appropriate values.

The keys in this context are called fields.

So the following updates the array before you then write the array to file.

_ID3v2Frame_SetFields("TRCK",$TrackNum)

TRCK being the key or field, and $TrackNum the value for that key/field.

On 3/20/2020 at 10:57 AM, Funtime60 said:

and $TrackNum is a number and not a string, _ID3v2Frame_SetFields() completely hangs.

I've not come across this issue that I recall, and I have used the UDF many times, if an earlier version adapted by myself. I still use it regularly in my main program, plus some others.

I'm not sure why you are passing it as number and not just as a digit string number.

I'm not the original developer of the UDF either, but the way I recall it, certain tags are supposed to be in a specific format ... string, integer, etc ... probably to meet the ID3 specification.

So you may need to sanitize your input or amend your copy of the UDF.

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

Posted
Quote

I'm not sure why you are passing it as number and not just as a digit string. 

I was iterating through a list of files. Using a for loop, the count is a number.

I also apologize for my first post as I was rather and still am frustrated with the way this UDF functions. I'd much prefer it return the array of data to me so I can handle it as I want to rather than trust it to work the way I barely understand it to or restrict how I do it.

thanks for the response, I'm rather puzzled as to why I had that issue on my own.

Posted (edited)
13 hours ago, Funtime60 said:

I'd much prefer it return the array of data to me so I can handle it as I want

Well, it does do that when you use the read function first ... which is how it is supposed to be done with this UDF.

You then add and or modify.

Remember the array is a pair of items for each ID3Tag entry. There is no getting around that, and not down to the UDF.

13 hours ago, Funtime60 said:

I was iterating through a list of files. Using a for loop, the count is a number.

I am sure I do that too, and never had an issue.

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

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
  • Recently Browsing   0 members

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