bpwhelan / EmbyAniSync

Sync Emby anime library to AniList
GNU General Public License v3.0
11 stars 3 forks source link

Error on Emby URL #6

Closed avalynnrose closed 11 months ago

avalynnrose commented 1 year ago

I have used the PlexAniSync for a long time and now looking to switch to Emby. This is probably user error, but I have not been able to get the script going.

If I input my Emby URL as the In-Home (LAN) access URL from my Emby Dashboard I get the following error:

File "C:.EmbyAniSync-master\embypython\rest.py", line 216, in request raise ApiException(http_resp=r) embypython.rest.ApiException: (500) Reason: Internal Server Error HTTP response headers: HTTPHeaderDict({'Content-Length': '41', 'Content-Type': 'text/html', 'Date': 'Thu, 24 Aug 2023 21:08:03 GMT', 'Server': 'Kestrel', 'Access-Control-Allow-Headers': 'Accept, Accept-Language, Authorization, Cache-Control, Content-Disposition, Content-Encoding, Content-Language, Content-Length, Content-MD5, Content-Range, Content-Type, Date, Host, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, Origin, OriginToken, Pragma, Range, Slug, Transfer-Encoding, Want-Digest, X-MediaBrowser-Token, X-Emby-Token, X-Emby-Client, X-Emby-Client-Version, X-Emby-Device-Id, X-Emby-Device-Name, X-Emby-Authorization', 'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS', 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Private-Network': 'true', 'Private-Network-Access-Name': 'XXXXXXXXXXX', 'Private-Network-Access-Id': 'XXXXXXXXXXXX'}) HTTP response body: b'Input string was not in a correct format.'

If I input my Emby URL as the Remote (WAN) access URL from the dashboard, then I get this error about refusal to connect. I have already checked my remote access in other places and there are no issues with access.

File "C:\Users\XXXX\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\retry.py", line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='XXXXXX', port=8096): Max retries exceeded with url: /Items?Recursive=True&ParentId=1&Fields=ProviderIds%2CRecursiveItemCount%2CSortName%2CProductionYear&IncludeItemTypes=Series&EnableUserData=True&UserId=XXXX&api_key=XXXXXXXXXXXXX(Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x0000026B0A16BB90>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it'))

bpwhelan commented 12 months ago

Sorry, not sure how I didn't see this until recently. Didn't get any real interest in the project for a few months after posting so I forgot to check up.

I'm not exactly sure when I figured this out but I guess I never documented it. The URL should be.

"{protocol}://{url}:{port}/Emby"

Not sure if this is your issue or not, but i know it's not clearly explained in the readme.

For reference, this is my settings.ini

[general]
sync_all_timer = 12

[EMBY]
anime_section_ids = 19,16
 # Choose 'direct' or 'myemby'
;authentication_method = direct

# Direct IP
url = https://my-remote-url.com/emby
apikey = 

# if you enable home_user_sync it will only sync against that specific Emby home user, it requires the full url of your Emby server just like with the Direct IP method
# home_username is the actual Emby home username and not their e-mail address, this is also case sensitive

;home_user_sync = False
;home_username = Megumin
;home_server_base_url = http://127.0.0.1:32400

[ANILIST]
emby_episode_count_priority = False
skip_list_update = False
log_failed_matches = True

[users]
users = Beans,Miguel
[users.Beans]
emby_user_id = 
anilist_username = Beans
anilist_token = 
[users.Miguel]
emby_user_id = 
anilist_username = 
anilist_token

Will add something to alleviate the need for this in the config.

avalynnrose commented 12 months ago

Thank you! I added /emby to the URL but I am still getting the same errors... I am supposed to be using the remote URL?

bpwhelan commented 12 months ago

As far as I know it shouldn't matter, the only thing that matters is if the protocol matches and if emby exists there. I just use remote since dns makes it "forever" set up for me personally, and I have the option to move it off-site.

if local, i assume it should just be http://ip:port/emby

I can test once i get off work today to confirm.

epicawk commented 11 months ago

Getting the same error with local IP, tried localhost as well.

bpwhelan commented 11 months ago

Hmmm, I was able to connect and run this with URL as local IP to my server running in a docker container on home server.

url = http://192.168.x.x:8096/emby

Will boot up a Windows Server to see if there is anything different there in case you all are using Emby Server for Windows.

In the mean time if there is any other info that you can give me about your setup that would be greatly appreciated

Edit: Tested with a fresh Windows Emby Server install. Was able to connect using localhost, 127.0.0.1 and my machine's IP.

Edit 2: Also Tested without /emby, still works, think i got /emby from their api browser

epicawk commented 11 months ago

I`m on Windows, for the api key you simply created it in advanced?

avalynnrose commented 11 months ago

I am using Windows... still no luck for me. I'm not using docker. I have created the API key in the emby settings. I'm not sure what other information would be helpful.

My settings page looks like this:

[general]
sync_all_timer = 12

[EMBY]
# Comma Seperated List of library ID for update_all
anime_section_ids = 4
url = http://http://76.154.x.x:8096/emby
apikey = key is here

[ANILIST]
emby_episode_count_priority = False
skip_list_update = False
log_failed_matches = True

[users]
# Comma Seperated List of EMBY User Names (not sure if case sensitive) Corresponds to following subsections
users = NAME
[users.NAME]
emby_user_id = NAME
anilist_username = username
anilist_token = token is here
bpwhelan commented 11 months ago

url = http://http://76.154.x.x:8096/emby

Just want to confirm this is just a typo when making this comment and not your actual config? That would likely be the issue if it's what it's running on.

Also, make sure emby_user_id is what you see in the URL when you edit your user, if I don't make this clear in the readme I will edit it to make sure that's known

https://emby-url/web/index.html#!/users/user?userId={USER_ID_IS_HERE}

epicawk commented 11 months ago

It was the emby user id for me, thanks!

bpwhelan commented 11 months ago

It was the emby user id for me, thanks!

Sweet, If you run into anything else or have any ideas for improvements just open a new ticket. I haven't made any real changes other than adding docker stuff since I first wrote it so I'm expecting there to be issues... but it seems to have been pretty consistent for me.

avalynnrose commented 11 months ago

That was it for me as well! Thank you so much (the user ID, the https was just a typo)

bpwhelan commented 11 months ago

Awesome, it is stated in the readme where to find that but I will make it more clear. Thanks for your interest. Please let me know with a new issue if you run into anything or have any ideas for improvements.

bpwhelan commented 11 months ago

Addressed in e70edeb

IMPORTANT: To find your EMBY_USER_ID, go to the individual user's settings page and you will find it in the url.