Put database within data dir
Some checks are pending
Create and publish a Docker image / build-and-push-image (push) Waiting to run
Some checks are pending
Create and publish a Docker image / build-and-push-image (push) Waiting to run
This commit is contained in:
parent
4a1a69e76f
commit
e5ede625b3
@ -20,7 +20,7 @@ class NewAccount(commands.Cog):
|
|||||||
async def newaccount(self, interaction: discord.Interaction) -> None:
|
async def newaccount(self, interaction: discord.Interaction) -> None:
|
||||||
"""Create a new temporary Jellyfin account"""
|
"""Create a new temporary Jellyfin account"""
|
||||||
# Make sure the user doesn't already have an account
|
# Make sure the user doesn't already have an account
|
||||||
db = sqlite3.connect("cordarr.db")
|
db = sqlite3.connect("data/cordarr.db")
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"SELECT * FROM jellyfin_accounts WHERE user_id = ?",
|
"SELECT * FROM jellyfin_accounts WHERE user_id = ?",
|
||||||
|
@ -19,7 +19,7 @@ class Status(commands.Cog):
|
|||||||
@app_commands.command()
|
@app_commands.command()
|
||||||
async def status(self, interaction: discord.Interaction) -> None:
|
async def status(self, interaction: discord.Interaction) -> None:
|
||||||
"""Get the status of the movies you have requested"""
|
"""Get the status of the movies you have requested"""
|
||||||
db = sqlite3.connect("cordarr.db")
|
db = sqlite3.connect("data/cordarr.db")
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"SELECT title, release_year, local_id, tmdbid, tvdbid FROM"
|
"SELECT title, release_year, local_id, tmdbid, tvdbid FROM"
|
||||||
@ -183,7 +183,7 @@ class Status(commands.Cog):
|
|||||||
# If the movie has a file, then it has finished downloading
|
# If the movie has a file, then it has finished downloading
|
||||||
if data.get("hasFile", True):
|
if data.get("hasFile", True):
|
||||||
# Remove from database
|
# Remove from database
|
||||||
db = sqlite3.connect("cordarr.db")
|
db = sqlite3.connect("data/cordarr.db")
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"DELETE FROM requests WHERE user_id = ? AND"
|
"DELETE FROM requests WHERE user_id = ? AND"
|
||||||
|
@ -153,7 +153,9 @@ def database_setup() -> None:
|
|||||||
"""
|
"""
|
||||||
Create the database if it does not exist
|
Create the database if it does not exist
|
||||||
"""
|
"""
|
||||||
db = sqlite3.connect("cordarr.db")
|
if not os.path.exists("data"):
|
||||||
|
os.makedirs("data")
|
||||||
|
db = sqlite3.connect("data/cordarr.db")
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"CREATE TABLE IF NOT EXISTS requests (title TEXT, release_year TEXT,"
|
"CREATE TABLE IF NOT EXISTS requests (title TEXT, release_year TEXT,"
|
||||||
|
@ -161,7 +161,7 @@ class RequestButtonView(discord.ui.View):
|
|||||||
return await interaction.response.send_message(embed=embed)
|
return await interaction.response.send_message(embed=embed)
|
||||||
|
|
||||||
# Keep track of the requests for the `/status` command
|
# Keep track of the requests for the `/status` command
|
||||||
db = sqlite3.connect("cordarr.db")
|
db = sqlite3.connect("data/cordarr.db")
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"INSERT INTO requests (title, release_year, local_id, tmdbid,"
|
"INSERT INTO requests (title, release_year, local_id, tmdbid,"
|
||||||
|
@ -67,7 +67,7 @@ def create_jellyfin_account(user_id):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
# Add the information to the database
|
# Add the information to the database
|
||||||
db = sqlite3.connect("cordarr.db")
|
db = sqlite3.connect("data/cordarr.db")
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"INSERT INTO jellyfin_accounts (user_id, jellyfin_user_id,"
|
"INSERT INTO jellyfin_accounts (user_id, jellyfin_user_id,"
|
||||||
|
@ -10,7 +10,7 @@ def delete_accounts():
|
|||||||
Delete Jellyfin accounts that have passed their deletion time
|
Delete Jellyfin accounts that have passed their deletion time
|
||||||
"""
|
"""
|
||||||
# Get all expired Jellyfin accounts
|
# Get all expired Jellyfin accounts
|
||||||
db = sqlite3.connect("cordarr.db")
|
db = sqlite3.connect("data/cordarr.db")
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"SELECT jellyfin_user_id FROM jellyfin_accounts WHERE"
|
"SELECT jellyfin_user_id FROM jellyfin_accounts WHERE"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user