Hello,
I added a new Option for automatic 3D-Mode, which checks the file/folder name of the current movie.
If "3D" or "SBS" exist in the name, the sbs-mode get used. If "OU" exist in the name, the top/bottom-mode get used.
If you copy all 3D movies to a folder with "3D" in name (e.g. "3D movies"), the 3D-boblight mode get automatically enabled for these movies.
Here is the current patch:
Code:
diff -u -r script.xbmc.boblight-master/script.xbmc.boblight/default.py script.xbmc.boblight/default.py
--- script.xbmc.boblight-master/script.xbmc.boblight/default.py 2013-04-25 10:37:00.000000000 +0200
+++ script.xbmc.boblight/default.py 2013-05-21 13:27:49.153902897 +0200
@@ -168,7 +168,7 @@
else:
ret = "musicvideo"
settings.handleCategory(ret)
-
+ settings.handle3Dmode()
def run_boblight():
main = Main()
@@ -189,14 +189,22 @@
if not settings.staticBobActive:
capture.waitForCaptureStateChangeEvent(1000)
if capture.getCaptureState() == xbmc.CAPTURE_STATE_DONE and player_monitor.isPlaying():
- width = capture.getWidth();
- height = capture.getHeight();
+ widthori = capture.getWidth();
+ heightori = capture.getHeight();
+ if settings.bob3Dmode == 1: # sbs
+ widthused = widthori / 2
+ else:
+ widthused = widthori
+ if settings.bob3Dmode == 2: # top/bottom
+ heightused = heightori / 2
+ else:
+ heightused = heightori
pixels = capture.getImage();
- bob.bob_setscanrange(width, height)
+ bob.bob_setscanrange(widthused, heightused)
rgb = (c_int * 3)()
- for y in range(height):
- row = width * y * 4
- for x in range(width):
+ for y in range(heightused):
+ row = widthori * y * 4
+ for x in range(widthused):
rgb[0] = pixels[row + x * 4 + 2]
rgb[1] = pixels[row + x * 4 + 1]
rgb[2] = pixels[row + x * 4]
diff -u -r script.xbmc.boblight-master/script.xbmc.boblight/resources/language/English/strings.xml script.xbmc.boblight/resources/language/English/strings.xml
--- script.xbmc.boblight-master/script.xbmc.boblight/resources/language/English/strings.xml 2013-04-25 10:37:00.000000000 +0200
+++ script.xbmc.boblight/resources/language/English/strings.xml 2013-05-21 14:16:11.141037102 +0200
@@ -12,6 +12,7 @@
<string id="104">Disable boblight</string>
<string id="105">Override used category</string>
<string id="106">Category</string>
+ <string id="107">3D Mode</string>
<!--Movie/MusicVideo/Other-->
<string id="200">Movie</string>
@@ -26,6 +27,12 @@
<string id="220">Custom</string>
<string id="221">Slow</string>
<string id="222">Fast</string>
+
+ <!--3D-->
+ <string id="230">Off</string>
+ <string id="231">SideBySide</string>
+ <string id="232">Top/Bottom</string>
+ <string id="233">Automatic (File name)</string>
<!--MusicVideo-->
<string id="300">Musicvideo</string>
diff -u -r script.xbmc.boblight-master/script.xbmc.boblight/resources/language/German/strings.xml script.xbmc.boblight/resources/language/German/strings.xml
--- script.xbmc.boblight-master/script.xbmc.boblight/resources/language/German/strings.xml 2013-04-25 10:37:00.000000000 +0200
+++ script.xbmc.boblight/resources/language/German/strings.xml 2013-05-21 13:10:13.291120202 +0200
@@ -12,6 +12,7 @@
<string id="104">Boblight ausschalten</string>
<string id="105">Erzwinge Kategorie</string>
<string id="106">Kategorie</string>
+ <string id="107">3D Modus</string>
<!--Movie/MusicVideo/Other-->
<string id="200">Film</string>
@@ -26,6 +27,12 @@
<string id="220">Eigene</string>
<string id="221">langsam</string>
<string id="222">schnell</string>
+
+ <!--3D-->
+ <string id="230">Aus</string>
+ <string id="231">SideBySide</string>
+ <string id="232">Top/Bottom</string>
+ <string id="233">Automatisch (Dateiname)</string>
<!--MusicVideo-->
<string id="300">Musikvideo</string>
Nur in script.xbmc.boblight/resources/lib: boblight.pyc.
diff -u -r script.xbmc.boblight-master/script.xbmc.boblight/resources/lib/settings.py script.xbmc.boblight/resources/lib/settings.py
--- script.xbmc.boblight-master/script.xbmc.boblight/resources/lib/settings.py 2013-04-25 10:37:00.000000000 +0200
+++ script.xbmc.boblight/resources/lib/settings.py 2013-05-21 13:38:38.829052919 +0200
@@ -19,6 +19,7 @@
import sys
import xbmc, xbmcgui
+import re
__scriptname__ = sys.modules[ "__main__" ].__scriptname__
__addon__ = sys.modules[ "__main__" ].__addon__
@@ -57,6 +58,8 @@
self.networkaccess = __addon__.getSetting("networkaccess") == "true"
self.overwrite_cat = __addon__.getSetting("overwrite_cat") == "true"
self.overwrite_cat_val = int(__addon__.getSetting("overwrite_cat_val"))
+ self.bob3D = int(__addon__.getSetting("bob3D"))
+ self.bob3DMode = 0
self.screensaver = xbmc.getCondVisibility("System.ScreenSaverActive")
self.bobdisable = __addon__.getSetting("bobdisable") == "true"
self.current_option = ""
@@ -181,6 +184,43 @@
threshold = 0.0
return (saturation,value,speed,autospeed,interpolation,threshold)
+ #handle the fix settings for 3D mode
+ def detect3DmodeFix(self):
+ log('settings() - detect3DmodeFix (mode: %s)' % str(self.bob3D))
+ self.bob3Dmode=0 # no 3D
+ if self.bob3D == 1:
+ self.bob3Dmode=1 # sbs
+ if self.bob3D == 2:
+ self.bob3Dmode=2 # top/bottom
+
+ #handle the filename for 3D autodetection
+ def detect3DmodeFilename(self):
+ if xbmc.Player().isPlaying():
+ currentPlayingFile = xbmc.Player().getPlayingFile()
+ else:
+ currentPlayingFile = "not playing"
+ log('settings() - detect 3DmodeFilename (file: %s)' % currentPlayingFile)
+ self.bob3Dmode=0 # no 3D
+ if re.search(r'3D', currentPlayingFile, re.I):
+ self.bob3Dmode=1 # default for 3D = sbs
+ if re.search(r'OU', currentPlayingFile, re.I):
+ self.bob3Dmode=2 # top/bottom
+ if re.search(r'SBS', currentPlayingFile, re.I):
+ self.bob3Dmode=1 # sbs
+
+ # handle 3D mode
+ def handle3Dmode(self):
+ log('settings() - handle3Dmode')
+ if self.bob3D == 0:
+ self.detect3DmodeFix()
+ if self.bob3D == 1:
+ self.detect3DmodeFix()
+ if self.bob3D == 2:
+ self.detect3DmodeFix()
+ if self.bob3D == 3:
+ self.detect3DmodeFilename()
+ log('settings() - used mode: %s' % str(self.bob3Dmode))
+
#handle all settings according to the static bg light
#this is used until category "other" can do real boblight
#when no video is rendered
Nur in script.xbmc.boblight/resources/lib: settings.pyc.
Nur in script.xbmc.boblight/resources/lib: tools.pyc.
diff -u -r script.xbmc.boblight-master/script.xbmc.boblight/resources/settings.xml script.xbmc.boblight/resources/settings.xml
--- script.xbmc.boblight-master/script.xbmc.boblight/resources/settings.xml 2013-04-25 10:37:00.000000000 +0200
+++ script.xbmc.boblight/resources/settings.xml 2013-05-21 13:09:52.864907073 +0200
@@ -9,6 +9,8 @@
<setting id="hostport" type="number" subsetting="true" enable="eq(-2,true)" label="103" default="19333" />
<setting id="sep2" type="sep" />
<setting id="bobdisable" type="bool" label="104" default="false" />
+ <setting id="sep4" type="sep" />
+ <setting id="bob3D" type="enum" subsettings="true" label="107" default="0" lvalues="230|231|232|233" />
</category>
<category label="200">
<setting id="movie_preset" type="enum" label="201" default="1" lvalues="220|221|222" />
Kind regards,
Uwe Heinritz.