@@ -221,7 +221,7 @@ def check_upgrade_or_new(volume, existing_files):
221
221
222
222
message = (
223
223
f"\n \t Download: { volume .name } "
224
- f"\n \t \t is { 'an' if upgrade_status else 'not an' } upgrade to: "
224
+ f"\n \t \t is { 'an' if upgrade_status else 'not an' } upgrade to: "
225
225
f"\n \t Existing: { existing_file .name } "
226
226
)
227
227
@@ -256,29 +256,37 @@ def has_unacceptable_keywords(torrent):
256
256
257
257
# Processes file names, removing excluded files
258
258
def process_file_names (files , files_to_exclude ):
259
- file_names = [
260
- os .path .basename (file .name ) for file in files if file not in files_to_exclude
261
- ]
259
+ file_names = [file .name for file in files if file not in files_to_exclude ]
262
260
return file_names
263
261
264
262
265
263
# Organizes the file names into volumes
266
264
def organize_files (torrent , file_names ):
267
- volumes = upgrade_to_volume_class (
268
- upgrade_to_file_class (
269
- file_names ,
270
- f"/{ torrent .name } " ,
271
- is_correct_extensions_feature = convertable_file_extensions + file_extensions ,
265
+ volumes = []
266
+
267
+ for name in file_names :
268
+ dir_name = os .path .basename (os .path .dirname (name )) or torrent .name
269
+ volume_name = os .path .basename (name )
270
+
271
+ volume = upgrade_to_volume_class (
272
+ upgrade_to_file_class (
273
+ [volume_name ],
274
+ f"/{ dir_name } " ,
275
+ is_correct_extensions_feature = convertable_file_extensions
276
+ + file_extensions ,
277
+ test_mode = True ,
278
+ ),
279
+ skip_release_year = True ,
280
+ skip_release_group = True ,
281
+ skip_extras = True ,
282
+ skip_publisher = True ,
283
+ skip_premium_content = True ,
284
+ skip_subtitle = True ,
272
285
test_mode = True ,
273
- ),
274
- skip_release_year = True ,
275
- skip_release_group = True ,
276
- skip_extras = True ,
277
- skip_publisher = True ,
278
- skip_premium_content = True ,
279
- skip_subtitle = True ,
280
- test_mode = True ,
281
- )
286
+ )
287
+ if volume :
288
+ volumes .append (volume [0 ])
289
+
282
290
return volumes
283
291
284
292
@@ -525,7 +533,7 @@ def main():
525
533
)
526
534
if qb and qb .is_logged_in :
527
535
send_message_alt (
528
- "\t Connected to qBittorrent" ,
536
+ "\t Connected to qBittorrent. " ,
529
537
)
530
538
else :
531
539
send_message_alt (
0 commit comments