avoid setting queue when tracklist is the same

This commit is contained in:
Thomas Amland
2020-10-03 20:35:46 +02:00
parent f3bdbbd44d
commit 554d58f04b
2 changed files with 18 additions and 2 deletions
+13
View File
@@ -1,4 +1,5 @@
import MD5 from 'md5-es'
import { Track } from '@/shared/api'
export function randomString(): string {
let arr = new Uint8Array(16)
@@ -11,3 +12,15 @@ export function randomString(): string {
export function md5(str: string): string {
return MD5.hash(str)
}
export function trackListEquals(a: Track[], b: Track[]): boolean {
if (a.length !== b.length) {
return false
}
for (let i = 0; i < a.length; i++) {
if (a[i].id !== b[i].id) {
return false
}
}
return true
}