           else
             process()
             runSync()
-      
+
       process = =>
         videoIds = Object.keys(youtubePlaylistItems)
         media = media.filter (m) ->

        ga 'plugmixer.send', 'event', 'sync', 'click', 'login-youtube'

    handleAuthResult = (authResult) ->
      if authResult and not authResult.error 
        gapi.client.load 'youtube', 'v3', -> readPlaylists()
      else
        $('#plugmixer-youtube-login').click (event) -> checkAuth false


    @link: (plugPlaylistId, ytPlaylistId) ->
      if Playlists.getById(plugPlaylistId)?
        if !syncedPlaylists[plugPlaylistId]?
          syncedPlaylists[plugPlaylistId] =
            youtube: ytPlaylistId
            ignore: []
            lastSynced: null
