Bug#723140: rss2email: Support paused feeds in r2e-migrate script

2013-09-17 Thread Etienne Millon
* W. Trevor King wk...@tremily.us [130917 08:12]:
 I haven't used the conversion script myself, but if you're using
 slugify(url) to generate feed names in add(), I'd recommend using
 the same feed name (and not the feed index) for pausing:
 
   def pause(url):
   return subprocess.call(['r2e', 'pause', slugify(url)])

 Then there is no need for enumerate(), and you don't run into errors
 if there are already feeds in the 3.x database when you run the
 conversion script (which would shift the index numbers).
 Feeds.index() allows you to index by name since ff650e8 (Cleanups to
 Feed and Feeds, 2012-10-04), which was well before 3.0.

Thanks a lot for the patch!

Feed names are indeed generated with slugify(url), which is the best
we can have while staying offline.

The index shifting that you describe can not happen as r2e-migrate
exits with an error if a 3.x database already exists.

These two points are of course open to ideas for improvement (and
patches).

I didn't know that it was possible to use the feed name for
run/delete/pause/unpause/reset, but it's indeed mentioned in the
manpage. I think it will make a simpler patch, so I'll apply the
simplified version and release this with version 3.6.

Cheers,

-- 
Etienne Millon


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#723140: rss2email: Support paused feeds in r2e-migrate script

2013-09-16 Thread Denis Laxalde
Package: rss2email
Version: 1:3.5-1~exp1
Severity: wishlist
Tags: patch

Hi,

The attached patch for r2e-migrate script adds support for paused
(inactive) feeds during migration. I found it quite useful not to have
to redefine this by hand afterwards.

Thanks for considering,
Denis.

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-4-686-pae (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages rss2email depends on:
ii  python2.7   2.7.5-7
ii  python3 3.3.2-15
ii  python3-feedparser  5.1.3-1
ii  python3-html2text   3.200.3-2

rss2email recommends no packages.

Versions of packages rss2email suggests:
pn  esmtp  none

-- no debconf information
From 34842fd614c9e861163ed8e5723a05430ae5b56d Mon Sep 17 00:00:00 2001
From: Denis Laxalde de...@laxalde.org
Date: Mon, 16 Sep 2013 21:15:09 +0200
Subject: [PATCH] Support paused (inactive) feeds in r2e-migrate

---
 debian/r2e-migrate | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/debian/r2e-migrate b/debian/r2e-migrate
index b5c14bb..b2e2697 100644
--- a/debian/r2e-migrate
+++ b/debian/r2e-migrate
@@ -66,6 +66,8 @@ def slugify(s):
 def add(url):
 return subprocess.call(['r2e', 'add', slugify(url), url])
 
+def pause(index):
+return subprocess.call(['r2e', 'pause', str(index)])
 
 def main():
 if new_db_exists():
@@ -88,10 +90,12 @@ def main():
 set_email(email)
 
 print 'Adding feeds:'
-for feed in feeds:
+for i, feed in enumerate(feeds):
 url = feed.url
 print url
 add(url)
+if not feed.active:
+pause(i)
 
 if __name__ == '__main__':
 main()
-- 
1.8.4.rc3



Bug#723140: rss2email: Support paused feeds in r2e-migrate script

2013-09-16 Thread W. Trevor King
On Mon, Sep 16, 2013 at 09:28:19PM +0200, Denis Laxalde wrote:
  def add(url):
  return subprocess.call(['r2e', 'add', slugify(url), url])
  
 +def pause(index):
 +return subprocess.call(['r2e', 'pause', str(index)])
  
  def main():
  if new_db_exists():
 @@ -88,10 +90,12 @@ def main():
  set_email(email)
  
  print 'Adding feeds:'
 -for feed in feeds:
 +for i, feed in enumerate(feeds):
  url = feed.url
  print url
  add(url)
 +if not feed.active:
 +pause(i)

I haven't used the conversion script myself, but if you're using
slugify(url) to generate feed names in add(), I'd recommend using the
same feed name (and not the feed index) for pausing:

  def pause(url):
  return subprocess.call(['r2e', 'pause', slugify(url)])

Then there is no need for enumerate(), and you don't run into errors
if there are already feeds in the 3.x database when you run the
conversion script (which would shift the index numbers).
Feeds.index() allows you to index by name since ff650e8 (Cleanups to
Feed and Feeds, 2012-10-04), which was well before 3.0.


signature.asc
Description: OpenPGP digital signature