mirror of
https://github.com/skoelle/icloud-contacts-sync.git
synced 2026-09-18 07:50:25 +00:00
Compare commits
2
Commits
debaf7dd62
...
4c743036d5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c743036d5 | ||
|
|
619ea84c5f |
@@ -536,6 +536,7 @@ def web_search_special(
|
|||||||
"no_photo": db.search_contacts_without_photo,
|
"no_photo": db.search_contacts_without_photo,
|
||||||
"no_city": db.search_contacts_without_city,
|
"no_city": db.search_contacts_without_city,
|
||||||
"no_social": db.search_contacts_without_social,
|
"no_social": db.search_contacts_without_social,
|
||||||
|
"last_updated": db.search_contacts_last_updated,
|
||||||
}.get(type)
|
}.get(type)
|
||||||
|
|
||||||
if not query_fn:
|
if not query_fn:
|
||||||
@@ -545,6 +546,7 @@ def web_search_special(
|
|||||||
"no_photo": "Kontakte ohne Bild",
|
"no_photo": "Kontakte ohne Bild",
|
||||||
"no_city": "Kontakte ohne Stadt",
|
"no_city": "Kontakte ohne Stadt",
|
||||||
"no_social": "Kontakte ohne Social Profil",
|
"no_social": "Kontakte ohne Social Profil",
|
||||||
|
"last_updated": "Zuletzt aktualisiert",
|
||||||
}
|
}
|
||||||
|
|
||||||
with db.get_connection() as conn:
|
with db.get_connection() as conn:
|
||||||
|
|||||||
@@ -92,5 +92,6 @@
|
|||||||
<a href="/search/special?type=no_photo" class="special-search-link">ohne Bild</a>
|
<a href="/search/special?type=no_photo" class="special-search-link">ohne Bild</a>
|
||||||
<a href="/search/special?type=no_city" class="special-search-link">ohne City</a>
|
<a href="/search/special?type=no_city" class="special-search-link">ohne City</a>
|
||||||
<a href="/search/special?type=no_social" class="special-search-link">ohne Social</a>
|
<a href="/search/special?type=no_social" class="special-search-link">ohne Social</a>
|
||||||
|
<a href="/search/special?type=last_updated" class="special-search-link">last updated</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -232,6 +232,24 @@ def search_contacts_without_social(conn, account: str | None) -> list[dict]:
|
|||||||
return cur.fetchall()
|
return cur.fetchall()
|
||||||
|
|
||||||
|
|
||||||
|
def search_contacts_last_updated(conn, account: str | None) -> list[dict]:
|
||||||
|
where_clause, params = _account_filter_clause(account)
|
||||||
|
op = "AND" if where_clause else "WHERE"
|
||||||
|
with conn.cursor() as cur:
|
||||||
|
cur.execute(
|
||||||
|
f"""SELECT id, full_name, given_name, middle_name, family_name,
|
||||||
|
prefix, suffix, organization, birthday, account, photo_url
|
||||||
|
FROM contacts {where_clause}
|
||||||
|
{op} given_name IS NOT NULL AND given_name != ''
|
||||||
|
AND family_name IS NOT NULL AND family_name != ''
|
||||||
|
AND family_name != 'X'
|
||||||
|
ORDER BY updated_at DESC
|
||||||
|
LIMIT 200""",
|
||||||
|
params,
|
||||||
|
)
|
||||||
|
return cur.fetchall()
|
||||||
|
|
||||||
|
|
||||||
def get_most_common_birthday(conn) -> date | None:
|
def get_most_common_birthday(conn) -> date | None:
|
||||||
with conn.cursor() as cur:
|
with conn.cursor() as cur:
|
||||||
cur.execute(
|
cur.execute(
|
||||||
|
|||||||
@@ -107,6 +107,23 @@ def main():
|
|||||||
last_sync = datetime.now(Config.TIMEZONE)
|
last_sync = datetime.now(Config.TIMEZONE)
|
||||||
next_mailer = next_run_time(MAIL_SEND_HOUR)
|
next_mailer = next_run_time(MAIL_SEND_HOUR)
|
||||||
|
|
||||||
|
if MAILER_ENABLED:
|
||||||
|
try:
|
||||||
|
today = datetime.now(Config.TIMEZONE).date()
|
||||||
|
with db.get_connection() as conn:
|
||||||
|
with conn.cursor() as cur:
|
||||||
|
cur.execute(
|
||||||
|
"SELECT 1 FROM birthday_mail_log WHERE sent_date = %s LIMIT 1",
|
||||||
|
(today,),
|
||||||
|
)
|
||||||
|
already_sent = cur.fetchone() is not None
|
||||||
|
if not already_sent and next_mailer.date() > today:
|
||||||
|
logger.info("Mailer fuer heute noch nicht gesendet — hole nach")
|
||||||
|
run_mailer()
|
||||||
|
next_mailer = next_run_time(MAIL_SEND_HOUR)
|
||||||
|
except Exception:
|
||||||
|
logger.exception("Pruefung/Nachholen des Mailers fehlgeschlagen")
|
||||||
|
|
||||||
while not _shutdown:
|
while not _shutdown:
|
||||||
now = datetime.now(Config.TIMEZONE)
|
now = datetime.now(Config.TIMEZONE)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user