Skip to content

Instantly share code, notes, and snippets.

@maforget
Created August 29, 2023 19:35
Show Gist options
  • Save maforget/744970dbdad47877e731a3d41d4190d7 to your computer and use it in GitHub Desktop.
Save maforget/744970dbdad47877e731a3d41d4190d7 to your computer and use it in GitHub Desktop.
UserScript SmartList - Returns the books added in the last (x) hours
from System import DateTime
#@Name Books Added the Last (x) Hours
#@Hook CreateBookList
#@PCount 1
#@Enabled false
#@Description Books Added the Last (x) Hours
def GetBooksWith (books, a, b):
newList = []
for book in books:
if (DateTime.Now - book.AddedTime).TotalHours <= int(a):
newList.append(book)
return newList
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment