<commit_before># playlist.coffee
# in addition to being responsible for managing the playlist
# the playlist is responsible for s
define ["app", "apps/config/storage/localstorage", "entities/feed"], (Swabcast) ->
  Swabcast.module "Entities", (Entities, Swabcast, Backbone, Marionette, $, _) ->
    Entities.QueuedEpisode = Backbone.Model.extend(
      url: "queuedtracks"
      urlRoot: "playlist"
      order: 0,
      validate: (attrs) ->
        "must have valid uid property"  unless attrs.uid
    )

    Entities.configureStorage Entities.QueuedEpisode

    Entities.Playlist = Backbone.Collection.extend(
      url: "playlist"
      model: Entities.QueuedEpisode
      comparator: "order"
    )
    Entities.configureStorage Entities.Playlist

    #public
    API =
      getEpisodeEntity: (uniqueId) ->
        console.log(uniqueId)
        episode = new Entities.QueuedEpisode(id: uniqueId)
        defer = $.Deferred()
        setTimeout (->
          episode.fetch
            success: (data) ->
              console.log("success getting episodeEntity",data)
              defer.resolve data

            error: ->
              defer.resolve `undefined`
        ), 100
        defer.promise()

      getPlaylistEntities: ->
        queuedTracks = new Entities.Playlist()
        defer = $.Deferred()
        queuedTracks.fetch success: (data) ->
          defer.resolve data

        promise = defer.promise()
        # $.when(promise).done (queuedtracks) ->

        promise

      addToPlaylist: (model) ->
        queuedTracks = @getPlaylistEntities()<commit_msg>removing commented code, cleaning up<commit_after># playlist.coffee
define ["app", "apps/config/storage/localstorage", "entities/feed"], (Swabcast) ->
  Swabcast.module "Entities", (Entities, Swabcast, Backbone, Marionette, $, _) ->
    Entities.QueuedEpisode = Backbone.Model.extend(
      url: "queuedtracks"
      urlRoot: "playlist"
      order: 0,
      validate: (attrs) ->
        "must have valid uid property"  unless attrs.uid
    )

    Entities.configureStorage Entities.QueuedEpisode

    Entities.Playlist = Backbone.Collection.extend(
      url: "playlist"
      model: Entities.QueuedEpisode
      comparator: "order"
    )
    Entities.configureStorage Entities.Playlist

    #public
    API =
      getEpisodeEntity: (uniqueId) ->
        console.log(uniqueId)
        episode = new Entities.QueuedEpisode(id: uniqueId)
        defer = $.Deferred()
        setTimeout (->
          episode.fetch
            success: (data) ->
              console.log("success getting episodeEntity",data)
              defer.resolve data

            error: ->
              defer.resolve `undefined`
        ), 100
        defer.promise()

      getPlaylistEntities: ->
        if queuedTracks
          console.log(queuedtracks)
          delete queuedTracks
        queuedTracks = new Entities.Playlist()
        defer = $.Deferred()
        queuedTracks.fetch
          success: (data) ->
            defer.resolve data

        defer.promise()

      addToPlaylist: (model) ->
        queuedTracks = @getPlaylistEntities()
{'fraction_non_alphanumeric': 0.10578778135048232, 'fraction_numerical': 0.002572347266881029, 'mean_word_length': 2.257591623036649, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6948607', 'n_tokens_mistral': 922, 'n_tokens_neox': 898, 'n_words': 193}