diff options
Diffstat (limited to 'apps/links/utils.py')
-rw-r--r-- | apps/links/utils.py | 49 |
1 files changed, 4 insertions, 45 deletions
diff --git a/apps/links/utils.py b/apps/links/utils.py index 9acbd52..9e5aea5 100644 --- a/apps/links/utils.py +++ b/apps/links/utils.py @@ -70,9 +70,9 @@ def sync_magnolia_links(*args, **kwargs): break def sync_delicious_links(*args, **kwargs): - b = delicious.get(settings.DELICIOUS_USER, settings.DELICIOUS_PASS) + b = delicious.get_all(settings.DELICIOUS_USER, settings.DELICIOUS_PASS) dupe = False - for post in b['posts']: + for post in b: taglist = [] try: row = Link.objects.get(magnolia_id=safestr(post['hash'])) @@ -91,7 +91,7 @@ def sync_delicious_links(*args, **kwargs): break else: status = 0 - descr = markdown.markdown(unquotehtml(safestr(post['extended'])), safe_mode = False) + descr = markdown.markdown(unquotehtml(safestr(post['extended'])), safe_mode = False) l, created = Link.objects.get_or_create( title = post['description'], magnolia_id = safestr(post['hash']), @@ -115,48 +115,7 @@ def sync_delicious_links(*args, **kwargs): break - - """ - b, created = Link.objects.get_or_create( - url = info['href'], - description = info['extended'], - tags = info.get('tag', ''), - date = parsedate(info['time']), - title = info['description'] - ) - for b in bookmarks.bookmarks.bookmark: - - try: - row = Link.objects.get(magnolia_id=safestr(b.id)) - # If the row exists already, set the dupe flag - print b.title.PCDATA - dupe = True - except ObjectDoesNotExist: - tags=", ".join(t.name for t in b.tags.tag if t.name != "2lux") - # grab the photo (local copies are good, should I ever change bookmark services) - local_image_url = "%s/%s.jpg" %(safestr(datetime.datetime.today().strftime("%b").lower()), safestr(b.id)) - f = copy_file(safestr(b.screenshot.PCDATA), safestr(b.id)) - # set the privacy flag (default to false to be on the safe side) - public = 0 - if safestr(b.private) == 'false': public=1 - # Create and save a new link obj - l = Link.objects.create( - title = safestr(b.title.PCDATA), - magnolia_id = safestr(b.id), - url = safestr(b.url.PCDATA), - description = unquotehtml(safestr(b.description.PCDATA)), - screen_url = local_image_url, - rating = safestr(b.rating), - pub_date = datetime.datetime(*(time.strptime(str(b.created[:-6]), '%Y-%m-%dT%H:%M:%S')[0:6])), - status = public, - enable_comments = True, - - ) - email_link(l) - send_to_delicious(l) - if (dupe): - break - """ + def email_link(link): |