Die Taginformationen einer wma Datei auslesen
hallo,
da ich mich vor kurzem damit beschäftigt hatte die wma Taginformationen auszulesen und auf das Problem der Abweichung der Tag Header usw. und die Unfähigkeit einiger wma units auch wirklich alle tags auszulesen gestoßen bin, hab ich mich informiert und herausgefunden wie man einfach den Mediaplayer zum Auslesen missbrauchen kann.
da ich euch das nicht vorenthalten möchte hier der Code:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46:
| type TWMAFileInfo = record Duration: string; Author: string; CurrentBitRate: string; FileSize: string; Is_Protected: Boolean; SourceURL: string; Title: string; Album: string; Composer: string; Genre: string; Lyrics: string; TrackNumber: Integer; Year: Integer; end;
procedure ReadWMATag(Filename: string; var TagInformation: TWMAFileInfo); var wmplayer, wmfile: OLEVariant; begin try try wmplayer := GetActiveOleObject('WMPlayer.OCX'); except wmplayer := CreateOleObject('WMPlayer.OCX'); end; wmfile := wmplayer.newMedia(Filename);
TagInformation.Duration := wmfile.durationString; TagInformation.Author := wmfile.getItemInfo('Author'); TagInformation.CurrentBitRate := wmfile.getItemInfo('CurrentBitRate'); TagInformation.FileSize := wmfile.getItemInfo('FileSize'); TagInformation.Is_Protected := wmfile.getItemInfo('Is_Protected'); TagInformation.SourceURL := wmfile.getItemInfo('SourceURL'); TagInformation.Title := wmfile.getItemInfo('Title'); TagInformation.Album := wmfile.getItemInfo('WM/AlbumTitle'); TagInformation.Composer := wmfile.getItemInfo('WM/Composer'); TagInformation.Genre := wmfile.getItemInfo('WM/Genre'); TagInformation.Lyrics := wmfile.getItemInfo('WM/Lyrics'); TagInformation.TrackNumber := wmfile.getItemInfo('WM/TrackNumber'); TagInformation.Year := wmfile.getItemInfo('WM/Year'); finally wmfile := unassigned; wmplayer := unassigned; end; end; |
der MediaPlayer muss natürlich installiert sein.
mfg
GSE
Moderiert von jasocul: Beitrag geprüft am 09.06.2006
_________________
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs
and the universe trying to produce bigger and better idiots. So far, the universe is winning. (Richard Cook)