Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
deanishe committed Apr 30, 2015
0 parents commit e8fbdfd
Show file tree
Hide file tree
Showing 9 changed files with 573 additions and 0 deletions.
70 changes: 70 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Created by https://www.gitignore.io

### Vim ###
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
*.un~
Session.vim
.netrwhist
*~


### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

Binary file added Google Similar Images-1.0.alfredworkflow
Binary file not shown.
21 changes: 21 additions & 0 deletions LICENCE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

# Find Similar Images with Google Images Search #

An [Alfred 2][alfred] workflow.

Perform a Google Image search based on a file on your computer.

**Insert demo here!**

## Usage ##

Google search supports PNG, JPG, GIF and BMP images only. This workflow
is available as a File Action for any of these filetypes in Alfred.

There is also a Hotkey to search based on the current Finder selection. If more
than one image file is selected, on the first will be used.


## Licence ##

This workflow is released under the [MIT License][mit].


[alfred]: http://www.alfredapp.com/
[mit]: ./LICENCE.txt

39 changes: 39 additions & 0 deletions src/call_with_finder_selection.applescript
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
(*
Get images in Finder selection, then call the workflow again with
the first selected image.
If no images are selected, return an error message, which
can be passed to a Post Notification action.
*)

-- The filetypes understood by Google Image Search
set imageExtensions to {"jpg", "jpeg", "bmp", "gif", "png"}

-- Return list of files selected in Finder whose extensions are
-- in imageExtensions
on selectedImages()
set theImages to {}
tell application "Finder"
set theSelection to the selection
if (the count of theSelection) is greater than 0 then
repeat with theFile in theSelection
if the name extension of theFile is in my imageExtensions then
set the end of theImages to (theFile as alias)
end if
end repeat
end if
log ((the count of theImages) as text) & " image(s) selected"
end tell
return theImages
end selectedImages

set theImages to my selectedImages()
if (count of theImages) is greater than 0 then
set theImage to item 1 of theImages
set thePath to POSIX path of theImage

-- Use the workflow's own external trigger
tell application "Alfred 2" to run trigger "Find Similar Images" in workflow "net.deanishe.alfred-google-similar-images" with argument thePath
else
return "No images selected"
end if
Binary file added src/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e8fbdfd

Please sign in to comment.