![]() |
#1 |
Enthusiast
![]() Posts: 40
Karma: 10
Join Date: Oct 2012
Device: Pocket Book Touch HD3
|
News management: delete older than xxx on cli
Hi,
I am running a calibre server for news only on a hosted vserver. That's why I manage everything by using the cli. I can load news via ebook-convert, I can update meta data via ebook-meta and I can add news to calibre via calibredb. I created some simple scripts to do the job daily, weekly, every fortnight and monthly by cronjobs. But I didn't find an option to automatically delete news in the same way as it is possible in the GUI: "delete news older than xxx". So here is my question: Can I delete news epubs form the calibre db by script in the way described above, and if so, how? Greets, Sebastian |
![]() |
![]() |
![]() |
#2 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,257
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
calibredb remove
|
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Enthusiast
![]() Posts: 40
Karma: 10
Join Date: Oct 2012
Device: Pocket Book Touch HD3
|
Well, yes.
But how do I write a script that reads the IDs of the epubs I want to delete? |
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,257
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
calibredb list --fields timestamp,authors
|
![]() |
![]() |
![]() |
#5 |
Enthusiast
![]() Posts: 40
Karma: 10
Join Date: Oct 2012
Device: Pocket Book Touch HD3
|
Thank you Kovid for your quick answers. I will give it another try.
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,257
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Just for completeness:
Code:
calibredb list --search 'date:<60daysago and authors:=calibre and tags:News' Last edited by kovidgoyal; 10-03-2012 at 03:08 AM. |
![]() |
![]() |
![]() |
#7 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,257
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
And
Code:
calibredb list --search 'date:<1daysago and tags:news and authors:=calibre' | cut -f1 -d" " | tail -n+2 |
![]() |
![]() |
![]() |
#8 | |
Enthusiast
![]() Posts: 40
Karma: 10
Join Date: Oct 2012
Device: Pocket Book Touch HD3
|
Hello Kovid,
thanks again for this quick responses. I'm really impressed. I tried to execute your code but generated the following error: Quote:
OS is Debian Squeeze, Python is: Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40) [GCC 4.4.5] on linux2 Greets, Sebastian |
|
![]() |
![]() |
![]() |
#9 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,257
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You need to use the correct localized version of daysago for whatever language you have set on your system.
|
![]() |
![]() |
![]() |
#10 | ||
Enthusiast
![]() Posts: 40
Karma: 10
Join Date: Oct 2012
Device: Pocket Book Touch HD3
|
Quote:
$ locale gives me a complete german utf8 environment. Quote:
|
||
![]() |
![]() |
![]() |
#11 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,381
Karma: 78877538
Join Date: Nov 2007
Location: Toronto
Device: Libra H2O, Libra Colour
|
When I look in the calibre source tree, there is a file src\calibre\translations\de.po (http://bazaar.launchpad.net/~kovid/c...slations/de.po)
Within it I see Code:
msgid "daysago" msgstr "vor Tagen" Code:
calibredb list --search 'date:<1vor tagen and tags:news and authors:=calibre' | cut -f1 -d" " | tail -n+2 |
![]() |
![]() |
![]() |
#12 |
Linux User
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,282
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
|
That would be kind of strange, and in that case I'd just run this command with LANG=C
Edit: Which doesn't work either because it's a language setting in Calibre. Last edited by frostschutz; 10-04-2012 at 08:59 AM. |
![]() |
![]() |
![]() |
#13 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,257
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
CALIBRE_OVERRIDE_LANG=en calibredb ...
|
![]() |
![]() |
![]() |
#14 |
Linux User
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,282
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
|
Ah, nice.
Reading into the source code, it also accepts _daysago instead of daysago regardless of language. EDIT: I take it back, _daysago only works when it's not English? I don't get it. EDIT2: ah, it's because _daysago ends with daysago ... horror Search filters should stay untranslated I think, it's not like you replace "and" with "und" either. And it's not easy to guess what the translation could be. Last edited by frostschutz; 10-04-2012 at 09:08 AM. |
![]() |
![]() |
![]() |
#15 | ||
Enthusiast
![]() Posts: 40
Karma: 10
Join Date: Oct 2012
Device: Pocket Book Touch HD3
|
Sorry, but error persists:
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
Tags |
news delete cli |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Is there a way to delete old news from the device when downloading new news? | mwheinz | Library Management | 2 | 01-16-2012 12:15 PM |
Start all scheduled news downloads using CLI | Zillion | Calibre | 2 | 07-19-2011 11:21 AM |
Delete news older than | Stingo | Calibre | 2 | 12-25-2010 05:13 AM |
folder management & delete source file after conversion | Taantric | Calibre | 1 | 12-16-2008 01:10 AM |