29 Commits

Author SHA1 Message Date
  Ivars e2b07e2b9e remontes 5 years ago
  Ivars 23c5c37028 lmt.lv u.c. 5 years ago
  Ivars 9e1db0fc73 0.2.14 5 years ago
  Ivars 316b0a15cf 0.2.13 5 years ago
  Ivars b0c87d8447 0.2.13 5 years ago
  Ivars 8bd5eaba06 0.2.12 5 years ago
  Ivars 6d766e393a 0.2.12 6 years ago
  Ivars a7249ecbba 0.2.11 6 years ago
  Ivars 8acc8b2e37 0.2.1 6 years ago
  Ivars abd7bd8865 0.1.99 6 years ago
  Ivars 820d7e07ea 0.1.99 6 years ago
  Ivars 0d69a412a5 pielikts klāt XTV.lv 6 years ago
  Ivars 80f8263336 0.1.98 6 years ago
  Ivars 2d2a752b36 0.1.97 6 years ago
  Ivars b1fc9275b7 0.1.96 6 years ago
  Ivars 4f4af54497 0.1.95 6 years ago
  Ivars 56a68f937d salabots replay 6 years ago
  Ivars 2a19ce8f05 0.1.94 6 years ago
  Ivars 1286e1ecf6 a 6 years ago
  Ivars 4246f0fb2f 0.1.94 6 years ago
  Ivars 3e8c0375ec labojumi 6 years ago
  Ivars 032a43ccbb 0.1.94 6 years ago
  Ivars 95a24794b2 0.1.93 6 years ago
  Ivars 387d13ebd6 0.1.92 6 years ago
  Ivars 124e75c37e 0.1.92 6 years ago
  Ivars 6c6e2871f2 0.1.91 6 years ago
  Ivars 2412b3e84d 0.1.90 6 years ago
  Ivars a0870f8347 0.1.90 6 years ago
  Ivars 58277e3cf2 0.1.90 6 years ago
11 changed files with 517 additions and 428 deletions
  1. 10
    6
      addon.py
  2. 4
    2
      addon.xml
  3. 7
    2
      changelog.md
  4. 1
    1
      get_version.py
  5. 41
    41
      kmake.bat
  6. 299
    254
      project.wpr
  7. 11
    2
      resources/language/English/strings.xml
  8. 1
    1
      resources/lib/content
  9. 11
    4
      resources/settings.xml
  10. 9
    2
      service.py
  11. 123
    113
      wingdbstub.py

+ 10
- 6
addon.py View File

@@ -33,6 +33,7 @@ use_storage = plugin.get_setting("general_use_storage",bool) # TODO vajag noček
33 33
 storage_ttl = plugin.get_setting("general_ttl",int)
34 34
 use_proxy = plugin.get_setting("general_proxy_use",bool)
35 35
 proxy_url = plugin.get_setting("general_proxy_url",str)
36
+proxy_remote_key = plugin.get_setting("general_proxy_remote_key",str)
36 37
 playlist = plugin.get_setting("general_playlist",str)
37 38
 download_dir = plugin.get_setting("general_download_dir",str)
38 39
 view_mode = plugin.get_setting("general_view_mode",str)
@@ -235,12 +236,15 @@ def play_video(streams):
235 236
     subfiles = []
236 237
     #stream = util.stream_chamge(stream)
237 238
     if use_proxy:
238
-        if "resolver" in stream and stream["resolver"] in ("hqq","filmas") or \
239
-            "surl" in stream and re.search(r"http*://(hqq|goo\.gl)",stream["surl"]) or \
240
-            "lattelecom.tv/mobile-vod/" in stream["url"]: # TODO
241
-            #re.search(r"http*://.+?lattelecom\.tv/.+?auth_token=[^=]+=", stream["url"]):
242
-            stream["url"] = util.streamproxy_encode(stream["url"],stream["headers"],proxy_url)
243
-            stream["headers"] = {}
239
+        # if "resolver" in stream and stream["resolver"] in ("hqq","filmas") or \
240
+        #    "surl" in stream and re.search(r"http*://(hqq|goo\.gl)",stream["surl"]) or \
241
+        #    "lattelecom.tv/mobile-vod/" in stream["url"]: # TODO
242
+        3    #re.search(r"http*://.+?lattelecom\.tv/.+?auth_token=[^=]+=", stream["url"]):
243
+        #    stream["url"] = util.streamproxy_encode(stream["url"],stream["headers"],proxy_url)
244
+        #    stream["headers"] = {}
245
+        qs = {"key": proxy_remote_key} if proxy_remote_key else None
246
+        stream["url"] = util.streamproxy_encode3("playstream", stream["url"], proxy_url, stream["headers"] )
247
+        stream["headers"] = None
244 248
     if stream["headers"]:
245 249
         hh = []
246 250
         for k in stream["headers"]:

+ 4
- 2
addon.xml View File

@@ -1,10 +1,12 @@
1 1
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
-<addon version="0.1.99" id="plugin.video.playstream" name="PlayStream" provider-name="ivars777"  >
2
+<addon version="0.2.15" 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" />
6 6
     <import addon="script.module.simplejson" />
7
-    <import addon="script.module.twisted" optional="true"/>
7
+    <import addon="script.module.pytz" />
8
+    <!-- <import addon="script.module.twisted" optional="true"/> -->
9
+    pytz
8 10
   </requires>
9 11
   <extension point="xbmc.python.pluginsource" library="addon.py">
10 12
     <provides>video</provides>

+ 7
- 2
changelog.md View File

@@ -1,5 +1,10 @@
1
-**0.1.98** (26.01.2019):
2
-- [feature] pielikts klāt XTV.lv
1
+**0.2.15** (06.10.2019):
2
+- [fix] salabots lmt.lv (Facebook video)
3
+- [fix] content autonomā git projektā
4
+
5
+**0.2.13** (24.02.2019):
6
+- [feature] playstreamproxy nodrošina m3u8
7
+- [fix] salabots TVDom
3 8
 
4 9
 **0.1.98** (23.12.2018):
5 10
 - [fix] salabots filmix, tvplay

+ 1
- 1
get_version.py View File

@@ -1,2 +1,2 @@
1 1
 import re,sys
2
-print re.search('<addon version="([^"]+)',open(sys.argv[1]).read()).group(1)
2
+print re.search('<addon.+?%s="([^"]+)'%sys.argv[2],open(sys.argv[1]).read()).group(1)

+ 41
- 41
kmake.bat View File

@@ -1,38 +1,37 @@
1 1
 @echo off
2 2
 
3
-:--- Pull content submodule ---
4
-pushd resources\lib\content
5
-git commit -a -m labojumi
6
-git checkout .
7
-git pull
8
-popd
9
-
10 3
 :=== Parameters ===
11
-python get_version.py addon.xml >version.txt
4
+python -c "import re,sys; print re.search('<addon.+?version=""([^""]+)""',open('addon.xml').read()).group(1)" >version.txt
12 5
 set /p ver=<version.txt
13
-echo %ver%
6
+python -c "import re,sys; print re.search('<addon.+?id=""([^""]+)""',open('addon.xml').read()).group(1)" >id.txt
7
+set /p pack_name=<id.txt
8
+echo %pack_name% %ver%
14 9
 pause
15 10
 
16
-set prog=PlayStream
17
-set pack_name=plugin.video.playstream
18
-set desc=Play online streams from various sources, mostly Latvian
19
-
20
-set ipk_dir=ipkg\
21 11
 set release_dir=release\
22
-set repo_dir=..\repo\
23
-set feed_dir=q:\web\repo\
12
+set repo_dir=q:\web\repo\
13
+:set feed_dir=q:\web\repo\
24 14
 
25 15
 set AR=\MinGW\bin\ar.exe
26 16
 set TAR=\MinGW\msys\1.0\bin\tar.exe
17
+set CP=\MinGW\msys\1.0\bin\cp.exe
18
+set ZIP=
27 19
 rem set ZIP=\Program Files (x86)\Gow\bin\zip.exe
28 20
 
29
-:=== data files ===
21
+
22
+:=== Pull content submodule ===
23
+pushd resources\lib\content
24
+:git commit -a -m labojumi
25
+git checkout .
26
+git pull
27
+popd
28
+
29
+
30
+:=== Create package zip file ===
30 31
 if exist "%pack_name%" rm -r -f "%pack_name%"
31 32
 mkdir "%pack_name%""
32 33
 if not exist %release_dir% mkdir %release_dir%
33
-if not exist %repo_dir% mkdir %repo_dir%
34
-if not exist  %repo_dir%%pack_name% mkdir  %repo_dir%%pack_name%
35
-
34
+echo Copying files to %pack_name%
36 35
 
