aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Command/ImportFeed.hs9
-rw-r--r--debian/changelog7
-rw-r--r--debian/control2
-rw-r--r--doc/git-annex.mdwn2
-rw-r--r--doc/tips/downloading_podcasts.mdwn3
-rw-r--r--doc/todo/make___34__itemdate__34___valid_importfeed_template_option.mdwn3
-rw-r--r--git-annex.cabal2
7 files changed, 24 insertions, 4 deletions
diff --git a/Command/ImportFeed.hs b/Command/ImportFeed.hs
index 50f4278b6..3f629af6e 100644
--- a/Command/ImportFeed.hs
+++ b/Command/ImportFeed.hs
@@ -15,6 +15,8 @@ import Text.Feed.Types
import qualified Data.Set as S
import qualified Data.Map as M
import Data.Time.Clock
+import Data.Time.Format
+import System.Locale
import Common.Annex
import qualified Annex
@@ -212,6 +214,7 @@ feedFile tmpl i extension = Utility.Format.format tmpl $ M.fromList
, fieldMaybe "itemdescription" $ getItemDescription $ item i
, fieldMaybe "itemrights" $ getItemRights $ item i
, fieldMaybe "itemid" $ snd <$> getItemId (item i)
+ , fieldMaybe "itempubdate" $ pubdate $ item i
, ("extension", sanitizeFilePath extension)
]
where
@@ -221,6 +224,12 @@ feedFile tmpl i extension = Utility.Format.format tmpl $ M.fromList
fieldMaybe k Nothing = (k, "none")
fieldMaybe k (Just v) = field k v
+ pubdate itm = case getItemPublishDate itm :: Maybe (Maybe UTCTime) of
+ Just (Just d) -> Just $
+ formatTime defaultTimeLocale "%F" d
+ -- if date cannot be parsed, use the raw string
+ _ -> replace "/" "-" <$> getItemPublishDateString itm
+
{- Called when there is a problem with a feed.
- Throws an error if the feed is broken, otherwise shows a warning. -}
feedProblem :: URLString -> String -> Annex ()
diff --git a/debian/changelog b/debian/changelog
index 3d316fc7b..996f0ef04 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+git-annex (5.20140406) UNRELEASED; urgency=medium
+
+ * importfeed: Filename template can now contain an itempubdate variable.
+ Needs feed 0.3.9.2.
+
+ -- Joey Hess <joeyh@debian.org> Mon, 07 Apr 2014 16:22:02 -0400
+
git-annex (5.20140405) unstable; urgency=medium
* git-annex-shell: Added notifychanges command.
diff --git a/debian/control b/debian/control
index dd7eaa848..1a2aaed70 100644
--- a/debian/control
+++ b/debian/control
@@ -55,7 +55,7 @@ Build-Depends:
libghc-xml-types-dev,
libghc-async-dev,
libghc-http-dev,
- libghc-feed-dev,
+ libghc-feed-dev (>= 0.3.9.2),
libghc-regex-tdfa-dev [!mipsel !s390],
libghc-regex-compat-dev [mipsel s390],
libghc-tasty-dev (>= 0.7) [!mipsel !sparc],
diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn
index 2d43953af..03e05d934 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -268,7 +268,7 @@ subdirectories).
Use `--template` to control where the files are stored.
The default template is '${feedtitle}/${itemtitle}${extension}'
- (Other available variables: feedauthor, itemauthor, itemsummary, itemdescription, itemrights, itemid)
+ (Other available variables: feedauthor, itemauthor, itemsummary, itemdescription, itemrights, itemid, itempubdate)
The `--relaxed` and `--fast` options behave the same as they do in addurl.
diff --git a/doc/tips/downloading_podcasts.mdwn b/doc/tips/downloading_podcasts.mdwn
index d412a73bf..876d8d4e1 100644
--- a/doc/tips/downloading_podcasts.mdwn
+++ b/doc/tips/downloading_podcasts.mdwn
@@ -23,7 +23,8 @@ there's a --template option. The default is
`--template='${feedtitle}/${itemtitle}${extension}'`
Other available template variables:
-feedauthor, itemauthor, itemsummary, itemdescription, itemrights, itemid
+feedauthor, itemauthor, itemsummary, itemdescription, itemrights, itemid,
+itempubdate
## catching up
diff --git a/doc/todo/make___34__itemdate__34___valid_importfeed_template_option.mdwn b/doc/todo/make___34__itemdate__34___valid_importfeed_template_option.mdwn
index 31978a7b6..9b6f6ce7c 100644
--- a/doc/todo/make___34__itemdate__34___valid_importfeed_template_option.mdwn
+++ b/doc/todo/make___34__itemdate__34___valid_importfeed_template_option.mdwn
@@ -13,3 +13,6 @@ or
that "works" but is ugly :)
Would love to be able to put a YYYYMMDD at the beginning and then the title.
+
+> [[done]]; itempubdate will use form YYYY-MM-DD (or the raw date string
+> if the feed does not use a parsable form). --[[Joey]]
diff --git a/git-annex.cabal b/git-annex.cabal
index a91540bbf..59b7b3a59 100644
--- a/git-annex.cabal
+++ b/git-annex.cabal
@@ -210,7 +210,7 @@ Executable git-annex
CPP-Options: -DWITH_DNS
if flag(Feed)
- Build-Depends: feed
+ Build-Depends: feed (>= 0.3.9.2)
CPP-Options: -DWITH_FEED
if flag(Quvi)