(file, filenameHintWithoutPath, object)
| 2684 | } |
| 2685 | |
| 2686 | function grooveFileToDbFile(file, filenameHintWithoutPath, object) { |
| 2687 | object = object || {key: uuid()}; |
| 2688 | var parsedTrack = parseTrackString(file.getMetadata("track")); |
| 2689 | var parsedDisc = parseTrackString(file.getMetadata("disc") || file.getMetadata("TPA")); |
| 2690 | object.name = (file.getMetadata("title") || filenameWithoutExt(filenameHintWithoutPath) || "").trim(); |
| 2691 | object.artistName = (file.getMetadata("artist") || "").trim(); |
| 2692 | object.composerName = (file.getMetadata("composer") || |
| 2693 | file.getMetadata("TCM") || "").trim(); |
| 2694 | object.performerName = (file.getMetadata("performer") || "").trim(); |
| 2695 | object.albumArtistName = (file.getMetadata("album_artist") || "").trim(); |
| 2696 | object.albumName = (file.getMetadata("album") || "").trim(); |
| 2697 | object.compilation = !!(parseInt(file.getMetadata("TCP"), 10) || |
| 2698 | parseInt(file.getMetadata("TCMP"), 10)); |
| 2699 | object.track = parsedTrack.value; |
| 2700 | object.trackCount = parsedTrack.total; |
| 2701 | object.disc = parsedDisc.value; |
| 2702 | object.discCount = parsedDisc.total; |
| 2703 | object.duration = file.duration(); |
| 2704 | object.year = parseIntOrNull(file.getMetadata("date")); |
| 2705 | object.genre = file.getMetadata("genre"); |
| 2706 | object.replayGainTrackGain = parseFloatOrNull(file.getMetadata("REPLAYGAIN_TRACK_GAIN")); |
| 2707 | object.replayGainTrackPeak = parseFloatOrNull(file.getMetadata("REPLAYGAIN_TRACK_PEAK")); |
| 2708 | object.replayGainAlbumGain = parseFloatOrNull(file.getMetadata("REPLAYGAIN_ALBUM_GAIN")); |
| 2709 | object.replayGainAlbumPeak = parseFloatOrNull(file.getMetadata("REPLAYGAIN_ALBUM_PEAK")); |
| 2710 | return object; |
| 2711 | } |
| 2712 | |
| 2713 | function uniqueFilename(filename) { |
| 2714 | // break into parts |
no test coverage detected