mirror of
https://github.com/murdos/musicbrainz-userscripts
synced 2025-03-04 22:37:16 +00:00
beatport_pro_importer: try to guess the release type
- set the release type to single/EP/album based on title, number of tracks and total duration
This commit is contained in:
parent
be4e3ef1a6
commit
fe64395c72
1 changed files with 3 additions and 0 deletions
|
@ -66,6 +66,7 @@ function retrieveReleaseInfo(release_url) {
|
|||
var the_tracks = unsafeWindow.Playables.tracks;
|
||||
var seen_tracks = {}; // to shoot duplicates ...
|
||||
var release_artists = [];
|
||||
var total_duration = 0;
|
||||
$.each(the_tracks,
|
||||
function (idx, track) {
|
||||
if (track.release.id != release_id) {
|
||||
|
@ -93,6 +94,7 @@ function retrieveReleaseInfo(release_url) {
|
|||
'title': title,
|
||||
'duration': track.duration.minutes
|
||||
});
|
||||
total_duration += track.duration.milliseconds;
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -109,6 +111,7 @@ function retrieveReleaseInfo(release_url) {
|
|||
'format': release.format
|
||||
} );
|
||||
|
||||
release.type = MBReleaseImportHelper.guessReleaseType(release.title, tracks.length, total_duration/1000);
|
||||
LOGGER.info("Parsed release: ", release);
|
||||
return release;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue