import { INativeTagMap } from '../common/GenericTagTypes' ; import { CommonTagMapper } from '../common/GenericTagMapper' ; import { IRating , ITag } from '../type' ; /**
 * ASF Metadata tag mappings.
 * See http://msdn.microsoft.com/en-us/library/ms867702.aspx
 */ const asfTagMap = { Title : 'title' , Author : 'artist' , 'WM/AlbumArtist' : 'albumartist' , 'WM/AlbumTitle' : 'album' , 'WM/Year' : 'date' , 'WM/OriginalReleaseTime' : 'originaldate' , 'WM/OriginalReleaseYear' : 'originalyear' , Description : 'comment' , 'WM/TrackNumber' : 'track' , 'WM/PartOfSet' : 'disk' , 'WM/Genre' : 'genre' , 'WM/Composer' : 'composer' , 'WM/Lyrics' : 'lyrics' , 'WM/AlbumSortOrder' : 'albumsort' , 'WM/TitleSortOrder' : 'titlesort' , 'WM/ArtistSortOrder' : 'artistsort' , 'WM/AlbumArtistSortOrder' : 'albumartistsort' , 'WM/ComposerSortOrder' : 'composersort' , 'WM/Writer' : 'lyricist' , 'WM/Conductor' : 'conductor' , 'WM/ModifiedBy' : 'remixer' , 'WM/Engineer' : 'engineer' , 'WM/Producer' : 'producer' , 'WM/DJMixer' : 'djmixer' , 'WM/Mixer' : 'mixer' , 'WM/Publisher' : 'label' , 'WM/ContentGroupDescription' : 'grouping' , 'WM/SubTitle' : 'subtitle' , 'WM/SetSubTitle' : 'discsubtitle' , 'WM/IsCompilation' : 'compilation' , 'WM/SharedUserRating' : 'rating' , 'WM/BeatsPerMinute' : 'bpm' , 'WM/Mood' : 'mood' , 'WM/Media' : 'media' , 'WM/CatalogNo' : 'catalognumber' , 'MusicBrainz/Album Status' : 'releasestatus' , 'MusicBrainz/Album Type' : 'releasetype' , 'MusicBrainz/Album Release Country' : 'releasecountry' , 'WM/Script' : 'script' , 'WM/Language' : 'language' , Copyright : 'copyright' , LICENSE : 'license' , 'WM/EncodedBy' : 'encodedby' , 'WM/EncodingSettings' : 'encodersettings' , 'WM/Barcode' : 'barcode' , 'WM/ISRC' : 'isrc' , 'MusicBrainz/Track Id' : 'musicbrainz_recordingid' , 'MusicBrainz/Release Track Id' : 'musicbrainz_trackid' , 'MusicBrainz/Album Id' : 'musicbrainz_albumid' , 'MusicBrainz/Artist Id' : 'musicbrainz_artistid' , 'MusicBrainz/Album Artist Id' : 'musicbrainz_albumartistid' , 'MusicBrainz/Release Group Id' : 'musicbrainz_releasegroupid' , 'MusicBrainz/Work Id' : 'musicbrainz_workid' , 'MusicBrainz/TRM Id' : 'musicbrainz_trmid' , 'MusicBrainz/Disc Id' : 'musicbrainz_discid' , 'Acoustid/Id' : 'acoustid_id' , 'Acoustid/Fingerprint' : 'acoustid_fingerprint' , 'MusicIP/PUID' : 'musicip_puid' , 'WM/ARTISTS' : 'artists' , 'WM/InitialKey' : 'key' , ASIN : 'asin' , 'WM/Work' : 'work' , 'WM/AuthorURL' : 'website' , 'WM/Picture' : 'picture' } ; export class AsfTagMapper extends CommonTagMapper { public static toRating ( rating ) { return { rating : parseFloat ( rating + 1 ) / 5 } ; } public constructor ( ) { super ( [ 'asf' ] , asfTagMap ) ; } protected postMap ( tag ) { switch ( tag . id ) { case 'WM/SharedUserRating' : const keys = tag . id . split ( ':' ) ; tag . value = AsfTagMapper . toRating ( tag . value ) ; tag . id = keys [ 0 ] ; break ; } } }