Пример #1
0
    _setResultsByPlaylist: function(playlistId) {
      // https://github.com/MeoMix/StreamusChromeExtension/issues/567
      var pendingRequest = YouTubeV3API.getPlaylistSongs({
        playlistId: playlistId,
        success: this._onGetPlaylistSongsSuccess.bind(this, playlistId),
        error: this._onSearchError.bind(this)
      });

      this.set('pendingRequest', pendingRequest);
    },
Пример #2
0
        _setResultsByPlaylist: function(playlistId) {
            //  TODO: This is not DRY with how a Playlist loads its songs internally, how can I share the logic?
            var pendingRequest = YouTubeV3API.getPlaylistSongs({
                playlistId: playlistId,
                success: this._onGetPlaylistSongsSuccess.bind(this, playlistId),
                error: this._onSearchError.bind(this)
            });

            this.set('pendingRequest', pendingRequest);
        },
Пример #3
0
 _onAddSongsByDataSourceSuccess: function(nextPageToken) {
     if (_.isUndefined(nextPageToken)) {
         this.set('dataSourceLoaded', true);
     } else {
         //  Request next batch of data by iteration once addItems has succeeded.
         YouTubeV3API.getPlaylistSongs({
             playlistId: this.get('dataSource').get('id'),
             pageToken: nextPageToken,
             success: this._onGetPlaylistSongsSuccess.bind(this)
         });
     }
 },
Пример #4
0
    _onGetPlaylistSongsSuccess: function(playlistId, response) {
      this.get('results').addSongs(response.songs);

      if (!_.isUndefined(response.nextPageToken)) {
        var pendingRequest = YouTubeV3API.getPlaylistSongs({
          playlistId: playlistId,
          pageToken: response.nextPageToken,
          success: this._onGetPlaylistSongsSuccess.bind(this, playlistId),
          error: this._onSearchError.bind(this)
        });

        this.set('pendingRequest', pendingRequest);
      } else {
        this.set('pendingRequest', null);
      }
    },
Пример #5
0
 loadDataSource: function() {
     YouTubeV3API.getPlaylistSongs({
         playlistId: this.get('dataSource').get('id'),
         success: this._onGetPlaylistSongsSuccess.bind(this)
     });
 },