Skip to content

Commit

Permalink
Version 0.6 released
Browse files Browse the repository at this point in the history
  • Loading branch information
stgraber committed Dec 2, 2006
1 parent 1a063e3 commit e1ba668
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 17 deletions.
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
pastebinit (0.6-0ubuntu1) feisty; urgency=low
* New version upstream (change the default Pastebin, fix a bug with paste.ubuntu-nl.org, add support of regexp)

-- Stéphane Graber <stgraber@stgraber.org> Tue, 28 Nov 2006 19:32:40 +0100

pastebinit (0.5-0ubuntu1) feisty; urgency=low
* Initial release

Expand Down
2 changes: 1 addition & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ Depends: python ${python:Depends}
Description: A command line pastebin client
This tools can send the result of a command or
a file passed as argument directly to a pastebin
(actually http://paste.ubuntu-nl.org or http://pastebin.com).
(actually http://paste.stgraber.org, http://paste.ubuntu-nl.org or http://pastebin.com).
33 changes: 17 additions & 16 deletions pastebinit
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/python

# Writen by Stephane Graber <stgraber@stgraber.org>
# Last modification : Mon Nov 27 21:14:40 CET 2006
# Last modification : Sat Dec 02 23:24:40 CET 2006

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -18,42 +18,43 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

import urllib, os, sys, re
defaultPB="http://paste.stgraber.org"
version="0.6"
defaultPB="http://paste.stgraber.org" #Default pastebin
version="0.6" #Version number to show in the usage

#Return the parameters depending of the pastebin used
def getParameters(website,content,user):
def getParameters(website,content,user,version):
"Return the parameters array for the selected pastebin"
params={}

if website == "http://paste.stgraber.org":
params['poster']=user
params['code2']=content
params['parent_pid']=""
params['format']="text"
params['version']=version
params['parent_pid']="" #For reply, "" means homepage (new thread)
params['format']="text" #The format, for syntax hilighting
params['paste']="Send"
params['remember']="1" #Do you want a cookie ?
params['remember']="0" #Do you want a cookie ?
params['expiry']="f" #The expiration, f = forever
params['regexp']="None"
elif website == "http://paste.ubuntu-nl.org":
params['poster']=user
params['content']=content
params['syntax']="text"
params['syntax']="text" #The format, for syntax hilighting
params['regexp']="None"
elif re.search("http://.*\.pastebin\.com", website):
params['poster']=user
params['code2']=content
params['parent_pid']=""
params['parent_pid']="" #For reply, "" means homepage (new thread)
params['format']="text" #The format, for syntax hilighting
params['paste']="Send"
params['remember']="1" #Do you want a cookie ?
params['remember']="0" #Do you want a cookie ?
params['expiry']="f" #The expiration, f = forever
params['regexp']="None"
elif website == "http://pastebin.ca":
params['name']=user
params['content']=content
params['type']="1" #The expiration, 1 = raw
params['save']="1"
params['save']="0" #Do you want a cookie ?
params['s']="Submit Post"
params['regexp']='">http://pastebin.ca/(.*)</a></p><p>'
else:
Expand Down Expand Up @@ -85,16 +86,16 @@ except:
website=defaultPB

user=os.environ.get('USER') #Get the current username from the environment
params=getParameters(website,content,user) #Get the parameters array
reLink=params['regexp']
params['regexp']=None
params=getParameters(website,content,user,version) #Get the parameters array
reLink=params['regexp'] #Extract the regexp
params['regexp']=None #Remove the regexp from what will be sent
params=urllib.urlencode(params) #Convert to a format usable with the HTML POST

page=urllib.urlopen(website+'/',params) #Send the informations and be redirected to the final page

try:
if reLink != "None":
print website+"/"+re.split(reLink, page.read())[1]
if reLink != "None": #Check if we have to apply a regexp
print website+"/"+re.split(reLink, page.read())[1] #Print the result of the Regexp
else:
print page.url #Get the final page and show the url
except:
Expand Down
2 changes: 2 additions & 0 deletions pastebinit.1
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ The URL of an other supported pastebin to use (http://xyz.pastebin.com for examp
.SH SUPPORTED PASTEBINS
.RS
.RE
http://paste.stgraber.org
.RE
http://*.pastebin.com
.RE
http://paste.ubuntu-nl.org
Expand Down

0 comments on commit e1ba668

Please sign in to comment.