jherby2k / PowerShellAudio

An extensible, multi-format audio conversion and tagging module for Windows PowerShell
GNU Lesser General Public License v3.0
16 stars 3 forks source link

Get-AudioMetadata fails if the date can't be parsed #4

Open bherila opened 9 years ago

bherila commented 9 years ago
AudioFile: PS D:\new-music\1> Get-AudioMetadata -AudioFile $af
Get-AudioMetadata : '2000-11-14' is not a valid year
At line:1 char:1
+ Get-AudioMetadata -AudioFile $af
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-AudioMetadata], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException,PowerShellAudio.Commands.GetAudioMetadataCommand
jherby2k commented 9 years ago

DATE comments should not be assumed to only contain a year. Will fix!

jherby2k commented 9 years ago

For now anyway, Vorbis and FLAC are still going to be limited to the "standard" set of metadata. So even with the above resolved, the full DATE field is going to be stripped down to a simple Year.

Adding support for arbitrary metadata in these formats is something I'm thinking about, but I'm not sure how to do it elegantly just yet.

bherila commented 9 years ago

Can we make the DATE field just a string? I was thinking of making such a modification in my own fork.

jherby2k commented 9 years ago

That would mean MP3, AAC, ALAC etc. would not have access to the year when stored in a FLAC's DATE. FLAC -> Vorbis is really a special case. I think maybe the more elegant solution would be to add Day and Year to the standard metadata, then have the Vorbis and FLAC writers rebuild the full DATE using all 3. MP3 has a TDAT that could use the two new fields, and MP4 would disregard them.

bherila commented 9 years ago

Some of my MP3, AAC, and FLAC files have dates formatted YYYY, others have YYYY-MM-DD, is it really standardized? I don't want to clobber any metadata unless I absolutely have to.

jherby2k commented 9 years ago

Try the latest commit. I think it works the way you want.

bherila commented 9 years ago

It still is rather unhappy...

PS D:\Music\2014 General\1> ls *.m4a | Get-AudioMetadata
Get-AudioMetadata : '2011-09-13' is not a valid year
At line:1 char:12
+ ls *.m4a | Get-AudioMetadata
+            ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-AudioMetadata], ArgumentException
    + FullyQualifiedErrorId : System.ArgumentException,PowerShellAudio.Commands.GetAudioMetadataCommand
jherby2k commented 9 years ago

It's not a valid year, indeed. Are you storing a DATE in a YEAR comment? This works correctly for DATE comments, but the YEAR expects only a year.

jherby2k commented 9 years ago

If that's not it, can you make the file available to me for testing?

bherila commented 9 years ago

Yep, looks like that's it. But I'm going to claim innocence on this one, because It's what MusicBrainz writes by default. So most likely, nearly all of my music (which is tagged initially with MusicBrainz) has dates in the YEAR field :frowning:

Maybe it's time to file a bug against MusicBrainz?

Still, I feel like PowerShellAudio should be able to read this tag so that we can use it as a tool to fix our files that have been corrupted by MusicBrainz. I'm not sure what the most elegant way to handle this situation is.

image

jherby2k commented 9 years ago

Ok, nevermind. I didn't realize this was an mp4 file. Looks like the ©day field should behave like the vorbis DATE (can contain either a full date, or just the year). Can you try the latest commit and see if everything is working the way you want? I think I'm pretty close to a 1.0 release now, so I want to make sure your problem is resolved.

bherila commented 9 years ago

Good news first: Woo hoo! Get-AudioFile now works :smile:


PS C:\Users\Ben\Dropbox\projects\mp3fix\powershellaudio> ls 'D:\music\2014 General\1\*.m4a' | Get-AudioFile | Select Fil
eInfo,AudioInfo

