Browse Source

lalabots submodule

Ivars 7 years ago
parent
commit
08bd2aa08c
7 changed files with 378 additions and 11 deletions
  1. 1
    1
      .gitmodules
  2. 38
    5
      addon.py
  3. 1
    1
      addon.xml
  4. 4
    0
      changelog.md
  5. 5
    4
      kmake.bat
  6. 9
    0
      service.py
  7. 320
    0
      wingdbstub.py

+ 1
- 1
.gitmodules View File

@@ -1,3 +1,3 @@
1 1
 [submodule "resources/lib/content"]
2 2
 	path = resources/lib/content
3
-	url = http://root@git.blue.lv/home/content.git
3
+	url = http://git.blue.lv/home/content.git

+ 38
- 5
addon.py View File

@@ -9,6 +9,11 @@ import pickle
9 9
 from kodiswift import Plugin, ListItem, storage
10 10
 from kodiswift import xbmc, xbmcgui, xbmcplugin, xbmcvfs, xbmcaddon, CLI_MODE
11 11
 from resources.lib.content import ContentSources, util
12
+try:
13
+    import wingdbstub
14
+except:
15
+    pass
16
+
12 17
 cur_directory = os.path.dirname(__file__)
13 18
 icon_folder = os.path.join(cur_directory, "resources", "picons")
14 19
 icong_url =  xbmcaddon.Addon().getAddonInfo("path") + "/resources/picons/"
@@ -22,6 +27,7 @@ use_proxy = plugin.get_setting("general_proxy_use",bool)
22 27
 proxy_url = plugin.get_setting("general_proxy_url",str)
23 28
 playlist = plugin.get_setting("general_playlist",str)
24 29
 download_dir = plugin.get_setting("general_download_dir",str)
30
+view_mode = plugin.get_setting("general_view_mode",str)
25 31
 
26 32
 #storage_path = os.path.join(plugin.storage_path,"sources.p")
27 33
 if use_storage:
@@ -107,13 +113,11 @@ def main():
107 113
             plugin.notify(unicode(e),"Error",10000,xbmcgui.NOTIFICATION_ERROR)
108 114
             traceback.print_exc()
109 115
             return []
110
-        #xbmc.executebuiltin('Container.SetViewMode(500)')
111
-        plugin.set_view_mode(50)
112 116
         if use_storage and storage is not None:
113 117
             print "[playstream] Save sources to storage"
114 118
             storage["sources"] = sources
115 119
             storage.sync()
116
-        return items
120
+        return plugin.finish(items, view_mode=get_view_mode(), update_listing=False, cache_to_disc=False)
117 121
 
118 122
 def get_list(data):
119 123
     if isinstance(data,unicode):
@@ -143,14 +147,19 @@ def get_list(data):
143 147
              u'RunScript(special://home/addons/%s/context_download.py,"download","%s","%s","%s")' % (
144 148
                 plugin.id, title, data2, download_dir)),
145 149
         ]
146
-        items.append({
150
+        item = {
147 151
             "label": title,
148 152
             "path": prefix+data2,
149 153
             "thumbnail":thumb_data(img, is_playable),
154
+            #"poster":thumb_data(img, is_playable) ,
155
+            "icon":thumb_data(img, is_playable) ,
150 156
             "info":{"plot":desc},
151 157
             "is_playable":is_playable,
152 158
             "context_menu": context_menu,
153
-        })
159
+        }
160
+        if view_mode == "Poster":
161
+            item["poster"] = thumb_data(img, is_playable)
162
+        items.append(item)
154 163
     return items
155 164
 
156 165
 def play_video(streams):
@@ -205,6 +214,30 @@ def thumb_data(img, video=False):
205 214
         img = icong_url + img
206 215
     return img
207 216
 
217
+def get_view_mode():
218
+    modes = {
219
+        "skin.estuary": {
220
+            "None": None,
221
+            "List": 50,
222
+            "Poster": 51,
223
+            "IconWall":52 ,
224
+            "Shift": 53,
225
+            "InfoWall": 54,
226
+            "WideList": 55,
227
+            "Wall": 500,
228
+            "Banner": 501,
229
+            "FanArt": 502
230
+        }
231
+    }
232
+    skin = xbmc.getSkinDir()
233
+    vm = plugin.get_setting("general_view_mode", str)
234
+    if skin in modes and vm in modes[skin]:
235
+        view_mode = modes[skin][vm]
236
+    else:
237
+        view_mode = 50
238
+    return view_mode
239
+
240
+
208 241
 if __name__ == '__main__':
