Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Dev Branch #3

Merged
merged 5 commits into from
Mar 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@

# Important Disclaimer

The intention of this script is solely to automate downloading and converting of loaned OverDrive audiobooks, in order for use with your preferred audiobook player during the loan period.
The intention of this script is solely to automate downloading and converting of loaned OverDrive audiobooks, only
for personal use with your preferred audiobook player during the loan period.

# Features

Expand Down
9 changes: 4 additions & 5 deletions autobooks/AutoBooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@
sys.exit(1)

# Logging Config
LOG_FILENAME = os.path.join(
script_dir, 'log', 'AutoBooks-{:%H-%M-%S_%m-%d-%Y}.log'.format(datetime.now()))
LOG_PATH = os.path.join(script_dir, 'log')
LOG_FILENAME = os.path.join(LOG_PATH, "AutoBooks.log")
patterns = ['', '', '', '']
console_log_format = "{time:HH:mm:ss A} [{name}:{function}] {level}: {message}\n{exception}"
cronitor_log_format = "[{name}:{function}] {level}: {message}\n{exception}"
file_log_format = "{time:HH:mm:ss A} [{name}:{function}] {level}: {extra[scrubbed]}\n{exception}"
redacting_formatter = RedactingFormatter(patterns=patterns, source_fmt=file_log_format)
logger.configure(handlers=[
{'sink': sys.stderr, "format": console_log_format},
{'sink': LOG_FILENAME, "format": redacting_formatter.format},
# {'sink': process_logfile(), "format": cronitor_log_format}
{'sink': LOG_FILENAME,
"format": redacting_formatter.format, "retention": 10, "rotation": "1 day"},
])
odmpy.logger.handlers.clear()
odmpy.logger.addHandler(InterceptHandler())
Expand All @@ -70,7 +70,6 @@
# Cronitor Setup https://cronitor.io/
cronitor.api_key = parser.get("DEFAULT", "cronitor_apikey")
monitor = cronitor.Monitor(parser.get("DEFAULT", "cronitor_name_main"))
web_monitor = cronitor.Monitor(parser.get("DEFAULT", "cronitor_name_web"))


# Function to process the books.
Expand Down
2 changes: 1 addition & 1 deletion autobooks/DiscordBot.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async def on_ready():


@bot.command(name='web')
async def hello(ctx):
async def web(ctx):
# Send starting embed and running web
embed_start = discord.Embed(title="Running AutoBooks Web. This may take awhile....",
description=f"V.{version} \n Logfile: {LOG_FILENAME}", color=0xFFAFCC)
Expand Down
35 changes: 24 additions & 11 deletions autobooks_template.conf
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
[DEFAULT]
cronitor_name_main = AutoBooks
cronitor_name_web = AutoBooksWeb
cronitor_apikey =
discord_bot_token =
test_args = false
test_run = false
web_headless = true
odm_folder =
#Name of monitor to use for Cronitor(Optional)
cronitor_apikey =
#API key to access Cronitor(Optional)
discord_bot_token =
#Discord Bot Token(Optional)
test_args = False
#Debugging setting to use different args for odmpy(Leave False)
test_run = False
#Debugging setting to enable an extra run command(Leave False)
web_headless = True
#Picks whether to run chrome in headless mode. Required for ssh support without X11 forwarding. (True/False)
odm_folder =
#Folder where the .odm files are located.
out_folder =
#Folder where m4b files will be moved to.

#To add more libraries just make a copy of the below section and increment the number.
[library_0]
library_name =
library_name =
#Name for library, used in log messages
library_subdomain =
library_select = false
card_number =
card_pin =
#Overdrive subdomain Ex: "examplepage" from "https://examplepage.overdrive.com/"
library_select = False
#Library select box contents here. If not used for sign in put "False" Ex: "Example County Library"
card_number =
#Library card number here.
card_pin =
#Library card pin here. If not used for sign in put "False"
22 changes: 1 addition & 21 deletions setup.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# AutoBooks

Python tool to automate processing a batch of OverDrive audiobooks.
Python tools to automate processing a batch of OverDrive audiobooks.

# Important Disclaimer

Expand Down Expand Up @@ -58,24 +58,4 @@ To uninstall AutoBooks run the following command.
- macOS(GUI) Terminal: `open -a TextEdit ~/AutoBooks/autobooks.conf`
- Linux or macOS(CLI): `nano ~/AutoBooks/autobooks.conf`

### Config Options
```
[DEFAULT]
cronitor_name_main = AutoBooks #Name of monitor to use for Cronitor in the processing function
cronitor_name_web = AutoBooksWeb #Name of monitor to use for Cronitor in the web function.
cronitor_apikey = #Apikey for Cronitor to send monitoring data.
discord_bot_token = #Optional for using the discord bot functionality.
test_args = false #Picks args for odmpy, true disables merging into m4b files
test_run = false #Picks whether to enable a function call used for testing. Do not use with the autobooks-web command.
web_headless = true #Pickks whether to run chrome in headless mode. Required for ssh support without X11 forwarding.
odm_folder = #Folder where your .odm files are located.
out_folder = #Folder where m4b files will be moved to.

#To add more libraries just make a copy of the below section and increment the number.
[library_0]
library_page = #Overdrive subdomain of your library. Ex: "examplepage" from "https://examplepage.overdrive.com/"
library_select = false #Library select box contents here. If not used for sign in put "false" Ex: "Example County Library"
card_number = #Library card number here
card_pin = #Library card pin here. If not used for sign in put "false"
```