FileInfo                                                    AudioInfo
--------                                                    ---------
D:\music\2014 General\1\1.01 Love Me Do.m4a                 44.1kHz Stereo 76kbps MPEG 4 AAC [2:21]
D:\music\2014 General\1\1.02 From Me to You.m4a             44.1kHz Stereo 77kbps MPEG 4 AAC [1:56]
D:\music\2014 General\1\1.03 She Loves You.m4a              44.1kHz Stereo 78kbps MPEG 4 AAC [2:21]
D:\music\2014 General\1\1.04 I Want to Hold Your Hand.m4a   44.1kHz Stereo 161kbps MPEG 4 AAC [2:25]
D:\music\2014 General\1\1.05 Can't Buy Me Love.m4a          44.1kHz Stereo 161kbps MPEG 4 AAC [2:12]
D:\music\2014 General\1\1.06 A Hard Day's Night.m4a         44.1kHz Stereo 164kbps MPEG 4 AAC [2:33]
D:\music\2014 General\1\1.07 I Feel Fine.m4a                44.1kHz Stereo 162kbps MPEG 4 AAC [2:18]
D:\music\2014 General\1\1.08 Eight Days a Week.m4a          44.1kHz Stereo 159kbps MPEG 4 AAC [2:44]
D:\music\2014 General\1\1.09 Ticket to Ride.m4a             44.1kHz Stereo 124kbps MPEG 4 AAC [3:11]
D:\music\2014 General\1\1.10 Help!.m4a                      44.1kHz Stereo 133kbps MPEG 4 AAC [2:19]
D:\music\2014 General\1\1.11 Yesterday.m4a                  44.1kHz Stereo 154kbps MPEG 4 AAC [2:05]
D:\music\2014 General\1\1.12 Day Tripper.m4a                44.1kHz Stereo 157kbps MPEG 4 AAC [2:48]
D:\music\2014 General\1\1.13 We Can Work It Out.m4a         44.1kHz Stereo 157kbps MPEG 4 AAC [2:15]
D:\music\2014 General\1\1.14 Paperback Writer.m4a           44.1kHz Stereo 167kbps MPEG 4 AAC [2:18]
D:\music\2014 General\1\1.15 Yellow Submarine.m4a           44.1kHz Stereo 163kbps MPEG 4 AAC [2:38]
D:\music\2014 General\1\1.16 Eleanor Rigby.m4a              44.1kHz Stereo 148kbps MPEG 4 AAC [2:07]
D:\music\2014 General\1\1.17 Penny Lane.m4a                 44.1kHz Stereo 112kbps MPEG 4 AAC [3:00]
D:\music\2014 General\1\1.18 All You Need Is Love.m4a       44.1kHz Stereo 151kbps MPEG 4 AAC [3:48]
D:\music\2014 General\1\1.19 Hello, Goodbye.m4a             44.1kHz Stereo 164kbps MPEG 4 AAC [3:27]
D:\music\2014 General\1\1.20 Lady Madonna.m4a               44.1kHz Stereo 161kbps MPEG 4 AAC [2:17]
D:\music\2014 General\1\1.21 Hey Jude.m4a                   44.1kHz Stereo 152kbps MPEG 4 AAC [7:05]
D:\music\2014 General\1\1.22 Get Back.m4a                   44.1kHz Stereo 168kbps MPEG 4 AAC [3:12]
D:\music\2014 General\1\1.23 The Ballad of John and Yoko... 44.1kHz Stereo 135kbps MPEG 4 AAC [3:00]
D:\music\2014 General\1\1.24 Something.m4a                  44.1kHz Stereo 140kbps MPEG 4 AAC [3:01]
D:\music\2014 General\1\1.25 Come Together.m4a              44.1kHz Stereo 146kbps MPEG 4 AAC [4:19]
D:\music\2014 General\1\1.26 Let It Be.m4a                  44.1kHz Stereo 128kbps MPEG 4 AAC [3:51]
D:\music\2014 General\1\1.27 The Long and Winding Road.m4a  44.1kHz Stereo 158kbps MPEG 4 AAC [3:38]

However, Get-AudioMetadata still fails :frowning:

