taylorbobaylor / TrailerDownloader

Downloads all missing trailers for movies in your Plex library
GNU General Public License v3.0
40 stars 10 forks source link

Adding File System Watcher #13

Closed CubeComming closed 3 years ago

CubeComming commented 3 years ago

So about the folder watching and automatic trailer downloading...

I do plan to add a file system watcher and have it as a setting where it would automatically download the trailers for new movies you put in your library. I don't have an exact ETA on this unfortunately as work and life have been very slammed at the moment.

Did some research and found this...

https://github.com/Slaterpryce/DirectoryWatcher.js Looks pretty promising to me...

https://www.codeproject.com/Articles/699468/Monitoring-a-Folder-for-Changes-in-Files-and-Folde here a dokumentation...

taylorbobaylor commented 3 years ago

That one will take a little more time and a lot more testing but I'll keep you updated on the progress! 😃

CubeComming commented 3 years ago

Thank you 👍

https://github.com/Thulur/DirectoryWatcher Also found this one which might be easier to implement as it is written in C#. I'm really looking forward to it.

taylorbobaylor commented 3 years ago

Hey! I think I have something working and seems to be flawless on my personal library. Would you mind helping me test this before I merge into the main branch? Can you pull this image and test it out and see if it works for you? Just be sure to check the box for "Auto Trailer Downloads" on the setup page!

Pull this image and let me know what you think! https://hub.docker.com/repository/docker/taylorbobaylor/movie-trailer-downloader-auto-downloads

CubeComming commented 3 years ago

That was fast. Wonderful. Sadly there seem to be some problems...


  1. It seems to be stuck in a loop trying to get infos for "Back in the Future 3":

Logs:

 info: System.Net.Http.HttpClient.Default.LogicalHandler[100]

      Start processing HTTP request GET https://api.themoviedb.org/3/search/movie?language=en-US&query=Back to the Future Part 3 Official Trailer #1 - Christopher Lloyd Movie  HD-other&year=1990 HD-other&api_key=e438e2812f17faa299396505f2b375bb

  info: System.Net.Http.HttpClient.Default.ClientHandler[100]

      Sending HTTP request GET https://api.themoviedb.org/3/search/movie?language=en-US&query=Back to the Future Part 3 Official Trailer #1 - Christopher Lloyd Movie  HD-other&year=1990 HD-other&api_key=e438e2812f17faa299396505f2b375bb

  fail: TrailerDownloader.Services.AutoDownloadService[0]

      Error in AutoDownloadService.StartAutoDownload

  info: System.Net.Http.HttpClient.Default.ClientHandler[101]

      Received HTTP response headers after 123.1651ms - 401

  info: System.Net.Http.HttpClient.Default.LogicalHandler[101]

      End processing HTTP request after 124.4298ms - 401

  info: System.Net.Http.HttpClient.Default.LogicalHandler[100]

       Start processing HTTP request GET https://api.themoviedb.org/3/search/movie?language=en-US&query=Back to the Future Part 3 Official Trailer #1 - Christopher Lloyd Movie  HD-other&year=1990 HD-other&api_key=e438e2812f17faa299396505f2b375bb

  info: System.Net.Http.HttpClient.Default.ClientHandler[100]

       Sending HTTP request GET https://api.themoviedb.org/3/search/movie?language=en-US&query=Back to the Future Part 3 Official Trailer #1 - Christopher Lloyd Movie  HD-other&year=1990 HD-other&api_key=e438e2812f17faa299396505f2b375bb

   info: System.Net.Http.HttpClient.Default.ClientHandler[101]

     Received HTTP response headers after 123.8792ms - 401

  info: System.Net.Http.HttpClient.Default.LogicalHandler[101]

     End processing HTTP request after 124.1207ms - 401

  info: System.Net.Http.HttpClient.Default.LogicalHandler[100]

  1. Then he also seems to be stuck on trying to find a movie for my trash can..

Logs: info: TrailerDownloader.SignalRHubs.MovieHub[0]

      No movie found in directory: '/movies/.recycle'

info: System.Net.Http.HttpClient.Default.ClientHandler[101]

      Received HTTP response headers after 124.8418ms - 401

info: System.Net.Http.HttpClient.Default.LogicalHandler[101]

      End processing HTTP request after 125.6243ms - 401

Over and over again. Maybe just exclude all Folders starting with a "."


  1. And it seems to have some problem getting info for some movies: like here "Man of Steel"

    fail: TrailerDownloader.SignalRHubs.MovieHub[0]

      Error getting movie info for Man of Steel
    
      The request was canceled due to the configured HttpClient.Timeout of 100 seconds elapsing.

Thank you for your hard work and I hope these are easy fixes.

taylorbobaylor commented 3 years ago

Hey! I think is working as expected. The app requires a very specific folder structure and naming convention.

  1. It seems to be stuck in a loop trying to get infos for "Back in the Future 3":

    info: System.Net.Http.HttpClient.Default.LogicalHandler[100]
    
      Start processing HTTP request GET https://api.themoviedb.org/3/search/movie?language=en-US&query=Back to the Future Part 3 Official Trailer #1 - Christopher Lloyd Movie  HD-other&year=1990 HD-other&api_key=e438e2812f17faa299396505f2b375bb
    
    info: System.Net.Http.HttpClient.Default.ClientHandler[100]
    • It looks like you have an already existing trailer in that directory that didn't come from my app and is named differently and it thinks that is the movie and can't find that movie with TMDB API call.
  2. Then he also seems to be stuck on trying to find a movie for my trash can..

    • This is expected as it will scan all directories in your main Movie directory.
  3. And it seems to have some problem getting info for some movies: like here "Man of Steel"

    • Can you provide the folder structure and the names of the directories and the exact name of the movie file?

This honestly all seems to be working as expected. Instead of a file system watcher I'm actually using a polling method and automatically downloading all movie trailers that are missing over and over. It works for my library as all of the trailers already exist so it will only download the trailers for new movies that are put into the main Movie directory.

I hope this helps!

CubeComming commented 3 years ago

Alright so after deleting the trailer from Back to the Future it seems to work perfectly. Fast and correct trailers in seconds. 👍 Man of Steel somehow works now too... But I would still love it if he would ignore folders starting with a ".". And it doesn't remember the setup settings.. Would be perfect if it woud remember these after a restart of the server....

taylorbobaylor commented 3 years ago

Great! 😃

Hahahaha, okay, I'll look into that as well. In the mean time I'd really appreciate it if you can keep testing it out and keep an eye on things before I merge this into the main release!

Thanks and glad you're enjoying the app ❤️

CubeComming commented 3 years ago

Will do :smiley: Thank you

taylorbobaylor commented 3 years ago

That test image should be updated now to ignore hidden directories. Be sure to pull the latest image from docker. Let me know if that works for you!

taylorbobaylor commented 3 years ago

I just updated so you can save the config locally. Be sure to pull the latest image. Put something like this when you are installing the docker container and it should save the config.

-v /path/to/local/config/:/config
CubeComming commented 3 years ago

It works like a charm. 👍 Beautifully done. Thank you very much for your work.

taylorbobaylor commented 3 years ago

Awesome! Glad you're enjoying it 😃