diff --git a/translations/ar.json b/translations/ar.json index 83d909f8d..25c17ae61 100644 --- a/translations/ar.json +++ b/translations/ar.json @@ -210,5 +210,6 @@ "Remove Twitter posts": "إزالة مشاركات Twitter", "Sensitive": "حساس", "Word Replacements": "استبدال الكلمات", - "Happening Today": "يحدث اليوم" + "Happening Today": "يحدث اليوم", + "Happening This Week": "يحدث هذا الاسبوع" } diff --git a/translations/ca.json b/translations/ca.json index c41a76435..502b13ffb 100644 --- a/translations/ca.json +++ b/translations/ca.json @@ -210,5 +210,6 @@ "Remove Twitter posts": "Elimina les publicacions de Twitter", "Sensitive": "Sensible", "Word Replacements": "Substitucions de paraula", - "Happening Today": "Passant avui" + "Happening Today": "Passant avui", + "Happening This Week": "Passa aquesta setmana" } diff --git a/translations/cy.json b/translations/cy.json index 7d492fd8b..cdc3c40ee 100644 --- a/translations/cy.json +++ b/translations/cy.json @@ -210,5 +210,6 @@ "Remove Twitter posts": "Dileu postiadau Twitter", "Sensitive": "Sensitif", "Word Replacements": "Amnewidiadau Geiriau", - "Happening Today": "Digwydd Heddiw" + "Happening Today": "Digwydd Heddiw", + "Happening This Week": "Yn Digwydd Yr Wythnos Hon" } diff --git a/translations/de.json b/translations/de.json index 792a8eabc..554594edd 100644 --- a/translations/de.json +++ b/translations/de.json @@ -210,5 +210,6 @@ "Remove Twitter posts": "Entfernen Sie Twitter-Posts", "Sensitive": "Empfindlich", "Word Replacements": "Wortersetzungen", - "Happening Today": "Heute passiert" + "Happening Today": "Heute passiert", + "Happening This Week": "Diese Woche passiert" } diff --git a/translations/en.json b/translations/en.json index 863a4fd8f..029f6e5ae 100644 --- a/translations/en.json +++ b/translations/en.json @@ -210,5 +210,6 @@ "Remove Twitter posts": "Remove Twitter posts", "Sensitive": "Sensitive", "Word Replacements": "Word Replacements", - "Happening Today": "Happening Today" + "Happening Today": "Happening Today", + "Happening This Week": "Happening This Week" } diff --git a/translations/es.json b/translations/es.json index e936d6c82..bcb68b6e0 100644 --- a/translations/es.json +++ b/translations/es.json @@ -210,5 +210,6 @@ "Remove Twitter posts": "Eliminar publicaciones de Twitter", "Sensitive": "Sensible", "Word Replacements": "Reemplazos de palabras", - "Happening Today": "Sucediendo hoy" + "Happening Today": "Sucediendo hoy", + "Happening This Week": "Sucediendo esta semana" } diff --git a/translations/fr.json b/translations/fr.json index bf25dd4e1..7605cbd6e 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -210,5 +210,6 @@ "Remove Twitter posts": "Supprimer les messages Twitter", "Sensitive": "Sensible", "Word Replacements": "Remplacements de mots", - "Happening Today": "Se passe aujourd'hui" + "Happening Today": "Se passe aujourd'hui", + "Happening This Week": "Se passe cette semaine" } diff --git a/translations/ga.json b/translations/ga.json index e3da6d270..f1bc80b2e 100644 --- a/translations/ga.json +++ b/translations/ga.json @@ -210,5 +210,6 @@ "Remove Twitter posts": "Bain poist Twitter", "Sensitive": "Íogair", "Word Replacements": "Athchur Focal", - "Happening Today": "Ag tarlú inniu" + "Happening Today": "Ag tarlú inniu", + "Happening This Week": "Ag tarlú an tseachtain seo" } diff --git a/translations/hi.json b/translations/hi.json index 8fcef6bff..84537ccff 100644 --- a/translations/hi.json +++ b/translations/hi.json @@ -210,5 +210,6 @@ "Remove Twitter posts": "ट्विटर पोस्ट हटाएं", "Sensitive": "संवेदनशील", "Word Replacements": "शब्द प्रतिस्थापन", - "Happening Today": "आज हो रहा है" + "Happening Today": "आज हो रहा है", + "Happening This Week": "इस सप्ताह हो रहा है" } diff --git a/translations/it.json b/translations/it.json index 9b8bf7024..26d0c5d57 100644 --- a/translations/it.json +++ b/translations/it.json @@ -210,5 +210,6 @@ "Remove Twitter posts": "Rimuovi i post di Twitter", "Sensitive": "Sensibile", "Word Replacements": "Sostituzioni di parole", - "Happening Today": "Succede oggi" + "Happening Today": "Succede oggi", + "Happening This Week": "Succede questa settimana" } diff --git a/translations/ja.json b/translations/ja.json index 617cf782b..d44ae936c 100644 --- a/translations/ja.json +++ b/translations/ja.json @@ -210,5 +210,6 @@ "Remove Twitter posts": "Twitterの投稿を削除する", "Sensitive": "敏感", "Word Replacements": "単語の置換", - "Happening Today": "今日の出来事" + "Happening Today": "今日の出来事", + "Happening This Week": "今週の出来事" } diff --git a/translations/oc.json b/translations/oc.json index e22c79ed8..39b8dc9a2 100644 --- a/translations/oc.json +++ b/translations/oc.json @@ -206,5 +206,6 @@ "Remove Twitter posts": "Remove Twitter posts", "Sensitive": "Sensitive", "Word Replacements": "Word Replacements", - "Happening Today": "Happening Today" + "Happening Today": "Happening Today", + "Happening This Week": "Happening This Week" } diff --git a/translations/pt.json b/translations/pt.json index 0f97c66f2..6e3544c13 100644 --- a/translations/pt.json +++ b/translations/pt.json @@ -210,5 +210,6 @@ "Remove Twitter posts": "Remover postagens do Twitter", "Sensitive": "Sensível", "Word Replacements": "Substituições do Word", - "Happening Today": "Acontecendo hoje" + "Happening Today": "Acontecendo hoje", + "Happening This Week": "Acontecendo Esta Semana" } diff --git a/translations/ru.json b/translations/ru.json index 1f4aa3206..b3d389bb7 100644 --- a/translations/ru.json +++ b/translations/ru.json @@ -210,5 +210,6 @@ "Remove Twitter posts": "Удалить сообщения из Твиттера", "Sensitive": "чувствительный", "Word Replacements": "Замены слов", - "Happening Today": "Происходит сегодня" + "Happening Today": "Происходит сегодня", + "Happening This Week": "Происходит на этой неделе" } diff --git a/translations/zh.json b/translations/zh.json index 15fb923f9..6536148f4 100644 --- a/translations/zh.json +++ b/translations/zh.json @@ -210,5 +210,6 @@ "Remove Twitter posts": "删除Twitter帖子", "Sensitive": "敏感", "Word Replacements": "单词替换", - "Happening Today": "今天发生" + "Happening Today": "今天发生", + "Happening This Week": "本周发生" } diff --git a/webinterface.py b/webinterface.py index bca7ec595..ab96364b0 100644 --- a/webinterface.py +++ b/webinterface.py @@ -2969,6 +2969,11 @@ def htmlTimeline(defaultTimeline: str, \ str(now.year)+'?month='+str(now.month)+ \ '?day='+str(now.day)+'">' + if thisWeeksEventsCheck(baseDir,nickname,domain): + now=datetime.now() + tlStr+= \ + '
' # page up arrow if pageNumber>1: @@ -3809,6 +3814,54 @@ def todaysEventsCheck(baseDir: str,nickname: str,domain: str) -> bool: return eventsExist +def thisWeeksEventsCheck(baseDir: str,nickname: str,domain: str) -> bool: + """Are there calendar events this week? + """ + now=datetime.now() + year=now.year + monthNumber=now.month + dayNumber=now.day + + calendarFilename=baseDir+'/accounts/'+nickname+'@'+domain+'/calendar/'+str(year)+'/'+str(monthNumber)+'.txt' + if not os.path.isfile(calendarFilename): + return False + eventsExist=False + with open(calendarFilename,'r') as eventsFile: + for postId in eventsFile: + postId=postId.replace('\n','') + postFilename=locatePost(baseDir,nickname,domain,postId) + if postFilename: + postJsonObject=loadJson(postFilename) + if not postJsonObject: + continue + if not postJsonObject.get('object'): + continue + if not isinstance(postJsonObject['object'], dict): + continue + if not postJsonObject['object'].get('tag'): + continue + + for tag in postJsonObject['object']['tag']: + if not tag.get('type'): + continue + if tag['type']!='Event' and tag['type']!='Place': + continue + if tag['type']=='Event': + # tag is an event + if not tag.get('startTime'): + continue + eventTime= \ + datetime.strptime(tag['startTime'], \ + "%Y-%m-%dT%H:%M:%S%z") + if int(eventTime.strftime("%Y"))==year and \ + int(eventTime.strftime("%m"))==monthNumber and \ + (int(eventTime.strftime("%d"))>=dayNumber and \ + int(eventTime.strftime("%d"))<=dayNumber+6): + eventsExist=True + break + + return eventsExist + def getThisWeeksEvents(baseDir: str,nickname: str,domain: str) -> {}: """Retrieves calendar events for this week Returns a dictionary indexed by day number of lists containing Event and Place activities