Here's an updated patch for the end-of-month bug that I reported earlier. This patch is against SVN and is slightly cleaner, because it doesn't need to special case for the end of the month situation. I simply use the datetime module to get the next day for the enddate using the timedelta(1) call:
Code:
Index: default.py
===================================================================
--- default.py (revision 128)
+++ default.py (working copy)
@@ -626,7 +626,10 @@
elif self.args.period=="date":
#BUG CONNU : trouver un moyen de trouver le jour suivant en prenant en compte le nb de jours par mois
a,m,j=self.args.value.split("-")
- filelist = MPDB.search_between_dates( ("%s-%s-%s"%(a,m,j),format) , ( "%s-%s-%s"%(a,m,int(j)+1),format) )
+ import datetime
+ enddate = datetime.date(int(a), int(m), int(j)) + datetime.timedelta(1)
+ #filelist = MPDB.search_between_dates( ("%s-%s-%s"%(a,m,j),format) , ( "%s-%s-%s"%(a,m,int(j)+1),format) )
+ filelist = MPDB.search_between_dates( ("%s-%s-%s"%(a,m,j),format) , ( enddate.isoformat(),format) )
elif self.args.period=="period":
picfanart = os.path.join(PIC_PATH,"fanart-period.png")
Index: resources/lib/MypicsDB.py
===================================================================
--- resources/lib/MypicsDB.py (revision 128)
+++ resources/lib/MypicsDB.py (working copy)
@@ -975,8 +975,11 @@
elif period=="date":
#BUG CONNU : trouver un moyen de trouver le jour suivant en prenant en compte le nb de jours par mois
- a,m,j=value.split("-")
- filelist = search_between_dates( ("%s-%s-%s"%(a,m,j),format) , ( "%s-%s-%s"%(a,m,int(j)+1),format) )
+ a,m,j=value.split("-")
+ import datetime
+ enddate = datetime.date(int(a), int(m), int(j)) + datetime.timedelta(1)
+ #filelist = search_between_dates( ("%s-%s-%s"%(a,m,j),format) , ( "%s-%s-%s"%(a,m,int(j)+1),format) )
+ filelist = search_between_dates( ("%s-%s-%s"%(a,m,j),format) , ( enddate.isoformat(),format) )
else:
#pas de periode, alors toutes les photos du 01/01 de la plus petite année, au 31/12 de la plus grande année
I understand that this may be superceded by a better solution for getting dates, but meanwhile this fixes the existing code in a slightly cleaner way than my previous patch.