Skip to content

Commit

Permalink
🗃 Creates function to manually remove oldest percentage of shows to r…
Browse files Browse the repository at this point in the history
…efresh db
  • Loading branch information
skadogg committed Feb 25, 2024
1 parent 67dd4f3 commit 71831d4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modules/justwatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,3 +401,15 @@ def remove_manually_by_url(url):
j -= 1
break
modules.data_bin_convert.data_to_bin(show_db, './my_data/saved_data.bin')


def remove_manually_by_percentage(pct):
# Remove oldest pct% of shows from db
logging.info(f"Removing from db: {pct=}")
show_db = modules.data_bin_convert.bin_to_data('./my_data/saved_data.bin')

num_shows = len(show_db)
num_to_remove = int(num_shows * (pct / 100))
show_db = show_db[num_to_remove:num_shows]

modules.data_bin_convert.data_to_bin(show_db, './my_data/saved_data.bin')
1 change: 1 addition & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

# Manually remove shows
# modules.justwatch.remove_manually_by_url('https://www.justwatch.com/us/tv-show/great-news')
# modules.justwatch.remove_manually_by_percentage(1)

# Clean up shows already seen
modules.justwatch.remove_already_seen('https://www.justwatch.com/us/lists/my-lists?inner_tab=seenlist')
Expand Down

0 comments on commit 71831d4

Please sign in to comment.