j54j6 / YoutubeDL-Downloader

This little program is supposed to help you to make a private copy of videos from sites supporting youtube-dl. Currently many sites like youtube, NYT, CNBC but also adult sites like Pornhub 91porn and much more support it. Feel Free to use it ^^
GNU General Public License v2.0
14 stars 4 forks source link

fix some issue and typo #3

Closed strTATQwQ closed 5 months ago

strTATQwQ commented 5 months ago

When I tried to transfer my work from laptop to nas, I did a export-import operation and it got the following error:

DEBUG:project_functions:File also exist on FS - SKIP
DEBUG:root:Prepared Query: SELECT url,tags,data from items  WHERE id= ?
 data: [1]
DEBUG:project_functions:Check if tags are allowed
DEBUG:root:Prepared Query: SELECT option_value from config  WHERE option_name= ?
 data: ['use_tags_from_ydl']
Traceback (most recent call last):
  File "/mnt/d/YoutubeDL-Dowloader/yt_manager.py", line 163, in <module>
    NO_ERROR = start()
  File "/mnt/d/YoutubeDL-Dowloader/project_functions.py", line 68, in start
    return download_missing()
  File "/mnt/d/YoutubeDL-Dowloader/project_functions.py", line 1099, in download_missing
    data_inserted = insert_missing_file_data_in_db(file_already_exist_in_db[0], entry["url"], file_metadata)
  File "/mnt/d/YoutubeDL-Dowloader/project_functions.py", line 2652, in insert_missing_file_data_in_db
    if db_entry[2] is None or db_entry[1].strip() == "":
AttributeError: 'NoneType' object has no attribute 'strip'

I believe this was an error caused by not checking if db_entry[1] was empty at line 2652, making the change fixed it for me, but I didn't check the rest of it in depth

Also fixed some trivial typos in show_help()

Also may check the spelling of the repository title (

j54j6 commented 5 months ago

Hey :)

thank you for your PR :) - Indeed there is an error with the code. The check is basically wrong. This function should "iterate" over the fetched data array (check tags first, than the metadata and last the urls). I tried to merge your PR but the checks are failing caused by an indentation error... I checked the code and there were some more errors... - I try to fix some of the issues today and definitely will check the spelling inside the code (and the repo name - Thank you for that <3)

I also extended the tests to check also the export/import subscriptions function. In the next days I will add some more tests to detect this kind of errors :)

j54j6 commented 5 months ago

Oh your changes are inserted in a modified way. It should work now!

Pleas elet me know if you find any other erros - or of course add a new PR. If the tests are successfull I will simply merge it ^^