Giter Club home page Giter Club logo

Comments (13)

m-rots avatar m-rots commented on May 22, 2024

From a code perspective, we send multiple scans to Plex when the path matches multiple libraries:

for _, lib := range libs {
l := t.log.With().
Str("path", scanFolder).
Str("library", lib.Name).
Logger()
l.Trace().Msg("Sending scan request")
if err := t.api.Scan(scanFolder, lib.ID); err != nil {
return err
}
l.Info().Msg("Scan moved to target")
}

Now, what might be the issue is that certain libraries aren't actually being matched. The matching logic occurs here:

func (t target) getScanLibrary(folder string) ([]library, error) {
libraries := make([]library, 0)
for _, l := range t.libraries {
if strings.HasPrefix(folder, l.Path) {
libraries = append(libraries, l)
}
}
if len(libraries) == 0 {
return nil, fmt.Errorf("%v: failed determining libraries", folder)
}
return libraries, nil
}

As you can see, the matcher works by checking whether the path of a library is the prefix of the path that you want to have scanned.

Example

Let's take the following two libraries for an example (note the slash at the end!!):

  • /Media/Movies4k/
  • /Media/Movies/

If Autoscan receives a the path /Media/Movies/Luca (2021), then /Media/Movies/ is part of this path. However, /Media/Movies4k/ is not.

If the scan was for a 4k movie instead, with the path /Media/Movies4k/Luca (2021), then /Media/Movies4k/ is part of this path. However, /Media/Movies/ is not as the slash at the end is missing.

Recommendations

If you want a library containing both directories within Plex, then the /Media/Movies/ and /Media/Movies4k/ paths should be configured within the same library.

I have not heard of others reporting faulty behaviour when it comes down to this, so for now I recommend you to check how your Plex libraries are configured. If you've made changes to your Plex libraries, make sure to restart Autoscan.

from autoscan.

seannymurrs avatar seannymurrs commented on May 22, 2024

I think I understand what you're saying, but I'm going to list out the exact paths of my Movies and TV Shows below (I did a bit of paraphrasing in my original post). Let me know if it should be working with how I have things configured.

For my TV Shows, I have one library that contains the following folders (I copied and pasted the paths directly from the Plex library management web interface):

/home/seannymurrs/gmedia/TV (4K)
/home/seannymurrs/gmedia/TV

I then have another library that only contains /home/seannymurrs/gmedia/TV (this is the library that I share with family members).

For my movies, it's essentially the same. One library contains the following folders:

/home/seannymurrs/gmedia/Movies (4K)
/home/seannymurrs/gmedia/Movies

The second library only contains /home/seannymurrs/gmedia/Movies (which again is the one I share with family members).

What I'm noticing, is more often than not the libraries that contain both my HD and 4k content are being updated while the libraries that only contain the one folder (and excludes the 4k content) does not get updated. As I mentioned in my original post, it seems like it happens more with TV Shows, but I cannot say with 100% certainty that's the case. The few times I have specifically noticed it with TV Shows, it seemed to be when entire seasons (or multiple seasons) were downloaded and added to Plex at once. This is typically because a family member requested that show be added but then asked me why it wasn't showing up for them. I'm not sure if that has anything to do with my issue, but I figured I'd mention it just in case.

from autoscan.

m-rots avatar m-rots commented on May 22, 2024

Please check whether you can gather some logs on the Autoscan side of things. If it's receiving and transmitting scans correctly (as should be visible from the logs), then it might perhaps be a Radarr/Sonarr or Plex issue.

from autoscan.

seannymurrs avatar seannymurrs commented on May 22, 2024

Please check whether you can gather some logs on the Autoscan side of things. If it's receiving and transmitting scans correctly (as should be visible from the logs), then it might perhaps be a Radarr/Sonarr or Plex issue.

I will try and replicate the issue and copy/paste the logs. Is there a way to have Autoscan to log more details than the default level? I see the option if running via Docker, but I have it installed on my Linux-based seed box.

from autoscan.

m-rots avatar m-rots commented on May 22, 2024
./autoscan --verbosity=2

from autoscan.

seannymurrs avatar seannymurrs commented on May 22, 2024

I managed to replicate the issue with a TV Show episode. I started autoscan with the -vv flag (I did it before I saw your reply). The output is below (I removed the No scans are available, retrying in 15 seconds... that repeated every 15 seconds since I'm pretty sure they don't tell you much):

Jun 22 14:16:26 TRC Successful authentication method=POST request_id=c392hulqnu7nlqbspb10 url=/triggers/sonarr
Jun 22 14:16:26 TRC Received JSON body event={"episodeFile":{"RelativePath":"Season 02/The Venture Bros. (2004) - S02E12 - Showdown at Cremation Creek 1 [WEBDL-1080p][8bit][h264][AAC 2.0][FR+EN]-CiELOS.mkv"},"eventType":"Download","renamedEpisodeFiles":null,"series":{"Path":"/home/seannymurrs/gmedia/TV/The Venture Bros. (2004)"}} method=POST request_id=c392hulqnu7nlqbspb10 url=/triggers/sonarr
Jun 22 14:16:26 INF Scan moved to processor event=Download method=POST path="/home/seannymurrs/gmedia/TV/The Venture Bros. (2004)/Season 02" request_id=c392hulqnu7nlqbspb10 url=/triggers/sonarr
Jun 22 14:16:26 DBG Request processed duration=57.623397 method=POST request_id=c392hulqnu7nlqbspb10 status=200 url=/triggers/sonarr
Jun 22 14:26:33�TRC�Sending scan request library="TV Shows" path="/home/seannymurrs/gmedia/TV/The Venture Bros. (2004)/Season 02" target=plex url=http://localhost:XXXXX
Jun 22 14:26:33�INF�Scan moved to target library="TV Shows" path="/home/seannymurrs/gmedia/TV/The Venture Bros. (2004)/Season 02" target=plex url=http://localhost:XXXXX