209 242
     if CLI_MODE:
210 243
         from kodiswift.cli.cli import main as start

+ 1
- 1
addon.xml View File

@@ -1,5 +1,5 @@
1 1
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
-<addon version="0.1.50" id="plugin.video.playstream" name="PlayStream" provider-name="ivars777"  >
2
+<addon version="0.1.52" id="plugin.video.playstream" name="PlayStream" provider-name="ivars777"  >
3 3
   <requires>
4 4
     <import addon="xbmc.python" version="2.1.0"/>
5 5
     <import addon="script.module.requests" />

+ 4
- 0
changelog.md View File

@@ -1,4 +1,8 @@
1 1
 
2
+**0.1.52** (17.02.2018)
3
+- [feature] PlayStream autostart opcija
4
+- [feature] View Mode opcija
5
+
2 6
 **0.1.50** (12.12.2017)
3 7
 - [change] Labojumi atbilstoši PlayStream 0.7o
4 8
 - [feature] Testa variants video lejupielādei

+ 5
- 4
kmake.bat View File

@@ -1,10 +1,11 @@
1 1
 @echo off
2 2
 
3 3
 :--- Pull content submodule ---
4
-pushd resources\lib\content
5
-git checkout .
6
-git pull
7
-popd
4
+git submodule update --init -- "resources/lib/content"
5
+rem pushd resources\lib\content
6
+rem git checkout .
7
+rem git pull
8
+rem popd
8 9
 
9 10
 :=== Parameters ===
10 11
 python get_version.py addon.xml >version.txt

+ 9
- 0
service.py View File

@@ -5,10 +5,19 @@ from kodiswift import xbmc, xbmcgui, xbmcplugin, xbmcvfs, CLI_MODE
5 5
 #from resources.lib import ContentSources, util
6 6
 #sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)),"resources","lib","sources"))
7 7
 from  resources.lib.content import playstreamproxy
8
+try:
9
+    import wingdbstub
10
+except:
11
+    pass
12
+
8 13
 #monitor = xbmc.Monitor()
9 14
 
10 15
 plugin = Plugin()
11 16
 plugin.load_addon_settings()
17
+autostart = plugin.get_setting("general_autostart", bool)
18
+if autostart:
19
+    xbmc.executebuiltin("RunAddon(plugin.video.playstream)")
20
+# view_mode = plugin.get_setting("view_mode", str)
12 21
 port = plugin.get_setting("general_port",int)
13 22
 start_proxy = plugin.get_setting("general_proxy",bool)
14 23
 host = "localhost"

+ 320
- 0
wingdbstub.py View File

