ThePornDatabase / namer

Renames adult video files so that the plex/jellyfin plugins and stash script will match without user input. Runs server or command mode.
https://theporndb.net
171 stars 26 forks source link

Not Renaming or Tagging even Though Match Found #189

Closed RealPeteSys closed 1 year ago

RealPeteSys commented 1 year ago

Hello,

I recently observed an issue when I would run namer. I'll submit new video files into my watch directory and observe the application fail to make a match to the database. I've confirmed that a match should indeed be made, as the hash values equal those in the DB. Enabling debug, I see that it accurately identified the correct Studio, Date, Performers, and Title (| DEBUG | Phash match with ...(Correct Information)...), but doesn't rename the file accordingly. It then moves them into the failed directory. I've used namer successfully and this issue has only started to happen recently. I haven't edited my config file (besides enabling debugging) in a way that would cause this to happen. I do also see this entry in the debug view: | DEBUG | Could not parse target name which may be a file (or directory) name depending on settings and input: .... I'm not sure if this is a significant error or not. The file name is not conducive to being accurately parsed, but I usually aim for a match via hash values.

I then tested namer on a file which was successfully processed a month ago, and it failed to identify it. Similar behavior as stated above. Where it found the right DB entry, but didn't rename it. I'm not sure what the issue might be for this behavior. Are there any other logs which I can view or share that might help pinpoint the issue?

Edit: If I rename the file with the name given when namer finds a match based on Phash (line in the debug window) and move it back into my watch directory, the program will correctly name it and move into the dest folder. In this manner, I need to run the program twice. One time to have fail but give the name. A second time once I manually edit the name for it to pull the movie details and succeed.

I'm using the standard watchdog command: python -m namer watchdog .config file (token removed): namer.txt

Snippet from the terminal with the pertinent parts:

namer | 2023-03-24 20:43:22 | ℹ️ INFO | Calculating phash for file "/data/work/movie.mp4" namer | 2023-03-24 20:43:30 | ℹ️ INFO | Calculated hashes: {'duration': NUMBER, 'phash': 'NUMBER', 'oshash': 'NUMBER'} namer | 2023-03-24 20:43:30 | ℹ️ INFO | Requesting GET "https://api.metadataapi.net/scenes?hash=NUMBER&hashType=PHASH" namer | 2023-03-24 20:43:33 | ℹ️ INFO | Requesting GET "https://api.metadataapi.net/sites/number" namer | 2023-03-24 20:43:33 | ℹ️ INFO | Requesting GET "https://api.metadataapi.net/scenes" namer | 2023-03-24 20:43:33 | 🐞 DEBUG | Phash match with 'SITE- DATE- TITLE' namer | 2023-03-24 20:43:33 | 🐞 DEBUG | Match was 100.00 for namer | 2023-03-24 20:43:33 | 🐞 DEBUG | Match was 0.00 for

I've checked that the hash values are all legitimate and can be found in the DB. The snippet makes it seem as though the hash had a 100% match to an entry in the DB. Do I understand the scoring system, or am I making a misunderstanding? It seems when a name match is made, the 'score' value can exceed 100. Is the video hash bound to 0-100?

RealPeteSys commented 1 year ago

Not sure if the following has any connection to the original issue. When running namer in Docker, the following error is displayed. Namer still seems to function, as it still attempts to parse and analyze files. Connection issue to the DB?