37 36
 for %%f in (
38 37
 readme.md
@@ -71,7 +70,7 @@ resources\lib\content\sources\iplayer.py
71 70
 resources\lib\content\sources\movieplace.py
72 71
 resources\lib\content\sources\ltc.py
73 72
 resources\lib\content\sources\mtgplay.py
74
-resources\lib\content\sources\play24.py
73
+resources\lib\content\sources\xtv.py
75 74
 resources\lib\content\sources\replay.py
76 75
 resources\lib\content\sources\lmt.py
77 76
 resources\lib\content\sources\serialguru.py
@@ -98,29 +97,30 @@ resources\lib\content\resolvers\youtuberesolver.py
98 97
 
99 98
 xcopy /y /q resources\lib\content\picons\* %pack_name%\resources\picons\
100 99
 
101
-pause
102
-
100
+echo Creating %release_dir%%pack_name%-%ver%.zip
103 101
 if exist  %release_dir%%pack_name%-%ver%.zip rm %release_dir%%pack_name%-%ver%.zip
104
-rem zip  -r %release_dir%%pack_name%-%ver%.zip %pack_name%
105
-"C:\Program Files\WinRAR\winrar.exe" a -afzip -r %release_dir%%pack_name%-%ver%.zip %pack_name%
106
-copy  addon.xml  %repo_dir%%pack_name%\addon.xml /Y
107
-copy  %release_dir%%pack_name%-%ver%.zip  %repo_dir%%pack_name%\%pack_name%-%ver%.zip /Y
108
-python -c "import hashlib; print hashlib.md5(open(r'%repo_dir%%pack_name%\%pack_name%-%ver%.zip','r').read()).hexdigest()" >%repo_dir%%pack_name%\%pack_name%-%ver%.zip.md5
102
+7za a -r -tzip -bb0 -bsp1 -bso0 %release_dir%%pack_name%-%ver%.zip %pack_name%
103
+if exist %pack_name% rm -r -f %pack_name%
109 104
 
105
+if ()==(%1%) (
106
+    GOTO :EOF
107
+)
108
+:=== Add to git ===
109
+echo Adding to git
110 110
 git add %release_dir%%pack_name%-%ver%.zip
111
-rm -r -f "%pack_name%"
111
+git commit -m %ver%
112
+git tag -d %ver%
113
+git tag %ver%
114
+git push
112 115
 
113
-if not ()==(%1%) (
114
-    git commit -m %ver%
115
-    git tag -d %ver%
116
-    git tag %ver%
117
-    git push
118 116
 
119
-    pushd  %repo_dir%..
120
-    call update_repo.bat
121
-    rem xcopy /s /y /u repo %feed_dir%
122
-    robocopy repo %feed_dir%  addons.* /copy:dat
123
-    robocopy repo\%pack_name% q:\web\repo\%pack_name% /copy:DAT /xo
124
-    popd
117
+:=== Copy package to repo ===
118
+echo Copying  %release_dir%%pack_name%-%ver%.zip to %repo_dir%%pack_name%
119
+if not exist %repo_dir% mkdir %repo_dir%
120
+if not exist  %repo_dir%%pack_name% mkdir  %repo_dir%%pack_name%
121
+cp  addon.xml  %repo_dir%%pack_name%\addon.xml -fpv
122
+cp  %release_dir%%pack_name%-%ver%.zip  %repo_dir%%pack_name%\%pack_name%-%ver%.zip -fpv
123
+python -c "import hashlib; print hashlib.md5(open(r'%repo_dir%%pack_name%\%pack_name%-%ver%.zip','r').read()).hexdigest()" >%repo_dir%%pack_name%\%pack_name%-%ver%.zip.md5
124
+python ..\generate_repo.py %repo_dir%
125 125
 )
126
-pause
126
+

+ 299
- 254
project.wpr View File

@@ -82,11 +82,7 @@ proj.launch-config = {loc('addon.py'): ('project',
82 82
          ''))}
83 83
 proj.main-file = loc('addon.py')
84 84
 [user attributes]
85
-debug.breakpoints = {loc('addon.py'): {225L: (0,
86
-        None,
87
-        1,
88
-        0)},
89
-                     loc('context_download.py'): {125L: (0,
85
+debug.breakpoints = {loc('context_download.py'): {125L: (0,
90 86
         None,
91 87
         1,
92 88
         0),
@@ -94,11 +90,11 @@ debug.breakpoints = {loc('addon.py'): {225L: (0,
94 90
                None,
95 91
                1,
96 92
                0)},
97
-                     loc('unknown:<untitled> #2'): {10: (0,
93
+                     loc('unknown:<untitled> #1'): {10: (0,
98 94
         None,
99 95
         1,
100 96
         0)},
101
-                     loc('unknown:<untitled> #1'): {2: (0,
97
+                     loc('unknown:<untitled> #2'): {2: (0,
102 98
         None,
103 99
         1,
104 100
         0)}}
@@ -205,7 +201,7 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
205 201
                                {'tree-state': {'file-sort-method': 'by name',
206 202
         'list-files-first': 0,
207 203
         'tree-states': {'deep': {'expanded-nodes': [],
208
-                                 'selected-nodes': [(24,)],
204
+                                 'selected-nodes': [(40,)],
209 205
                                  'top-node': (0,)}},
210 206
         'tree-style': 'deep'}}),
211 207
                               ('browser',
@@ -692,6 +688,9 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
692 688
         loc('unknown:<untitled> #3'): {'expanded-nodes': [],
693 689
                                        'selected-nodes': [],
694 690
                                        'top-node': None},
691
+        loc('unknown:<untitled> #8'): {'expanded-nodes': [],
692
+                                       'selected-nodes': [],
693
+                                       'top-node': None},
695 694
         loc('unknown:<untitled> #6'): {'column-widths': [1.0],
696 695
                                        'expanded-nodes': [],
697 696
                                        'selected-nodes': [],
@@ -699,14 +698,11 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
699 698
         loc('unknown:<untitled> #7'): {'expanded-nodes': [],
700 699
                                        'selected-nodes': [],
701 700
                                        'top-node': None},
702
-        loc('unknown:<untitled> #4'): {'expanded-nodes': [],
701
+        loc('unknown:<untitled> #5'): {'expanded-nodes': [],
703 702
                                        'selected-nodes': [],
704 703
                                        'top-node': None},
705
-        loc('unknown:<untitled> #5'): {'column-widths': [1.0],
704
+        loc('unknown:<untitled> #4'): {'column-widths': [1.0],
706 705
                                        'expanded-nodes': [],
707
-                                       'selected-nodes': [],
708
-                                       'top-node': None},
709
-        loc('unknown:<untitled> #8'): {'expanded-nodes': [],
710 706
                                        'selected-nodes': [],
711 707
                                        'top-node': None}},
712 708
                                 'browse_mode': u'Current Module',
@@ -778,7 +774,7 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
778 774
                                        'fRegexFlags': 42,
779 775
                                        'fReplaceText': u'item["posterUrl"]',
780 776
                                        'fReverse': False,
781
-                                       'fSearchText': u'ftpli',
777
+                                       'fSearchText': u'get_sett',
782 778
                                        'fStartPos': 0,
783 779
                                        'fStyle': 'text',
784 780
                                        'fWholeWords': False,
@@ -844,12 +840,12 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
844 840
                        'attrib-starts': [],
845 841
                        'first-line': 0L,
846 842
                        'folded-linenos': [],
847
-                       'history': {None: ['p\n']},
843
+                       'history': {},
848 844
                        'launch-id': None,
849
-                       'sel-line': 8L,
850
-                       'sel-line-start': 183L,
851
-                       'selection_end': 183L,
852
-                       'selection_start': 183L,
845
+                       'sel-line': 0L,
846
+                       'sel-line-start': 0L,
847
+                       'selection_end': 0L,
848
+                       'selection_start': 0L,
853 849
                        'zoom': 0L}),
854 850
                      ('debug-watch',
855 851
                       'wide',
@@ -898,244 +894,231 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
898 894
                       {})],
899 895
         'primary_view_state': {'editor_states': ('horizontal',
900 896
         1.0,
901
-        ({'bookmarks': ([[loc('context_download.py'),
902
-                          {'attrib-starts': [('download_hls',
903
-        237)],
904
-                           'first-line': 277L,
897
+        ({'bookmarks': ([[loc('resources/lib/content/playstreamproxy.py'),
898
+                          {'attrib-starts': [('start',
899
+        299)],
900
+                           'first-line': 78L,
905 901
                            'folded-linenos': [],
906
-                           'sel-line': 298L,
907
-                           'sel-line-start': 11543L,
908
-                           'selection_end': 11563L,
909
-                           'selection_start': 11558L,
902
+                           'sel-line': 305L,
903
+                           'sel-line-start': 10967L,
904
+                           'selection_end': 10967L,
905
+                           'selection_start': 10967L,
910 906
                            'zoom': 0L},
911
-                          1548527119.987],
912
-                         [loc('context_download.py'),
913
-                          {'attrib-starts': [('download_hls',
914
-        237)],
915
-                           'first-line': 287L,
907
+                          1553961342.06],
908
+                         [loc('service.py'),
909
+                          {'attrib-starts': [],
910
+                           'first-line': 28L,
916 911
                            'folded-linenos': [],
917
-                           'sel-line': 300L,
918
-                           'sel-line-start': 11584L,
919
-                           'selection_end': 11629L,
920
-                           'selection_start': 11619L,
912
+                           'sel-line': 40L,
913
+                           'sel-line-start': 1576L,
914
+                           'selection_end': 1630L,
915
+                           'selection_start': 1622L,
921 916
                            'zoom': 0L},
922
-                          1548527138.088],
923
-                         [loc('context_download.py'),
924
-                          {'attrib-starts': [('download_file',
925
-        371)],
926
-                           'first-line': 378L,
917
+                          1553961371.515],
918
+                         [loc('resources/lib/content/playstreamproxy.py'),
919
+                          {'attrib-starts': [('start',
920
+        299)],
921
+                           'first-line': 78L,
927 922
                            'folded-linenos': [],
928
-                           'sel-line': 396L,
929
-                           'sel-line-start': 15075L,
930
-                           'selection_end': 15094L,
931
-                           'selection_start': 15089L,
923
+                           'sel-line': 305L,
924
+                           'sel-line-start': 10967L,
925
+                           'selection_end': 10967L,
926
+                           'selection_start': 10967L,
932 927
                            'zoom': 0L},
933
-                          1548527145.504],
934
-                         [loc('context_download.py'),
935
-                          {'attrib-starts': [('download_sub',
936
-        428)],
937
-                           'first-line': 409L,
928
+                          1553961375.812],
929
+                         [loc('resources/lib/content/playstreamproxy.py'),
930
+                          {'attrib-starts': [('start2',
931
+        314)],
932
+                           'first-line': 305L,
938 933
                            'folded-linenos': [],
939
-                           'sel-line': 430L,
940
-                           'sel-line-start': 16204L,
941
-                           'selection_end': 16235L,
942
-                           'selection_start': 16230L,
934
+                           'sel-line': 314L,
935
+                           'sel-line-start': 11297L,
936
+                           'selection_end': 11307L,
937
+                           'selection_start': 11301L,
943 938
                            'zoom': 0L},
944
-                          1548527153.692],
945
-                         [loc('addon.py'),
946
-                          {'attrib-starts': [('play_video',
947
-        223)],
948
-                           'first-line': 219L,
949
-                           'folded-linenos': [44L,
950
-        87L],
951
-                           'sel-line': 234L,
952
-                           'sel-line-start': 10475L,
953
-                           'selection_end': 10475L,
954
-                           'selection_start': 10475L,
939
+                          1553961387.279],
940
+                         [loc('service.py'),
941
+                          {'attrib-starts': [],
942
+                           'first-line': 28L,
943
+                           'folded-linenos': [],
944
+                           'sel-line': 40L,
945
+                           'sel-line-start': 1576L,
946
+                           'selection_end': 1630L,
947
+                           'selection_start': 1622L,
955 948
                            'zoom': 0L},
956
-                          1548527189.976],
957
-                         [loc('context_download.py'),
958
-                          {'attrib-starts': [('download_sub',
959
-        428)],
960
-                           'first-line': 415L,
949
+                          1553961400.666],
950
+                         [loc('resources/lib/content/playstreamproxy.py'),
951
+                          {'attrib-starts': [('start',
952
+        299)],
953
+                           'first-line': 305L,
961 954
                            'folded-linenos': [],
962
-                           'sel-line': 430L,
963
-                           'sel-line-start': 16204L,
964
-                           'selection_end': 16235L,
965
-                           'selection_start': 16230L,
955
+                           'sel-line': 308L,
956
+                           'sel-line-start': 11116L,
957
+                           'selection_end': 11145L,
958
+                           'selection_start': 11145L,
966 959
                            'zoom': 0L},
967
-                          1548527207.874],
968
-                         [loc('context_download.py'),
969
-                          {'attrib-starts': [('download_sub',
970
-        428)],
971
-                           'first-line': 425L,
960
+                          1553961417.581],
961
+                         [loc('service.py'),
962
+                          {'attrib-starts': [],
963
+                           'first-line': 24L,
972 964
                            'folded-linenos': [],
973
-                           'sel-line': 446L,
974
-                           'sel-line-start': 16685L,
975
-                           'selection_end': 16705L,
976
-                           'selection_start': 16701L,
965
+                           'sel-line': 29L,
966
+                           'sel-line-start': 1092L,
967
+                           'selection_end': 1116L,
968
+                           'selection_start': 1116L,
977 969
                            'zoom': 0L},
978
-                          1548527221.502],
979
-                         [loc('context_download.py'),
980
-                          {'attrib-starts': [('download_sub',
981
-        428)],
982
-                           'first-line': 425L,
970
+                          1553961647.967],
971
+                         [loc('resources/lib/content/playstreamproxy.py'),
972
+                          {'attrib-starts': [('start',
973
+        299)],
974
+                           'first-line': 296L,
983 975
                            'folded-linenos': [],
984
-                           'sel-line': 446L,
985
-                           'sel-line-start': 16685L,
986
-                           'selection_end': 16711L,
987
-                           'selection_start': 16706L,
976
+                           'sel-line': 308L,
977
+                           'sel-line-start': 11116L,
978
+                           'selection_end': 11145L,
979
+                           'selection_start': 11145L,
988 980
                            'zoom': 0L},
989
-                          1548527222.414],
990
-                         [loc('context_download.py'),
991
-                          {'attrib-starts': [('download_image',
992
-        454)],
993
-                           'first-line': 439L,
981
+                          1553961697.976],
982
+                         [loc('service.py'),
983
+                          {'attrib-starts': [],
984
+                           'first-line': 28L,
994 985
                            'folded-linenos': [],
995
-                           'sel-line': 460L,
996
-                           'sel-line-start': 17124L,
997
-                           'selection_end': 17154L,
998
-                           'selection_start': 17149L,
986
+                           'sel-line': 40L,
987
+                           'sel-line-start': 1576L,
988
+                           'selection_end': 1576L,
989
+                           'selection_start': 1576L,
999 990
                            'zoom': 0L},
1000
-                          1548527225.136],
1001
-                         [loc('context_download.py'),
1002
-                          {'attrib-starts': [('download_image',
1003
-        454)],
1004
-                           'first-line': 451L,
991
+                          1553961716.689],
992
+                         [loc('resources/lib/content/playstreamproxy.py'),
993
+                          {'attrib-starts': [('start',
994
+        299)],
995
+                           'first-line': 296L,
1005 996
                            'folded-linenos': [],
1006
-                           'sel-line': 464L,
1007
-                           'sel-line-start': 17229L,
1008
-                           'selection_end': 17251L,
1009
-                           'selection_start': 17246L,
997
+                           'sel-line': 301L,
998
+                           'sel-line-start': 10888L,
999
+                           'selection_end': 10888L,
1000
+                           'selection_start': 10888L,
1010 1001
                            'zoom': 0L},
1011
-                          1548527226.448],
1012
-                         [loc('context_download.py'),
1013
-                          {'attrib-starts': [('Job',
1014
-        501),
1015
-        ('Job.read',
1016
-         508)],
1017
-                           'first-line': 489L,
1002
+                          1553961732.748],
1003
+                         [loc('service.py'),
1004
+                          {'attrib-starts': [],
1005
+                           'first-line': 28L,
1018 1006
                            'folded-linenos': [],
1019
-                           'sel-line': 510L,
1020
-                           'sel-line-start': 18653L,
1021
-                           'selection_end': 18675L,
1022
-                           'selection_start': 18670L,
1007
+                           'sel-line': 38L,
1008
+                           'sel-line-start': 1489L,
1009
+                           'selection_end': 1550L,
1010
+                           'selection_start': 1546L,
1023 1011
                            'zoom': 0L},
1024
-                          1548527228.555],
1025
-                         [loc('context_download.py'),
1026
-                          {'attrib-starts': [('Job',
1027
-        501),
1028
-        ('Job.write',
1029
-         517)],
1030
-                           'first-line': 498L,
1012
+                          1553961741.184],
1013
+                         [loc('resources/lib/content/playstreamproxy.py'),
1014
+                          {'attrib-starts': [('start2',
1015
+        314)],
1016
+                           'first-line': 293L,
1031 1017
                            'folded-linenos': [],
1032
-                           'sel-line': 519L,
1033
-                           'sel-line-start': 18897L,
1034
-                           'selection_end': 18915L,
1035
-                           'selection_start': 18910L,
1018
+                           'sel-line': 314L,
1019
+                           'sel-line-start': 11297L,
1020
+                           'selection_end': 11373L,
1021
+                           'selection_start': 11365L,
1036 1022
                            'zoom': 0L},
1037
-                          1548527235.792],
1038
-                         [loc('context_download.py'),
1039
-                          {'attrib-starts': [('download_video',
1040
-        104)],
1041
-                           'first-line': 128L,
1023
+                          1553961812.104],
1024
+                         [loc('service.py'),
1025
+                          {'attrib-starts': [],
1026
+                           'first-line': 24L,
1042 1027
                            'folded-linenos': [],
1043
-                           'sel-line': 133L,
1044
-                           'sel-line-start': 5005L,
1045
-                           'selection_end': 5020L,
1046
-                           'selection_start': 5015L,
1028
+                           'sel-line': 32L,
1029
+                           'sel-line-start': 1281L,
1030
+                           'selection_end': 1281L,
1031
+                           'selection_start': 1281L,
1047 1032
                            'zoom': 0L},
1048
-                          1548527237.569],
1049
-                         [loc('context_download.py'),
1050
-                          {'attrib-starts': [('download_stream',
1051
-        149)],
1052
-                           'first-line': 204L,
1033
+                          1553961852.617],
1034
+                         [loc('resources/lib/content/playstreamproxy.py'),
1035
+                          {'attrib-starts': [('start2',
1036
+        314)],
1037
+                           'first-line': 293L,
1053 1038
                            'folded-linenos': [],
1054
-                           'sel-line': 209L,
1055
-                           'sel-line-start': 8350L,
1056
-                           'selection_end': 8360L,
1057
-                           'selection_start': 8358L,
1039
+                           'sel-line': 314L,
1040
+                           'sel-line-start': 11297L,
1041
+                           'selection_end': 11373L,
1042
+                           'selection_start': 11365L,
1058 1043
                            'zoom': 0L},
1059
-                          1548527257.115],
1060
-                         [loc('context_download.py'),
1061
-                          {'attrib-starts': [('download_stream',
1062
-        149)],
1063
-                           'first-line': 181L,
1044
+                          1553961856.675],
1045
+                         [loc('service.py'),
1046
+                          {'attrib-starts': [],
1047
+                           'first-line': 24L,
1064 1048
                            'folded-linenos': [],
1065
-                           'sel-line': 186L,
1066
-                           'sel-line-start': 7336L,
1067
-                           'selection_end': 7350L,
1068
-                           'selection_start': 7349L,
1049
+                           'sel-line': 32L,
1050
+                           'sel-line-start': 1281L,
1051
+                           'selection_end': 1281L,
1052
+                           'selection_start': 1281L,
1069 1053
                            'zoom': 0L},
1070
-                          1548527258.645],
1071
-                         [loc('context_download.py'),
1072
-                          {'attrib-starts': [('download_stream',
1073
-        149)],
1074
-                           'first-line': 0L,
1054
+                          1553961868.934],
1055
+                         [loc('resources/lib/content/playstreamproxy.py'),
1056
+                          {'attrib-starts': [('StreamHandler',
1057
+        90),
1058
+        ('StreamHandler.do_GET',
1059
+         107)],
1060
+                           'first-line': 118L,
1075 1061
                            'folded-linenos': [],
1076
-                           'sel-line': 186L,
1077
-                           'sel-line-start': 7336L,
1078
-                           'selection_end': 7352L,
1079
-                           'selection_start': 7348L,
1062
+                           'sel-line': 129L,
1063
+                           'sel-line-start': 4408L,
1064
+                           'selection_end': 4408L,
1065
+                           'selection_start': 4408L,
1080 1066
                            'zoom': 0L},
1081
-                          1548527280.832],
1082
-                         [loc('resources/lib/content/file.py'),
1083
-                          {'attrib-starts': [('FileObject',
1084
-        20),
1085
-        ('FileObject.__init__',
1086
-         22)],
1087
-                           'first-line': 18L,
1088
-                           'folded-linenos': [83L,
1089
-        86L,
1090
-        102L],
1091
-                           'sel-line': 25L,
1092
-                           'sel-line-start': 803L,
1093
-                           'selection_end': 835L,
1094
-                           'selection_start': 827L,
1067
+                          1553961933.719],
1068
+                         [loc('resources/lib/content/ContentSources.py'),
1069
+                          {'attrib-starts': [('ContentSources',
1070
+        16),
1071
+        ('ContentSources.get_content',
1072
+         66)],
1073
+                           'first-line': 85L,
1074
+                           'folded-linenos': [],
1075
+                           'sel-line': 96L,
1076
+                           'sel-line-start': 4327L,
1077
+                           'selection_end': 4327L,
1078
+                           'selection_start': 4327L,
1095 1079
                            'zoom': 0L},
1096
-                          1548527622.598],
1097
-                         [loc('addon.py'),
1098
-                          {'attrib-starts': [('play_video',
1099
-        223)],
1100
-                           'first-line': 219L,
1101
-                           'folded-linenos': [44L,
1102
-        87L],
1103
-                           'sel-line': 234L,
1104
-                           'sel-line-start': 10475L,
1105
-                           'selection_end': 10475L,
1106
-                           'selection_start': 10475L,
1080
+                          1553961943.014],
1081
+                         [loc('resources/lib/content/playstreamproxy.py'),
1082
+                          {'attrib-starts': [('StreamHandler',
1083
+        90),
1084
+        ('StreamHandler.do_GET',
1085
+         107)],
1086
+                           'first-line': 118L,
1087
+                           'folded-linenos': [],
1088
+                           'sel-line': 129L,
1089
+                           'sel-line-start': 4408L,
1090
+                           'selection_end': 4408L,
1091
+                           'selection_start': 4408L,
1107 1092
                            'zoom': 0L},
1108
-                          1548527712.597],
1109
-                         [loc('resources/lib/content/file.py'),
1110
-                          {'attrib-starts': [('FileObject',
1111
-        20),
1112
-        ('FileObject.__init__',
1113
-         22)],
1114
-                           'first-line': 0L,
1115
-                           'folded-linenos': [86L,
1116
-        102L],
1117
-                           'sel-line': 34L,
1118
-                           'sel-line-start': 1129L,
1119
-                           'selection_end': 1154L,
1120
-                           'selection_start': 1150L,
1093
+                          1553962003.692],
1094
+                         [loc('resources/lib/content/ContentSources.py'),
1095
+                          {'attrib-starts': [('ContentSources',
1096
+        16),
1097
+        ('ContentSources.get_content',
1098
+         66)],
1099
+                           'first-line': 74L,
1100
+                           'folded-linenos': [],
1101
+                           'sel-line': 83L,
1102
+                           'sel-line-start': 3836L,
1103
+                           'selection_end': 3836L,
1104
+                           'selection_start': 3836L,
1121 1105
                            'zoom': 0L},
1122
-                          1548527998.133],
1123
-                         [loc('resources/lib/content/file.py'),
1124
-                          {'attrib-starts': [('FileObject',
1125
-        20),
1126
-        ('FileObject.__init__',
1127
-         22)],
1128
-                           'first-line': 26L,
1129
-                           'folded-linenos': [86L,
1130
-        102L],
1131
-                           'sel-line': 34L,
1132
-                           'sel-line-start': 1129L,
1133
-                           'selection_end': 1160L,
1134
-                           'selection_start': 1157L,
1106
+                          1553962031.709],
1107
+                         [loc('resources/lib/content/playstreamproxy.py'),
1108
+                          {'attrib-starts': [('StreamHandler',
1109
+        90),
1110
+        ('StreamHandler.do_GET',
1111
+         107)],
1112
+                           'first-line': 106L,
1113
+                           'folded-linenos': [],
1114
+                           'sel-line': 111L,
1115
+                           'sel-line-start': 3644L,
1116
+                           'selection_end': 3644L,
1117
+                           'selection_start': 3644L,
1135 1118
                            'zoom': 0L},
1136
-                          1548527999.634]],
1119
+                          1553962875.617]],
1137 1120
                         20),
1138
-          'current-loc': loc('resources/lib/content/file.py'),
1121
+          'current-loc': loc('resources/lib/content/ContentSources.py'),
1139 1122
           'editor-state-list': [(loc('changelog.md'),
1140 1123
                                  {'attrib-starts': [],
1141 1124
                                   'first-line': 0L,
@@ -1149,10 +1132,10 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1149 1132
                                  {'attrib-starts': [],
1150 1133
                                   'first-line': 0L,
1151 1134
                                   'folded-linenos': [],
1152
-                                  'sel-line': 9L,
1153
-                                  'sel-line-start': 461L,
1154
-                                  'selection_end': 491L,
1155
-                                  'selection_start': 491L,
1135
+                                  'sel-line': 7L,
1136
+                                  'sel-line-start': 361L,
1137
+                                  'selection_end': 429L,
1138
+                                  'selection_start': 429L,
1156 1139
                                   'zoom': 0L}),
1157 1140
                                 (loc('context_menu.py'),
1158 1141
                                  {'attrib-starts': [],
@@ -1173,15 +1156,14 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1173 1156
                                   'selection_start': 111L,
1174 1157
                                   'zoom': 0L}),
1175 1158
                                 (loc('addon.py'),
1176
-                                 {'attrib-starts': [('play_video',
1177
-        223)],
1178
-                                  'first-line': 219L,
1159
+                                 {'attrib-starts': [],
1160
+                                  'first-line': 22L,
1179 1161
                                   'folded-linenos': [44L,
1180 1162
         87L],
1181
-                                  'sel-line': 234L,
1182
-                                  'sel-line-start': 10475L,
1183
-                                  'selection_end': 10475L,
1184
-                                  'selection_start': 10475L,
1163
+                                  'sel-line': 31L,
1164
+                                  'sel-line-start': 1063L,
1165
+                                  'selection_end': 1092L,
1166
+                                  'selection_start': 1084L,
1185 1167
                                   'zoom': 0L}),
1186 1168
                                 (loc('context_download.py'),
1187 1169
                                  {'attrib-starts': [('download_stream',
@@ -1197,13 +1179,13 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1197 1179
                                  {'attrib-starts': [('ContentSources',
1198 1180
         16),
1199 1181
         ('ContentSources.get_content',
1200
-         64)],
1201
-                                  'first-line': 62L,
1182
+         66)],
1183
+                                  'first-line': 74L,
1202 1184
                                   'folded-linenos': [],
1203
-                                  'sel-line': 67L,
1204
-                                  'sel-line-start': 2870L,
1205
-                                  'selection_end': 2870L,
1206
-                                  'selection_start': 2870L,
1185
+                                  'sel-line': 83L,
1186
+                                  'sel-line-start': 3836L,
1187
+                                  'selection_end': 3836L,
1188
+                                  'selection_start': 3836L,
1207 1189
                                   'zoom': 0L}),
1208 1190
                                 (loc('resources/lib/content/sources/config.py'),
1209 1191
                                  {'attrib-starts': [('Source',
@@ -1241,6 +1223,37 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1241 1223
                                   'sel-line-start': 2364L,
1242 1224
                                   'selection_end': 2364L,
1243 1225
                                   'selection_start': 2364L,
1226
+                                  'zoom': 0L}),
1227
+                                (loc('service.py'),
1228
+                                 {'attrib-starts': [],
1229
+                                  'first-line': 24L,
1230
+                                  'folded-linenos': [],
1231
+                                  'sel-line': 32L,
1232
+                                  'sel-line-start': 1281L,
1233
+                                  'selection_end': 1281L,
1234
+                                  'selection_start': 1281L,
1235
+                                  'zoom': 0L}),
1236
+                                (loc('../../../../Program Files/Kodi/system/Python/Lib/traceback.py'),
1237
+                                 {'attrib-starts': [('format_exception',
1238
+        129)],
1239
+                                  'first-line': 125L,
1240
+                                  'folded-linenos': [],
1241
+                                  'sel-line': 138L,
1242
+                                  'sel-line-start': 5168L,
1243
+                                  'selection_end': 5168L,
1244
+                                  'selection_start': 5168L,
1245
+                                  'zoom': 0L}),
1246
+                                (loc('resources/lib/content/playstreamproxy.py'),
1247
+                                 {'attrib-starts': [('StreamHandler',
1248
+        90),
1249
+        ('StreamHandler.do_GET',
1250
+         107)],
1251
+                                  'first-line': 106L,
1252
+                                  'folded-linenos': [],
1253
+                                  'sel-line': 111L,
1254
+                                  'sel-line-start': 3644L,
1255
+                                  'selection_end': 3644L,
1256
+                                  'selection_start': 3644L,
1244 1257
                                   'zoom': 0L})],
1245 1258
           'has-focus': True,
1246 1259
           'locked': False},
@@ -1253,7 +1266,10 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1253 1266
           loc('resources/lib/content/ContentSources.py'),
1254 1267
           loc('resources/lib/content/sources/config.py'),
1255 1268
           loc('resources/lib/content/sources/ltc.py'),
1256
-          loc('resources/lib/content/file.py')]),
1269
+          loc('resources/lib/content/file.py'),
1270
+          loc('service.py'),
1271
+          loc('../../../../Program Files/Kodi/system/Python/Lib/traceback.py'),
1272
+          loc('resources/lib/content/playstreamproxy.py')]),
1257 1273
         ({'bookmarks': ([(loc('iubx.py'),
1258 1274
                           {'attrib-starts': [('main',
1259 1275
         42)],
@@ -1496,16 +1512,19 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1496 1512
           loc('plugin.video.playstream/resources/settings.xml'),
1497 1513
           loc('que_management.py'),
1498 1514
           loc('plugin.video.playstream/resources/lib/util.py')])),
1499
-                               'open_files': [u'addon.xml',
1515
+                               'open_files': [u'addon.py',
1516
+        u'addon.xml',
1500 1517
         u'changelog.md',
1518
+        u'context_download.py',
1501 1519
         u'context_menu.py',
1502 1520
         u'kmake.bat',
1503
-        u'resources/lib/content/ContentSources.py',
1521
+        u'resources/lib/content/file.py',
1504 1522
         u'resources/lib/content/sources/config.py',
1505 1523
         u'resources/lib/content/sources/ltc.py',
1506
-        u'context_download.py',
1507
-        u'addon.py',
1508
-        u'resources/lib/content/file.py',
1524
+        u'../../../../Program Files/Kodi/system/Python/Lib/traceback.py',
1525
+        u'service.py',
1526
+        u'resources/lib/content/playstreamproxy.py',
1527
+        u'resources/lib/content/ContentSources.py',
1509 1528
         u'addon.py',
1510 1529
         u'changelog.md',
1511 1530
         u'plugin.video.playstream/resources/lib/util.py',
@@ -1527,16 +1546,18 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1527 1546
                          0,
1528 1547
                          2459,
1529 1548
                          1462)}]}
1530
-guimgr.recent-documents = [loc('resources/lib/content/file.py'),
1531
-                           loc('addon.py'),
1532
-                           loc('context_download.py'),
1549
+guimgr.recent-documents = [loc('resources/lib/content/ContentSources.py'),
1550
+                           loc('resources/lib/content/playstreamproxy.py'),
1533 1551
                            loc('service.py'),
1534
-                           loc('resources/lib/content/sources/ltc.py'),
1535
-                           loc('resources/lib/content/ContentSources.py'),
1552
+                           loc('addon.py'),
1553
+                           loc('../../../../Program Files/Kodi/system/Python/Lib/traceback.py'),
1554
+                           loc('addon.xml'),
1536 1555
                            loc('resources/lib/content/sources/config.py'),
1556
+                           loc('resources/lib/content/sources/ltc.py'),
1557
+                           loc('resources/lib/content/file.py'),
1558
+                           loc('context_download.py'),
1537 1559
                            loc('kmake.bat'),
1538 1560
                            loc('context_menu.py'),
1539
-                           loc('addon.xml'),
1540 1561
                            loc('changelog.md')]
1541 1562
 guimgr.visual-state = {loc('addon.py'): {'attrib-starts': [],
1542 1563
         'first-line': 0L,
@@ -1997,6 +2018,16 @@ guimgr.visual-state = {loc('addon.py'): {'attrib-starts': [],
1997 2018
         'sel-line-start': 4655L,
1998 2019
         'selection_end': 4691L,
1999 2020
         'selection_start': 4691L,
2021
+        'zoom': 0L},
2022
+                       loc('resources/lib/content/playstreamproxy.py'): {'at'\
2023
+        'trib-starts': [('start',
2024
+                         275)],
2025
+        'first-line': 21L,
2026
+        'folded-linenos': [],
2027
+        'sel-line': 275L,
2028
+        'sel-line-start': 9738L,
2029
+        'selection_end': 9747L,
2030
+        'selection_start': 9742L,
2000 2031
         'zoom': 0L},
2001 2032
                        loc('resources/lib/content/run.py'): {'attrib-starts': [('p'\
2002 2033
         'layer',
@@ -2495,6 +2526,20 @@ guimgr.visual-state = {loc('addon.py'): {'attrib-starts': [],
2495 2526
         'sel-line-start': 12403,
2496 2527
         'selection_end': 12403,
2497 2528
         'selection_start': 12403},
2529
+                       loc('../../../../Program Files/Kodi/system/Python/Lib/_weakrefset.py'): {'a'\
2530
+        'ttrib-starts': [('WeakSet',
2531
+                          34),
2532
+                         ('WeakSet.__init__',
2533
+                          35),
2534
+                         ('WeakSet.__init__._remove',
2535
+                          37)],
2536
+        'first-line': 25L,
2537
+        'folded-linenos': [],
2538
+        'sel-line': 38L,
2539
+        'sel-line-start': 1062L,
2540
+        'selection_end': 1062L,
2541
+        'selection_start': 1062L,
2542
+        'zoom': 0L},
2498 2543
                        loc('../../../../Python27/Lib/site-packages/kodiswift/listitem.py'): {'a'\
2499 2544
         'ttrib-starts': [('ListItem',
2500 2545
                           20),
@@ -2777,7 +2822,9 @@ search.replace-history = [u'item["posterUrl"]+"/"',
2777 2822
                           u'#logger',
2778 2823
                           u'ustvnow',
2779 2824
                           u'unicode(e)']
2780
-search.search-history = [u'open(',
2825
+search.search-history = [u'sources',
2826
+                         u' [playstream] play_video',
2827
+                         u'open(',
2781 2828
                          u'channels',
2782 2829
                          u'"nfo"',
2783 2830
                          u'api_url',
@@ -2785,7 +2832,6 @@ search.search-history = [u'open(',
2785 2832
                          u'get_streams',
2786 2833
                          u'download_image',
2787 2834
                          u'sources_direco',
2788
-                         u'sources',
2789 2835
                          u'countr',
2790 2836
                          u'overwrite',
2791 2837
                          u'Except',
@@ -2795,8 +2841,7 @@ search.search-history = [u'open(',
2795 2841
                          u'enigma',
2796 2842
                          u'UA',
2797 2843
                          u'm3u',
2798
-                         u'kEmbedded',
2799
-                         u'item["posterUrl"]']
2844
+                         u'kEmbedded']
2800 2845
 testing.stored-results = (1,
2801 2846
                           [],
2802 2847
                           {})

+ 11
- 2
resources/language/English/strings.xml View File

@@ -4,6 +4,7 @@
4 4
   <string id="30000">PlayStream</string>
5 5
 
6 6
   <string id="40000">General settings</string>
7
+  <string id="40021">Playstreamproxy</string>
7 8
   <string id="40001">Replay.lv</string>
8 9
   <string id="40002">Skaties.lv</string>
9 10
   <string id="40003">Shortcut.tv</string>
@@ -29,10 +30,18 @@
29 30
   <string id="50010">Save plugin status between call</string>
30 31
   <string id="50011">Time to live for status</string>
31 32
   <string id="50012">Download directory</string>
33
+
32 34
   <string id="50013">Start local proxy server</string>
33 35
   <string id="50014">Local proxy server port</string>
34
-  <string id="50017">Use proxy for problematic streams</string>
35
-  <string id="50015">Stream proxy url</string>
36
+  <string id="50027">Local proxy secret key</string>
37
+  <string id="50028">Redirect streams</string>
38
+  <string id="50029">User multithreading</string>
39
+  <string id="50030">Threads</string>
40
+
41
+  <string id="50017">Use playstreamproxy for content</string>
42
+  <string id="50015">Playstreamproxy url</string>
43
+  <string id="50031">Playstreamproxy secret key</string>
44
+
36 45
   <string id="50016">Playlist file (m3u)</string>
37 46
   <string id="50020">Autostart PlayStream</string>
38 47
   <string id="50021">View Mode</string>

+ 1
- 1
resources/lib/content

@@ -1 +1 @@
1
-Subproject commit eb74cc0a47f8259ac534251008fc594f928f454b
1
+Subproject commit b1add8217bbb6c551559f91ed78b905d27281731

+ 11
- 4
resources/settings.xml View File

@@ -9,13 +9,20 @@
9 9
         <setting id="general_download_dir" label="50012" type="folder" default="download" />
10 10
         <setting id="general_download_overwrite" label="50025" type="bool" default="false" />
11 11
         <setting id="general_playlist" label="50016" type="file" default="playstream.m3u" />
12
-        <setting id="general_proxy" label="50013" type="bool" default="false" />
13
-        <setting id="general_port" label="50014" type="number" default="8880" />
14
-        <setting id="general_proxy_use" label="50017" type="bool" default="false" />
15
-        <setting id="general_proxy_url" label="50015" type="text" default="http://localhost:8880/" />
16 12
         <setting id="general_streams_file" label="50022" type="file" default="streams.cfg" />
17 13
         <setting id="general_streams_file_remote" label="50023" type="file" default="ftp://user:password@hostname/hdd/streams.cfg" />
18 14
         <setting id="general_use_streams_file_remote" label="50024" type="bool" default="false" />
15
+        <setting id="general_proxy_use" label="50017" type="bool" default="false" />
16
+        <setting id="general_proxy_url" label="50015" type="text" default="http://localhost:8880/" />
17
+        <setting id="general_proxy_remote_key" label="50031" type="text" default="" />
18
+    </category>
19
+    <category label="40021">
20
+        <setting id="general_proxy" label="50013" type="bool" default="false" />
21
+        <setting id="general_port" label="50014" type="number" default="8880" />
22
+        <setting id="general_proxy_key" label="50027" type="text" default="" />
23
+        <setting id="general_proxy_redirect" label="50028" type="bool" default="true" />
24
+        <setting id="general_proxy_multithread" label="50029" type="bool" default="false" />
25
+        <setting id="general_proxy_workers" label="50030" type="number" default="10" />
19 26
     </category>
20 27
 
21 28
     <category label="40003">

+ 9
- 2
service.py View File

@@ -27,11 +27,18 @@ if autostart:
27 27
 
28 28
 port = plugin.get_setting("general_port",int)
29 29
 start_proxy = plugin.get_setting("general_proxy",bool)
30
-host = "localhost"
30
+redirect = plugin.get_setting("general_proxy_redirect",bool)
31
+multithread = plugin.get_setting("general_proxy_multithread",bool)
32
+workers = plugin.get_setting("general_proxy_workers",int)
33
+key = plugin.get_setting("general_proxy_key",str)
34
+host = "0.0.0.0"
31 35
 if start_proxy:
32 36
     plugin.notify("Starting playstreamproxy","Info",10000, xbmcgui.NOTIFICATION_INFO)
33 37
     try:
34
-        playstreamproxy.start(host, port)
38
+        if multithread:
39
+            playstreamproxy.start2(host, port, redirect, key, workers)
40
+        else:
41
+            playstreamproxy.start(host, port, redirect, key)
35 42
     except Exception as e:
36 43
         xbmcgui.Dialog().ok("Error starting playstreamproxyserver",unicode(e))
37 44
         #plugin.notify(unicode(e), "Error", 10000, xbmcgui.NOTIFICATION_ERROR)

+ 123
- 113
wingdbstub.py View File

@@ -23,6 +23,10 @@ For details, see Debugging Externally Launched Code in the manual.
23 23
 #########################################################################
24 24
 
25 25
 import sys
26
+orig_sys_modules = list(sys.modules.keys())
27
+orig_sys_path = list(sys.path)
28
+orig_meta_path = list(sys.meta_path)
29
+
26 30
 import os
27 31
 if sys.version_info >= (3, 7):
28 32
   import importlib
@@ -32,14 +36,14 @@ else:
32 36
 #------------------------------------------------------------------------
33 37
 # Required configuration values (some installers set this automatically)
34 38
 
35
-# This should be the full path to your Wing installation.  On OS X, use
36
-# the full path of the Wing application bundle, for example
37
-# /Applications/WingIDE.app.  When set to None, the environment variable
38
-# WINGHOME is used instead.
39
-WINGHOME = r"C:\Program Files (x86)\Wing IDE 6.1"
39
+# This should be the full path to your Wing installation.  On OS X, use 
40
+# the full path of the Wing application bundle, for example 
41
+# /Applications/WingPro.app.  When set to None, the environment variable 
42
+# WINGHOME is used instead.  
43
+WINGHOME = r"C:\Program Files (x86)\Wing Pro 7.0"
40 44
 
41 45
 #------------------------------------------------------------------------
42
-# Optional configuration values:  The named environment variables, if set,
46
+# Optional configuration values:  The named environment variables, if set, 
43 47
 # will override these settings.
44 48
 
45 49
 # Set this to 1 to disable all debugging; 0 to enable debugging
@@ -57,16 +61,16 @@ kWingHostPort = 'localhost:50005'
57 61
 # This is only used when the debug process is not attached to
58 62
 # an IDE or the IDE has dropped its connection. The configured
59 63
 # port can optionally be added to the IDE's Common Attach Hosts
60
-# preference. Note that a random port is used instead if the given
64
+# preference. Note that a random port is used instead if the given 
61 65
 # port is already in use.
62 66
 # (WINGDB_ATTACHPORT environment variable)
63 67
 kAttachPort = '50015'
64 68
 
65 69
 # Set this to a filename to log verbose information about the debugger
66 70
 # internals to a file.  If the file does not exist, it will be created
67
-# as long as its enclosing directory exists and is writeable.  Use
68
-# "<stderr>" or "<stdout>" to write to stderr or stdout.  Note that
69
-# "<stderr>" may cause problems on Windows if the debug process is not
71
+# as long as its enclosing directory exists and is writeable.  Use 
72
+# "<stderr>" or "<stdout>" to write to stderr or stdout.  Note that 
73
+# "<stderr>" may cause problems on Windows if the debug process is not 
70 74
 # running in a console.
71 75
 # (WINGDB_LOGFILE environment variable)
72 76
 kLogFile = None
@@ -78,7 +82,7 @@ kLogFile = None
78 82
 kLogVeryVerbose = 0
79 83
 
80 84
 # Set this to 1 when debugging embedded scripts in an environment that
81
-# creates and reuses a Python instance across multiple script invocations.
85
+# creates and reuses a Python instance across multiple script invocations.  
82 86
 # It turns off automatic detection of program quit so that the debug session
83 87
 # can span multiple script invocations.  When this is turned on, you may
84 88
 # need to call ProgramQuit() on the debugger object to shut down the
@@ -89,12 +93,12 @@ kLogVeryVerbose = 0
89 93
 # this module in the second or later Python instance.  See the Wing
90 94
 # manual for details.
91 95
 # (WINGDB_EMBEDDED environment variable)
92
-kEmbedded = 1
96
+kEmbedded = 0
93 97
 
94 98
 # Path to search for the debug password file and the name of the file
95
-# to use.  The password file contains a security token for all
96
-# connections to the IDE and must match the wingdebugpw file in the
97
-# User Settngs directory used by the IDE. '$<winguserprofile>'
99
+# to use.  The password file contains a security token for all 
100
+# connections to the IDE and must match the wingdebugpw file in the 
101
+# User Settngs directory used by the IDE. '$<winguserprofile>' 
98 102
 # is replaced by the User Settings directory for the user that
99 103
 # is running the process.
100 104
 # (WINGDB_PWFILEPATH environment variable)
@@ -110,94 +114,77 @@ kExitOnFailure = 0
110 114
 #------------------------------------------------------------------------
111 115
 # Find Wing debugger installation location
112 116
 
113
-if sys.hexversion >= 0x03000000:
114
-  def has_key(o, key):
115
-    return key in o
116
-else:
117
-  def has_key(o, key):
118
-    return o.has_key(key)
119
-
120 117
 # Check environment:  Must have WINGHOME defined if still == None
121 118
 if WINGHOME == None:
122
-  if has_key(os.environ, 'WINGHOME'):
119
+  if 'WINGHOME' in os.environ:
123 120
     WINGHOME=os.environ['WINGHOME']
124 121
   else:
125
-    msg = '\n'.join(["*******************************************************************",
126
-                     "Error: Could not find Wing installation!  You must set WINGHOME or edit",
127
-                     "wingdbstub.py where indicated to point it to the location where",
122
+    msg = '\n'.join(["*******************************************************************", 
123
+                     "Error: Could not find Wing installation!  You must set WINGHOME or edit", 
124
+                     "wingdbstub.py where indicated to point it to the location where", 
128 125
                      "Wing is installed.\n"])
129 126
     sys.stderr.write(msg)
130 127
     raise ImportError(msg)
131
-
128
+  
132 129
 WINGHOME = os.path.expanduser(WINGHOME)
133
-kPWFilePath.append(WINGHOME)
134 130
 
135
-# The user settings dir where per-user settings & patches are located.  Will be
136
-# set from environment if left as None
137
-kUserSettingsDir = None
138
-if kUserSettingsDir is None:
139
-  kUserSettingsDir = os.environ.get('WINGDB_USERSETTINGS')
140
-
141
-def _FindActualWingHome(winghome):
131
+def NP_FindActualWingHome(winghome):
142 132
   """ Find the actual directory to use for winghome.  Needed on OS X
143 133
   where the .app directory is the preferred dir to use for WINGHOME and
144 134
   .app/Contents/MacOS is accepted for backward compatibility. """
145
-
135
+  
146 136
   if sys.platform != 'darwin':
147 137
     return winghome
148
-
138
+  
149 139
   app_dir = None
150 140
   if os.path.isdir(winghome):
151 141
     if winghome.endswith('/'):
152 142
       wo_slash = winghome[:-1]
153 143
     else:
154 144
       wo_slash = winghome
155
-
145
+      
156 146
     if wo_slash.endswith('.app'):
157 147
       app_dir = wo_slash
158 148
     elif wo_slash.endswith('.app/Contents/MacOS'):
159 149
       app_dir = wo_slash[:-len('/Contents/MacOS')]
160
-
150
+    
161 151
   if app_dir and os.path.isdir(os.path.join(app_dir, 'Contents', 'Resources')):
162 152
     return os.path.join(app_dir, 'Contents', 'Resources')
163
-
153
+  
164 154
   return winghome
155
+  
156
+WINGHOME = NP_FindActualWingHome(WINGHOME)
157
+os.environ['WINGHOME'] = WINGHOME
165 158
 
166
-def _ImportWingdb(winghome, user_settings=None):
167
-  """ Find & import wingdb module. """
168
-
169
-  try:
170
-    exec_dict = {}
171
-    execfile(os.path.join(winghome, 'bin', '_patchsupport.py'), exec_dict)
172
-    find_matching = exec_dict['FindMatching']
173
-    dir_list = find_matching('bin', winghome, user_settings)
174
-  except Exception:
175
-    dir_list = []
176
-  dir_list.extend([os.path.join(winghome, 'bin'), os.path.join(winghome, 'src')])
177
-  for path in dir_list:
178
-    try:
179
-      if sys.version_info >= (3, 7):
180
-        import importlib.machinery
181
-        import importlib.util
182
-
183
-        spec = importlib.machinery.PathFinder.find_spec('wingdb', [path])
184
-        if spec is not None:
185
-          mod = importlib.util.module_from_spec(spec)
186
-          if mod is not None:
187
-            spec.loader.exec_module(mod)
188
-            return mod
189
-      else:
190
-        f, p, d = imp.find_module('wingdb', [path])
191
-        try:
192
-          return imp.load_module('wingdb', f, p, d)
193
-        finally:
194
-          if f is not None:
195
-            f.close()
196
-
197
-    except ImportError:
198
-      pass
159
+# Path used to find the wingdebugpw file
160
+kPWFilePath.append(WINGHOME)
199 161
 
200
-  return None
162
+#-----------------------------------------------------------------------
163
+def NP_LoadModuleFromBootstrap(winghome, modname):
164
+  """Load a module from the installation bootstrap directory.  Assumes that
165
+  imports don't change sys.path.  The modules are unloaded from sys.modules
166
+  so they can be loaded again later from an update."""
167
+  
168
+  # Limited to simple module loads
169
+  assert '.' not in modname
170
+  
171
+  orig_sys_path = sys.path[:]
172
+  orig_modules = set(sys.modules)
173
+  
174
+  dirname = winghome + '/bootstrap'
175
+  sys.path.insert(0, dirname)
176
+  
177
+  code = 'import %s' % modname
178
+  exec(code)
179
+  
180
+  new_modules = set(sys.modules)
181
+  new_modules.difference_update(orig_modules)
182
+  for mod in new_modules:
183
+    del sys.modules[mod]
184
+    
185
+  sys.path = orig_sys_path
186
+  
187
+  return locals()[modname]
201 188
 
202 189
 #------------------------------------------------------------------------
203 190
 # Set debugger if it hasn't been set -- this is to handle module reloading
@@ -206,24 +193,26 @@ try:
206 193
   debugger
207 194
 except NameError:
208 195
   debugger = None
209
-
196
+  
197
+#-----------------------------------------------------------------------
210 198
 # Unset WINGDB_ACTIVE env if it was inherited from another process
211 199
 # XXX Would be better to be able to call getpid() on dbgtracer but can't access it yet
212 200
 if 'WINGDB_ACTIVE' in os.environ and os.environ['WINGDB_ACTIVE'] != str(os.getpid()):
213 201
   del os.environ['WINGDB_ACTIVE']
214 202
 
203
+#-----------------------------------------------------------------------
215 204
 # Start debugging if not disabled and this module has never been imported
216 205
 # before
217
-if (not kWingDebugDisabled and debugger is None
218
-    and not has_key(os.environ, 'WINGDB_DISABLED') and
219
-    not has_key(os.environ, 'WINGDB_ACTIVE')):
206
+if (not kWingDebugDisabled and debugger is None and
207
+    'WINGDB_DISABLED' not in os.environ and 
208
+    'WINGDB_ACTIVE' not in os.environ):
220 209
 
221 210
   exit_on_fail = 0
222
-
211
+  
223 212
   try:
224 213
     # Obtain exit if fails value
225 214
     exit_on_fail = os.environ.get('WINGDB_EXITONFAILURE', kExitOnFailure)
226
-
215
+    
227 216
     # Obtain configuration for log file to use, if any
228 217
     logfile = os.environ.get('WINGDB_LOGFILE', kLogFile)
229 218
     if logfile == '-' or logfile == None or len(logfile.strip()) == 0:
@@ -232,76 +221,96 @@ if (not kWingDebugDisabled and debugger is None
232 221
     very_verbose_log = os.environ.get('WINGDB_LOGVERYVERBOSE', kLogVeryVerbose)
233 222
     if type(very_verbose_log) == type('') and very_verbose_log.strip() == '':
234 223
       very_verbose_log = 0
235
-
224
+      
236 225
     # Determine remote host/port where the IDE is running
237 226
     hostport = os.environ.get('WINGDB_HOSTPORT', kWingHostPort)
238 227
     colonpos = hostport.find(':')
239 228
     host = hostport[:colonpos]
240 229
     port = int(hostport[colonpos+1:])
241
-
230
+  
242 231
     # Determine port to listen on locally for attach requests
243 232
     attachport = int(os.environ.get('WINGDB_ATTACHPORT', kAttachPort))
244
-
233
+  
245 234
     # Check if running embedded script
246 235
     embedded = int(os.environ.get('WINGDB_EMBEDDED', kEmbedded))
247
-
236
+  
248 237
     # Obtain debug password file search path
249
-    if has_key(os.environ, 'WINGDB_PWFILEPATH'):
238
+    if 'WINGDB_PWFILEPATH' in os.environ:
250 239
       pwfile_path = os.environ['WINGDB_PWFILEPATH'].split(os.pathsep)
251 240
     else:
252 241
       pwfile_path = kPWFilePath
253
-
242
+    
254 243
     # Obtain debug password file name
255
-    if has_key(os.environ, 'WINGDB_PWFILENAME'):
244
+    if 'WINGDB_PWFILENAME' in os.environ:
256 245
       pwfile_name = os.environ['WINGDB_PWFILENAME']
257 246
     else:
258 247
       pwfile_name = kPWFileName
259
-
260
-    # Load wingdb.py
261
-    actual_winghome = _FindActualWingHome(WINGHOME)
262
-    wingdb = _ImportWingdb(actual_winghome, kUserSettingsDir)
263
-    if wingdb == None:
264
-      sys.stdout.write("*******************************************************************\n")
265
-      sys.stdout.write("Error: Cannot find wingdb.py in $(WINGHOME)/bin or $(WINGHOME)/src\n")
266
-      sys.stdout.write("Error: Please check the WINGHOME definition in wingdbstub.py\n")
267
-      sys.exit(2)
268
-
248
+    
249
+    # Set up temporary log for errors from merge importer Setup
250
+    class CTmpLog:
251
+      def __init__(self):
252
+        self.fErrors = []
253
+      def write(self, s):
254
+        self.fErrors.append(s)
255
+    tmp_log = CTmpLog()
256
+    
257
+    # Set up the meta importer; everything after this point can be update
258
+    bootstrap_utils = NP_LoadModuleFromBootstrap(WINGHOME, 'bootstrap_utils')
259
+    winghome, user_settings = bootstrap_utils.NP_SetupWingHomeModule(WINGHOME)
260
+    meta = bootstrap_utils.NP_CreateMetaImporter(WINGHOME, user_settings, 'dbg',
261
+                                                 tmp_log)
262
+    import _winghome
263
+    _winghome.kWingHome = winghome
264
+    _winghome.kUserSettings = user_settings
265
+    
269 266
     # Find the netserver module and create an error stream
270
-    netserver = wingdb.FindNetServerModule(actual_winghome, kUserSettingsDir)
271
-    err = wingdb.CreateErrStream(netserver, logfile, very_verbose_log)
272
-
273
-    # Start debugging
274
-    debugger = netserver.CNetworkServer(host, port, attachport, err,
267
+    from debug.tserver import startdebug
268
+    netserver = startdebug.FindNetServerModule(WINGHOME, user_settings)
269
+    err = startdebug.CreateErrStream(netserver, logfile, very_verbose_log)
270
+    
271
+    # Write any temporary log entries
272
+    for s in tmp_log.fErrors:
273
+      err.write(s)
274
+      
275
+    # Create debug server
276
+    debugger = netserver.CNetworkServer(host, port, attachport, err, 
275 277
                                         pwfile_path=pwfile_path,
276 278
                                         pwfile_name=pwfile_name,
277 279
                                         autoquit=not embedded)
280
+    
281
+    # Restore module and path environment
282
+    from debug.tserver import startdebug
283
+    startdebug.RestoreEnvironment(orig_sys_modules, orig_sys_path, orig_meta_path)
284
+    
285
+    # Start debugging
278 286
     debugger.StartDebug(stophere=0)
279 287
     os.environ['WINGDB_ACTIVE'] = str(os.getpid())
280 288
     if debugger.ChannelClosed():
281 289
       raise ValueError('Not connected')
282
-
290
+    
283 291
   except:
284 292
     if exit_on_fail:
285 293
       raise
286 294
     else:
287 295
       pass
288 296
 
297
+#-----------------------------------------------------------------------
289 298
 def Ensure(require_connection=1, require_debugger=1):
290 299
   """ Ensure the debugger is started and attempt to connect to the IDE if
291 300
   not already connected.  Will raise a ValueError if:
292
-
301
+  
293 302
   * the require_connection arg is true and the debugger is unable to connect
294 303
   * the require_debugger arg is true and the debugger cannot be loaded
295
-
304
+  
296 305
   If SuspendDebug() has been called through the low-level API, calling
297 306
   Ensure() resets the suspend count to zero and additional calls to
298 307
   ResumeDebug() will be ignored until SuspendDebug() is called again.
299
-
308
+  
300 309
   Note that a change to the host & port to connect to will only
301 310
   be use if a new connection is made.
302
-
311
+  
303 312
   """
304
-
313
+  
305 314
   if debugger is None:
306 315
     if require_debugger:
307 316
       raise ValueError("No debugger")
@@ -311,17 +320,18 @@ def Ensure(require_connection=1, require_debugger=1):
311 320
   colonpos = hostport.find(':')
312 321
   host = hostport[:colonpos]
313 322
   port = int(hostport[colonpos+1:])
314
-
323
+  
315 324
   resumed = debugger.ResumeDebug()
316 325
   while resumed > 0:
317 326
     resumed = debugger.ResumeDebug()
318
-
319
-  debugger.SetClientAddress((host, port))
320
-
327
+  
328
+  debugger.SetClientAddress((host, port))  
329
+  
321 330
   if not debugger.DebugActive():
322 331
     debugger.StartDebug()
323 332
   elif debugger.ChannelClosed():
324 333
     debugger.ConnectToClient()
325
-
334
+    
326 335
   if require_connection and debugger.ChannelClosed():
327 336
     raise ValueError('Not connected')
337
+