l3uddz / plex_autoscan

Script to assist sonarr/radarr with plex imports. Will only scan the folder that has been imported, instead of the whole library section.
GNU General Public License v3.0
396 stars 70 forks source link

Lidarr - Unknown scan request from: '127.0.0.1' #89

Closed dabigc closed 5 years ago

dabigc commented 5 years ago

Lidarr was working with plex_autoscan but has stopped and gives this error in the plex_autoscan logs when Lidarr attempts to trigger a scan.

ERROR - AUTOSCAN [139816710383424]: Unknown scan request from: '127.0.0.1'

It looks like the Lidarr web hook options have changed (as seen below) from what the documentation shows. Is this is a known issue or is it something I can help get working?

image
desimaniac commented 5 years ago

Looks like they made some change on their side, needs updating.

wishbones commented 5 years ago

Here is a patch that fixes it:

diff --git a/scan.py b/scan.py
index aa6a08d..4b40cd6 100755
--- a/scan.py
+++ b/scan.py
@@ -514,14 +514,18 @@ def client_pushed():
         start_scan(final_path, 'Sonarr',
                    "Upgrade" if ('isUpgrade' in data and data['isUpgrade']) else data['eventType'])

-    elif 'artist' in data and 'trackFile' in data and 'eventType' in data:
+    elif 'artist' in data and 'trackFiles' in data and 'eventType' in data:
         # lidarr download/upgrade webhook
-        path = os.path.join(data['artist']['path'], data['trackFile']['relativePath'])
-        logger.info("Client %r scan request for album track: '%s', event: '%s'", request.remote_addr, path,
-                    "Upgrade" if ('isUpgrade' in data and data['isUpgrade']) else data['eventType'])
-        final_path = utils.map_pushed_path(conf.configs, path)
-        start_scan(final_path, 'Lidarr',
-                   "Upgrade" if ('isUpgrade' in data and data['isUpgrade']) else data['eventType'])
+        paths = set()
+        for track in data['trackFiles']:
+            path = os.path.join(data['artist']['path'], track['relativePath'])
+            paths.add(path)
+        for path in paths:
+            logger.info("Client %r scan request for album track: '%s', event: '%s'", request.remote_addr, path,
+                        "Upgrade" if ('isUpgrade' in data and data['isUpgrade']) else data['eventType'])
+            final_path = utils.map_pushed_path(conf.configs, path)
+            start_scan(final_path, 'Lidarr',
+                       "Upgrade" if ('isUpgrade' in data and data['isUpgrade']) else data['eventType'])

     else:
         logger.error("Unknown scan request from: %r", request.remote_addr)

Not sure if this is 100% the right way to resolve this, but it works at least.

NHDriver4 commented 5 years ago

Was there ever a pr generated to fix this issue? I'm also having unknown scan requests from Lidarr.

desimaniac commented 5 years ago

Fixed with 94d7d3c