PS C:\Users\Ben\Dropbox\projects\mp3fix\powershellaudio> ls 'D:\music\2014 General\1*.m4a' | Get-AudioFile | Get-AudioMetadata Get-AudioMetadata : '2011-09-13' is not a valid year At line:1 char:54

  • ... s 'D:\music\2014 General\1*.m4a' | Get-AudioFile | Get-AudioMetadata
  • 
    - CategoryInfo          : NotSpecified: (:) [Get-AudioMetadata], ArgumentException
    - FullyQualifiedErrorId :  System.ArgumentException,PowerShellAudio.Commands.GetAudioMetadataCommand
bherila commented 9 years ago

P.S. Can you reopen this issue until we figure it out? That'd make it simpler for me to track and get back to you more quickly. Thanks!

jherby2k commented 9 years ago

Just to be clear, are you running the latest commit, or the last beta I released? Assuming the former, can you download Atomic Parsley and paste the results for

atomicparsley.exe filename.m4a -t

bherila commented 9 years ago

Last beta you released + replaced the DLLs in the main directory with a fresh build of the latest commit.

PS D:\music\2014 General\1> AtomicParsley.exe '.\1.01 Love Me Do.m4a' -t
Atom "©nam" contains: Love Me Do
Atom "©ART" contains: The Beatles
Atom "©alb" contains: 1
Atom "©gen" contains: Rock
Atom "trkn" contains: 1 of 27
Atom "disk" contains: 1 of 1
Atom "©day" contains: 2011-09-13
Atom "©too" contains: qaac 2.44, CoreAudioToolbox 7.9.9.3, AAC-LC Encoder, TVBR q73, Quality 96
Atom "----" [iTunSMPB] contains:  00000000 00000840 0000003C 00000000005EB384 00000000 00000000 00000000 00000000 000000
00 00000000 00000000 00000000
Atom "----" [iTunNORM] contains:  000011BB 000011BB 00002C54 00002C54 00024CA8 00024CA8 00006583 00006583 00024CA8 00024
CA8
Atom "----" [replaygain_track_gain] contains: -6.57 dB
Atom "----" [replaygain_track_peak] contains: 0.793091
Atom "----" [MusicBrainz Track Id] contains: 1f518811-7cf9-4bdc-a656-0958e130f312
Atom "----" [MusicBrainz Album Id] contains: 217fb7d2-40b7-4b4b-8860-8b72c970208a
Atom "----" [MusicBrainz Release Group Id] contains: 4f539c70-1a19-37a3-ba14-979f11fc0686
Atom "----" [CATALOGNUMBER] contains: 50999 529325 2 6
Atom "----" [BARCODE] contains: 5099952932526
Atom "----" [ASIN] contains: B005F9CPG8
Atom "----" [MEDIA] contains: CD
Atom "----" [LABEL] contains: Capitol Records
Atom "----" [SCRIPT] contains: Latn
Atom "----" [MusicBrainz Album Release Country] contains: US
Atom "----" [MusicBrainz Artist Id] contains: b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d
Atom "----" [MusicBrainz Album Artist Id] contains: b10bbbfc-cf9e-42e0-be17-e2c3e1d2600d
Atom "----" [Acoustid Id] contains: cefa2259-0d0b-4b68-b3ac-e7c768f0b50b
Atom "----" [MusicBrainz Album Status] contains: official
Atom "----" [MusicBrainz Album Type] contains: album
Atom "----" [ISRC] contains: GBAYE0000920
Atom "soaa" contains: Beatles, The
Atom "soar" contains: Beatles, The
Atom "aART" contains: The Beatles
Atom "covr" contains: 1 piece of artwork
jherby2k commented 9 years ago

Ah. The fix is in the MP4 extension.

Download the latest commit, compile the release build and then run the installer from Deployment\Bootstrapper\bin\Release. Make sure to uninstall any previous version first (the version # hasn't been incremented, so it won't do an upgrade).

For testing without installing, compile Debug, open a powershell prompt, and run

import-module solutiondir\PowerShellAudio.Commands\bin\Debug\PowerShellAudio.Commands.dll

When modifying the code in an extension, always do a "clean" before "build" so the extension gets updated properly.

bherila commented 9 years ago

I'm sorry for the long delay getting back to you. Thanks for posting the updated .zip too, it made it super easy to try out. I just wanted to confirm that it DOES work now!