Skip to content

Commit f9c00cf

Browse files
committed
redditadd: add force option to update selectively
1 parent f6b0631 commit f9c00cf

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

library/createdb/reddit_add.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ def reddit_add(args=None) -> None:
313313
log.error(f"[{path}]: Skipping unknown URL")
314314
continue
315315

316-
if db_playlists.get_id(args, path) is None:
316+
if db_playlists.get_id(args, path) is None or args.force:
317317
try:
318318
if extractor_key == "reddit_praw_redditor":
319319
redditor_new(args, {"path": path, "name": name})

library/mediadb/download.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,14 @@ def download(args=None) -> None:
146146
strings.duration(consts.now() - d["time_deleted"]),
147147
)
148148
continue
149-
elif d["time_modified"] > int(previous_time_attempted):
149+
elif d.get("time_modified") and d["time_modified"] > int(previous_time_attempted):
150150
log.info(
151151
"[%s]: Download already attempted %s ago. Skipping!",
152152
m["path"],
153153
strings.duration(consts.now() - d["time_modified"]),
154154
)
155155
continue
156-
elif d["download_attempts"] and d["download_attempts"] > args.download_retries:
156+
elif d.get("download_attempts") and d["download_attempts"] > args.download_retries:
157157
log.info(
158158
"[%s]: Download attempts exceed download retries limit. Skipping!",
159159
m["path"],

library/playback/play_actions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ def process_playqueue(args) -> None:
346346
media = db_media.get_playlist_media(args, args.playlists)
347347
else:
348348
media = list(args.db.query(query, bindings))
349+
log.debug("len(media_sql) = %s", len(media))
349350
log.debug("query: %s", t.elapsed())
350351

351352
if args.fetch_siblings:

library/playback/torrents_info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,8 @@ def torrents_info():
112112
"seen_complete": strings.relative_datetime(t.seen_complete) if t.seen_complete > 0 else None,
113113
"last_activity": strings.relative_datetime(t.last_activity),
114114
"time_active": strings.duration(t.time_active),
115-
"num_seeds": f"{t.num_complete} ({t.num_seeds})",
116-
# 'num_leechs': f"{t.num_incomplete} ({t.num_leechs})",
115+
"num_seeds": f"{t.num_seeds} ({t.num_complete})",
116+
# 'num_leechs': f"{t.num_leechs} ({t.num_incomplete})",
117117
# 'comment': t.comment,
118118
}
119119
for t in torrents

library/readme.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
4646
<img align="right" width="300" height="600" src="https://raw.githubusercontent.com/chapmanjacobd/library/main/.github/examples/art.avif" />
4747
48-
[![Downloads](https://static.pepy.tech/badge/xklb)](https://pepy.tech/project/xklb)
48+
[![Downloads](https://static.pepy.tech/badge/library)](https://pepy.tech/project/library)
4949
5050
## Install
5151

0 commit comments

Comments
 (0)