Forum

Full Version: Ability to throttle background processes?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Since the Pi is limited in processing power, it would be helpful if certain background processes could be assigned a lower priority, such as library scanning.

I have thousands of TV episodes and several hundred movies in my collection, and while the Pi is scanning the disks to include them in the library, the CPU is at 70-90% utilization.

Some of this excess overhead is because I'm using NTFS for the drives. I'm going to convert to ext4, but even then, it would be nice to be able to tell the Pi that library scanning takes a back seat to playback.

Unfortunately, since XBMC is monolithic, I can't use available linux tools to control process priority. This is something that would have to be implemented in the code.

Is this something that should be requested of the XBMC devs? In that world, Pi and Android users are the minority, and most users have plenty of processing power to fly through a library update. I fear that asking in that community would result in no action since there are so few of us who would really benefit from that capability.

Ideas?
This is no solution to the library scanner as you can't start and stop it without killing xbmc.....or can you.. (guess it can...maybe belese knows how to do it)
(25th Feb, 2013 02:20 AM)BartOtten Wrote: [ -> ]This is no solution to the library scanner as you can't start and stop it without killing xbmc.....or can you.. (guess it can...maybe belese knows how to do it)

you should be able stop scanning library manually, if im not mistaken Wink
No you can't, only start it.
So, adding the ability to stop the scan is something that would have to be implemented by the XBMC maintainers?

If there was a way to stop and start the scan, or better yet, PAUSE it, we could tweak our screensaver modes to run the scan only when the system is idle.
(25th Feb, 2013 03:38 AM)belese Wrote: [ -> ]No you can't, only start it.

yes you can Wink 100% sure as I just did it
Just start scan your media to library, than when is scanning evoke contextual menu as you are still on the source what you scanning and select Stop scanning
Cool
(25th Feb, 2013 03:41 AM)2twisty Wrote: [ -> ]So, adding the ability to stop the scan is something that would have to be implemented by the XBMC maintainers?

If there was a way to stop and start the scan, or better yet, PAUSE it, we could tweak our screensaver modes to run the scan only when the system is idle.

Start/Stop scan files into library is already in XBMC for some years, read my post above Wink
Sorry misreaded
Yes, you can manually, but not with an xbmc api.
2twisty: could you be so kind to request the api change / feature?
I assume you mean that I should make the request at the XBMC github, right?

https://github.com/xbmc/xbmc/issues/2318
We already have an issue like this on our github.
OK. After I posted this on their github, they told me that they only take bug reports on github and closed it -- they asked that I post it to their forum, instead.

So, here's the link. If you would find this feature useful as an exposed feature in JSON, please pop in an comment so that they know that others would find this useful.

http://forum.xbmc.org/showthread.php?tid=157860
Now i understand what you did Smile Awaiting their response.

As far as i can see in the code this is already supported:
Code:
else if (execute.Equals("updatelibrary") && params.size())
  {
    if (params[0].Equals("music"))
    {
      if (g_application.IsMusicScanning())
        g_application.StopMusicScan();
      else
        g_application.StartMusicScan(params.size() > 1 ? params[1] : "");
    }
    if (params[0].Equals("video"))
    {
      if (g_application.IsVideoScanning())
        g_application.StopVideoScan();
      else
        g_application.StartVideoScan(params.size() > 1 ? params[1] : "");
    }
  }

This part is executed with the updatelibrary function, if will check if a scan is already running and if it isn't starts the scan. If it is it will stop the scan. So you just need to run the updatelibrary function twice i think. Also the core of XBMC has no such thing as pausing the scan and continuing it:

Code:
void Start(const CStdString& strDirectory, int flags);
  void FetchAlbumInfo(const CStdString& strDirectory, bool refresh=false);
  void FetchArtistInfo(const CStdString& strDirectory, bool refresh=false);
  bool IsScanning();
  void Stop();
That might work. So, does IsScanning() return a bool as to the state of scanning?

This function works like the Uncertainty Principle. The act of measuring its state will change its state.

I'd much rather see discrete start and stop commands.

So, is IsScanning() exposed by API? If so, we could use it to measure the state by changing it...but that's not ideal.

Generally, scans are short and only picking up new items, so maybe this is considered an annoyance only during initial scan or a complete library rebuild.
Pages: 1 2
Reference URL's