Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReferenceError: tracks is not defined (строка 1646, файл Library) #4

Closed
vlalog opened this issue Dec 12, 2020 · 4 comments
Closed

Comments

@vlalog
Copy link
Contributor

vlalog commented Dec 12, 2020

Исполняемый код:

function BigDailyMix() {
    let banTracks = Source.getPlaylistTracks('Banned', '2w4kXoYT1mmymY2dUHH1mR');
    let savedTracks = Source.getSavedTracks();
    Combiner.push(banTracks, savedTracks);

    let onlyForYouTracks = Source.getTracks([
        { name: 'Микс дня 1', id: '37i9dQZF1E35Rw9lXJezmd' },
        { name: 'Микс дня 2', id: '37i9dQZF1E38UFtVDcIo9c' },
        { name: 'Микс дня 3', id: '37i9dQZF1E3adpvqEe1FTy' },
        { name: 'Микс дня 4', id: '37i9dQZF1E38oJAmh1ZdKu' },
        { name: 'Микс дня 5', id: '37i9dQZF1E38bS1WqtspJi' },
        { name: 'Микс дня 6', id: '37i9dQZF1E380MTxhVBAq4' },
        { name: 'Радар новинок', id: '37i9dQZEVXbhGiCpjS9KHh' },
        { name: 'Открытия недели', id: '37i9dQZEVXcRrEFL8wsRER' },
    ]);
    
    Filter.dedupTracks(onlyForYouTracks);
    Filter.dedupArtists(onlyForYouTracks);
    Filter.removeTracks(onlyForYouTracks, banTracks);
    Filter.matchOriginalOnly(onlyForYouTracks);
    Filter.matchExceptRu(onlyForYouTracks);
    
    let updDate = new Date();
    let tracks = onlyForYouTracks;
    onlyForYouTracks = Order.sort(tracks, 'features.energy', 'desc');
      
    Playlist.saveWithReplace({
        id: '4Ystjry0PxwofnJiKaeVkp',
        name: "[vlalog's tech] daily mix",
        tracks: onlyForYouTracks,
        description: Playlist.getDescription(onlyForYouTracks) + '. Updated at ' + updDate,
        randomCover: 'update',
    });
}

Версия из этого коммита

@Chimildic
Copy link
Owner

Исправлено. Обновите библиотеку.

@vlalog
Copy link
Contributor Author

vlalog commented Dec 13, 2020

Теперь TypeError: Cannot read property 'slice' of undefined (строка 1555, файл Library)

@Chimildic
Copy link
Owner

Теперь TypeError: Cannot read property 'slice' of undefined (строка 1555, файл Library)

Order.sort не возвращает новый массив, сортирует существующий. Уберите присвоение:

onlyForYouTracks = Order.sort(tracks, 'features.energy', 'desc');

@vlalog
Copy link
Contributor Author

vlalog commented Dec 13, 2020

Работает, спасибо

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants