The branch, frodo has been updated
via 7738e5b6ba0c2a03995109cbf0832a16284bd109 (commit)
from bee54b02f2b47b2f2ce4390ed2d1bd2d1e498c01 (commit)
- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=7738e5b6ba0c2a03995109cbf0832a16284bd109
commit 7738e5b6ba0c2a03995109cbf0832a16284bd109
Author: ronie <[email protected]>
Date: Mon Mar 11 21:02:21 2013 +0100
[service.watchdog] -v0.7.3
diff --git a/service.watchdog/addon.xml b/service.watchdog/addon.xml
index ac8c9f2..3dc00ed 100644
--- a/service.watchdog/addon.xml
+++ b/service.watchdog/addon.xml
@@ -2,7 +2,7 @@
<addon
id="service.watchdog"
name="Watchdog"
- version="0.7.2"
+ version="0.7.3"
provider-name="takoi">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
@@ -12,7 +12,10 @@
<extension point="xbmc.python.script" library="script.py"/>
<extension point="xbmc.addon.metadata">
<platform>all</platform>
- <summary>Keep library synced with file system</summary>
- <description>This service will automatically update the video and music
library when new files are added or removed from a media source. Update is
instant.</description>
+ <language/>
+ <summary lang="en">Keep library synced with file system</summary>
+ <summary lang="fr">Maintient les médiathèques synchonisée avec le
système de fichiers</summary>
+ <description lang="en">This service will automatically update the video
and music library when new files are added or removed from a media source.
Update is instant.</description>
+ <description lang="fr">Ce service met automatiquement à jour les
médiathèques vidéo et musique lorsque des nouveaux fichiers sont ajoutés ou
supprimés d'une source. La mise à jour est instantannée.</description>
</extension>
</addon>
diff --git a/service.watchdog/changelog.txt b/service.watchdog/changelog.txt
index 55df404..e01ce3f 100644
--- a/service.watchdog/changelog.txt
+++ b/service.watchdog/changelog.txt
@@ -1,3 +1,9 @@
+[B]0.7.3[/B]
+- added French translation
+- now tries to not scan when when non-media files are added
+- fixed: scanning sometimes failing due to reserved characters not being
escaped
+- fixed: poller (depth 2) sometimes failing when files are added
+
[B]0.7.2[/B]
- added option for disabling pause on playback
- other minor tweaks
diff --git a/service.watchdog/core/main.py b/service.watchdog/core/main.py
index b2a2fcf..6ff7510 100644
--- a/service.watchdog/core/main.py
+++ b/service.watchdog/core/main.py
@@ -54,7 +54,7 @@ class XBMCActor(pykka.ThreadingActor):
while self._xbmc_is_busy():
pass
log("scanning %s (%s)" % (path, library))
- xbmc.executebuiltin("UpdateLibrary(%s,\"%s\")" % (library, path))
+ xbmc.executebuiltin("UpdateLibrary(%s,%s)" % (library, escape_param(path)))
def clean(self, library, path=None):
""" Tell xbmc to clean. Returns immediately when scanning has started. """
@@ -120,23 +120,29 @@ class EventHandler(FileSystemEventHandler):
self.event_queue = event_queue
def on_created(self, event):
- self.event_queue.scan()
+ if not self._can_skip(event, event.src_path):
+ self.event_queue.scan()
def on_deleted(self, event):
- if CLEAN:
- if not event.is_directory:
- _, ext = os.path.splitext(str(event.src_path))
- if EXTENSIONS.find('|%s|' % ext) == -1:
- return
+ if CLEAN and not self._can_skip(event, event.src_path):
self.event_queue.clean()
def on_moved(self, event):
- if CLEAN:
+ if CLEAN and not self._can_skip(event, event.src_path):
self.event_queue.clean()
- self.event_queue.scan()
+ if not self._can_skip(event, event.dest_path):
+ self.event_queue.scan()
def on_any_event(self, event):
- log("<%s> <%s>" % (str(event.event_type), str(event.src_path)))
+ log("<%s> <%s>" % (event.event_type, event.src_path))
+
+ def _can_skip(self, event, path):
+ if not event.is_directory and path:
+ _, ext = os.path.splitext(path)
+ if EXTENSIONS.find('|%s|' % ext) == -1:
+ log("skipping <%s> <%s>" % (event.event_type, path))
+ return True
+ return False
def get_media_sources(type):
@@ -157,12 +163,16 @@ def get_media_sources(type):
ret.append(path)
return ret
+def escape_param(s):
+ escaped = s.replace('\\', '\\\\').replace('"', '\\"')
+ return '"' + escaped.encode('utf-8') + '"'
+
def log(msg):
- xbmc.log("%s: %s" % (ADDON_ID, msg), xbmc.LOGDEBUG)
+ xbmc.log("%s: %s" % (ADDON_ID, msg.encode('utf-8')), xbmc.LOGDEBUG)
def notify(msg):
if SHOW_NOTIFICATIONS:
- xbmc.executebuiltin("XBMC.Notification(Library Watchdog,\"%s\")" % msg)
+ xbmc.executebuiltin("XBMC.Notification(Library Watchdog,%s)" %
escape_param(msg))
def select_observer(path):
import observers
@@ -180,7 +190,6 @@ def watch(library, xbmc_actor):
sources = get_media_sources(library)
log("%s sources %s" % (library, sources))
for path in sources:
- path = path.encode('utf-8')
observer_cls = select_observer(path)
if observer_cls:
try:
diff --git a/service.watchdog/core/polling.py b/service.watchdog/core/polling.py
index 8d44c7b..7107e55 100644
--- a/service.watchdog/core/polling.py
+++ b/service.watchdog/core/polling.py
@@ -62,7 +62,7 @@ class SnapshotWithStat(PathSnapsot):
def diff(self, other):
created, deleted = self.path_diff(other)
modified = []
- for path in set(self._stat_info) - deleted:
+ for path in set(self._stat_info) - deleted - created:
if self._stat_info[path] != other._stat_info[path]:
modified.append(path)
return created, deleted, modified
diff --git a/service.watchdog/core/polling_xbmc.py
b/service.watchdog/core/polling_xbmc.py
index ea2e0c0..8ceb08d 100644
--- a/service.watchdog/core/polling_xbmc.py
+++ b/service.watchdog/core/polling_xbmc.py
@@ -18,10 +18,10 @@ from functools import partial
from polling import *
def _join_path(base, lst):
- return [ os.path.join(base, _) for _ in lst if not hidden(_) ]
+ return [ os.path.join(base, _.decode('utf-8')) for _ in lst if not hidden(_)
]
def _walker_recursive(top):
- dirs, files = xbmcvfs.listdir(top)
+ dirs, files = xbmcvfs.listdir(top) #returns utf-8 encoded str
dirs = _join_path(top, dirs)
files = _join_path(top, files)
yield dirs, files
@@ -30,7 +30,7 @@ def _walker_recursive(top):
yield dirs, files
def _walker_depth_1(top):
- dirs, files = xbmcvfs.listdir(top)
+ dirs, files = xbmcvfs.listdir(top) #returns utf-8 encoded str
yield _join_path(top, dirs), _join_path(top, files)
def _get_mtime(path):
diff --git a/service.watchdog/icon.png b/service.watchdog/icon.png
index 84d6975..d5568a1 100644
Binary files a/service.watchdog/icon.png and b/service.watchdog/icon.png differ
diff --git a/service.watchdog/lib/watchdog/observers/inotify.py
b/service.watchdog/lib/watchdog/observers/inotify.py
index 3a9b8e0..617f8d2 100644
--- a/service.watchdog/lib/watchdog/observers/inotify.py
+++ b/service.watchdog/lib/watchdog/observers/inotify.py
@@ -651,7 +651,7 @@ if platform.is_linux():
Event bit mask.
"""
wd = inotify_add_watch(self._inotify_fd,
- path,
+ path.encode('utf-8'),
mask)
if wd == -1:
Inotify._raise_error()
@@ -714,7 +714,7 @@ if platform.is_linux():
while i + 16 < len(event_buffer):
wd, mask, cookie, length =\
struct.unpack_from('iIII', event_buffer, i)
- name = event_buffer[i + 16:i + 16 + length].rstrip('\0')
+ name = event_buffer[i + 16:i + 16 +
length].rstrip('\0').decode('utf-8')
i += 16 + length
yield wd, mask, cookie, name
-----------------------------------------------------------------------
Summary of changes:
service.watchdog/addon.xml | 9 +++--
service.watchdog/changelog.txt | 6 +++
service.watchdog/core/main.py | 35 ++++++++++++-------
service.watchdog/core/polling.py | 2 +-
service.watchdog/core/polling_xbmc.py | 6 ++--
service.watchdog/icon.png | Bin 19896 -> 19946 bytes
service.watchdog/lib/watchdog/observers/inotify.py | 4 +-
.../resources/language/French/strings.xml | 19 +++++++++++
8 files changed, 59 insertions(+), 22 deletions(-)
create mode 100644 service.watchdog/resources/language/French/strings.xml
hooks/post-receive
--
Scripts
------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
endpoint security space. For insight on selecting the right partner to
tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons