Merge lp:~sungdh86/gwibber/urlshorter-durl into lp:gwibber

Proposed by DaeHyun Ego Sung
Status: Merged
Merge reported by: Robert Bruce Park
Merged at revision: not available
Proposed branch: lp:~sungdh86/gwibber/urlshorter-durl
Merge into: lp:gwibber
Diff against target: 97 lines (+38/-4)
5 files modified
.bzrignore (+4/-0)
gwibber/microblog/urlshorter/__init__.py (+2/-1)
gwibber/microblog/urlshorter/durlme.py (+25/-0)
gwibber/microblog/util/__init__.py (+6/-2)
po/gwibber.pot (+1/-1)
To merge this branch: bzr merge lp:~sungdh86/gwibber/urlshorter-durl
Reviewer Review Type Date Requested Status
Robert Bruce Park Approve
gwibber-committers Pending
Review via email: mp+49944@code.launchpad.net

Description of the change

I add url shorter service "durl.me" in Gwibber. (url shorter service such as "is.gd, cli.gs, tinyurl.com, ur1.ca, goo.gl, bit.ly, etc")

durl.me is a short URL service.
Korea(Republic of Korea)'s No'2 Web Portal "Daum(http://www.daum.net/)"'s short URL service.
It's open & free, readable, visible:Preview thumnail before visiting, usable short URL service.

Daum's web service use a short URL service durl.me. It durl.me API is open. so Gwibber suppported a short url service "durl.me" by me.

    durl.me Homepage: http://durl.me
    durl.me OpenAPI: http://durl.kr/doc/OpenAPI.html
    durl.me Twitter: http://twitter.com/durl_me

To post a comment you must log in.
Revision history for this message
Robert Bruce Park (robru) wrote :

Thanks for taking the time to submit this patch, unfortunately Gwibber has gone through extensive changes recently and your patch no longer applies to the latest codebase.

Fortunately, the new URL shortening code has been simplified quite a bit and it should be quite easy to add support for this URL shortening service. I intend to work on this later today.

Please try out the latest Gwibber, I think you'll be quite pleased with what we've accomplished.

review: Needs Fixing
Revision history for this message
Robert Bruce Park (robru) wrote :

Hmmmmm, it looks like durl only provides XML or JSON output. Currently we have a very simple API implemented that works best with only text-based responses (eg, just the raw short URL is provided, no JSON is used).

Revision history for this message
Robert Bruce Park (robru) wrote :

Ok, I have implemented durl.me in the new friends-service. You can see my work here:

http://bazaar.launchpad.net/~super-friends/friends/trunk-next/revision/200

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2008-12-27 22:52:45 +0000
3+++ .bzrignore 2011-02-16 10:44:06 +0000
4@@ -1,3 +1,7 @@
5 gwibber/semantic.cache
6 semantic.cache
7 *.mo
8+build/lib.linux-i686-2.6
9+build/mo
10+build/scripts-2.6
11+build/share
12
13=== modified file 'gwibber/microblog/urlshorter/__init__.py'
14--- gwibber/microblog/urlshorter/__init__.py 2010-06-23 15:18:21 +0000
15+++ gwibber/microblog/urlshorter/__init__.py 2011-02-16 10:44:06 +0000
16@@ -1,5 +1,5 @@
17
18-import cligs, isgd, tinyurlcom, ur1ca
19+import cligs, isgd, tinyurlcom, ur1ca, durlme
20 #import snipurlcom, zima
21
22 PROTOCOLS = {
23@@ -9,4 +9,5 @@
24 "tinyurl.com": tinyurlcom,
25 "ur1.ca": ur1ca,
26 #"zi.ma": zima,
27+ "durl.me": durlme,
28 }
29
30=== added file 'gwibber/microblog/urlshorter/durlme.py'
31--- gwibber/microblog/urlshorter/durlme.py 1970-01-01 00:00:00 +0000
32+++ gwibber/microblog/urlshorter/durlme.py 2011-02-16 10:44:06 +0000
33@@ -0,0 +1,25 @@
34+
35+"""
36+
37+durl,me interface for Gwibber
38+Egogun (Dae-Hyun Sung) - 02/13/2011
39+
40+"""
41+
42+import urllib2, json
43+
44+PROTOCOL_INFO = {
45+
46+ "name": "durl.me",
47+ "version": 0.1,
48+ "fqdn" : "http://durl.me",
49+
50+}
51+
52+class URLShorter:
53+
54+ def short(self, text):
55+ shorturl = urllib2.urlopen("http://durl.me/api/Create.do?type=json&longurl=%s" % urllib2.quote(text)).read()
56+ short = json.loads(shorturl)
57+ return short['shortUrl']
58+
59
60=== modified file 'gwibber/microblog/util/__init__.py'
61--- gwibber/microblog/util/__init__.py 2010-11-17 02:20:57 +0000
62+++ gwibber/microblog/util/__init__.py 2011-02-16 10:44:06 +0000
63@@ -72,7 +72,9 @@
64 'movapic': 'http://.*movapic.com/pic/([A-Za-z0-9]+)',
65 'znl.me': 'http://znl.me/([A-Za-z0-9-_]+)',
66 'bcphotoshare': 'http://.*bcphotoshare.com/photos/[0-9]+/([0-9]+)',
67- 'twitvideo.jp': 'http://.*twitvideo.jp/(?!contents)([A-Za-z0-9-_]+)'
68+ 'twitvideo.jp': 'http://.*twitvideo.jp/(?!contents)([A-Za-z0-9-_]+)',
69+ 'durl.me': 'http://durl.me/([A-Za-z0-9-_]+)',
70+ 'durl.kr': 'http://durl.kr/([A-Za-z0-9-_]+)',
71 }
72 thumburi = {
73 'twitpic': 'http://twitpic.com/show/thumb/@',
74@@ -99,7 +101,9 @@
75 'movapic': 'http://image.movapic.com/pic/s_@.jpeg',
76 'znl.me': 'http://app.zannel.com/content/@/Image-160x120-P-JPG.jpg',
77 'bcphotoshare': 'http://images.bcphotoshare.com/storages/@/thumbnail.jpg',
78- 'twitvideo.jp': 'http://twitvideo.jp/img/thumb/@'
79+ 'twitvideo.jp': 'http://twitvideo.jp/img/thumb/@',
80+ 'durl.me': 'http://durl.me/@.image',
81+ 'durl.kr': 'http://durl.kr/@.image',
82 }
83
84 images = []
85
86=== modified file 'po/gwibber.pot'
87--- po/gwibber.pot 2010-12-14 20:30:58 +0000
88+++ po/gwibber.pot 2011-02-16 10:44:06 +0000
89@@ -8,7 +8,7 @@
90 msgstr ""
91 "Project-Id-Version: PACKAGE VERSION\n"
92 "Report-Msgid-Bugs-To: \n"
93-"POT-Creation-Date: 2010-12-14 15:14-0500\n"
94+"POT-Creation-Date: 2011-02-13 23:30+0900\n"
95 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
96 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
97 "Language-Team: LANGUAGE <LL@li.org>\n"

Subscribers

People subscribed via source and target branches