Kodi Community Forum

Full Version: [RELEASE] Library watchdog
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This addon used to work perfectly until I switched my media files from locally connected USB drive to NFS shared from another server. I have not changed the mountpoint, so everything works perfectly fine still, except for the watchdog Sad

I tried switching from auto to polling without success too. Any idea?
(2012-10-13, 14:11)takoi Wrote: [ -> ]
(2012-10-06, 21:45)rabbly Wrote: [ -> ]Hi, just wondering how the delay setting works?
It's the delay between when the event is happening to when the update is done. It's in advanced because you probably don't need it

I wonder if it's possible to change how the delay works. I would prefer if update ist triggert after no file changes were made during delay.
(I'm often change and upload several files over a very slow wifi-connection, so uploading e.g a mp3-file takes several secounds. It even gets worse when an library update triggers after the first file of an whole album is finished)
I get this in my xbmc.log when running in debug mode after I removed the folder "Der Tatortreiniger" from my directory "TV Shows":
Code:
18:17:54 T:140449809405696   ERROR: Exception in thread Thread-10:
                                            Traceback (most recent call last):
                                              File "./Lib/threading.py", line 551, in __bootstrap_inner
                                              File "/storage/.xbmc/addons/service.watchdog/lib/watchdog/observers/api.py", line 191, in run
                                                self.queue_events(self.timeout)
                                              File "/storage/.xbmc/addons/service.watchdog/core/polling.py", line 80, in queue_events
                                                created, deleted, modified = self._snapshot.diff(new_snapshot)
                                              File "/storage/.xbmc/addons/service.watchdog/core/polling.py", line 66, in diff
                                                if self._stat_info[path] != other._stat_info[path]:
                                            KeyError: 'smb://BEN/MASS2/Video/TV Shows/Der Tatortreiniger'

EDIT:
Here the complete log (deleted breaking Bad this time):
http://pastebin.com/MQedRz2Z

Also I noticed that sometimes the plugin omits my folder "TV Shows" according to the log. Switching the scanning depth forth and back and rebooting fixed it.

EDIT2:
It seems the problem that the script omits "TV Shows" happens everytime after the ERROR mentioned before. You can see that also in the log (no more log lines "Using authentication ur" for TV Shows after the ERROR).
Still not working here so had to delete it. Has there been any new updates since a few weeks back?
A suggestion: The addon should obey the checkbox "exclude from scan" that the user can set for sources.
Ok, another issue I encountered (sorry, hopefully the last oneSmile:

When I add a video to my video folder this addon triggers a library update as expected. But the update fails to detect the new video file.

This is how it looks:
Code:
22:38:24 T:139901303514880   DEBUG: service.watchdog: poller: create event appeared in set(['smb://BEN/MASS2/Video/TV Shows/Once Upon A Time/Season 1/tvp-oneupon-s01e16-DELETE_720p.mkv'])
22:38:24 T:139901295122176   DEBUG: service.watchdog: <created> <smb://BEN/MASS2/Video/TV Shows/*>
22:38:28 T:139901714560768   DEBUG: service.watchdog: scanning smb://BEN/MASS2/Video/TV Shows/ (video)

In XBMC the status dialog pops up for one millisecond but then the new episode does not get added. When I however trigger a library update manually in XBMC then it is detected instantly.

I think it is related to the selective video update triggered by the plugin here in main.py:
Code:
def scan(self, library, path):
    """ Tell xbmc to scan. Returns immediately when scanning has started. """
    while self._xbmc_is_busy():
      pass
    log("scanning %s (%s)" % (path, library))
    xbmc.executebuiltin("UpdateLibrary(%s,%s)" % (library, escape_param(path)))

When I change it to
Code:
xbmc.executebuiltin("UpdateLibrary(%s)" % (library))
it works as expected (it takes longer cause it triggers a complete instead of a selective update tho).

So I think its either a bug in XBMC regarding selective library update or the addon does not pass the path correctly to XBMC.

But it looks like XBMC sees the path correctly:
Code:
22:38:28 T:139901714560768   DEBUG: service.watchdog: scanning smb://BEN/MASS2/Video/TV Shows/ (video)
22:38:28 T:139902033319680  NOTICE: Thread CVideoInfoScanner start, auto delete: false
22:38:28 T:139902595012416   DEBUG: ------ Window Init (DialogExtendedProgressBar.xml) ------
22:38:28 T:139902033319680  NOTICE: VideoInfoScanner: Starting scan ..
22:38:28 T:139902033319680   DEBUG: CAnnouncementManager - Announcement: OnScanStarted from xbmc
22:38:28 T:139902033319680   DEBUG: GOT ANNOUNCEMENT, type: 16, from xbmc, message OnScanStarted
22:38:28 T:139902033319680   DEBUG: OpenDir - Using authentication url smb://<mysecret>@BEN/MASS2/Video/TV%20Shows
22:38:28 T:139902033319680  NOTICE: VideoInfoScanner: Finished scan. Scanning for video info took 00:00

This is the complete log:
http://pastebin.com/SKnXMWY1

EDIT:
Ok, seems to be an XBMC bug: http://forum.xbmc.org/showthread.php?tid...id=1384514
I created a script that whenever I plug my HDD It runs a library update.
I run this script always when XBMC starts (I'm using this addon that run scripts after xbmc starts http://forum.xbmc.org/showthread.php?tid=151011).
Its a infinite loop script so everytime I plug my HDD it runs a library update

Is it possible to include this script at Library watchdog and instead of running a library update, starts Library Watchdog and then checks if there's new media and THEN run the library update?

OR add a line on my script to start Library Watchdog service?


Code:
#!/bin/bash
clear
echo "Tailing kern.log: searching for new HDD"
tail -fn0 /tmp/kern.log | while read line ; do
        echo "$line" | grep "kernel: sda: sda1"
        if [ $? = 0 ]
        then
                # Actions
                sleep 3
                curl --data-binary '{ "jsonrpc": "2.0", "method": "VideoLibrary.Scan", "id": "mybash"}' -H 'content-type: application/json;' http://localhost/jsonrpc
        fi
done

Can I change the line "curl --data-binary...." to "bash /home/pi/.xmbc/addons/service.watchdog/service.py" ?

Does library watchdog saves the data (folder/files structure) so If I reboot, it will know that I added new media?
Otherwise my suggestion to include this line above won't work.
Hi,

I'm having an issue where watchdog will update my Movies, but not my TV shows. Looking at the debug logs I see the new TV show detected, but it does not appear in my library. Manually updating the library resolves this problem. I don't understand why it works for Movies, but not for TV Shows. Any ideas?
^^^^^^^^^ Thats what happens with me too mate
(2013-04-03, 01:43)thestealth Wrote: [ -> ]Hi,

I'm having an issue where watchdog will update my Movies, but not my TV shows. Looking at the debug logs I see the new TV show detected, but it does not appear in my library. Manually updating the library resolves this problem. I don't understand why it works for Movies, but not for TV Shows. Any ideas?

Same problem here. Have not found a solution yet.
Guys, assuming we are talking about the same problem, you might try to apply that workaround here: http://forum.xbmc.org/showthread.php?tid...pid1384493

Basically go to your main.py and change line:
Code:
xbmc.executebuiltin("UpdateLibrary(%s,%s)" % (library, escape_param(path)))
to
Code:
xbmc.executebuiltin("UpdateLibrary(%s)" % (library))

For me it worked. Its not a solution but its at least a workaround. The downside is that it triggers a complete library update (as you would do manually) instead of a partial update. So it takes a bit longer.
Firstly, I just wanna thank you for this glorious addon!

Now over to business.
Two days ago, I noticed a huge memory leak in xbmc - also it would crash everytime I exited.
Now I've located the source of the bug in your addon, sorry. :/

As soon as I activate Depth Inf. in polling method for network shares, XBMC will eventually chug 3GB of RAM. I now have it set on Depth 2, and everything works OK.
This happens on both my computers with xbmc. and they are both running Windows 7 with XBMC 12.1 and Watchdog 0.74.

Do you want a debug log?

Cheers,
Valfar.
(2013-03-29, 19:19)devkid Wrote: [ -> ]I get this in my xbmc.log when running in debug mode after I removed the folder "Der Tatortreiniger" from my directory "TV Shows":
Code:
18:17:54 T:140449809405696   ERROR: Exception in thread Thread-10:
                                            Traceback (most recent call last):
                                              File "./Lib/threading.py", line 551, in __bootstrap_inner
                                              File "/storage/.xbmc/addons/service.watchdog/lib/watchdog/observers/api.py", line 191, in run
                                                self.queue_events(self.timeout)
                                              File "/storage/.xbmc/addons/service.watchdog/core/polling.py", line 80, in queue_events
                                                created, deleted, modified = self._snapshot.diff(new_snapshot)
                                              File "/storage/.xbmc/addons/service.watchdog/core/polling.py", line 66, in diff
                                                if self._stat_info[path] != other._stat_info[path]:
                                            KeyError: 'smb://BEN/MASS2/Video/TV Shows/Der Tatortreiniger'

EDIT:
Here the complete log (deleted breaking Bad this time):
http://pastebin.com/MQedRz2Z

Also I noticed that sometimes the plugin omits my folder "TV Shows" according to the log. Switching the scanning depth forth and back and rebooting fixed it.

EDIT2:
It seems the problem that the script omits "TV Shows" happens everytime after the ERROR mentioned before. You can see that also in the log (no more log lines "Using authentication ur" for TV Shows after the ERROR).
What version are you using? That should have been fixed not so long ago.

(2013-04-01, 01:03)devkid Wrote: [ -> ]A suggestion: The addon should obey the checkbox "exclude from scan" that the user can set for sources.
It already does

(2013-04-01, 22:48)devkid Wrote: [ -> ]Ok, another issue I encountered (sorry, hopefully the last oneSmile:

When I add a video to my video folder this addon triggers a library update as expected. But the update fails to detect the new video file.

This is how it looks:
Code:
22:38:24 T:139901303514880   DEBUG: service.watchdog: poller: create event appeared in set(['smb://BEN/MASS2/Video/TV Shows/Once Upon A Time/Season 1/tvp-oneupon-s01e16-DELETE_720p.mkv'])
22:38:24 T:139901295122176   DEBUG: service.watchdog: <created> <smb://BEN/MASS2/Video/TV Shows/*>
22:38:28 T:139901714560768   DEBUG: service.watchdog: scanning smb://BEN/MASS2/Video/TV Shows/ (video)

In XBMC the status dialog pops up for one millisecond but then the new episode does not get added. When I however trigger a library update manually in XBMC then it is detected instantly.

I think it is related to the selective video update triggered by the plugin here in main.py:
Code:
def scan(self, library, path):
    """ Tell xbmc to scan. Returns immediately when scanning has started. """
    while self._xbmc_is_busy():
      pass
    log("scanning %s (%s)" % (path, library))
    xbmc.executebuiltin("UpdateLibrary(%s,%s)" % (library, escape_param(path)))

When I change it to
Code:
xbmc.executebuiltin("UpdateLibrary(%s)" % (library))
it works as expected (it takes longer cause it triggers a complete instead of a selective update tho).

So I think its either a bug in XBMC regarding selective library update or the addon does not pass the path correctly to XBMC.

But it looks like XBMC sees the path correctly:
Code:
22:38:28 T:139901714560768   DEBUG: service.watchdog: scanning smb://BEN/MASS2/Video/TV Shows/ (video)
22:38:28 T:139902033319680  NOTICE: Thread CVideoInfoScanner start, auto delete: false
22:38:28 T:139902595012416   DEBUG: ------ Window Init (DialogExtendedProgressBar.xml) ------
22:38:28 T:139902033319680  NOTICE: VideoInfoScanner: Starting scan ..
22:38:28 T:139902033319680   DEBUG: CAnnouncementManager - Announcement: OnScanStarted from xbmc
22:38:28 T:139902033319680   DEBUG: GOT ANNOUNCEMENT, type: 16, from xbmc, message OnScanStarted
22:38:28 T:139902033319680   DEBUG: OpenDir - Using authentication url smb://<mysecret>@BEN/MASS2/Video/TV%20Shows
22:38:28 T:139902033319680  NOTICE: VideoInfoScanner: Finished scan. Scanning for video info took 00:00

This is the complete log:
http://pastebin.com/SKnXMWY1

EDIT:
Ok, seems to be an XBMC bug: http://forum.xbmc.org/showthread.php?tid...id=1384514
Since you're the only one providing log I'll assume all of you have the same directory layout as detailed here: http://forum.xbmc.org/showthread.php?tid...pid1387760 So another workaround wold be to not use that kind of layout.

(2013-04-08, 15:49)valfy Wrote: [ -> ]Firstly, I just wanna thank you for this glorious addon!

Now over to business.
Two days ago, I noticed a huge memory leak in xbmc - also it would crash everytime I exited.
Now I've located the source of the bug in your addon, sorry. :/

As soon as I activate Depth Inf. in polling method for network shares, XBMC will eventually chug 3GB of RAM. I now have it set on Depth 2, and everything works OK.
This happens on both my computers with xbmc. and they are both running Windows 7 with XBMC 12.1 and Watchdog 0.74.

Do you want a debug log?

Cheers,
Valfar.
Known issue. http://forum.xbmc.org/showthread.php?tid=157233 But it's not the addon that's leaking, it's xbmc.
Watchdog doesnt even work for me. I've sent you logs before. It scans and works with movies folder and music folder but not tv shows
Did you read what I linked to?