             q.promise
 
 
+        # Listen for movies changes
+        $rootScope.$on "refresh.movies", () ->
+            $scope.init()
+
+        # Add drop event to document
+        document.addEventListener "dragover", (e) -> e.preventDefault() and e.stopPropagation()
+        document.addEventListener "dragleave", (e) -> e.preventDefault() and e.stopPropagation()
+        document.addEventListener "drop", (e) ->
+            e.preventDefault()
+            e.stopPropagation()
+            $scope.drop e.dataTransfer.files
+
         # Init app
         $scope.init()

 # # MainCtrl
 # Controller of the gummyApp
###
angular.module 'gummyApp'
    .controller 'MainCtrl', ($scope, $rootScope, $timeout, $q, $trakt, $rotten) ->


        ###*
         # Internal database
         # @attribute db
        ###
        $scope.db = new Datastore
            filename: "#{app.getPath 'home'}/Gummy/movies.db"
            autoload: true


        ###*

        $scope.check_filepath = (file) ->
            q = $q.defer()

            $db.movies.find { path: file.path }, (e, items) ->
                if e then q.reject e
                else if items.length > 0 then q.reject "Movie already in library"
                else q.resolve file
