Permalink
Browse files

rewrite project

  • Loading branch information...
1 parent a9b92a9 commit e7314ec9e53547a23cd802941e0f739e1de16de4 @lavelle committed Feb 9, 2013
View
0 .gitignore 100755 → 100644
No changes.
View
0 img/logo.png 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0 img/logo.psd 100755 → 100644
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
8 readme.md 100755 → 100644
@@ -1,23 +1,23 @@
-#ClipCloud
+# ClipCloud
ClipCloud is a program for quickly sharing files. Currently it consists of a command line program written in Python that can upload files to Dropbox.
A GUI is planned, as well as the ability to upload elsewhere, such as a personal server via SSH.
It has only been primarily tested on Windows but most functionality also works on OS X and Linux. The Dropbox API is bundled with it, but you'll need to install its dependencies, `OAuth` `simplejson` separately and also `wxPython` if you want to take screenshots.
-##Arguments:
+## Arguments:
- `up </path/to/file/or/folder> [second file, third file...]`: Upload the specified files and folders.
- `snap [-m mode]`: Take a screenshot and upload it. Mode can be `draw` or `screen`. Defaults to `screen`.
- `history [-l number_of_records] [-t sort_by] [-b start] [-d direction]`: Show a history of the files you've uploaded previously. Defaults to the last 10 records.
- `revisit <operation> <id>`: Do something with a previously uploaded file. `id` specifies which file to upload. `operation` can be either `upload`, `remote` or `local`.
- `text [-e extension]`: Share the contents of your clipboard. Currently uploads to Dropbox, support for Github Gists planned. Extenstion defaults to `txt`.
-##Options:
+## Options:
- `-s` `--share`: Specify what to do with the link to the uploaded file. Current options are sharing to Facebook, Twitter, Email, setting the clipboard or writing to stdout so you can pipe the url to other programs. Defaults to `clipboard`.
- `-h` `--help`: Display the help message
-##Todo:
+## Todo:
- Package as a .exe for distribution to users without Python
- Add text snippet sharing to Github Gists?
View
@@ -1,110 +1,98 @@
-#!/usr/bin/env python
-#
-# ######################################################################
-#
-# CCC L III PPP CCC L OO U U DDD #
-# C L I P P C L O O U U D D ## ### #
-# C L I PPP C L O O U U D D #### #######
-# CCC LLLL III P CCC LLLL OO UU DDD ###############
-#
-# ######################################################################
-# (c) 2011-2012 Giles Lavelle GPLv3
-#
-
-# for interacting with the file system
-import os
-
-# for parsing command-line arguments and options
-from argparse import ArgumentParser
-
-from lib.main import *
-from lib.settings import *
-
-
-def clipcloud():
- """
- Wrapper around the rest of the program's functionality.
- Receives the command line parameters and passes them on to be processed.
- Also does some other stuff that needs to be done every time the program runs.
- """
-
- # Create the folder for storing screenshots if it doesnt exist.
- if not os.path.exists(SCREENSHOT_PATH):
- os.makedirs(SCREENSHOT_PATH)
-
- # Create the folder for storing temporary files if it doesnt exist.
- if not os.path.exists(TMP_PATH):
- os.makedirs(TMP_PATH)
-
- # Add command line options
- # Create the master argument parser instance
- parser = ArgumentParser(description=HELP_MESSAGE)
-
- # Add any global options - ones that apply to all tools
- parser.add_argument('-s', '--share', dest='share',
- help="share a link to the file to a social media site",
- default='clipboard', choices=SHARING_SERVICES)
-
- # Create the subparsers for each of the program's separate tools
- subparsers = parser.add_subparsers()
-
- # Create the parser for options that only apply to uploading files and folders
- upload_parser = subparsers.add_parser('up')
- upload_parser.add_argument('filepaths', nargs='+')
- upload_parser.set_defaults(func=upload)
-
- # Create the parser for options that only apply to revisiting old uploads
- revisit_parser = subparsers.add_parser('revisit')
- revisit_parser.add_argument('operation',
- choices=['local', 'remote', 'upload'])
- revisit_parser.add_argument('id', type=int)
- revisit_parser.set_defaults(func=revisit)
-
- # Create the parser for options that only apply to sharing text snippets
- text_parser = subparsers.add_parser('text')
- text_parser.add_argument('-v', '--text-service', dest='text',
- help="The hosting service to upload text snippets to",
- default='dropbox', choices=['dropbox'])
- # The Dropbox file viewer has inbuilt syntax highlighting so the file extension is relevant
- text_parser.add_argument('-e', '--extension', dest='extension',
- help="The extension of the file to save the snippet of text to",
- default='txt')
- text_parser.set_defaults(func=snippet)
-
- # Create the parser for options that only apply to taking screenshots
- screenshot_parser = subparsers.add_parser('snap')
- screenshot_parser.add_argument('-m', '--mode', dest='mode',
- help="The way the area of the screen to be captured is defined",
- default='screen', choices=['screen', 'draw'])
- screenshot_parser.set_defaults(func=screenshot)
-
- # Create the parser for options that only apply to viewing the history
- history_parser = subparsers.add_parser('history')
- history_parser.add_argument('-l', '--limit', dest='limit', type=int,
- help="The number of records in the history database to show",
- default=10)
- history_parser.add_argument('-d', '--direction', dest='direction',
- help="The direction to sort the results by - ascending or descending",
- default='a', choices=['a', 'd'])
- history_parser.add_argument('-t', '--sort-by', dest='sort_by',
- help="The field to sort the history results by",
- default='id', choices=['id', 'url', 'path', 'timestamp'])
- history_parser.add_argument('-b', '--start', dest='start', type=int,
- help="The ID of the record to start the history table at",
- default=1)
- history_parser.set_defaults(func=history)
-
- # finally parse all arguments run the relevant function
- args = parser.parse_args()
- args.func(args)
-
-# Don't do anything if this file is being imported as a module
-if __name__ == '__main__':
- # If program execution time is being measured, call the main function from a timer
- if TIMER_ACTIVATED:
- from timeit import Timer
- t = Timer('clipcloud.clipcloud()', 'import clipcloud')
- print t.timeit(number=1)
- # Otherwise just call it
- else:
- clipcloud()
+#!/usr/bin/env python
+#
+# (c) 2011-2013 Giles Lavelle GPLv3
+
+import os
+from argparse import ArgumentParser
+
+from lib.main import *
+from lib.settings import *
+
+
+def clipcloud():
+ """
+ Wrapper around the rest of the program's functionality.
+ Receives the command line parameters and passes them on to be processed.
+ Also does some other stuff that needs to be done every time the program runs.
+ """
+
+ # Create the folder for storing screenshots if it doesnt exist.
+ if not os.path.exists(SCREENSHOT_PATH):
+ os.makedirs(SCREENSHOT_PATH)
+
+ # Create the folder for storing temporary files if it doesnt exist.
+ if not os.path.exists(TMP_PATH):
+ os.makedirs(TMP_PATH)
+
+ # Add command line options
+ # Create the master argument parser instance
+ parser = ArgumentParser(description=HELP_MESSAGE)
+
+ # Add any global options - ones that apply to all tools
+ parser.add_argument('-s', '--share', dest='share',
+ help="share a link to the file to a social media site",
+ default='clipboard', choices=SHARING_SERVICES)
+
+ # Create the subparsers for each of the program's separate tools
+ subparsers = parser.add_subparsers()
+
+ # Create the parser for options that only apply to uploading files and folders
+ upload_parser = subparsers.add_parser('up')
+ upload_parser.add_argument('filepaths', nargs='+')
+ upload_parser.set_defaults(func=upload)
+
+ # Create the parser for options that only apply to revisiting old uploads
+ revisit_parser = subparsers.add_parser('revisit')
+ revisit_parser.add_argument('operation',
+ choices=['local', 'remote', 'upload'])
+ revisit_parser.add_argument('id', type=int)
+ revisit_parser.set_defaults(func=revisit)
+
+ # Create the parser for options that only apply to sharing text snippets
+ text_parser = subparsers.add_parser('text')
+ text_parser.add_argument('-v', '--text-service', dest='text',
+ help="The hosting service to upload text snippets to",
+ default='dropbox', choices=['dropbox'])
+ # The Dropbox file viewer has inbuilt syntax highlighting so the file extension is relevant
+ text_parser.add_argument('-e', '--extension', dest='extension',
+ help="The extension of the file to save the snippet of text to",
+ default='txt')
+ text_parser.set_defaults(func=snippet)
+
+ # Create the parser for options that only apply to taking screenshots
+ screenshot_parser = subparsers.add_parser('snap')
+ screenshot_parser.add_argument('-m', '--mode', dest='mode',
+ help="The way the area of the screen to be captured is defined",
+ default='screen', choices=['screen', 'draw'])
+ screenshot_parser.set_defaults(func=screenshot)
+
+ # Create the parser for options that only apply to viewing the history
+ history_parser = subparsers.add_parser('history')
+ history_parser.add_argument('-l', '--limit', dest='limit', type=int,
+ help="The number of records in the history database to show",
+ default=10)
+ history_parser.add_argument('-d', '--direction', dest='direction',
+ help="The direction to sort the results by - ascending or descending",
+ default='a', choices=['a', 'd'])
+ history_parser.add_argument('-t', '--sort-by', dest='sort_by',
+ help="The field to sort the history results by",
+ default='id', choices=['id', 'url', 'path', 'timestamp'])
+ history_parser.add_argument('-b', '--start', dest='start', type=int,
+ help="The ID of the record to start the history table at",
+ default=1)
+ history_parser.set_defaults(func=history)
+
+ # finally parse all arguments run the relevant function
+ args = parser.parse_args()
+ args.func(args)
+
+# Don't do anything if this file is being imported as a module
+if __name__ == '__main__':
+ # If program execution time is being measured, call the main function from a timer
+ if TIMER_ACTIVATED:
+ from timeit import Timer
+ t = Timer('clipcloud.clipcloud()', 'import clipcloud')
+ print t.timeit(number=1)
+ # Otherwise just call it
+ else:
+ clipcloud()
View
0 src/gui.py 100755 → 100644
No changes.
View
0 src/lib/__init__.py 100755 → 100644
No changes.
View
0 src/lib/clipboard.py 100755 → 100644
No changes.
View
0 src/lib/dbox.py 100755 → 100644
No changes.
View
0 src/lib/dropbox/__init__.py 100755 → 100644
No changes.
View
0 src/lib/dropbox/client.py 100755 → 100644
No changes.
View
0 src/lib/dropbox/rest.py 100755 → 100644
No changes.
View
0 src/lib/dropbox/session.py 100755 → 100644
No changes.
View
0 src/lib/dropbox/trusted-certs.crt 100755 → 100644
No changes.
View
0 src/lib/gridformat.py 100755 → 100644
No changes.
View
0 src/lib/history.py 100755 → 100644
No changes.
View
0 src/lib/main.py 100755 → 100644
No changes.
View
0 src/lib/message.py 100755 → 100644
No changes.
View
0 src/lib/pyjson.py 100755 → 100644
No changes.
View
0 src/lib/screenshot.py 100755 → 100644
No changes.
View
0 src/lib/settings.py 100755 → 100644
No changes.
View
0 src/lib/tray.py 100755 → 100644
No changes.

0 comments on commit e7314ec

Please sign in to comment.