Beispiel #1
0
    def _get(self, query, filters):
        (results, url) = self._search_core(query.encode('utf-8'))

        threads = []
        for result in results:
            el = result.el
            title = result.title
            for filter in filters:
                custom_filter = False
                packageType = filter.type
                if self._custom_filter is not None:
                    if self._custom_filter.fn(title):
                        custom_filter = True
                        packageType = self._custom_filter.type

                if custom_filter or filter.fn(title):
                    torrent = {}
                    torrent['scraper'] = self.caller_name
                    torrent['hash'] = ''
                    torrent['package'] = packageType
                    torrent['release_title'] = title
                    torrent['size'] = None
                    torrent['seeds'] = None

                    if self._use_thread_for_info:
                        if len(threads) >= 5:
                            break

                        threads.append(
                            threading.Thread(target=self._info_core,
                                             args=(el, torrent, url)))
                        if DEV_MODE:
                            wait_threads(threads)
                            threads = []
                    else:
                        self._info_core(el, torrent, url)

                    if DEV_MODE and len(self._temp_results) > 0:
                        return

        wait_threads(threads)
Beispiel #2
0
    def _get(self, query, filters):
        results = self._search_core(query)

        threads = []
        for result in results:
            el = result.el
            title = result.title
            for filter in filters:
                custom_filter = False
                packageType = filter.type
                if self._custom_filter is not None:
                    if self._custom_filter.fn(title):
                        custom_filter = True
                        packageType = self._custom_filter.type

                if custom_filter or filter.fn(title):
                    torrent = {}
                    torrent['package'] = packageType
                    torrent['release_title'] = title
                    torrent['size'] = None
                    torrent['seeds'] = None

                    if self._use_thread_for_info:
                        if len(threads) >= 5:
                            break

                        threads.append(
                            threading.Thread(target=self._info_core,
                                             args=(el, torrent)))
                        if DEV_MODE:
                            wait_threads(threads)
                            threads = []
                    else:
                        self._info_core(el, torrent)

                    if DEV_MODE and len(self._torrent_list) > 0:
                        return

        wait_threads(threads)
Beispiel #3
0
 def _query_thread(self, query, filters):
     return threading.Thread(target=self._get, args=(query, filters))
Beispiel #4
0
 def _query_thread(self, query, filters):
     return threading.Thread(target=self._get,
                             args=(query.encode('utf-8'), filters))