@@ -0,0 +1,320 @@
1
+#########################################################################
2
+""" wingdbstub.py    -- Debug stub for debuggifying Python programs
3
+
4
+Copyright (c) 1999-2001, Archaeopteryx Software, Inc.  All rights reserved.
5
+
6
+Written by Stephan R.A. Deibel and John P. Ehresman
7
+
8
+Usage:
9
+-----
10
+
11
+This is the file that Wing DB users copy into their python project 
12
+directory if they want to be able to debug programs that are launched
13
+outside of the IDE (e.g., CGI scripts, in response to a browser page
14
+load).
15
+
16
+To use this, edit the configuration values below to match your 
17
+Wing installation and requirements of your project.
18
+
19
+Then, add the following line to your code:
20
+
21
+  import wingdbstub
22
+
23
+Debugging will start immediately after this import statements.
24
+
25
+Next make sure that your IDE is running and that it's configured to accept
26
+connections from the host the debug program will be running on.
27
+
28
+Now, invoking your python file should run the code within the debugger.
29
+Note, however, that Wing will not stop in the code unless a breakpoint
30
+is set.
31
+
32
+If the debug process is started before the IDE, or is not listening
33
+at the time this module is imported then the program will run with
34
+debugging until an attach request is seen.  Attaching only works 
35
+if the .wingdebugpw file is present; see the manual for details.
36
+
37
+On win32, you either need to edit WINGHOME in this script or
38
+pass in an environment variable called WINGHOME that points to
39
+the Wing installation directory.
40
+
41
+"""
42
+#########################################################################
43
+
44
+import sys
45
+import os
46
+import imp
47
+
48
+
49
+#------------------------------------------------------------------------
50
+# Default configuration values:  Note that the named environment 
51
+# variables, if set, will override these settings.
52
+
53
+# Set this to 1 to disable all debugging; 0 to enable debugging
54
+# (WINGDB_DISABLED environment variable)
55
+kWingDebugDisabled = 0
56
+
57
+# Host:port of the IDE within which to debug: As configured in the IDE
58
+# with the Server Port preference
59
+# (WINGDB_HOSTPORT environment variable)
60
+kWingHostPort = 'localhost:50005'
61
+
62
+# Port on which to listen for connection requests, so that the
63
+# IDE can (re)attach to the debug process after it has started.
64
+# Set this to '-1' to disable listening for connection requests.
65
+# This is only used when the debug process is not attached to
66
+# an IDE or the IDE has dropped its connection. The configured
67
+# port can optionally be added to the IDE's Common Attach Hosts
68
+# preference. Note that a random port is used instead if this 
69
+# port is already in use!
70
+# (WINGDB_ATTACHPORT environment variable)
71
+kAttachPort = '50015'
72
+
73
+# Set this to a filename to log verbose information about the debugger
74
+# internals to a file.  If the file does not exist, it will be created
75
+# as long as its enclosing directory exists and is writeable.  Use 
76
+# "<stderr>" or "<stdout>".  Note that "<stderr>" may cause problems 
77
+# on win32 if the debug process is not running in a console.
78
+# (WINGDB_LOGFILE environment variable)
79
+kLogFile = None
80
+
81
+# Set to get a tremendous amount of logging from the debugger internals
82
+# (WINGDB_LOGVERYVERBOSE)
83
+kLogVeryVerbose = 0
84
+
85
+# Set this to 1 when debugging embedded scripts in an environment that
86
+# creates and reuses a Python instance across multiple script invocations:  
87
+# It turns off automatic detection of program quit so that the debug session
88
+# can span multiple script invocations.  When this is turned on, you may
89
+# need to call ProgramQuit() on the debugger object to shut down the
90
+# debugger cleanly when your application exits or discards the Python
91
+# instance.  If multiple Python instances are created in the same run,
92
+# only the first one will be able to debug unless it terminates debug
93
+# and the environment variable WINGDB_ACTIVE is unset before importing
94
+# this module in the second or later Python instance.  See the Wing
95
+# IDE manual for details.
96
+kEmbedded = 0
97
+
98
+# Path to search for the debug password file and the name of the file
99
+# to use.  The password file contains the encryption type and connect 
100
+# password for all connections to the IDE and must match the wingdebugpw
101
+# file in the profile dir used by the IDE.  Any entry of '$<winguserprofile>' 
102
+# is replaced by the wing user profile directory for the user that the 
103
+# current process is running as
104
+# (WINGDB_PWFILEPATH environment variable)
105
+kPWFilePath = [os.path.dirname(__file__), '$<winguserprofile>']
106
+kPWFileName = 'wingdebugpw'
107
+
108
+# Whether to exit if the debugger fails to run or to connect with an IDE
109
+# for whatever reason
110
+kExitOnFailure = 0
111
+
112
+#------------------------------------------------------------------------
113
+# Find Wing debugger installation location
114
+
115
+# Edit this to point to your Wing installation or set to None to use env WINGHOME
116
+# On OS X this must be set to name of the Wing application bundle
117
+# (for example, /Applications/WingIDE.app)
118
+WINGHOME = None
119
+
120
+if sys.hexversion >= 0x03000000:
121
+  def has_key(o, key):
122
+    return key in o
123
+else:
124
+  def has_key(o, key):
125
+    return o.has_key(key)
126
+    
127
+# Check environment:  Must have WINGHOME defined if still == None
128
+if WINGHOME == None:
129
+  if has_key(os.environ, 'WINGHOME'):
130
+    WINGHOME=os.environ['WINGHOME']
131
+  else:
132
+    sys.stdout.write("*******************************************************************\n")
133
+    sys.stdout.write("Error: Could not find Wing installation!  You must set WINGHOME or edit\n")
134
+    sys.stdout.write("wingdbstub.py where indicated to point it to the location where\n")
135
+    sys.stdout.write("Wing is installed.\n")
136
+    sys.exit(1)
137
+
138
+kPWFilePath.append(WINGHOME)
139
+
140
+# The user settings dir where per-user settings & patches are located.  Will be
141
+# set from environment if left as None
142
+kUserSettingsDir = None
143
+if kUserSettingsDir is None:
144
+  kUserSettingsDir = os.environ.get('WINGDB_USERSETTINGS')
145
+  
146
+def _FindActualWingHome(winghome):
147
+  """ Find the actual directory to use for winghome.  Needed on OS X
148
+  where the .app directory is the preferred dir to use for WINGHOME and
149
+  .app/Contents/MacOS is accepted for backward compatibility. """
150
+  
151
+  if sys.platform != 'darwin':
152
+    return winghome
153
+  
154
+  app_dir = None
155
+  if os.path.isdir(winghome):
156
+    if winghome.endswith('/'):
157
+      wo_slash = winghome[:-1]
158
+    else:
159
+      wo_slash = winghome
160
+      
161
+    if wo_slash.endswith('.app'):
162
+      app_dir = wo_slash
163
+    elif wo_slash.endswith('.app/Contents/MacOS'):
164
+      app_dir = wo_slash[:-len('/Contents/MacOS')]
165
+    
166
+  if app_dir and os.path.isdir(os.path.join(app_dir, 'Contents', 'Resources')):
167
+    return os.path.join(app_dir, 'Contents', 'Resources')
168
+  
169
+  return winghome
170
+  
171
+def _ImportWingdb(winghome, user_settings=None):
172
+  """ Find & import wingdb module. """
173
+  
174
+  try:
175
+    exec_dict = {}
176
+    execfile(os.path.join(winghome, 'bin', '_patchsupport.py'), exec_dict)
177
+    find_matching = exec_dict['FindMatching']
178
+    dir_list = find_matching('bin', winghome, user_settings)
179
+  except Exception:
180
+    dir_list = []
181
+  dir_list.extend([os.path.join(winghome, 'bin'), os.path.join(winghome, 'src')])
182
+  for path in dir_list:
183
+    try:
184
+      f, p, d = imp.find_module('wingdb', [path])
185
+      try:
186
+        return imp.load_module('wingdb', f, p, d)
187
+      finally:
188
+        if f is not None:
189
+          f.close()
190
+      break
191
+    except ImportError:
192
+      pass
193
+
194
+#------------------------------------------------------------------------
195
+# Set debugger if it hasn't been set -- this is to handle module reloading
196
+# In the reload case, the debugger variable will be set to something
197
+try:
198
+  debugger
199
+except NameError:
200
+  debugger = None
201
+  
202
+# Unset WINGDB_ACTIVE env if it was inherited from another process
203
+# XXX Would be better to be able to call getpid() on dbgtracer but can't access it yet
204
+if 'WINGDB_ACTIVE' in os.environ and os.environ['WINGDB_ACTIVE'] != str(os.getpid()):
205
+  del os.environ['WINGDB_ACTIVE']
206
+
207
+# Start debugging if not disabled and this module has never been imported
208
+# before
209
+if (not kWingDebugDisabled and debugger is None
210
+    and not has_key(os.environ, 'WINGDB_DISABLED') and 
211
+    not has_key(os.environ, 'WINGDB_ACTIVE')):
212
+
213
+  exit_on_fail = 0
214
+  
215
+  try:
216
+    # Obtain exit if fails value
217
+    exit_on_fail = os.environ.get('WINGDB_EXITONFAILURE', kExitOnFailure)
218
+    
219
+    # Obtain configuration for log file to use, if any
220
+    logfile = os.environ.get('WINGDB_LOGFILE', kLogFile)
221
+    if logfile == '-' or logfile == None or len(logfile.strip()) == 0:
222
+      logfile = None
223
+
224
+    very_verbose_log = os.environ.get('WINGDB_LOGVERYVERBOSE', kLogVeryVerbose)
225
+    if type(very_verbose_log) == type('') and very_verbose_log.strip() == '':
226
+      very_verbose_log = 0
227
+      
228
+    # Determine remote host/port where the IDE is running
229
+    hostport = os.environ.get('WINGDB_HOSTPORT', kWingHostPort)
230
+    colonpos = hostport.find(':')
231
+    host = hostport[:colonpos]
232
+    port = int(hostport[colonpos+1:])
233
+  
234
+    # Determine port to listen on locally for attach requests
235
+    attachport = int(os.environ.get('WINGDB_ATTACHPORT', kAttachPort))
236
+  
237
+    # Check if running embedded script
238
+    embedded = int(os.environ.get('WINGDB_EMBEDDED', kEmbedded))
239
+  
240
+    # Obtain debug password file search path
241
+    if has_key(os.environ, 'WINGDB_PWFILEPATH'):
242
+      pwfile_path = os.environ['WINGDB_PWFILEPATH'].split(os.pathsep)
243
+    else:
244
+      pwfile_path = kPWFilePath
245
+    
246
+    # Obtain debug password file name
247
+    if has_key(os.environ, 'WINGDB_PWFILENAME'):
248
+      pwfile_name = os.environ['WINGDB_PWFILENAME']
249
+    else:
250
+      pwfile_name = kPWFileName
251
+    
252
+    # Load wingdb.py
253
+    actual_winghome = _FindActualWingHome(WINGHOME)
254
+    wingdb = _ImportWingdb(actual_winghome, kUserSettingsDir)
255
+    if wingdb == None:
256
+      sys.stdout.write("*******************************************************************\n")
257
+      sys.stdout.write("Error: Cannot find wingdb.py in $(WINGHOME)/bin or $(WINGHOME)/src\n")
258
+      sys.stdout.write("Error: Please check the WINGHOME definition in wingdbstub.py\n")
259
+      sys.exit(2)
260
+    
261
+    # Find the netserver module and create an error stream
262
+    netserver = wingdb.FindNetServerModule(actual_winghome, kUserSettingsDir)
263
+    err = wingdb.CreateErrStream(netserver, logfile, very_verbose_log)
264
+    
265
+    # Start debugging
266
+    debugger = netserver.CNetworkServer(host, port, attachport, err, 
267
+                                        pwfile_path=pwfile_path,
268
+                                        pwfile_name=pwfile_name,
269
+                                        autoquit=not embedded)
270
+    debugger.StartDebug(stophere=0)
271
+    os.environ['WINGDB_ACTIVE'] = str(os.getpid())
272
+    if debugger.ChannelClosed():
273
+      raise ValueError('Not connected')
274
+    
275
+  except:
276
+    if exit_on_fail:
277
+      raise
278
+    else:
279
+      pass
280
+
281
+def Ensure(require_connection=1, require_debugger=1):
282
+  """ Ensure the debugger is started and attempt to connect to the IDE if
283
+  not already connected.  Will raise a ValueError if:
284
+  
285
+  * the require_connection arg is true and the debugger is unable to connect
286
+  * the require_debugger arg is true and the debugger cannot be loaded
287
+  
288
+  If SuspendDebug() has been called through the low-level API, calling
289
+  Ensure() resets the suspend count to zero and additional calls to
290
+  ResumeDebug() will be ignored until SuspendDebug() is called again.
291
+  
292
+  Note that a change to the host & port to connect to will only
293
+  be use if a new connection is made.
294
+  
295
+  """
296
+  
297
+  if debugger is None:
298
+    if require_debugger:
299
+      raise ValueError("No debugger")
300
+    return
301
+
302
+  hostport = os.environ.get('WINGDB_HOSTPORT', kWingHostPort)
303
+  colonpos = hostport.find(':')
304
+  host = hostport[:colonpos]
305
+  port = int(hostport[colonpos+1:])
306
+  
307
+  resumed = debugger.ResumeDebug()
308
+  while resumed > 0:
309
+    resumed = debugger.ResumeDebug()
310
+  
311
+  debugger.SetClientAddress((host, port))  
312
+  
313
+  if not debugger.DebugActive():
314
+    debugger.StartDebug()
315
+  elif debugger.ChannelClosed():
316
+    debugger.ConnectToClient()
317
+    
318
+  if require_connection and debugger.ChannelClosed():
319
+    raise ValueError('Not connected')
320
+