Waterboy1602 / Addarr

Telegram Bot for adding series/movies to Sonarr/Radarr or for changing the download speed of Transmission/Sabnzbd
MIT License
232 stars 55 forks source link

TypeError: string indices must be integers, not 'str' #145

Open figgzs opened 10 months ago

figgzs commented 10 months ago

Hello

This my 1st time using telegram bots and python... so take it easy on the noob please :) After much trial and error i've finnally hit a wall that a ican't pass. As long as python was complaining about the config.yaml file i was able to see where the problem was, but this case i have no idea...

C:\Addarr\src>python addarr.py Traceback (most recent call last): File "C:\Addarr\src\addarr.py", line 19, in import delete as delete File "C:\Addarr\src\delete.py", line 11, in from addarr import getService, clearUserData, stop File "C:\Addarr\src\addarr.py", line 35, in application = Application.builder().token(config["telegram"]["token"]).build()


TypeError: string indices must be integers, not 'str'

[config-copy.txt](https://github.com/Waterboy1602/Addarr/files/13443586/config-copy.txt)

what did i did wrong?
thank you in advance for your help.
Waterboy1602 commented 10 months ago

Does your Telegram token exists out of two parts that are connected with an :? It should be 9 numbers followed by an : and then a string of characters

figgzs commented 10 months ago

my telegram token has 10 numbers : and then a string chars (numbers, capital letters, small letters and special chars) one underscore in my case. example 6802489040:BAFCs3CrEOPy2vEbdbr_2QfIdYN0uT6ieLA

Waterboy1602 commented 10 months ago

I've tried changing the form of the Telegram token in my config.yaml and Addarr starts without problem. So I guess it has nothing to do with the fact that your token exists out of 10 numbers.

I've also looked into your config-file and doesn't see any problems on the first sight. To be honest I've also never experienced your error message before

figgzs commented 10 months ago

hummm ok i'll start from new vm, i'm using windows 11 virtual machine btw. this one has plex sonarr/radarr and prowlarr working great, but i'll install e new one clear from all other software and get back to you.

figgzs commented 10 months ago

thank you very much :)

figgzs commented 10 months ago

Hello good news got it to start :) been adding/removing spaces on the variables in config.yaml and got it to "talk" to me in telegram. But when i say the type of search (movie/series) it does not respond. image

and on the console i've got the folling error:

c:\Addarr\src>python addarr.py c:\Addarr\src\addarr.py:832: RuntimeWarning: coroutine 'startCheck' was never awaited if startCheck(): RuntimeWarning: Enable tracemalloc to get the object allocation traceback 2023-11-24 05:14:50,426 - addarr - INFO - Start chatting with Addarr in Telegram. The first time you use "start" you will be asked to enter your password.

2023-11-24 05:15:10,239 - addarr.commons - WARNING - Generate of APIQUERY failed: string indices must be integers, not 'str'. No error handlers are registered, logging exception. Traceback (most recent call last): File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\telegram\ext_application.py", line 1195, in process_update await coroutine File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\telegram\ext_conversationhandler.py", line 850, in handle_update new_state: object = await handler.handle_update( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\telegram\ext_basehandler.py", line 153, in handle_update return await self.callback(update, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Addarr\src\addarr.py", line 389, in searchSerieMovie searchResult = service.search(title) ^^^^^^^^^^^^^^^^^^^^^ File "c:\Addarr\src\sonarr.py", line 23, in search req = requests.get(commons.generateApiQuery("sonarr", "series/lookup", parameters)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\api.py", line 73, in get return request("get", url, params=params, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\api.py", line 59, in request return session.request(method=method, url=url, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 575, in request prep = self.prepare_request(req) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\sessions.py", line 486, in prepare_request p.prepare( File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\models.py", line 368, in prepare self.prepare_url(url, params) File "C:\Users\user\AppData\Local\Programs\Python\Python312\Lib\site-packages\requests\models.py", line 439, in prepare_url raise MissingSchema( requests.exceptions.MissingSchema: Invalid URL 'None': No scheme supplied. Perhaps you meant https://None?

Any tips?

bulletproof2k commented 6 months ago

I also noticed that it doesn't add anything to sonarr/radarr returns an error when adding all seasons:

"Unfortunately, it was not possible to add the series. 
To start a new search, enter - films"

It would be nice to add an example to read.me how to correctly and what exactly to write in the config.yml. I'm not sure I did everything right.

sonarr:
  server: 
    addr: localhost
    port : 8989 # Default is 8989
    path: / # Default is / . If set, it must start and finish with / . Eg: /sonarr/
    ssl: false # Default false
  auth:
    apikey: myapikey
    username: 
    password:
  search: true # Start search after adding series
  seasonFolder: true
  languageProfile: Russian
  excludedRootFolders: # If set must not have a trailing slash Eg: /mnt/Media
    - # First excluded folder, add others with a "-" on a new line (same indentation)
  narrowRootFolderNames: true # If true, only the last folder name will be shown instead of full path
  excludedQualityProfiles:
transmission:
  enable: true # Enable the Transmission commands
  onlyAdmin: false # Transmission command  will only work for admins
  host: localhost:9091
  authentication: false # Is Transmission protected with a password?
  username: 
  password: