diff --git a/Package Managers.alfredworkflow b/Package Managers.alfredworkflow index 1df0cf2..cd6ad4e 100644 Binary files a/Package Managers.alfredworkflow and b/Package Managers.alfredworkflow differ diff --git a/README.md b/README.md index 1f52512..997cc2e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Package Managers ([Download v3.03](https://github.com/willfarrell/alfred-pkgman-workflow/releases/download/3.03/Package.Managers.alfredworkflow)) +# Package Managers ([Download v3.04](https://github.com/willfarrell/alfred-pkgman-workflow/releases/download/3.04/Package.Managers.alfredworkflow)) Package Repo Search diff --git a/current-version.json b/current-version.json index ffa3a30..de639d0 100644 --- a/current-version.json +++ b/current-version.json @@ -1,5 +1,5 @@ { - "version": 3.03, - "download_url": "https://github.com/willfarrell/alfred-pkgman-workflow/releases/download/3.02/Package.Managers.alfredworkflow", + "version": 3.04, + "download_url": "https://github.com/willfarrell/alfred-pkgman-workflow/releases/download/3.04/Package.Managers.alfredworkflow", "description": "Package Repo Search" } diff --git a/src/Docker.php b/src/Docker.php index 3bc4b4e..0414947 100644 --- a/src/Docker.php +++ b/src/Docker.php @@ -8,8 +8,8 @@ class Docker extends Repo { protected $id = 'docker'; protected $kind = 'images'; - protected $url = 'https://registry.hub.docker.com'; - protected $search_url = 'https://registry.hub.docker.com/search?q='; + protected $url = 'https://hub.docker.com'; + protected $search_url = 'https://index.docker.io/v1/search?q='; public function search($query) { @@ -17,32 +17,24 @@ public function search($query) return $this->xml(); } - $this->pkgs = $this->cache->get_query_regex( + $this->pkgs = $this->cache->get_query_json( $this->id, $query, - "{$this->search_url}{$query}", - '/(
[\s\S]*?<\/a>)/i', - 1 - ); + "{$this->search_url}{$query}" + ); - foreach($this->pkgs as $pkg) { + foreach($this->pkgs->results as $pkg) { // make params - preg_match('/[\s\S]*?

([\s\S]*?)<[\s\S]*<\/h2>([\s\S]*?)<\/div>/i', $pkg, $matches); - $title = trim(preg_replace('/\s+/', '', $matches[2])); - $url = $this->url . trim(preg_replace('/\s+/', '', $matches[1])); - $description = trim(preg_replace('/\s+/', ' ', $matches[3])); - if (!$description || trim(preg_replace('/\s+/', '', $matches[3])) == '') { - $description = $url; - } + $title = $pkg->name; + $repository = ($pkg->is_official ) ? '_' : 'r'; + $url = $this->url . '/'. $repository . '/'. $pkg->name; + $description = $pkg->description; - preg_match('/\s?([\s\S]*?)\s?<\/span>/i', $pkg, $matches); - $updated = trim(preg_replace('/\s+/', ' ', $matches[1])); - $this->cache->w->result( $title, $this->makeArg($title, $url), - $title.' ~ '.$updated, + $title.' ~ '.$pkg->star_count, $description, "icon-cache/{$this->id}.png" );