MediaElch icon indicating copy to clipboard operation
MediaElch copied to clipboard

Automatic scrap for multiple files doesn't work

Open Axolotl-13 opened this issue 4 years ago • 2 comments

Describe the bug I want to search for images for many MKV files. So I do a batch search, but MediaElch is unable to search by itself on the image providers. Why ? Because he does not know how to search using a title of the type "film_name (year) residual_text". Let me explain... My MKVs are named like this: "film_name (year) - director - rip language [video, audio]", for example: "Gone girl (2014) - David Fincher - VF-VO+ST BDrip [x265 1080p, AC3 5.1]". But, despite numerous additions in "Words to exclude", there is still some text after "(year)" (at least the director's name), which blocks the search. So I have to make a file by file request after manually deleting this text, which is much longer.

To Reproduce Steps to reproduce the behavior:

  1. Select multiple files
  2. Click on 'Scrap.'
  3. Click on 'Start scraping.'
  4. Click on 'Close.'

Expected behavior Any result returns.

Screenshots Impossible to upload screenshots: Error message: "Something went really wrong, and we can’t process that file. Try again"

If applicable, add screenshots to help explain your problem.

MediaElch Version:

  • [ ] 2.6.7-dev (nightly)
  • [x] 2.6.6 stable

Operating System:

  • [x] Windows
  • [ ] macOS
  • [ ] Linux (distribution: .)

Additional context Add any other context about the problem here.

Axolotl-13 avatar Apr 20 '20 11:04 Axolotl-13

I have the same problem. In my Linux install I fixed it with the following, pretty minimal, patch:

diff --cc src/scrapers/movie/TMDb.cpp
index 2ef0884e,50ec9c09..00000000
--- a/src/scrapers/movie/TMDb.cpp
+++ b/src/scrapers/movie/TMDb.cpp
@@@ -397,7 -359,20 +397,24 @@@ void TMDb::searchFinished(
      reply->deleteLater();

      if (nextPage == -1) {
++<<<<<<< Updated upstream
 +        emit searchDone(results, {});
++=======
+
+         // Fallback: if no results, remove last word and try again...
+         if (results.size() == 0)
+         {
+             int pos = searchString.lastIndexOf(QChar(' '));
+             if (pos != -1)
+             {
+                 searchString = searchString.left(pos);
+                 search(searchString);
+                 return;
+             }
+         }
+
+         emit searchDone(results);
++>>>>>>> Stashed changes
      } else {
          QString nextPageStr{QString::number(nextPage)};
          const QUrl url = [&]() {

Essentially whenever a search fails it removes the last word from the name and tries again, until there is nothing left. Given that it only accepts a search result if there is a single result it's pretty safe, if too much is removed there will be more than one result and it will not be accepted.

It's not super robust, given that it increases the lookup frequency, sometimes it runs into traffic limitations on the DBs, so it would be better to add some stepback handling, but it simplifies the movie handling process pretty significantly.

I would love to see this in an official version so that I can use it on Windows, too (I won't try compiling on Windows myself, too much trouble ;).

RandomNameUser avatar May 03 '20 01:05 RandomNameUser

@Axolotl-13 Thank you for this report. :-) Ok, so film_name (year) - director - rip language [video, audio] is indeed rather long. I've never seen a user have any useful string after the year. It may make sense to strip everything after it.

While the approach from @RandomNameUser may not be perfect, something similar may be. I'll look into it.

I would love to see this in an official version so that I can use it on Windows, too (I won't try compiling on Windows myself, too much trouble ;).

If you know how to use Docker, I've created a docker image which I'm using to compile MediaElch for Windows using mxe. :-) See https://github.com/Komet/MediaElch/tree/master/travis-ci/docker#windows-mxe

bugwelle avatar May 10 '20 17:05 bugwelle