@@ -105,6 +105,8 @@ def media_printer(args, data, units=None, media_len=None) -> None:
105
105
if "f" not in print_args and "limit" in getattr (args , "defaults" , []):
106
106
media .reverse ()
107
107
108
+ tables = args .db .table_names ()
109
+
108
110
duration = sum (m .get ("duration" ) or 0 for m in media )
109
111
if "a" in print_args and ("Aggregate" not in media [0 ].get ("path" ) or "" ):
110
112
if "count" in media [0 ]:
@@ -119,7 +121,7 @@ def media_printer(args, data, units=None, media_len=None) -> None:
119
121
D ["duration" ] = duration
120
122
D ["avg_duration" ] = duration / len (media )
121
123
122
- if hasattr (args , "action" ):
124
+ if hasattr (args , "action" ) and 'history' in tables :
123
125
if action in (SC .download , SC .download_status ) and "time_downloaded" in m_columns :
124
126
D ["download_duration" ] = cadence_adjusted_items (args , D ["count" ], time_column = "time_downloaded" )
125
127
else :
@@ -151,7 +153,7 @@ def media_printer(args, data, units=None, media_len=None) -> None:
151
153
marked = history .add (args , [d ["path" ] for d in media ])
152
154
log .warning (f"Marked { marked } metadata records as watched" )
153
155
154
- if "a" not in print_args and action == SC .download_status and "time_downloaded" in m_columns :
156
+ if "a" not in print_args and 'history' in tables and action == SC .download_status and "time_downloaded" in m_columns :
155
157
for m in media :
156
158
m ["download_duration" ] = cadence_adjusted_items (
157
159
args , m ["never_downloaded" ] + m ["retry_queued" ], time_column = "time_downloaded"
0 commit comments