Flexget / Flexget

The official FlexGet repository

Home Page:http://www.flexget.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Duplicate movie lists causing "Multiple rows were found when exactly one was required"

geodescent opened this issue · comments

Expected behaviour:

I managed to create two movie lists, one called "movies" (which I added 192 entries), and another called "Movies," which I don't think I've added anything to.

C:\Users\x\Downloads>flexget movie-list all
┏━━━┳━━━━━━━━━━━┓
┃ # ┃ List Name ┃
┡━━━╇━━━━━━━━━━━┩
│ 1 │ movies │
│ 2 │ Movies │
└───┴──────┘

I'd like to delete the 2nd list (due to the below-mentioned issue), but am unable to. In fact, issuing any of these commands yields the same error:

flexget movie-list purge 1
flexget movie-list purge 2
flexget movie-list purge "movies"
flexget movie-list purge "Movies"
flexget movie-list del 2
flexget movie-list del "Movies"
flexget movie-list list "movies"

The documentation does not clarify where the actual movie list file might be, though if not stored in ASCII format I wouldn't be able to manually edit it anyway.

Actual behaviour:

Receive the following error:

C:\Users\x\Downloads>flexget movie-list purge "Movies"
Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "C:\Users\x\AppData\Local\Programs\Python\Python312\Scripts\flexget.exe_main
.py", line 7, in
File "C:\Users\x\AppData\Local\Programs\Python\Python312\Lib\site-packages\flexget_init
.py", line 55, in main
manager.start()
File "C:\Users\x\AppData\Local\Programs\Python\Python312\Lib\site-packages\flexget\manager.py", line 366, in start
self.handle_cli()
File "C:\Users\x\AppData\Local\Programs\Python\Python312\Lib\site-packages\flexget\manager.py", line 395, in handle_cli
options.cli_command_callback(self, command_options)
File "C:\Users\x\AppData\Local\Programs\Python\Python312\Lib\site-packages\flexget\components\managed_lists\lists\movie_list\cli.py", line 83, in do_cli
movie_list_purge(options)
File "C:\Users\x\AppData\Local\Programs\Python\Python312\Lib\site-packages\flexget\components\managed_lists\lists\movie_list\cli.py", line 198, in movie_list_purge
movie_list = db.get_list_by_exact_name(options.list_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\x\AppData\Local\Programs\Python\Python312\Lib\site-packages\flexget\utils\database.py", line 30, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\x\AppData\Local\Programs\Python\Python312\Lib\site-packages\flexget\components\managed_lists\lists\movie_list\db.py", line 150, in get_list_by_exact_name
session.query(MovieListList).filter(func.lower(MovieListList.name) == name.lower()).one()
File "C:\Users\x\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\orm\query.py", line 2798, in one
return self._iter().one() # type: ignore
^^^^^^^^^^^^^^^^^^
File "C:\Users\x\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\result.py", line 1827, in one
return self._only_one_row(
^^^^^^^^^^^^^^^^^^^
File "C:\Users\x\AppData\Local\Programs\Python\Python312\Lib\site-packages\sqlalchemy\engine\result.py", line 813, in _only_one_row
raise exc.MultipleResultsFound(
sqlalchemy.exc.MultipleResultsFound: Multiple rows were found when exactly one was required

Steps to reproduce:

I went through my command line history and at no point did I use the uppercase M when interacting with the 'movies" list, however my config.yml did have a task called "Movies" (which was incomplete -- missing some plugins and exec bits) that flexget was called against while incomplete as part of testing functionality.

I have since renamed said task to "My_Movies"

Config:

tasks:
TV_Shows:
rss: https://rmz.cr/feed
series:
- Fargo:
begin: S05E07
qualities: [1080p, h265]
- True Detective:
begin: S04E01
qualities: [1080p, h265]
rmz:
filehosters_re:
- clicknupload.club
- clicknupload.space
- clicknupload.org
- clicknupload.to
- clicknupload.cc
- clicknupload.red
- clicknupload.click
exec:
- echo text={{url}} >> "c:\Users\x\Downloads\jD FolderWatch{{series_name}} {{series_id}}.crawljob"
- echo downloadFolder=c:\Users\x\Downloads >> "c:\Users\x\Downloads\jD FolderWatch{{series_name}} {{series_id}}.crawljob"
- echo autoConfirm=TRUE >> "c:\Users\x\Downloads\jD FolderWatch{{series_name}} {{series_id}}.crawljob"
# - echo autoStart=TRUE >> "c:\Users\x\Downloads\jD FolderWatch{{series_name}} {{series_id}}.crawljob"
##if you also need to parse the content of the url, uncomment following line
#- echo deepAnalyseEnabled=true >> "c:\Users\x\Downloads\jD FolderWatch{{title}}.crawljob"

My_Movies:
disable: seen
rss: https://rmz.cr/feed
quality: 1080p
list_match:
from:
- movie_list: Movies
rmz:
filehosters_re:
- clicknupload.club
- clicknupload.space
- clicknupload.org
- clicknupload.to
- clicknupload.cc
- clicknupload.red
- clicknupload.click
exec:
- echo text={{url}} >> "c:\Users\x\Downloads\jD FolderWatch{{movie_title}}.crawljob"
- echo downloadFolder=c:\Users\x\Downloads >> "c:\Users\x\Downloads\jD FolderWatch{{movie_title}}.crawljob"
- echo autoConfirm=TRUE >> "c:\Users\x\Downloads\jD FolderWatch{{movie_title}}.crawljob"
# - echo autoStart=TRUE >> "c:\Users\x\Downloads\jD FolderWatch{{movie_title}}.crawljob"
##if you also need to parse the content of the url, uncomment following line
#- echo deepAnalyseEnabled=true >> "c:\Users\x\Downloads\jD FolderWatch{{movie_title}}.crawljob"

Log:

flexget.log generates no new lines when the error is displayed when using verbose-level logging.

If issuing "flexget movie-list purge 2 --loglevel debug" I see the following:

(click to expand)
2023-12-25 09:34:34 DEBUG    manager                       Figuring out config load paths
2023-12-25 09:34:34 DEBUG    manager                       Found config: C:\Users\x\flexget\config.yml
2023-12-25 09:34:34 DEBUG    manager                       Config file C:\Users\x\flexget\config.yml selected
2023-12-25 09:34:34 DEBUG    manager                       sys.defaultencoding: utf-8
2023-12-25 09:34:34 DEBUG    manager                       sys.getfilesystemencoding: utf-8
2023-12-25 09:34:34 DEBUG    manager                       flexget detected io encoding: utf-8
2023-12-25 09:34:34 DEBUG    manager                       os.path.supports_unicode_filenames: True
2023-12-25 09:34:34 DEBUG    plugin                        Trying to load plugins from: ['C:\\Users\\x\\flexget\\plugins', 'C:\\Users\\x\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\flexget\\plugins']
2023-12-25 09:34:35 DEBUG    plugin                        Plugin `memusage` requires plugin `guppy3` to load.
2023-12-25 09:34:35 DEBUG    plugin                        Trying to load components from: ['C:\\Users\\x\\flexget\\components', 'C:\\Users\\x\\AppData\\Local\\Programs\\Python\\Python312\\Lib\\site-packages\\flexget\\components']
2023-12-25 09:34:36 DEBUG    plugin                        Plugins took 2.54 seconds to load. 323 plugins in registry.
2023-12-25 09:34:36 DEBUG    manager                       Removed C:\Users\x\flexget\.config-lock

Additional information:

  • FlexGet version: 3.10.7
  • Python version: 3.12.1
  • Installation method: Python GUI install + CLI commands per FlexGet documentation
  • Using daemon (yes/no): No
  • OS and version: Win10 22H2 19045.3803
  • Link to crash log: None; there is no separate crash log created in the same location as flexget.log

Following up, it appears referencing the movie list in the config.yml is case-sensitive and will create a duplication in the "movie_list_lists" table of db-config.sqlite:

My_Movies:
list_match:
from:

  • movie_list: Movies

Changing the bottom line as follows resolved:

  • movie_list: movies

(I used an SQLLite editor to strike the excess row from the "movie_list_lists" table in db-config.sqlite; can provide a backup of the corrupted if desired)