Skip to content

Commit

Permalink
[patch] fixed some instances which caused the Database malformed erro…
Browse files Browse the repository at this point in the history
…r to pop up
  • Loading branch information
Feramance committed Aug 13, 2023
1 parent edb5c6d commit afce1f9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 22 deletions.
25 changes: 11 additions & 14 deletions qBitrr/arr_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


class CommandsModel(Model):
Id = IntegerField()
Id = IntegerField(null=False, primary_key=True)
Name = TextField()
Body = TextField()
Priority = IntegerField()
Expand All @@ -12,12 +12,12 @@ class CommandsModel(Model):
EndedAt = DateTimeField(formats=["%Y-%m-%d %H:%M:%S.%f"])
Duration = TextField()
Exception = TextField()
Trigger = TextField()
Trigger = IntegerField()
Result = IntegerField()


class MoviesMetadataModel(Model):
Id = IntegerField()
Id = IntegerField(null=False, primary_key=True)
TmdbId = IntegerField()
ImdbId = TextField()
Images = TextField()
Expand All @@ -27,7 +27,7 @@ class MoviesMetadataModel(Model):
CleanTitle = TextField()
OriginalTitle = TextField()
CleanOriginalTitle = TextField()
OriginalLanguage = TextField()
OriginalLanguage = IntegerField()
Status = IntegerField()
LastInfoSync = DateTimeField(formats=["%Y-%m-%d %H:%M:%S.%f"])
Runtime = IntegerField()
Expand All @@ -49,7 +49,7 @@ class MoviesMetadataModel(Model):


class MoviesModel(Model):
Id = IntegerField()
Id = IntegerField(null=False, primary_key=True)
Path = TextField()
Monitored = IntegerField()
ProfileId = IntegerField()
Expand All @@ -66,32 +66,29 @@ class EpisodesModel(Model):
SeriesId = IntegerField(null=False)
SeasonNumber = IntegerField(null=False)
EpisodeNumber = IntegerField(null=False)

Title = TextField()
Overview = TextField()

EpisodeFileId = IntegerField()
AbsoluteEpisodeNumber = IntegerField()
SceneAbsoluteEpisodeNumber = IntegerField()
SceneEpisodeNumber = IntegerField()
SceneSeasonNumber = IntegerField()
Monitored = BooleanField()

AirDateUtc = DateTimeField(formats=["%Y-%m-%d %H:%M:%S.%f"])

AirDate = TextField()
Ratings = TextField()
Images = TextField()
UnverifiedSceneNumbering = BooleanField(null=False, default=False)
LastSearchTime = DateTimeField(formats=["%Y-%m-%d %H:%M:%S.%f"])

AiredAfterSeasonNumber = IntegerField()
AiredBeforeSeasonNumber = IntegerField()
AiredBeforeEpisodeNumber = IntegerField()
TvdbId = IntegerField()
Runtime = IntegerField()


class SeriesModel(Model):
Id = IntegerField()
Id = IntegerField(null=False, primary_key=True)
TvdbId = IntegerField()
TvRageId = IntegerField()
ImdbId = TextField()
Expand All @@ -104,12 +101,12 @@ class SeriesModel(Model):
Images = TextField()
Path = TextField()
Monitored = BooleanField()
SeasonFolder = TextField()
SeasonFolder = IntegerField()
LastInfoSync = DateTimeField(formats=["%Y-%m-%d %H:%M:%S.%f"])
LastDiskSync = DateTimeField(formats=["%Y-%m-%d %H:%M:%S.%f"])
Runtime = IntegerField()
SeriesType = IntegerField()
Network = IntegerField()
Network = TextField()
UseSceneNumbering = BooleanField()
FirstAired = DateTimeField(formats=["%Y-%m-%d %H:%M:%S.%f"])
NextAiring = DateTimeField(formats=["%Y-%m-%d %H:%M:%S.%f"])
Expand All @@ -125,4 +122,4 @@ class SeriesModel(Model):
Added = DateTimeField(formats=["%Y-%m-%d %H:%M:%S.%f"])
AddOptions = TextField()
TvMazeId = IntegerField()
# LanguageProfileId = IntegerField()
OriginalLanguage = IntegerField()
19 changes: 12 additions & 7 deletions qBitrr/arss.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,14 +955,19 @@ def api_calls(self) -> None:
def arr_db_query_commands_count(self) -> int:
if not self.search_missing:
return 0
search_commands = (
self.model_arr_command.select()
.where(
(self.model_arr_command.EndedAt.is_null(True))
& (self.model_arr_command.Name.endswith("Search"))

try:
search_commands = ( # ilovemywife
self.model_arr_command.select()
.where(
(self.model_arr_command.EndedAt.is_null(True))
& (self.model_arr_command.Name.endswith("Search"))
)
.count()
)
.count()
)
except BaseException:
self.logger.trace("No unended commands found")
search_commands = 0

return search_commands

Expand Down
3 changes: 2 additions & 1 deletion qBitrr/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ def process_flags() -> argparse.Namespace | bool:
CONFIG = MyConfig("./config.toml")

if COPIED_TO_NEW_DIR is not None:
print(f"STARTUP | {CONFIG.path} |\n{CONFIG}")
# print(f"STARTUP | {CONFIG.path} |\n{CONFIG}")
print(f"STARTUP")
else:
print(f"STARTUP | CONFIG_FILE={CONFIG_FILE} | CONFIG_PATH={CONFIG_PATH}")

Expand Down

0 comments on commit afce1f9

Please sign in to comment.