Exemplo n.º 1
0
    def merge_duplicates(self, task):
        # def emitter():
        duplicate_items = task.duplicate_items(self.lib)
        _freshen_items(duplicate_items)
        duplicate_paths = [item.path for item in duplicate_items]

        # Record merged paths in the session so they are not reimported
        self.mark_merged(duplicate_paths)

        merged_task = ImportTask(None, task.paths + duplicate_paths,
                                 task.items + duplicate_items)

        self.new_pipeline([merged_task], self.lookup_stages())
Exemplo n.º 2
0
    def merge_duplicates(self, task_id):
        task = self.tasks.pop(task_id, None)
        if not task:
            print(task, "not in tasks")
            return
        task = self.tasks[task_id]
        # def emitter():
        duplicate_items = task.duplicate_items(self.lib)
        _freshen_items(duplicate_items)
        duplicate_paths = [item.path for item in duplicate_items]

        # Record merged paths in the session so they are not reimported
        self.mark_merged(duplicate_paths)

        merged_task = ImportTask(None, task.paths + duplicate_paths,
                                 task.items + duplicate_items)

        self.new_pipeline([merged_task], self.lookup_stages())
Exemplo n.º 3
0
 def test_hate(self):
     genre_p = []
     artist_p = []
     album_p = []
     white_p = []
     task = ImportTask()
     task.cur_artist = u'Test Artist'
     task.cur_album = u'Test Album'
     task.items = [Item({'genre': 'Test Genre'})]
     self.assertFalse(
         IHatePlugin.do_i_hate_this(task, genre_p, artist_p, album_p,
                                    white_p))
     genre_p = 'some_genre test\sgenre'.split()
     self.assertTrue(
         IHatePlugin.do_i_hate_this(task, genre_p, artist_p, album_p,
                                    white_p))
     genre_p = []
     artist_p = 'bad_artist test\sartist'
     self.assertTrue(
         IHatePlugin.do_i_hate_this(task, genre_p, artist_p, album_p,
                                    white_p))
     artist_p = []
     album_p = 'tribute christmas test'.split()
     self.assertTrue(
         IHatePlugin.do_i_hate_this(task, genre_p, artist_p, album_p,
                                    white_p))
     album_p = []
     white_p = 'goodband test\sartist another_band'.split()
     genre_p = 'some_genre test\sgenre'.split()
     self.assertFalse(
         IHatePlugin.do_i_hate_this(task, genre_p, artist_p, album_p,
                                    white_p))
     genre_p = []
     artist_p = 'bad_artist test\sartist'
     self.assertFalse(
         IHatePlugin.do_i_hate_this(task, genre_p, artist_p, album_p,
                                    white_p))
     artist_p = []
     album_p = 'tribute christmas test'.split()
     self.assertFalse(
         IHatePlugin.do_i_hate_this(task, genre_p, artist_p, album_p,
                                    white_p))