all right guys and welcome back to another ibra corp video thanks for popping in with us today
glad to have you here today i've got something a little bit new for you may not have heard of
it not much information out there about it but i think it's a pretty useful tool to help integrate
with our existing setups including our hard link videos and our media server videos so
if you haven't watched our hard link videos i always recommend you check that out it's
really useful it really helps with the impact on your system when it comes to
all the media automation tools including plex so today this video will work hand in hand with that
and we're going to be looking at auto scan so what is auto scan so as it says here auto
scan replaces the default plex and envy behavior for picking up file changes on the file system
it integrates with sonar radar lidar and google drive to fetch changes in near real time without
relying on the file system and if you're a user of plex you're probably aware that sometimes it can
get quite annoying when you make changes on the file system and then a massive scan gets triggered
basically putting heaps of load onto your server and onto your systems there so the beauty of this
application is it will actually cue the scans and it will check for changes in real time
and apply the scan to that folder only so that plex doesn't have to go looking through the
entire library and triggering a massive scan which is unnecessary so before i start i would like to
take a quick second here just to thank all the people that support us financially over on the
ibracorp website ibracorptoio as well as all of my moderators and community members in the
discord who have been helping immensely with other users questions and giving suggestions and today
a specific shout out to our member hawks who has provided heaps of input to the community him and
this duck both of them have been really great in helping our members get more information out there
and answer their questions that i may not be able to answer all the time so today hawks actually
wrote up a lot of the instructions for this video and so we're going to be walking through and using
some of his templates if this sounds interesting and you want to cut down the load on your server
and improve the performance with your scans this is the video for you so let's get into it
all right guys so we're here on the github page for the developer who's created this
we'll scroll up of course we've got to give credit to cloud box cloudbox is the developer
on the github cloud box slash auto scan is their repository and they've done a lot of work with
this which is really fantastic i did see that there was a previous version as you can see
there was one called plex auto scan auto scan is a rewrite of the original plex auto scan
written in the go language in addition this rewrite introduces a more modular approach
should be easy to extend in the future so we're going to be going with this version today and
it's obviously been recently updated whereas the other one i don't think it has last i checked but
i'm going to simplify it for you so that we can have a better understanding of how this all works
together so the first thing we'll do is jump into your unraid server and today we're going to be
using our live environment zeus and the reason why is because this is a more established server it's
going to make a lot more sense using these sort of tools because it's already assuming that you've
set up basics of having a plex server sonar radar etc so first thing you want to do head over to the
app store in the app store we're going to look up auto scan here we've got hot io's repository
great developer i've already mentioned him a few times for his work on different applications so
he currently is the only one on here with this anyway so big thank you to him for his work
on this once you've got this up pretty much just go ahead and click to install and go to default
now it's a pretty basic template there's nothing too much that we have to change but i am going to
add a couple of things here so the first thing we'll do expand everything just to make sure
we can see it all you see you've got the slash config now if you're using the default app data
location that works fine you can just leave it as that the plex login obviously use your login for
plex so i'll go ahead and put mine in at the end under the network type i'll set it to our custom
network type we're also going to add two fields so we're going to go ahead under here and click on
add in the container path we're going to put data and under the host path we're going to put
the user slash data slash media now this is us using our hard linking video to understand how
our mappings are working so basically we've got everything living under this data slash media
folder okay and that allows our hard links to work and function correctly so again if you haven't
seen that video please check that one out on our channel because it will make a lot more sense to
have everything unified and this is our preferred method here at ibracorp other channels might do
it differently but i can guarantee you that once you go to this method you won't really go back
so once we've got that there we can just go ahead and click add the other thing we're going to add
is a port so under here under add again we're just going to go port you can just call that port
and the default port that these operate on will be 30 30 so we'll put 30 30 twice in there so
we've got the port 30 30 30 30 again go ahead and click add and there you go so now i'll put in my
plex details you'll do the same so put your email address and your password here for plex and then
once you're done just go ahead and click apply so we've clicked apply now we're just going to wait
for it to install now we'll click done so open up your file browser and we'll head down to the
app data location where the configuration should have been created so we're in our network share
for zeus and we can see the appdata folder and the auto scan folder that's been created so open
that up and you'll notice here it's got a plex token and some other auto scan and configuration
information so that token didn't exist previously and the reason why it's been created is because we
put our username and password in the template for plex so then it's gone and created this for us and
pulled the token down so what you'll need to do is open up this config.yml now there's two ways
i recommend you can do this one is using something like notepad plus plus the other is using visual
studio and the reason why is because those two apps will help you see it in the correct format
if you have an incorrect spacing or anything like that it basically breaks these files so guys i
recommend using a specialist tool for that not just notepad so once you've got that we can right
click it and go either open or edit with notepad plus plus i'm going to go with plus plus today
and here's our configuration file so all of our work is going to be done in this file today
so what i'll do is just uh based on some feedback you guys have given me i'm just going to zoom up a
little bit those watching on mobile hopefully this makes it a bit easier for you to see
so this is pretty much empty there's nothing in here so there's nothing actually working
and that's perfectly fine so what we're going to do is start filling it out now lucky for you guys
i have a template here already written up working with hawks and thanks to his suggestions here
it's going to make it a lot easier to get this going so it's not going to make a lot of sense
but what we'll do is we'll just copy everything in here pretty much and i'll walk you through it
and we'll start right at the top so minimum age auto scan does not check whether scan requests
received by triggers exist on the file system therefore to make sure a file exists before it
reaches the target we need to set a minimum age the minimum age delays the scan from being sent to
the targets after it has been added to the queue by a trigger the default minimum age is set at 10
minutes to prevent common synchronization issues so here i've got at 2 minutes 30 seconds you can
set that pretty much at whatever you like you know in my case today i'll set it at five minutes so
to do that we have to put a five followed by m for minutes there you go scan delay pretty
self-explanatory if you want to delay the scan by how long we can set that timing here as well so
we've got that set to 15 seconds scan stats and that's basically if you're looking at the logs
it will actually print out a statistics or what's happening with the scans at a certain interval so
at the moment it's set to every 30 minutes and every 30 minutes it will say how many
scans are waiting and how many are queued and things like that so that's just a little bit
of housekeeping stuff that's up to you what your personal preference is i find these values work
okay as well authentication so this will come in later when we connect it to sonar and radar
and that basically allows you to have an authentication on the url request you're going to
make that a lot more secure then we have anchors so i'll explain to you anchors really quickly here
so to prevent the processor from calling targets when a remote mount is offline we
can define a list of so-called anchor files these anchor files do not have any special properties
and often have no content however they can be used to check whether a file exists on the file system
if the file does not exist and you have not made any changes to the file then it is certain that
the remote mount must be offline or the software is having problems so when an anchor file is
unavailable the processor will halt its operations until the file is back online so it just gives it
a way to check that that location is available and online before it tries to make any changes
so we're going to head back to zeus to be able to create these anchor files and
this is going to be the quickest way to do it here in unraid so we've got this command here
make directory going to the user data media makes this file and creator in that location
it's worth noting again that this is assuming you have set up your setup like our hard linking
video so these file locations this directory is matching that video setup if you have a different
one for your media maybe it's called user slash automation slash media then you need to update
this but this is ours so we're just going to go ahead and copy that head back to your server and
in the top right we can open up a terminal window pop the terminal window right click and paste so
now we've got that directory there looks good go ahead and click enter that's pretty much it so
if i was to open up the file explorer and we try to go to that location which is user slash data
that's our share there media and there's our anchor so that's our anchor location there
set up and ready to go so if we go back to our configuration file it's referencing the
right location now so we're happy with that we can move on to the next step the port is 30 30
and we already preemptively set that up when we created the template so that's perfectly fine too
obviously if 3030 is not available for you make sure you update it so then comes the triggers so
triggers are pretty much the input that auto scan gets they translate incoming data into
a common data format called the scan and auto scan supports two kinds of triggers they support
daemon processes which are triggers run in the background and fetch resources based on a cron
schedule then there's web hooks these triggers expose http handlers which can be added to the
trigger software so in our case that's obviously sonar and radar and we're going to go with the
webhook option that's our route directory for our media so we want it to look there for any changes
under the paths we've got slash media slash movies and slash media tv so obviously for radar that's
where our location is and that's where it is for sona so we want to make sure that that's correct
so in here we're saying include that here for the scan and here's the paths that we want you to keep
an eye on for the targets then we have plex but this doesn't just work for plex so we've got plex
nb jellyfin they're the three that they've got listed and so you would configure these similar
with a couple of differences if you are using anything except for plex which is what we're
covering today if you want to use it for gel if you're not mb then i recommend looking at the auto
scan github page just to make sure you get all the right variables but this is assuming you're going
to do it for plex so we're nearly there pretty much and it's nearly set up so basically url
obviously the url of your plex instance now this can be both your internal address or the external
address if you want to go out and come back through the reverse proxy so then there's the
last thing we need to put into this file which is the plex token pretty straightforward to get that
the first thing we need to do is head to plex so once you're in plex open up a piece of media on
your library go to more and go to get info under here you'll see view xml go ahead and click that
and in the top url bar if we go all the way to the right you'll see a code here called plex token
copy the plex token from the url bar and bring it back here into your config file once you've
done that you can go ahead and click save and just scrolling through the file one last time we
can see that everything looks pretty good the next part we have to do now is connect it to sony radar
and then make one setting change in plex so now we're in sonar go ahead and go to settings
under settings go to connect hit the plus icon select webhook in the webhook name we'll just
give it a name that obviously works for you so i'm just going to use autoscan so we only want
import and upgrade we'll untick the other two and we'll also click on series delete and episode file
delete as well as well as this one here which is delete for upgrade so as you can see in this
case because i have auto scan on the same custom docker network i can just refer to it by auto scan
i don't need to have the full ip address we've then got the port number which we configured
so then there's this other part that we need to add as well so with forward slash triggers
forward slash the name of the trigger now if you're not sure what that is if we go back to
the configuration file real quick the name is this part here that's being referenced and this is so
that we don't have duplicates of the same trigger so if you were to rename this to something else
then that would be the one you used at the end of the url so in this case we've called it sonar
and if we go back to sonar we need to make sure we've got forward slash triggers forward slash
sonar the method is post and the username and password is obviously what we've configured in the
top of the file here that way we can authenticate all the transactions that are happening through
go ahead and click test i just had another look there on the documentation and we can actually
support rename as well so we'll go ahead and click rename and then for the sonar we'll go
series delete episode delete we'll untick this one so basically you've got on import on upgrade
rename series delete and episode file delete once you've done that we can test it one last time go
ahead and click save you might be wondering whether that's actually works if we open that
up and we click test go back to your docker check the logs for auto scan and as you can
see in the logs for auto scan we can see the test event come through so that's good that means it's
communicating fine obviously sonar will tell you if it can't communicate as well so we're happy
with that we can just leave it as it's pretty much now repeat the same steps and do the same thing
with radar so i'll go ahead and do that and cut to it for you now guys if you get in this situation
i will just add that i missed a important step so we made the changes on our configuration file
as you can see here but we haven't restarted the container so that it picks up these new
changes so we'll need to go back to to the docker list and we'll just restart the container here
that way you can pull all the settings that we've just set up and then you should be able to test
things again and it will work so once we've done that we can click save and now we've pretty much
set up sonar and radar that part is now complete so there's one more step that we'll need to do
and that's in plex so auto scan replaces plex's default behavior of updating the plex library
automatically therefore it is advised to turn off plexus update my library automatically
feature so if we go into your settings for plex and head over down to library here
and what we'll do is uncheck scan my library automatically so that way we don't want it to
do the scans for us now to be honest with you guys i'm not sure whether the second option
of run a partial scan when changes are detected is necessary or not now because we're supposed to
be replacing this automatic scan feature i i'm thinking that we probably don't need that the
instructions for the auto scan application don't explicitly say anything about this so i'm going to
untick it because it kind of to me sounds like it probably shouldn't be running and on top of
that the scan periodically also could be an issue too so we're going to uncheck that one as well
and we'll go ahead and click save in theory the idea is that now that we've done that it should
only scan one location and still trigger a scan in plex so what we'll have to do is actually request
something and see whether it works so we'll go over here and we'll just add something real quick
so we've just added some content and we're going to wait for that to process so we'll keep the logs
open and we'll just keep an eye on it and we'll see what happens once this is finished processing
this way we can see all three areas so we can see if plex starts doing anything
whether radar starts doing anything and whether auto scan does its thing as well
okay our file is just about done so we're about to see what happens now once this
is finished the imports happened there we go we've just seen the trigger on auto scan run
scan has been moved trigger has been executed so it's gone to the folder so that's good that means
that the communication between radar and auto scan is good it's picked it up on the actual file
server okay we can start seeing our first issue now which is that it's telling us the anchor file
is unavailable so just looking back in our file here okay that is a mistake on my behalf in the
code that we used here as you can see so we've actually we've got it as dot anchor rather than
anchors which is what's written here so that is my mistake my apologies so if we save that
and we'll go ahead and restart the container that should then find the correct location
all right guys so i found the issue on why it's not finding the anchor file and if we go back to
basics here we're looking at the template we can see that i've mapped the datus to the data slash
media folder so what we've done is we've said that the hostpath media is referred to as
data now that's not actually correct so what we want to do is actually remap that
and we'll take the media part out so that it's mapping to the data on the top level as well
so go ahead and click apply and then it should find our anchor file this time
and there we go that's that was the issue so that was my mistake guys now that we've had a
chance to actually look at it in practice i might even drop that down back to the 2 minutes and 30
seconds marker because it did take quite a while to kick in which we probably don't need and i'll
set the scan stats to probably 15 minutes just so we can be aware of what's happening a little bit
more regularly as well always remember any changes you make to a configuration file you restart the
container so it picks up those new changes also if you're not aware be sure to set the container to
auto start and use this arrow on the right hand corner here to move it into the startup order
you would like it to be so something like auto scan i probably want it to kick off prior to plex
which is all the way down here so i can move that so i can move that to probably around where jacket
is and be happy with that now if you wanted it to have a delay remember to click advanced view
and you can set in seconds how long you want it to wait plenty of other docker tips in our
docker tips and tricks video as well but that is pretty much how to help control your plex
scanning capabilities with auto scan i hope that was helpful guys be sure to tune in with us soon
please remember to like and subscribe it really helps the channel out i really appreciate you
guys another big thanks to everyone who supports us on our website whether it's just by membership
or financially anything you do to help is always appreciated so thank you very much be sure to join
our discord if you're interested where you can post your requests and help out other members
of the community glad to have you on board and we'll see you in the next hibricorp video
you