I also redacted the port # of my Plex server. I don't think having that would compromise my system at all, but I figured it's better to be safe than sorry.

In this case, the new episode showed up in my "TV Shows" library (which contains both the 4k and HD folders) but not my "TV Shows (HD)" library (which only contains /home/seannymurrs/gmedia/TV)

from autoscan.

seannymurrs avatar seannymurrs commented on May 22, 2024

I did a few more controlled tests today, and I feel safe saying that the issue happens consistently with downloaded TV shows but not with movies. Each time I downloaded a movie, the Autoscan logs showed both libraries being targeted and updated. With the T. shows, it was only the library that contained both HD and 4k content that was updated (even though the episode was downloaded to a location that is in both libraries).

I checked the configuration in Sonarr, and everything looks ok (there's not a lot of options to mess up there). I'm at a loss of where to go from here.

from autoscan.

seannymurrs avatar seannymurrs commented on May 22, 2024

Does anyone have any suggestions on how to further diagnose this? I feel confident it isn't an issue with Sonarr since there really aren't enough options there to mess something up. If it isn't an issue with Autoscan, then all I'm left with is something with how my Plex libraries are set up. My first thought would be something with the folder structure, but I'm not sure why that would affect one library but not the other. I compared the settings for both libraries, and they're identical (other than the one having the additional folder for 4k content). I could try removing the 4k content from that library and adding it to the other library (effectively swapping the libraries) to see if that changes which library was updated with Autoscan, but I can't see that actually making a difference. The only other thought I had is that the library with both HD & 4k content (the one that IS updated via Autoscan) was around before the library that contains only HD content. Again, though, I'm not sure why the age of the libraries would affect something like this.

from autoscan.

m-rots avatar m-rots commented on May 22, 2024

I too am not sure what to do at this point. It could very well be a logic error within Autoscan as we currently do not have a test suite in place for the Plex target. However, I currently have no time to debug this issue so for now I unfortunately do have to disappoint you.

from autoscan.

l3uddz avatar l3uddz commented on May 22, 2024

@seannymurrs when you start autoscan, can you also send the log snippets where it pulls in the Plex library paths?

You can search for Retrieved libraries

from autoscan.

seannymurrs avatar seannymurrs commented on May 22, 2024

@seannymurrs when you start autoscan, can you also send the log snippets where it pulls in the Plex library paths?

You can search for Retrieved libraries

So the issue actually seemed to have resolved itself yesterday. I'm guessing it was some sort of issue with the library paths, but I'm still not 100% certain where the problem was. I decided to remove the HD path from my primary library (so I would have one library of only 4k content and one with only HD content) to see if that would get autoscan to trigger the HD library to update. Before I had a chance to fully test it, however, I changed my mind and added the HD content back to the primary library (putting them back where we started). For some reason, though, removing and re-adding that path for the HD content to my primary library caused autoscan to start seeing both libraries when HD content was added.

Again, I'm not sure how that fixed it, but I'm just happy that it seems to be working now.

from autoscan.

l3uddz avatar l3uddz commented on May 22, 2024

@seannymurrs when you start autoscan, can you also send the log snippets where it pulls in the Plex library paths?
You can search for Retrieved libraries

So the issue actually seemed to have resolved itself yesterday. I'm guessing it was some sort of issue with the library paths, but I'm still not 100% certain where the problem was. I decided to remove the HD path from my primary library (so I would have one library of only 4k content and one with only HD content) to see if that would get autoscan to trigger the HD library to update. Before I had a chance to fully test it, however, I changed my mind and added the HD content back to the primary library (putting them back where we started). For some reason, though, removing and re-adding that path for the HD content to my primary library caused autoscan to start seeing both libraries when HD content was added.

Again, I'm not sure how that fixed it, but I'm just happy that it seems to be working now.

Happy to hear.

I think the last time we saw something like this, the user having the issue found that they had an additional space at the end of their path in the associated Plex Library

from autoscan.

seannymurrs avatar seannymurrs commented on May 22, 2024

@seannymurrs when you start autoscan, can you also send the log snippets where it pulls in the Plex library paths?
You can search for Retrieved libraries

So the issue actually seemed to have resolved itself yesterday. I'm guessing it was some sort of issue with the library paths, but I'm still not 100% certain where the problem was. I decided to remove the HD path from my primary library (so I would have one library of only 4k content and one with only HD content) to see if that would get autoscan to trigger the HD library to update. Before I had a chance to fully test it, however, I changed my mind and added the HD content back to the primary library (putting them back where we started). For some reason, though, removing and re-adding that path for the HD content to my primary library caused autoscan to start seeing both libraries when HD content was added.
Again, I'm not sure how that fixed it, but I'm just happy that it seems to be working now.

Happy to hear.

I think the last time we saw something like this, the user having the issue found that they had an additional space at the end of their path in the associated Plex Library

It's possible that was the case, though I did try and check for something like that at one point along the way. I did think I had solved the issue earlier because I noticed the path for my HD library changed seemingly on its own from /home/seannymurrs/gmedia/TV to something starting with /mnt/. It still showed the content correctly, so I'm guessing it had something to do with how my shared seedbox is set up. I fixed the path, however, and still saw the issue. Either way, it's working now, so I'm happy. Thanks for helping me get this resolved.

from autoscan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.