I'm wanting to add the length (time) of a track for export using csv. Length is nothing more than the time it would take a track to play. I'm not a programmer but I do know it can be done but I have no idea how to do it. Any help would be greatly appreciated
Did you have a look at the help for the export function?
There you find, among other property variables
%_length% Length (formatted)
I've tried that and I get nothing. I've also tried %_length_seconds% and I get a number but you have to divide by 60 to get something close to time but doesn't represent the correct time (length of the song). Needless to say, my LENGTH is represented minutes, seconds i.e 03:34. I know there's a way to represent this time because I had done it years ago using csv but I'll be darned if I can remember how.
Are you sure @xpac5896a?
not true anymore?
I use this setup in my column browser, works fine for me. You should be able to use the same field for an export.
That is astounding.
Could you show us the script snippet where you use it? Perhaps as a screendump?
Is the %_length% value missing for ALL of your files? Have you tried to validate the files in question to make sure there isn’t a header issue? It seems very strange that this value is missing but %_length_seconds% is populated. You mentioned that you need to divide this by 60, but that is correct for this field. Does this return the expected minutes/seconds?
$loopend()build on %_date% with %_app% - the universal Tag editor - Mp3tag - the universal Tag Editor (ID3v2, MP4, OGG, FLAC, ...)
This is what I’m using to export using CSV. The format for according to “Placeholders for export configurations” is supposed to be
%_length% = Length (formatted)
Which you noticed I put at the end of the string. All you are doing is rearranging items to fit your needs and adding time. I've tried the%_length, as you can see, I've tried using just %lenght%, I've tried using %_length_seconds% but all that does is give you the length of time in seconds. I'm doing something wrong in the string, I'm not a programmer so to me everything seems right according to what I see. So what is it Im deoing wrong? I have no idea.
I would like to correct myself in regards to the string for time. The format %_length% does give you length, however, IT'S IN HOURS, not minutes and seconds. I did an AutoSum of 1137 songs just to see what I would get. The last cell was formatted in dd:hh:mm:ss the total was 14:19:14:00, that's 14 days 19 hours, and 14 minutes. Really? I added a column and did a formula converting the hours to minutes and seconds for the same amount of songs. The outcome was 02:18:43:14 and again the final cell was formatted as dd:hh:mm:ss. Quite a difference. This comes in handy if you want to calculate how long it would take to play all songs in your collection or you just might want to do just some of them. If there is a string somewhere that can convert the hours into minutes and seconds rather than hours and minutes please let me know what it is because %_length" sure doesn't.
I exported a csv file with a few tracks, adding %_length% as the last field. All came out in the correct format. I had one track longer than 60 minutes, it came out as expected in the format 01:07:04 (1 hour, 7 minutes, 4 seconds) as expected.
The rest were regular songs and came out in mm:ss only.
I’m not sure if you can run a simple summing formula for this field. You may have to use the %_length_seconds% field, then calculate days:hours:minutes:seconds from there.
The export in MP3Tag knows global variables for this purpose which work for each loop.
Have a look at the help in section export for the variables.
%_total_time% Total playing time (formatted output) %_total_time2% Total playing time (formatted output without days) %_total_time_raw% Total playing time in seconds
I cannot reproduce this.I pasted your script to an export script and I got:
Sky never die;1997;Fresh Moods;Ambient Diary.One;A02;07:45 Scuba Tongues;1997;Dr. Scissorss;Ambient Diary.One;A02;10:06 Breezer in (the) Green;1997;Insect Jazz;Ambient Diary.One;A03;07:19 Alone? Lonely.;1997;Taklamakan 18';Ambient Diary.One;A04;09:40 The Witness;1997;Saafi Brothers / Sisters;Ambient Diary.One;A05;07:37 Strobe "Light" Network [Blue Glass Mix];1997;Cold;Ambient Diary.One;7;09:52 ` exactly the minutes that each track has in length.
ohrenkino: Even though you can open the CSV file once produced I never open the CSV file, I open it directly into excel. The reason, the csv file produces one line of data per row and is deposited into column A. I did however find a way to convert this data into columns and rows directly in excel but, unfortunately, it was just by chance that I found this function and I can't remember how I did it. You can use the "From Text/CSV' function found under the "Data" tab to import the CSV file but the result as far as time is concerned is formated as "AM". I must admit that looking at the raw data it does seem as though there are minutes and seconds. I just wish I could find that function to convert those single rows into columns in Excel. My only question is how.
You have to define a field delimiter, a character like
In Excel, you can set this character during the import. If Excel can find this character in your raw CSV data, it will split the data in separates columns for you.
I would advise to use the tab character.
You would then have to convert the column with the length to "Time"
And if that does not work, try
To sum it up: MP3tag works (again) without flaw, it is the target application that causes the problems.
If you allow Excel to import a csv file without changing the separator, it will include the colon “:” as one of those. And since this field was the last one and you don’t have another header, the minutes are being dropped during the import.
Use the tab character, or even some other keyboard character that you wouldn’t otherwise use. I personally use the § character since I have no use in any of my tags.
Additonal note for the import of a CSV into MS Excel:
Don't just double click on your CSV file to open it in Excel.
Open Excel first and then inside Excel click on
Open -> Search
then change the extension from the default
All files *.* or
Text files *.csv to find your
Then click on the Open-Button.
This way, you get a 3 step wizard to import your data into Excel.
In Step #1 of #3 you should choose Delimited (even if Excel tells you it has detected "Fixed width")
In Step #2 of #3 you can define your delimiter (a TAB or
; or § or whatever you use)
LyricsLover: The steps you provided does work but with only one drawback, the time factor. Bringing in the CSV file that way formats the time from minutes and seconds to hours and minutes. PROOF. Take and bring a number of songs you have into Excel in this manner you described, I've actually used it before. Highlight your time (length) column and do an AutoSum. You will find that your minutes have now turned to hours because importing time is a bear. Just for numbers, you may have a song that is 03:45 minutes long. Excel doesn't know this and will bring in the song at 3:45 which actually is hours and minutes. This may be OK for some but if you try to total the length column, just to see how long an album is you will end up with the wrong time. That's where a Formula comes in. You must convert the hours and minutes into minutes and seconds. If you bring in the raw data from the CSV file it will give you the minutes and seconds. I'm using Office 365 and in Excel, I accidentally found how to do this, putting the data into columns and rows, but for the life of me, I can't remember how I did it. Perhaps I should go over to the Office Forum and maybe somebody over there can point me in the right direction.
I appreciate all of the responses I've gotten. I know TIME (length) is a bear to convert to the correct format but unless you know how to use the Formulas in Excel, which I don't, it's very frustrating.
Is this necessary if you export %_total_time% also?
But the alleged lack of functions in Excel or the like is hardly the business of MP3tag - an excursion to an Excel forum would be appropriate, I would think.
Just an idea: if you know that there will never be a track that is longer than 59 minutes, 59 seconds, then export
00:%_length% instead of the simple