diff --git a/changelog.txt b/changelog.txt
index a7b9b2b9..cfcfe79a 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -4,6 +4,7 @@ v12.1.00 (future)
- Vastly improve scanning speed
- Use Gotham specific features
- Update to fanart.tv API v3
+- Add option to exclude folders from scanning
v12.0.28
- Don't set simplejson module to optional
diff --git a/lib/media_setup.py b/lib/media_setup.py
index 62d9915b..99df1b3e 100644
--- a/lib/media_setup.py
+++ b/lib/media_setup.py
@@ -32,6 +32,8 @@
### import libraries
from lib.utils import log
+from lib.settings import get
+setting = get()
### get datalist from the unique media item
# Retrieve JSON list
@@ -121,6 +123,8 @@ def _media_listing(media_type):
jsonobject = simplejson.loads(json_query)
if jsonobject.has_key('result') and jsonobject['result'].has_key('tvshows'):
for item in jsonobject['result']['tvshows']:
+ if media_excluded(item.get('file','').encode('utf-8')): # exclude tvshow from listing if it is in excluded folder
+ continue
# Search for season information
json_query_season = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetSeasons", "params": {"properties": ["season", "art"], "sort": { "method": "label" }, "tvshowid":%s }, "id": 1}' %item.get('tvshowid',''))
jsonobject_season = simplejson.loads(json_query_season)
@@ -152,6 +156,8 @@ def _media_listing(media_type):
jsonobject = simplejson.loads(json_query)
if jsonobject.has_key('result') and jsonobject['result'].has_key('movies'):
for item in jsonobject['result']['movies']:
+ if media_excluded(item.get('file','').encode('utf-8')): # exclude movie from listing if file is in excluded folder
+ continue
imdbnumber = item.get('imdbnumber','')
if imdbnumber in ['','tt0000000','0']:
from lib.provider import tmdb # import on behalf of searching when there's no ID
@@ -177,6 +183,8 @@ def _media_listing(media_type):
jsonobject = simplejson.loads(json_query)
if jsonobject.has_key('result') and jsonobject['result'].has_key('musicvideos'):
for item in jsonobject['result']['musicvideos']:
+ if media_excluded(item.get('file','').encode('utf-8')): # exclude video from listing if file is in excluded folder
+ continue
Medialist.append({'dbid': item.get('musicvideoid',''),
'id': '',
'name': item.get('label',''),
@@ -212,6 +220,28 @@ def media_disctype(filename, streamdetails):
disctype = 'n/a'
return disctype
+# returns True if media file meets exclusion settings
+def media_excluded(filename):
+ global setting
+ excludedpath = setting['folder_exclude_path']
+ excludedpath2 = setting['folder_exclude_path2']
+ excludedpath3 = setting['folder_exclude_path3']
+ excludeoption = setting['folder_exclude_option']
+ excludeoption2 = setting['folder_exclude_option2']
+ excludeoption3 = setting['folder_exclude_option3']
+ if excludeoption:
+ if excludedpath != "" and filename.find(excludedpath) > -1:
+ return True
+ # only check excludeoption2, if first one was enabled as well
+ if excludeoption2:
+ if excludedpath2 != "" and filename.find(excludedpath2) > -1:
+ return True
+ #only check excludeoption3, if second one was enabled as well
+ if excludeoption3:
+ if excludedpath3 != "" and filename.find(excludedpath3) > -1:
+ return True
+ return False
+
def base_name(base):
base = ntpath.basename(base)
base = os.path.splitext(base)[0]
diff --git a/lib/settings.py b/lib/settings.py
index e8c22514..ef9837b8 100644
--- a/lib/settings.py
+++ b/lib/settings.py
@@ -82,7 +82,14 @@ def get():
'musicvideo_extrathumbs': __addon__.getSetting("musicvideo_extrathumbs")== 'true',
'musicvideo_logo': __addon__.getSetting("musicvideo_logo") == 'true',
'musicvideo_clearart': __addon__.getSetting("musicvideo_clearart") == 'true',
- 'musicvideo_discart': __addon__.getSetting("musicvideo_discart") == 'true'}
+ 'musicvideo_discart': __addon__.getSetting("musicvideo_discart") == 'true',
+
+ 'folder_exclude_option': __addon__.getSetting("folder_exclude_option").lower() == 'true',
+ 'folder_exclude_path': __addon__.getSetting("folder_exclude_path"),
+ 'folder_exclude_option2': __addon__.getSetting("folder_exclude_option2").lower() == 'true',
+ 'folder_exclude_path2': __addon__.getSetting("folder_exclude_path2"),
+ 'folder_exclude_option3': __addon__.getSetting("folder_exclude_option3").lower() == 'true',
+ 'folder_exclude_path3': __addon__.getSetting("folder_exclude_path3")}
return setting
def get_limit():
diff --git a/resources/language/English/strings.po b/resources/language/English/strings.po
index 222cdeea..329f493d 100644
--- a/resources/language/English/strings.po
+++ b/resources/language/English/strings.po
@@ -263,7 +263,7 @@ msgid "[B]Options for downloading Musicvideo artwork[/B]"
msgstr ""
#empty strings from id 32093 to 32100
-#Add-on settings: Advanced settings section id=32101 to 32020
+#Add-on settings: Advanced settings section id=32101 to 32120
msgctxt "#32101"
msgid "Advanced"
@@ -447,3 +447,22 @@ msgstr ""
msgctxt "#32192"
msgid "[I] Artwork Downloader thread on the XBMC forum. [/I]"
msgstr ""
+
+#empty strings from id 32193 to 32210
+#Add-on settings: Exclusions section id=32211 to 32220
+
+msgctxt "#32211"
+msgid "Exclusions"
+msgstr ""
+
+msgctxt "#32212"
+msgid "[B]Setup folders to exclude while looking for artwork [/B]"
+msgstr ""
+
+msgctxt "#32213"
+msgid "Exclude path"
+msgstr ""
+
+msgctxt "#32214"
+msgid "Folder path (and subfolders)"
+msgstr ""
\ No newline at end of file
diff --git a/resources/language/German/strings.po b/resources/language/German/strings.po
index ae9690d9..41e81586 100644
--- a/resources/language/German/strings.po
+++ b/resources/language/German/strings.po
@@ -411,3 +411,22 @@ msgstr "[I]Für Fehler, Vorschläge oder alggemeine Fragen, besuche das [/I]"
msgctxt "#32192"
msgid "[I] Artwork Downloader thread on the XBMC forum. [/I]"
msgstr "[I] Artwork Downloader-Thema im XBMC-Forum (englisch). [/I]"
+
+#empty strings from id 32193 to 32210
+#Add-on settings: Exclusions section id=32211 to 32220
+
+msgctxt "#32211"
+msgid "Exclusions"
+msgstr "Ausnahmen"
+
+msgctxt "#32212"
+msgid "[B]Setup folders to exclude while looking for artwork [/B]"
+msgstr "[B]Pfade einrichten, die nicht durchsucht werden [/B]"
+
+msgctxt "#32213"
+msgid "Exclude path"
+msgstr "Ausnahme verwenden"
+
+msgctxt "#32214"
+msgid "Folder path (and subfolders)"
+msgstr "Verzeichnispfad (und Unterverzeichnisse)"
\ No newline at end of file
diff --git a/resources/settings.xml b/resources/settings.xml
index 2a7d4140..cf18c387 100644
--- a/resources/settings.xml
+++ b/resources/settings.xml
@@ -100,6 +100,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+