2023-04-06 20:33:08 namer  | 2023-04-06 19:33:08 | ❌ ERROR    | An error has been caught in function '__get_metadataapi_net_info', process 'MainProcess' (1), thread 'Thread-2 (__processing_thread)' (140139516610112):
2023-04-06 20:33:08 namer  | Traceback (most recent call last):
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 703, in urlopen
2023-04-06 20:33:08 namer  |     httplib_response = self._make_request(
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 449, in _make_request
2023-04-06 20:33:08 namer  |     six.raise_from(e, None)
2023-04-06 20:33:08 namer  |   File "<string>", line 3, in raise_from
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 444, in _make_request
2023-04-06 20:33:08 namer  |     httplib_response = conn.getresponse()
2023-04-06 20:33:08 namer  |   File "/usr/lib/python3.10/http/client.py", line 1374, in getresponse
2023-04-06 20:33:08 namer  |     response.begin()
2023-04-06 20:33:08 namer  |   File "/usr/lib/python3.10/http/client.py", line 318, in begin
2023-04-06 20:33:08 namer  |     version, status, reason = self._read_status()
2023-04-06 20:33:08 namer  |   File "/usr/lib/python3.10/http/client.py", line 287, in _read_status
2023-04-06 20:33:08 namer  |     raise RemoteDisconnected("Remote end closed connection without"
2023-04-06 20:33:08 namer  | http.client.RemoteDisconnected: Remote end closed connection without response
2023-04-06 20:33:08 namer  | 
2023-04-06 20:33:08 namer  | During handling of the above exception, another exception occurred:
2023-04-06 20:33:08 namer  | 
2023-04-06 20:33:08 namer  | Traceback (most recent call last):
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/requests/adapters.py", line 489, in send
2023-04-06 20:33:08 namer  |     resp = conn.urlopen(
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 787, in urlopen
2023-04-06 20:33:08 namer  |     retries = retries.increment(
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/urllib3/util/retry.py", line 550, in increment
2023-04-06 20:33:08 namer  |     raise six.reraise(type(error), error, _stacktrace)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/urllib3/packages/six.py", line 769, in reraise
2023-04-06 20:33:08 namer  |     raise value.with_traceback(tb)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 703, in urlopen
2023-04-06 20:33:08 namer  |     httplib_response = self._make_request(
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 449, in _make_request
2023-04-06 20:33:08 namer  |     six.raise_from(e, None)
2023-04-06 20:33:08 namer  |   File "<string>", line 3, in raise_from
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/urllib3/connectionpool.py", line 444, in _make_request
2023-04-06 20:33:08 namer  |     httplib_response = conn.getresponse()
2023-04-06 20:33:08 namer  |   File "/usr/lib/python3.10/http/client.py", line 1374, in getresponse
2023-04-06 20:33:08 namer  |     response.begin()
2023-04-06 20:33:08 namer  |   File "/usr/lib/python3.10/http/client.py", line 318, in begin
2023-04-06 20:33:08 namer  |     version, status, reason = self._read_status()
2023-04-06 20:33:08 namer  |   File "/usr/lib/python3.10/http/client.py", line 287, in _read_status
2023-04-06 20:33:08 namer  |     raise RemoteDisconnected("Remote end closed connection without"
2023-04-06 20:33:08 namer  | urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
2023-04-06 20:33:08 namer  | 
2023-04-06 20:33:08 namer  | During handling of the above exception, another exception occurred:
2023-04-06 20:33:08 namer  | 
2023-04-06 20:33:08 namer  | Traceback (most recent call last):
2023-04-06 20:33:08 namer  |   File "/usr/lib/python3.10/threading.py", line 973, in _bootstrap
2023-04-06 20:33:08 namer  |     self._bootstrap_inner()
2023-04-06 20:33:08 namer  |   File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
2023-04-06 20:33:08 namer  |     self.run()
2023-04-06 20:33:08 namer  |   File "/usr/lib/python3.10/threading.py", line 953, in run
2023-04-06 20:33:08 namer  |     self._target(*self._args, **self._kwargs)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/namer/watchdog.py", line 146, in __processing_thread
2023-04-06 20:33:08 namer  |     handle(command)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/namer/watchdog.py", line 54, in handle
2023-04-06 20:33:08 namer  |     process_file(command)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/namer/namer.py", line 179, in process_file
2023-04-06 20:33:08 namer  |     search_results = match(command.parsed_file, command.config, phash=phash)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/namer/metadataapi.py", line 505, in match
2023-04-06 20:33:08 namer  |     results: List[ComparisonResult] = __metadata_api_lookup(file_name_parts, namer_config, phash)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/namer/metadataapi.py", line 179, in __metadata_api_lookup
2023-04-06 20:33:08 namer  |     results: List[ComparisonResult] = __metadata_api_lookup_type(results, name_parts, namer_config, scene_type, phash)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/namer/metadataapi.py", line 158, in __metadata_api_lookup_type
2023-04-06 20:33:08 namer  |     results = __update_results(results, name_parts, namer_config, scene_type=scene_type, phash=phash)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/namer/metadataapi.py", line 142, in __update_results
2023-04-06 20:33:08 namer  |     for match_attempt in __get_metadataapi_net_fileinfo(name_parts, namer_config, skip_date, skip_name, scene_type=scene_type, phash=phash):
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/namer/metadataapi.py", line 468, in __get_metadataapi_net_fileinfo
2023-04-06 20:33:08 namer  |     file_infos = __get_metadataapi_net_info(url, name_parts, namer_config)
2023-04-06 20:33:08 namer  | > File "/usr/local/lib/python3.10/dist-packages/namer/metadataapi.py", line 449, in __get_metadataapi_net_info
2023-04-06 20:33:08 namer  |     json_response = __request_response_json_object(url, namer_config)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/namer/metadataapi.py", line 220, in __request_response_json_object
2023-04-06 20:33:08 namer  |     http = Http.request(method, url, cache_session=config.cache_session, headers=headers, json=data)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/namer/http.py", line 27, in request
2023-04-06 20:33:08 namer  |     return cache_session.request(method.value, url, **kwargs)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/requests_cache/session.py", line 115, in request
2023-04-06 20:33:08 namer  |     return super().request(method, url, *args, **kwargs)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/requests/sessions.py", line 587, in request
2023-04-06 20:33:08 namer  |     resp = self.send(prep, **send_kwargs)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/requests_cache/session.py", line 147, in send
2023-04-06 20:33:08 namer  |     response = self._send_and_cache(request, actions, **kwargs)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/requests_cache/session.py", line 189, in _send_and_cache
2023-04-06 20:33:08 namer  |     response = super().send(request, **kwargs)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/requests/sessions.py", line 701, in send
2023-04-06 20:33:08 namer  |     r = adapter.send(request, **kwargs)
2023-04-06 20:33:08 namer  |   File "/usr/local/lib/python3.10/dist-packages/requests/adapters.py", line 547, in send
2023-04-06 20:33:08 namer  |     raise ConnectionError(err, request=request)
2023-04-06 20:33:08 namer  | requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
2023-04-06 20:33:08 namer  | 2023-04-06 19:33:08 | ℹ️ INFO     | Requesting GET "https://api.metadataapi.net/scenes"
2023-04-06 20:33:09 namer  | 2023-04-06 19:33:09 | 🐞 DEBUG    | Match was 0.00 for```
4c0d3r commented 1 year ago

The server supplying the data has been going through growing pains, and has been unreliable lately. This is what you're seeing. TPDB discord is the best place for the status of the server.

It looks like the first issue is standard behavior with conflicting phash and name matches.... It makes users select a match from the UI.