пятница, 11 января 2013 г.

Попробуйте GoogleCL и вам понравится

Основная задача GoogleCL это возможность работы с сервисами из командной строки.
Есть можно ставить просто из репозитория или так как описано:

Check out the Manual and ExampleScripts for many more examples of what you can do, or the Install page for simple install instructions.

GoogleCL brings Google services to the command line.

We currently support the following Google services:

Blogger

$ google blogger post --title "foo" "command line posting"

Calendar

$ google calendar add "Lunch with Jim at noon tomorrow"

Contacts

$ google contacts list Bob --fields name,email > the_bobs.csv

Docs

$ google docs edit "Shopping list"

Finance

$ google finance create-txn "Savings Portfolio" NASDAQ:GOOG Buy

Picasa

$ google picasa create "Cat Photos" ~/photos/cats/*.jpg

Youtube

$ google youtube post --category Education killer_robots.avi

Более подробное описание команд:



Blogger
delete
list
post
tag
Calendar
add
delete
list
today
Contacts
add
add-groups
delete
delete-groups
list
list-groups
Docs
delete
edit
get
list
upload
Picasa
create
delete
get
list
list-albums
post
tag
Youtube
delete
list
post
tag



Also see the Manual and the SystemRequirements. Note that (only) the first time you use each service, you'll need to grant authorization from a web browser.


GoogleCL will do its best to figure out what you wanted without specific options being mentioned. In the descriptions that follow, any required options will be filled in by leftover command line arguments. For example, here is the description for the Blogger "tag" task:


Requires: title AND tags Optional: blog


So if you do not specify --title or --tags, either on the command line or with your configuration file, GoogleCL will read the first argument as the title, and the second as a comma-separated list of tags. That is,


$ google blogger tag "My Post" "tag1, tag2, tag3"


is equivalent to


$ google blogger tag --title "My Post --tags "tag1, tag2, tag3"


If you think something strange is going on, add the --verbose flag to the command, and you should see an output of what required fields were not specified with an option flag, and what the options were ultimately filled in with. Here's an example output from blogger list:


missing_reqs: ['fields']

Option convert: True

Option delimiter: ,

Option fields: title,url-site # Filled in from the config file

Option hostid: MY_HOST_ID

Option src: []

Option user: tom.h.miller

Option verbose: True


There are also instances, (usually when listing or deleting events) where you want to specify more than one value for an argument. These should be picked up from the command line arguments semi-intelligently. For example:


$ google calendar today Breakfast Lunch Dinner


will decide that you're looking for events with titles that start with "Breakfast", or "Lunch", or "Dinner".


These examples use regular expressions (albeit very simple ones). GoogleCL will only accept expressions that work with the Python re package. Regular expressions are enabled by default, but you can disable them with the regex configuration option. See ConfigurationOptions.


The following examples omit the leading $ google <service>

Blogger


Note: --blog is required the first time you run a blogger task, unless you only have one blog. If you have more than one blog and do not specify--blog, the blog that you entered the first time you ran GoogleCL will be used.
delete


Delete posts.


Requires: title Optional: blog
delete bad_post really_bad\w*
delete --blog ".*" --title ".*fanfic.*"
list


List posts.


Requires: fields AND delimiter Optional: blog, title, owner
list name,author,url --blog ".*"
list --owner <Blogger Profile ID Number>
list --delimiter="|" --title wiki




post


Post content to a blog.


Requires: src Optional: blog, title, tags, draft
post --tags "GoogleCL, awesome" --title "Test Post" --src "I'm posting from the command line"
post blogpost.txt
post ~/old_posts/*.txt ~/new_posts/*.html
post --blog "Ye Olde Tech Blog" "Hark! Android 2.2 released." --tags "google, android" --draft
tag


Label/tag posts in a blog.


Requires: title AND tags Optional: blog


See the Manual for tag syntax
tag "Chaffeur" "-confidential awesome"
tag --blog "Tagless" ".*" "--"
Calendar


Note: if --cal is omitted, your primary/default calendar will be used.


Note: For list and delete, your ENTIRE CALENDAR will be retrieved. This can take a while. Use --date to restrict date ranges, and --query to match text in the event title or description. See the Manual for how to use --date.
add


Add events.


Requires: src Optional: cal
add "Dinner party tomorrow at 6pm"
add --cal launch "Release .deb tomorrow" "Release .zip at 5"


Note: The src parameter is parsed for special values so you can set the time and the event length:
add "Meeting on 29 December at 10pm"


will add the entry from 10pm till 11pm on Dec 29 with the description "Meeting"
add "Meeting on 29 December at 8am till 2pm"



will add the entry from 8am till 2pm on Dec 29 with the description "Meeting"
add "Meeting with Megi on 29 December from 8am till 2pm"



will add the entry from 8am till 2pm on Dec 29 with the description "Meeting with Megi"
delete


Delete events.


Requires: (title OR query) Optional: date, cal
delete "Lunch with that jerk"
delete --cal "tentative" --title ".*"
list


List events.


Requires: fields AND delimiter Optional: title, query, date, cal
list --fields title,when,where --cal "commitments"
list Breakfast Lunch Dinner --date 2010-10-14
list -q party --cal ".*"
today


List events going on today. Essentially shorthand for --date <today>,<tomorrow> with the list task.


Requires: fields AND delimiter Optional: title, query, cal
today --cal ".*"
today --fields name,where --delimiter " :: "
Contacts


Note: --title is required for most of these. If you are prompted to enter a title, just hitting enter is equivalent to and faster than specifying ".".
add


Add contacts.


Requires: src


Note: src can be a name,email pair, or a file that contains one name,email pair per line.
add "J. Random Hacker, jrandom@example.com"
add "contacts.csv" "Jim Raynor, jimmy@noreaster.com"
add-groups


Add contact group(s)


Requires: title
add "LAN buddies"
add "Wedding guests" "Wedding services"
delete


Delete contacts.


Requires: title
delete Huey Dewey Louie
delete ".*Kerrigan"
delete-groups


Delete contact group.


Requires: title
delete-groups "In-laws"
list


List contacts.


Requires: fields AND title AND delimiter
list --fields=name,email,relations .*bert
list Jane Charlotte Emily
list-groups


List contact groups.


Requires: title


Note: Groups that begine with "System Group:" are the groups Gmail starts with.
list-groups ".*"
list-groups "System Group:"
Docs


Note: --folder will take the name of any folder, even subfolders.
delete


Delete documents.


Requires: title Optional: folder
delete "Evidence"
delete ".*" --folder junk
edit


Edit a document.


Requires: title Optional: format, editor, folder


Note: editing with Open Office will not work. See Issue 79 .


Note: You must have python-gdata >= 1.3.0 to edit documents.
edit "Shopping list" --editor vim
edit "Budget" --format html
get


Download a document.


Requires: (title OR folder) AND dest Optional: format


Note: You must have python-gdata >= 1.3.0 to download documents.
get --folder Homework .
get "Expense sheet" expenses.xls
list


List documents.


Requires: fields AND delimiter Optional: title, folder
list
list --folder essays --fields title,url --delimiter " : "
upload


Upload a document.


Requires: src Optional: title, folder, format


Note: --folder will accept only one folder to upload into. If you have two or more folders with the same name, even subfolders, you will have to pick between them (hard to do when they have the same name).


Note: Users with a Google Apps Premium account can use an additional option: --no-convert. This will let you upload arbitrary filetypes to Docs, like you can through the web interface. Unfortunately, this is not enabled for regular users.
upload ~/docs/to/share/*
upload Necronomicon.doc --folder "Book club" --title "Pride and Prejudice"
upload my_contacts.csv # Upload a CSV file, automatically converted to a spreadsheet.
upload my_contacts.csv --format txt # Upload a CSV file, keep as plain text.
Picasa
create


Create an album.


Requires: title Optional: src, date, summary, tags


Note: --tags will be applied to each photo being uploaded, not the album.
create "Vacation 2010" ~/Photos/2010/06/*.jpg
create "Empty album"
create --summary "Planet earth turns 6013" --date 2009-10-23 "Happy birthday, earth" ~/pics/trolling/*
create "CATS" ~/photos/theater/broadway/cats/*.png --tags lol
delete


Delete photos or albums.


Requires: (title OR query)


Note: --title will match on album names, --query on photo tags and captions. If --query is specified, the objects being deleted will be photos that match the query value that are also in the album that matches --title.
delete "Vacation 2010" -q "kind of boring" # Delete photos in album "Vacation 2010" that have a tag or caption of "kind of boring"
delete "Cosplay" "LARPing" # Delete the albums "Cosplay" and "LARPing"
get


Download albums.


Requires: title AND dest Optional: owner, format


Note: --format applies to videos ONLY, and should be either mp4 or swf
get "My album" .
get "Close-ups of large-toothed creatures" --owner sirwin --dest ~/photos
list


List photos.


Requires: fields AND delimiter Optional: title, query, owner


Note: --title still matches on album titles. This will list photos inside albums that match the title.
list
list --fields title,url,summary "cats" "more cats" "lolcats"
list --owner dr.horrible -q Penny
list --owner fancy.pants.cameraman --fields title,fstop,exposure,ev,model,flash
list-albums


List albums.


Requires: fields AND delimiter Optional: title, owner
list-albums --owner peter.parker, --fields
list-albums "Skiing .*"
post


Post photos or video to an album.


Requires: title AND src Optional: tags, owner
post "Empty album" ~/photos/new/*
post --src profile_picture.png --title "Me" --tags vanity
post "Collaboration Album 1" ~/photos/my_photos/*.jpg --owner a.adams
tag


Tag photos.


Requires: (title OR query) AND tags Optional: owner
tag "Stand-up night" "humor, comedy, night-out"
tag --owner anon "Photoshopped" "-plausible ridiculous"
Youtube


Note: You must log on with your Google account, but the --owner option will only accept YouTube usernames.


Note: The devkey is provided for you. However, because of the nature of the key, it may become invalid in the future, and in that case you will have to supply your own. --devkey will also take the name of a file where the devkey is stored.
delete


Delete videos.


Requires: title AND devkey
delete ".*cat.*"
delete "Vlog episode [0-9]+" --devkey mydevkey.txt
list


List videos by user.


Requires: fields AND delimiter Optional: title, owner
list --owner pomplamoosemusic
list --fields title,summary,url "My video" "My other video"
post


Post a video.


Requires: src AND category AND devkey Optional: title, summary, tags


Note: A list of legal values for category can be found in the Manual. If you don't really care what category your video gets uploaded to, set a default in your configuration file (see ConfigurationOptions).
post --category Education killer_robots.avi
post ~/videos/cat-falls-down-stairs.avi Comedy --tags "currency of the internet" --summary "Poor whiskers takes a tumble. She's fine, though, don't worry."
tag


Add tags to a video and/or change its category.


Requires: title AND (tags OR category) AND devkey
tag "Cooking with Rob" --category Education
tag "Vlog .*" "my life, video blogging, AWESOME" --category People



Комментариев нет:

Отправить комментарий