Selaa lähdekoodia

cinemalive strādā gan ar cloudsany gan ar openload

u.c.
Ivars 7 vuotta sitten
vanhempi
commit
92cd9f3e0e
6 muutettua tiedostoa jossa 574 lisäystä ja 393 poistoa
  1. 395
    310
      project.wpr
  2. 108
    0
      resolvers/cloudsany.py
  3. 1
    2
      resolvers/hqqresolver.py
  4. 52
    44
      run.py
  5. 11
    31
      sources/cinemalive.py
  6. 7
    6
      sources/ltc.py

+ 395
- 310
project.wpr Näytä tiedosto

@@ -28,16 +28,15 @@ proj.launch-config = {loc('ContentSources.py'): ('project',
28 28
         '')),
29 29
                       loc('iubx2.py'): ('project',
30 30
         (u'-sgr -d 10',
31
+         '')),
32
+                      loc('kivy_test.py'): ('project',
33
+        (u'https://dl4.sanii.co/files/2/60e13omc1cpph2/video.mp4',
31 34
          '')),
32 35
                       loc('run.py'): ('project',
33 36
                                       (u'config::home  streams_bernu.cfg',
34 37
                                        ''))}
35 38
 [user attributes]
36
-debug.breakpoints = {loc('ContentSources.py'): {39L: (0,
37
-        None,
38
-        1,
39
-        0)},
40
-                     loc('iub.py'): {102: (0,
39
+debug.breakpoints = {loc('iub.py'): {102: (0,
41 40
         None,
42 41
         1,
43 42
         0),
@@ -53,11 +52,11 @@ debug.breakpoints = {loc('ContentSources.py'): {39L: (0,
53 52
               None,
54 53
               1,
55 54
               0)},
56
-                     loc('sources/cinemalive.py'): {209L: (0,
55
+                     loc('resolvers/cloudsany.py'): {105L: (0,
57 56
         None,
58 57
         1,
59 58
         0)},
60
-                     loc('sources/ltc.py'): {101L: (0,
59
+                     loc('sources/ltc.py'): {102L: (0,
61 60
         None,
62 61
         1,
63 62
         0)},
@@ -152,6 +151,7 @@ debug.recent-run-args = {loc('ContentSources.py'): [u'config::home streams_bernu
152 151
         u'-sgr',
153 152
         u'--sgr',
154 153
         u'--slud'],
154
+                         loc('kivy_test.py'): [u'https://dl4.sanii.co/files/2/60e13omc1cpph2/video.mp4'],
155 155
                          loc('run.py'): [u'config::home  streams_bernu.cfg',
156 156
         u'config::home ',
157 157
         u'config::home streams_bernu.cfg',
@@ -165,7 +165,7 @@ edit.bookmarks = {'list_action': (loc('run.py'),
165 165
         ('Main.list_action',
166 166
          95)],
167 167
                                    'first-line': 98L,
168
-                                   'sel-line': 118L})}
168
+                                   'sel-line': 120L})}
169 169
 guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
170 170
                             'windows': [{'name': 'F8FpRDICw7YHXG3HV2rBc63asU'\
171 171
         'LBT7JH',
@@ -174,9 +174,9 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
174 174
         'view': {'area': 'tall',
175 175
                  'constraint': None,
176 176
                  'current_pages': [0,
177
-                                   0],
177
+                                   1],
178 178
                  'full-screen': False,
179
-                 'notebook_display': 'normal',
179
+                 'notebook_display': 'tabs only',
180 180
                  'notebook_percent': 0.17992831541218635,
181 181
                  'override_title': None,
182 182
                  'pagelist': [('project',
@@ -184,8 +184,9 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
184 184
                                0,
185 185
                                {'tree-state': {'file-sort-method': 'by name',
186 186
         'list-files-first': 0,
187
-        'tree-states': {'deep': {'expanded-nodes': [],
188
-                                 'selected-nodes': [(15,)],
187
+        'tree-states': {'deep': {'expanded-nodes': [(1,)],
188
+                                 'selected-nodes': [(1,
189
+        4)],
189 190
                                  'top-node': (0,)}},
190 191
         'tree-style': 'deep'}}),
191 192
                               ('snippets',
@@ -704,14 +705,14 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
704 705
         'top-node': [('generic attribute',
705 706
                       loc('../../../../../Python27/Lib/site-packages/PIL/Image.py'),
706 707
                       'ADAPTIVE')]},
707
-        loc('unknown:<untitled> #6'): {'expanded-nodes': [],
708
+        loc('unknown:<untitled> #4'): {'expanded-nodes': [],
708 709
                                        'selected-nodes': [],
709 710
                                        'top-node': None},
710 711
         loc('unknown:<untitled> #5'): {'column-widths': [1.0],
711 712
                                        'expanded-nodes': [],
712 713
                                        'selected-nodes': [],
713 714
                                        'top-node': None},
714
-        loc('unknown:<untitled> #4'): {'column-widths': [1.0],
715
+        loc('unknown:<untitled> #6'): {'column-widths': [1.0],
715 716
                                        'expanded-nodes': [],
716 717
                                        'selected-nodes': [],
717 718
                                        'top-node': None},
@@ -745,7 +746,7 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
745 746
         'current_pages': [2,
746 747
                           0],
747 748
         'notebook_display': 'normal',
748
-        'notebook_percent': 0.42672064777327934,
749
+        'notebook_percent': 0.5894736842105264,
749 750
         'override_title': None,
750 751
         'pagelist': [('debug-breakpoints',
751 752
                       'wide',
@@ -778,7 +779,7 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
778 779
                                        'fRegexFlags': 46,
779 780
                                        'fReplaceText': '',
780 781
                                        'fReverse': False,
781
-                                       'fSearchText': u'ConfigSou',
782
+                                       'fSearchText': u'blitt',
782 783
                                        'fStartPos': 0,
783 784
                                        'fStyle': 'text',
784 785
                                        'fWholeWords': False,
@@ -852,17 +853,48 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
852 853
         -1,
853 854
         -1),
854 855
                        'attrib-starts': [],
855
-                       'first-line': 17L,
856
+                       'first-line': 80L,
856 857
                        'folded-linenos': [],
857
-                       'history': {u'file:C:/Data/Programming/enigma2/PlayStream2/content/run.py': ['m'\
858
-        'od\n',
859
-        'dir(mod)\n',
860
-        'mod.__name__\n']},
858
+                       'history': {u'file:C:/Data/Programming/enigma2/PlayStream2/content/resolvers/cloudsany.py': ['u'\
859
+        'rl\n',
860
+        'print url\n',
861
+        'util.stream_type(s["url"])\n',
862
+        's\n',
863
+        'import run\n'],
864
+                                   u'file:C:/Data/Programming/enigma2/PlayStream2/content/run.py': ['u'\
865
+        'rl\n',
866
+        'print url\n',
867
+        'suburl\n',
868
+        're.sub("\\w:", "", subfile)\n',
869
+        'print subfile\n',
870
+        'if isinstance(title, str): title.decode("utf8")\n',
871
+        'sys.getfilesystemencoding()\n',
872
+        'stream["subs"][0]\n',
873
+        'title\n',
874
+        'print fname0\n'],
875
+                                   u'file:C:/Data/Programming/enigma2/PlayStream2/content/sources/cinemalive.py': ['s'\
876
+        'tream["subs"]\n',
877
+        'len(stream["subs"])\n',
878
+        'stream["subs"][0]\n',
879
+        'print p0\n',
880
+        'url_sub\n',
881
+        'print url_sub\n',
882
+        'print url\n',
883
+        'url\n',
884
+        'urllib2.urlopen(suburl)\n',
885
+        're.sub("\\w:", subfile, "")\n',
886
+        're.sub("\\w:", subfile, ")\n',
887
+        're.sub(pattern, repl, string, count=0, flags=0)\n',
888
+        're.sub("\\w:", "", subfile)\n',
889
+        'unicode(title)\n',
890
+        'title\n',
891
+        'title.decode("utf8")\n',
892
+        'if isinstance(title, str): title.decode("utf8")\n']},
861 893
                        'launch-id': None,
862
-                       'sel-line': 24L,
863
-                       'sel-line-start': 315L,
864
-                       'selection_end': 327L,
865
-                       'selection_start': 315L,
894
+                       'sel-line': 94L,
895
+                       'sel-line-start': 3987L,
896
+                       'selection_end': 3987L,
897
+                       'selection_start': 3987L,
866 898
                        'zoom': 0L}),
867 899
                      ('debug-watch',
868 900
                       'wide',
@@ -898,253 +930,258 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
898 930
         -1,
899 931
         -1),
900 932
                        'attrib-starts': [],
901
-                       'first-line': 0L,
933
+                       'first-line': 1L,
902 934
                        'folded-linenos': [],
903
-                       'history': {},
935
+                       'history': {None: ['print r"\\"\n',
936
+        'print r"\\\\"\n',
937
+        'print "\\\\"\n']},
904 938
                        'launch-id': None,
905
-                       'sel-line': 2L,
906
-                       'sel-line-start': 174L,
907
-                       'selection_end': 174L,
908
-                       'selection_start': 174L,
939
+                       'sel-line': 10L,
940
+                       'sel-line-start': 344L,
941
+                       'selection_end': 354L,
942
+                       'selection_start': 354L,
909 943
                        'zoom': 0L})],
910
-        'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('run.py'),
911
-        {'attrib-starts': [],
912
-         'first-line': 537L,
944
+        'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('sources/ltc.py'),
945
+        {'attrib-starts': [('Source',
946
+                            28),
947
+                           ('Source.get_info2',
948
+                            759)],
949
+         'first-line': 758L,
913 950
          'folded-linenos': [],
914
-         'sel-line': 548L,
915
-         'sel-line-start': 21051L,
916
-         'selection_end': 21072L,
917
-         'selection_start': 21072L,
951
+         'sel-line': 767L,
952
+         'sel-line-start': 37736L,
953
+         'selection_end': 37736L,
954
+         'selection_start': 37736L,
918 955
          'zoom': 0L},
919
-        1507139396.418],
920
-        [loc('ContentSources.py'),
921
-         {'attrib-starts': [('ContentSources',
922
-                             16),
923
-                            ('ContentSources.__init__',
924
-                             20)],
925
-          'first-line': 29L,
956
+        1507371104.021],
957
+        [loc('util.py'),
958
+         {'attrib-starts': [('unescape',
959
+                             538)],
960
+          'first-line': 539L,
926 961
           'folded-linenos': [],
927
-          'sel-line': 38L,
928
-          'sel-line-start': 1556L,
929
-          'selection_end': 1556L,
930
-          'selection_start': 1556L,
962
+          'sel-line': 547L,
963
+          'sel-line-start': 16779L,
964
+          'selection_end': 16779L,
965
+          'selection_start': 16779L,
931 966
           'zoom': 0L},
932
-         1507139404.352],
933
-        [loc('sources/config.py'),
934
-         {'attrib-starts': [('Source',
935
-                             12),
936
-                            ('Source.__init__',
937
-                             14)],
938
-          'first-line': 10L,
939
-          'folded-linenos': [],
940
-          'sel-line': 20L,
941
-          'sel-line-start': 756L,
942
-          'selection_end': 756L,
943
-          'selection_start': 756L,
944
-          'zoom': 0L},
945
-         1507139454.935],
967
+         1507371180.38],
946 968
         [loc('run.py'),
947
-         {'attrib-starts': [],
948
-          'first-line': 537L,
969
+         {'attrib-starts': [('play_stream',
970
+                             475)],
971
+          'first-line': 487L,
949 972
           'folded-linenos': [],
950
-          'sel-line': 548L,
951
-          'sel-line-start': 21051L,
952
-          'selection_end': 21072L,
953
-          'selection_start': 21072L,
973
+          'sel-line': 495L,
974
+          'sel-line-start': 18631L,
975
+          'selection_end': 18676L,
976
+          'selection_start': 18676L,
954 977
           'zoom': 0L},
955
-         1507139464.311],
956
-        [loc('ContentSources.py'),
957
-         {'attrib-starts': [('ContentSources',
958
-                             16),
959
-                            ('ContentSources.__init__',
960
-                             20)],
961
-          'first-line': 171L,
978
+         1507371335.802],
979
+        [loc('sources/ltc.py'),
980
+         {'attrib-starts': [('Source',
981
+                             28),
982
+                            ('Source.get_info2',
983
+                             759)],
984
+          'first-line': 758L,
962 985
           'folded-linenos': [],
963
-          'sel-line': 35L,
964
-          'sel-line-start': 1435L,
965
-          'selection_end': 1462L,
966
-          'selection_start': 1462L,
986
+          'sel-line': 768L,
987
+          'sel-line-start': 37779L,
988
+          'selection_end': 37779L,
989
+          'selection_start': 37779L,
967 990
           'zoom': 0L},
968
-         1507139509.009],
991
+         1507371354.506],
969 992
         [loc('run.py'),
970
-         {'attrib-starts': [],
971
-          'first-line': 537L,
993
+         {'attrib-starts': [('player',
994
+                             514)],
995
+          'first-line': 522L,
972 996
           'folded-linenos': [],
973
-          'sel-line': 544L,
974
-          'sel-line-start': 20857L,
975
-          'selection_end': 21094L,
976
-          'selection_start': 20857L,
997
+          'sel-line': 533L,
998
+          'sel-line-start': 20303L,
999
+          'selection_end': 20303L,
1000
+          'selection_start': 20303L,
977 1001
           'zoom': 0L},
978
-         1507139519.867],
979
-        [loc('ContentSources.py'),
980
-         {'attrib-starts': [],
981
-          'first-line': 171L,
1002
+         1507371523.35],
1003
+        [loc('sources/ltc.py'),
1004
+         {'attrib-starts': [('Source',
1005
+                             28),
1006
+                            ('Source.get_info2',
1007
+                             759)],
1008
+          'first-line': 758L,
982 1009
           'folded-linenos': [],
983
-          'sel-line': 183L,
984
-          'sel-line-start': 7031L,
985
-          'selection_end': 7069L,
986
-          'selection_start': 7069L,
1010
+          'sel-line': 765L,
1011
+          'sel-line-start': 37587L,
1012
+          'selection_end': 37587L,
1013
+          'selection_start': 37587L,
987 1014
           'zoom': 0L},
988
-         1507139553.439],
1015
+         1507371547.303],
989 1016
         [loc('run.py'),
990
-         {'attrib-starts': [],
991
-          'first-line': 537L,
1017
+         {'attrib-starts': [('player',
1018
+                             514)],
1019
+          'first-line': 522L,
992 1020
           'folded-linenos': [],
993
-          'sel-line': 544L,
994
-          'sel-line-start': 20857L,
995
-          'selection_end': 20989L,
996
-          'selection_start': 20857L,
1021
+          'sel-line': 533L,
1022
+          'sel-line-start': 20303L,
1023
+          'selection_end': 20303L,
1024
+          'selection_start': 20303L,
997 1025
           'zoom': 0L},
998
-         1507139565.195],
999
-        [loc('ContentSources.py'),
1000
-         {'attrib-starts': [('ContentSources',
1001
-                             16),
1002
-                            ('ContentSources.__init__',
1003
-                             20)],
1004
-          'first-line': 33L,
1026
+         1507371599.675],
1027
+        [loc('sources/ltc.py'),
1028
+         {'attrib-starts': [('Source',
1029
+                             28),
1030
+                            ('Source.get_info2',
1031
+                             759)],
1032
+          'first-line': 758L,
1005 1033
           'folded-linenos': [],
1006
-          'sel-line': 38L,
1007
-          'sel-line-start': 1556L,
1008
-          'selection_end': 1556L,
1009
-          'selection_start': 1556L,
1034
+          'sel-line': 761L,
1035
+          'sel-line-start': 37352L,
1036
+          'selection_end': 37357L,
1037
+          'selection_start': 37357L,
1010 1038
           'zoom': 0L},
1011
-         1507140419.978],
1039
+         1507371766.638],
1012 1040
         [loc('run.py'),
1013
-         {'attrib-starts': [],
1014
-          'first-line': 537L,
1041
+         {'attrib-starts': [('play_stream',
1042
+                             475)],
1043
+          'first-line': 482L,
1015 1044
           'folded-linenos': [],
1016
-          'sel-line': 544L,
1017
-          'sel-line-start': 20857L,
1018
-          'selection_end': 20989L,
1019
-          'selection_start': 20857L,
1045
+          'sel-line': 488L,
1046
+          'sel-line-start': 18421L,
1047
+          'selection_end': 18426L,
1048
+          'selection_start': 18426L,
1020 1049
           'zoom': 0L},
1021
-         1507140426.687],
1022
-        [loc('ContentSources.py'),
1023
-         {'attrib-starts': [('ContentSources',
1024
-                             16),
1025
-                            ('ContentSources.__init__',
1026
-                             20)],
1027
-          'first-line': 33L,
1050
+         1507371799.165],
1051
+        [loc('sources/cinemalive.py'),
1052
+         {'attrib-starts': [('Source',
1053
+                             30),
1054
+                            ('Source.get_streams',
1055
+                             167)],
1056
+          'first-line': 176L,
1028 1057
           'folded-linenos': [],
1029
-          'sel-line': 38L,
1030
-          'sel-line-start': 1556L,
1031
-          'selection_end': 1556L,
1032
-          'selection_start': 1556L,
1058
+          'sel-line': 172L,
1059
+          'sel-line-start': 8312L,
1060
+          'selection_end': 8333L,
1061
+          'selection_start': 8333L,
1033 1062
           'zoom': 0L},
1034
-         1507140443.699],
1063
+         1507371832.849],
1035 1064
         [loc('run.py'),
1036
-         {'attrib-starts': [],
1037
-          'first-line': 537L,
1065
+         {'attrib-starts': [('player',
1066
+                             514)],
1067
+          'first-line': 528L,
1038 1068
           'folded-linenos': [],
1039
-          'sel-line': 544L,
1040
-          'sel-line-start': 20857L,
1041
-          'selection_end': 20989L,
1042
-          'selection_start': 20857L,
1069
+          'sel-line': 533L,
1070
+          'sel-line-start': 20252L,
1071
+          'selection_end': 20252L,
1072
+          'selection_start': 20252L,
1043 1073
           'zoom': 0L},
1044
-         1507140457.254],
1045
-        [loc('ContentSources.py'),
1046
-         {'attrib-starts': [('ContentSources',
1047
-                             16),
1048
-                            ('ContentSources.__init__',
1049
-                             20)],
1050
-          'first-line': 33L,
1074
+         1507376935.998],
1075
+        [loc('kivy_test.py'),
1076
+         {'attrib-starts': [],
1077
+          'first-line': 250L,
1051 1078
           'folded-linenos': [],
1052
-          'sel-line': 43L,
1053
-          'sel-line-start': 1789L,
1054
-          'selection_end': 1813L,
1055
-          'selection_start': 1813L,
1079
+          'sel-line': 262L,
1080
+          'sel-line-start': 9968L,
1081
+          'selection_end': 9968L,
1082
+          'selection_start': 9968L,
1056 1083
           'zoom': 0L},
1057
-         1507141006.36],
1058
-        [loc('run.py'),
1084
+         1507376953.193],
1085
+        [loc('kivy_test.py'),
1059 1086
          {'attrib-starts': [],
1060
-          'first-line': 537L,
1087
+          'first-line': 8L,
1061 1088
           'folded-linenos': [],
1062
-          'sel-line': 544L,
1063
-          'sel-line-start': 20857L,
1064
-          'selection_end': 20989L,
1065
-          'selection_start': 20857L,
1089
+          'sel-line': 17L,
1090
+          'sel-line-start': 525L,
1091
+          'selection_end': 535L,
1092
+          'selection_start': 532L,
1066 1093
           'zoom': 0L},
1067
-         1507141011.515],
1068
-        [loc('ContentSources.py'),
1069
-         {'attrib-starts': [('ContentSources',
1070
-                             16),
1071
-                            ('ContentSources.__init__',
1072
-                             20)],
1073
-          'first-line': 33L,
1094
+         1507376964.014],
1095
+        [loc('kivy_test.py'),
1096
+         {'attrib-starts': [('PlayerApp',
1097
+                             69),
1098
+                            ('PlayerApp.on_start',
1099
+                             86)],
1100
+          'first-line': 76L,
1074 1101
           'folded-linenos': [],
1075
-          'sel-line': 38L,
1076
-          'sel-line-start': 1556L,
1077
-          'selection_end': 1556L,
1078
-          'selection_start': 1556L,
1102
+          'sel-line': 88L,
1103
+          'sel-line-start': 2411L,
1104
+          'selection_end': 2434L,
1105
+          'selection_start': 2430L,
1079 1106
           'zoom': 0L},
1080
-         1507146273.096],
1081
-        [loc('test_sources2.py'),
1082
-         {'attrib-starts': [('Main',
1083
-                             12),
1084
-                            ('Main.initUI',
1085
-                             30)],
1086
-          'first-line': 39L,
1107
+         1507376965.305],
1108
+        [loc('kivy_test.py'),
1109
+         {'attrib-starts': [('PlayerApp',
1110
+                             69),
1111
+                            ('PlayerApp.on_start',
1112
+                             86)],
1113
+          'first-line': 76L,
1087 1114
           'folded-linenos': [],
1088
-          'sel-line': 41L,
1089
-          'sel-line-start': 1171L,
1090
-          'selection_end': 1857L,
1091
-          'selection_start': 1171L,
1115
+          'sel-line': 88L,
1116
+          'sel-line-start': 2411L,
1117
+          'selection_end': 2436L,
1118
+          'selection_start': 2430L,
1092 1119
           'zoom': 0L},
1093
-         1507146273.708],
1094
-        [loc('ContentSources.py'),
1095
-         {'attrib-starts': [('ContentSources',
1096
-                             16),
1097
-                            ('ContentSources.__init__',
1098
-                             20)],
1099
-          'first-line': 33L,
1120
+         1507376966.453],
1121
+        [loc('kivy_test.py'),
1122
+         {'attrib-starts': [('PlayerApp',
1123
+                             69),
1124
+                            ('PlayerApp.on_start',
1125
+                             86)],
1126
+          'first-line': 76L,
1100 1127
           'folded-linenos': [],
1101
-          'sel-line': 38L,
1102
-          'sel-line-start': 1556L,
1103
-          'selection_end': 1556L,
1104
-          'selection_start': 1556L,
1128
+          'sel-line': 88L,
1129
+          'sel-line-start': 2411L,
1130
+          'selection_end': 2437L,
1131
+          'selection_start': 2430L,
1105 1132
           'zoom': 0L},
1106
-         1507146275.209],
1107
-        [loc('sources/euronews.py'),
1108
-         {'attrib-starts': [('Source',
1109
-                             26),
1110
-                            ('Source.__init__',
1111
-                             28)],
1112
-          'first-line': 19L,
1133
+         1507377044.666],
1134
+        [loc('kivy_test.py'),
1135
+         {'attrib-starts': [('PlayerApp',
1136
+                             69),
1137
+                            ('PlayerApp.on_start',
1138
+                             86)],
1139
+          'first-line': 85L,
1113 1140
           'folded-linenos': [],
1114
-          'sel-line': 31L,
1115
-          'sel-line-start': 919L,
1116
-          'selection_end': 951L,
1117
-          'selection_start': 951L,
1141
+          'sel-line': 88L,
1142
+          'sel-line-start': 2411L,
1143
+          'selection_end': 2437L,
1144
+          'selection_start': 2430L,
1118 1145
           'zoom': 0L},
1119
-         1507146275.803],
1120
-        [loc('ContentSources.py'),
1121
-         {'attrib-starts': [('ContentSources',
1122
-                             16),
1123
-                            ('ContentSources.__init__',
1124
-                             20)],
1125
-          'first-line': 33L,
1146
+         1507377045.853],
1147
+        [loc('kivy_test.py'),
1148
+         {'attrib-starts': [('PlayerApp',
1149
+                             69),
1150
+                            ('PlayerApp._next_frame',
1151
+                             187)],
1152
+          'first-line': 197L,
1153
+          'folded-linenos': [],
1154
+          'sel-line': 199L,
1155
+          'sel-line-start': 7221L,
1156
+          'selection_end': 7251L,
1157
+          'selection_start': 7251L,
1158
+          'zoom': 0L},
1159
+         1507377535.041],
1160
+        [loc('kivy_test.py'),
1161
+         {'attrib-starts': [('PlayerApp',
1162
+                             69),
1163
+                            ('PlayerApp.redraw',
1164
+                             214)],
1165
+          'first-line': 230L,
1126 1166
           'folded-linenos': [],
1127
-          'sel-line': 38L,
1128
-          'sel-line-start': 1556L,
1129
-          'selection_end': 1556L,
1130
-          'selection_start': 1556L,
1167
+          'sel-line': 234L,
1168
+          'sel-line-start': 8872L,
1169
+          'selection_end': 8945L,
1170
+          'selection_start': 8945L,
1131 1171
           'zoom': 0L},
1132
-         1507146277.883],
1133
-        [loc('sources/SourceBase.py'),
1134
-         {'attrib-starts': [('SourceBase',
1135
-                             33),
1136
-                            ('SourceBase.get_streams',
1137
-                             62)],
1138
-          'first-line': 54L,
1172
+         1507377986.528],
1173
+        [loc('kivy_test2.py'),
1174
+         {'attrib-starts': [],
1175
+          'first-line': 9L,
1139 1176
           'folded-linenos': [],
1140
-          'sel-line': 62L,
1141
-          'sel-line-start': 1841L,
1142
-          'selection_end': 1860L,
1143
-          'selection_start': 1849L,
1177
+          'sel-line': 14L,
1178
+          'sel-line-start': 262L,
1179
+          'selection_end': 279L,
1180
+          'selection_start': 279L,
1144 1181
           'zoom': 0L},
1145
-         1507146278.448]],
1182
+         1507377998.15]],
1146 1183
         20),
1147
-        'current-loc': loc('ContentSources.py'),
1184
+        'current-loc': loc('kivy_test2.py'),
1148 1185
         'editor-state-list': [(loc('ContentSources.py'),
1149 1186
                                {'attrib-starts': [('ContentSources',
1150 1187
         16),
@@ -1159,15 +1196,15 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1159 1196
                                 'zoom': 0L}),
1160 1197
                               (loc('sources/ltc.py'),
1161 1198
                                {'attrib-starts': [('Source',
1162
-        27),
1199
+        28),
1163 1200
         ('Source.get_info2',
1164
-         758)],
1165
-                                'first-line': 753L,
1201
+         759)],
1202
+                                'first-line': 758L,
1166 1203
                                 'folded-linenos': [],
1167
-                                'sel-line': 758L,
1168
-                                'sel-line-start': 37252L,
1169
-                                'selection_end': 37268L,
1170
-                                'selection_start': 37260L,
1204
+                                'sel-line': 761L,
1205
+                                'sel-line-start': 37352L,
1206
+                                'selection_end': 37357L,
1207
+                                'selection_start': 37357L,
1171 1208
                                 'zoom': 0L}),
1172 1209
                               (loc('../../../../../Python27/Lib/lib-tk/tkSimpleDialog.py'),
1173 1210
                                {'attrib-starts': [('Dialog',
@@ -1182,14 +1219,14 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1182 1219
                                 'selection_start': 1011L,
1183 1220
                                 'zoom': 0L}),
1184 1221
                               (loc('util.py'),
1185
-                               {'attrib-starts': [('info',
1186
-        553)],
1187
-                                'first-line': 547L,
1222
+                               {'attrib-starts': [('unescape',
1223
+        538)],
1224
+                                'first-line': 539L,
1188 1225
                                 'folded-linenos': [],
1189
-                                'sel-line': 555L,
1190
-                                'sel-line-start': 16900L,
1191
-                                'selection_end': 16920L,
1192
-                                'selection_start': 16917L,
1226
+                                'sel-line': 547L,
1227
+                                'sel-line-start': 16779L,
1228
+                                'selection_end': 16779L,
1229
+                                'selection_start': 16779L,
1193 1230
                                 'zoom': 0L}),
1194 1231
                               (loc('sources/filmix.py'),
1195 1232
                                {'attrib-starts': [('Source',
@@ -1204,25 +1241,14 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1204 1241
                                 'selection_start': 2353L,
1205 1242
                                 'zoom': 0L}),
1206 1243
                               (loc('run.py'),
1207
-                               {'attrib-starts': [],
1208
-                                'first-line': 537L,
1244
+                               {'attrib-starts': [('player',
1245
+        514)],
1246
+                                'first-line': 528L,
1209 1247
                                 'folded-linenos': [],
1210
-                                'sel-line': 544L,
1211
-                                'sel-line-start': 20857L,
1212
-                                'selection_end': 20989L,
1213
-                                'selection_start': 20857L,
1214
-                                'zoom': 0L}),
1215
-                              (loc('sources/replay.py'),
1216
-                               {'attrib-starts': [('Source',
1217
-        30),
1218
-        ('Source.get_content',
1219
-         41)],
1220
-                                'first-line': 109L,
1221
-                                'folded-linenos': [],
1222
-                                'sel-line': 114L,
1223
-                                'sel-line-start': 5306L,
1224
-                                'selection_end': 5306L,
1225
-                                'selection_start': 5306L,
1248
+                                'sel-line': 533L,
1249
+                                'sel-line-start': 20252L,
1250
+                                'selection_end': 20252L,
1251
+                                'selection_start': 20252L,
1226 1252
                                 'zoom': 0L}),
1227 1253
                               (loc('sources/iplayer.py'),
1228 1254
                                {'attrib-starts': [('Source',
@@ -1241,24 +1267,63 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1241 1267
         30),
1242 1268
         ('Source.get_streams',
1243 1269
          167)],
1244
-                                'first-line': 197L,
1270
+                                'first-line': 176L,
1245 1271
                                 'folded-linenos': [],
1246
-                                'sel-line': 203L,
1247
-                                'sel-line-start': 9883L,
1248
-                                'selection_end': 9941L,
1249
-                                'selection_start': 9941L,
1272
+                                'sel-line': 172L,
1273
+                                'sel-line-start': 8312L,
1274
+                                'selection_end': 8333L,
1275
+                                'selection_start': 8333L,
1250 1276
                                 'zoom': 0L}),
1251
-                              (loc('sources/config.py'),
1252
-                               {'attrib-starts': [('Source',
1253
-        12),
1254
-        ('Source.__init__',
1255
-         14)],
1256
-                                'first-line': 10L,
1277
+                              (loc('resolvers/cloudsany.py'),
1278
+                               {'attrib-starts': [('resolve',
1279
+        30)],
1280
+                                'first-line': 76L,
1281
+                                'folded-linenos': [],
1282
+                                'sel-line': 88L,
1283
+                                'sel-line-start': 2597L,
1284
+                                'selection_end': 2597L,
1285
+                                'selection_start': 2597L,
1286
+                                'zoom': 0L}),
1287
+                              (loc('resolvers/hqqresolver.py'),
1288
+                               {'attrib-starts': [('resolve',
1289
+        127)],
1290
+                                'first-line': 155L,
1291
+                                'folded-linenos': [],
1292
+                                'sel-line': 166L,
1293
+                                'sel-line-start': 6121L,
1294
+                                'selection_end': 6141L,
1295
+                                'selection_start': 6137L,
1296
+                                'zoom': 0L}),
1297
+                              (loc('resolvers/openload3.py'),
1298
+                               {'attrib-starts': [('resolve',
1299
+        49)],
1300
+                                'first-line': 47L,
1301
+                                'folded-linenos': [],
1302
+                                'sel-line': 59L,
1303
+                                'sel-line-start': 1909L,
1304
+                                'selection_end': 1932L,
1305
+                                'selection_start': 1928L,
1306
+                                'zoom': 0L}),
1307
+                              (loc('kivy_test.py'),
1308
+                               {'attrib-starts': [('PlayerApp',
1309
+        69),
1310
+        ('PlayerApp.redraw',
1311
+         214)],
1312
+                                'first-line': 230L,
1257 1313
                                 'folded-linenos': [],
1258
-                                'sel-line': 20L,
1259
-                                'sel-line-start': 756L,
1260
-                                'selection_end': 756L,
1261
-                                'selection_start': 756L,
1314
+                                'sel-line': 234L,
1315
+                                'sel-line-start': 8872L,
1316
+                                'selection_end': 8945L,
1317
+                                'selection_start': 8945L,
1318
+                                'zoom': 0L}),
1319
+                              (loc('kivy_test2.py'),
1320
+                               {'attrib-starts': [],
1321
+                                'first-line': 0L,
1322
+                                'folded-linenos': [],
1323
+                                'sel-line': 2L,
1324
+                                'sel-line-start': 45L,
1325
+                                'selection_end': 78L,
1326
+                                'selection_start': 78L,
1262 1327
                                 'zoom': 0L})],
1263 1328
         'has-focus': True,
1264 1329
         'locked': False},
@@ -1268,22 +1333,28 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1268 1333
          loc('util.py'),
1269 1334
          loc('sources/filmix.py'),
1270 1335
          loc('run.py'),
1271
-         loc('sources/replay.py'),
1272 1336
          loc('sources/iplayer.py'),
1273 1337
          loc('sources/cinemalive.py'),
1274
-         loc('sources/config.py')]),
1338
+         loc('resolvers/cloudsany.py'),
1339
+         loc('resolvers/hqqresolver.py'),
1340
+         loc('resolvers/openload3.py'),
1341
+         loc('kivy_test.py'),
1342
+         loc('kivy_test2.py')]),
1275 1343
                                'open_files': [u'sources/filmix.py',
1276 1344
         u'sources/iplayer.py',
1277
-        u'sources/ltc.py',
1278
-        u'sources/replay.py',
1279
-        u'util.py',
1280 1345
         u'../../../../../Python27/Lib/lib-tk/tkSimpleDialog.py',
1346
+        u'resolvers/openload3.py',
1347
+        u'ContentSources.py',
1348
+        u'resolvers/hqqresolver.py',
1349
+        u'resolvers/cloudsany.py',
1350
+        u'util.py',
1351
+        u'sources/ltc.py',
1281 1352
         u'sources/cinemalive.py',
1282
-        u'sources/config.py',
1283 1353
         u'run.py',
1284
-        u'ContentSources.py']},
1354
+        u'kivy_test.py',
1355
+        u'kivy_test2.py']},
1285 1356
         'saved_notebook_display': None,
1286
-        'split_percents': {0: 0.4352047277332208},
1357
+        'split_percents': {0: 0.5742869306087697},
1287 1358
         'splits': 2,
1288 1359
         'tab_location': 'top',
1289 1360
         'user_data': {}},
@@ -1296,16 +1367,19 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1296 1367
                          0,
1297 1368
                          2434,
1298 1369
                          1440)}]}
1299
-guimgr.recent-documents = [loc('ContentSources.py'),
1370
+guimgr.recent-documents = [loc('unknown:untitled-2.py'),
1371
+                           loc('kivy_test.py'),
1300 1372
                            loc('run.py'),
1301
-                           loc('sources/config.py'),
1302 1373
                            loc('sources/cinemalive.py'),
1374
+                           loc('sources/ltc.py'),
1375
+                           loc('util.py'),
1376
+                           loc('resolvers/cloudsany.py'),
1377
+                           loc('resolvers/hqqresolver.py'),
1378
+                           loc('ContentSources.py'),
1379
+                           loc('resolvers/openload3.py'),
1303 1380
                            loc('../../../../../Python27/Lib/lib-tk/tkSimpleDialog.py'),
1304 1381
                            loc('sources/filmix.py'),
1305
-                           loc('sources/replay.py'),
1306
-                           loc('sources/ltc.py'),
1307
-                           loc('sources/iplayer.py'),
1308
-                           loc('util.py')]
1382
+                           loc('sources/iplayer.py')]
1309 1383
 guimgr.visual-state = {loc('../../../Python25/Lib/BeautifulSoup.py'): {'attr'\
1310 1384
         'ib-starts': [('NavigableString',
1311 1385
                        354),
@@ -1504,6 +1578,17 @@ guimgr.visual-state = {loc('../../../Python25/Lib/BeautifulSoup.py'): {'attr'\
1504 1578
         'sel-line-start': 8879L,
1505 1579
         'selection_end': 8954L,
1506 1580
         'selection_start': 8879L,
1581
+        'zoom': 0L},
1582
+                       loc('sources/config.py'): {'attrib-starts': [('Source',
1583
+        12),
1584
+        ('Source.__init__',
1585
+         14)],
1586
+        'first-line': 10L,
1587
+        'folded-linenos': [],
1588
+        'sel-line': 20L,
1589
+        'sel-line-start': 756L,
1590
+        'selection_end': 756L,
1591
+        'selection_start': 756L,
1507 1592
         'zoom': 0L},
1508 1593
                        loc('sources/euronews.py'): {'attrib-starts': [('Sour'\
1509 1594
         'ce',
@@ -1614,14 +1699,14 @@ guimgr.visual-state = {loc('../../../Python25/Lib/BeautifulSoup.py'): {'attr'\
1614 1699
         'zoom': 0L},
1615 1700
                        loc('sources/replay.py'): {'attrib-starts': [('Source',
1616 1701
         30),
1617
-        ('Source.__init__',
1618
-         32)],
1619
-        'first-line': 23L,
1702
+        ('Source.get_content',
1703
+         41)],
1704
+        'first-line': 109L,
1620 1705
         'folded-linenos': [],
1621
-        'sel-line': 35L,
1622
-        'sel-line-start': 1141L,
1623
-        'selection_end': 1157L,
1624
-        'selection_start': 1149L,
1706
+        'sel-line': 114L,
1707
+        'sel-line-start': 5306L,
1708
+        'selection_end': 5306L,
1709
+        'selection_start': 5306L,
1625 1710
         'zoom': 0L},
1626 1711
                        loc('sources/tvdom.py'): {'attrib-starts': [('Source',
1627 1712
         32),
@@ -1735,26 +1820,26 @@ proj.build-cmd = {None: ('default',
1735 1820
                          None)}
1736 1821
 proj.env-vars = {None: ('default',
1737 1822
                         [u''])}
1738
-search.search-history = [u'ConfigSou',
1823
+search.search-history = [u'sys.arg',
1824
+                         u'escape',
1825
+                         u'play_stream',
1826
+                         u'lamb',
1827
+                         u'isinstance',
1828
+                         u'player',
1829
+                         u'util',
1830
+                         u'suburl',
1831
+                         u'play',
1832
+                         u'def play(',
1833
+                         u'play(',
1834
+                         u'subti',
1835
+                         u'"sub"',
1836
+                         u'openlo',
1837
+                         u'http',
1838
+                         u'resolve',
1839
+                         u'ConfigSou',
1739 1840
                          u'contentsour',
1740 1841
                          u'Source',
1741
-                         u'img',
1742
-                         u'decode',
1743
-                         u'lst.append',
1744
-                         u'icong',
1745
-                         u'icon',
1746
-                         u'print',
1747
-                         u'title',
1748
-                         u'get_info',
1749
-                         u'nfo',
1750
-                         u'"nfo"',
1751
-                         u'plugins',
1752
-                         u'desc =',
1753
-                         u'print ',
1754
-                         u'picon_path',
1755
-                         u'search',
1756
-                         u'{0',
1757
-                         u'exception']
1842
+                         u'img']
1758 1843
 testing.stored-results = (1,
1759 1844
                           [],
1760 1845
                           {})

+ 108
- 0
resolvers/cloudsany.py Näytä tiedosto

@@ -0,0 +1,108 @@
1
+# -*- coding: UTF-8 -*-
2
+
3
+import re,os,sys
4
+import json
5
+try:
6
+    import util
7
+except:
8
+    pp = os.path.dirname(os.path.abspath(__file__))
9
+    sys.path.insert(0,os.sep.join(pp.split(os.sep)[:-1]))
10
+    import util
11
+import urllib2
12
+import requests
13
+try:
14
+    from requests.packages.urllib3.exceptions import InsecureRequestWarning
15
+    requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
16
+except:
17
+    pass
18
+#from aadecode import AADecoder
19
+
20
+__author__ = 'ivars777'
21
+__name__ = 'cloudsany' if __name__ <> "__main__" else __name__
22
+
23
+
24
+def supports(url):
25
+    # https://cloudsany.com/i/b4kt66gm2sw4
26
+    return re.search(r'cloudsany\.\w+/\w/.+', url) is not None
27
+
28
+
29
+#INFO_URL = API_BASE_URL + '/streaming/info'
30
+
31
+def resolve(url):
32
+    headers = {
33
+        'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0',
34
+        'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
35
+        'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
36
+        'Accept-Encoding': 'none',
37
+        'Accept-Language': 'en-US,en;q=0.8',
38
+        'Referer': url}  # 'Connection': 'keep-alive'
39
+
40
+    # https://cloudsany.com/i/b4kt66gm2sw4
41
+    m = re.search('cloudsany\.\w+/i/(\w+)', url)
42
+    if not m:
43
+        return stream
44
+    vid=m.group(1)
45
+
46
+    r = requests.get(url, headers=headers)
47
+    if r.status_code <> 200:
48
+        raise Exception("Error getting stream")
49
+    r = r.content
50
+    m = re.search(r"'(https\|.+?jwplayer)'", r)
51
+    if not m:
52
+        print url
53
+        raise Exception("Can not find stream")
54
+
55
+    p = m.group(1).split("|")
56
+    p0 = m.group(1)
57
+
58
+
59
+    # Subtitles #
60
+    sub = {}
61
+    m = re.search(r"(\w+)\|label\|(\w+)\|(\w+)\|subtitles", p0)
62
+    if m:
63
+        url_sub = "https://cloudsany.com/subtitles/%s.%s" % (m.group(3), m.group(2))
64
+        url_title = m.group(1)
65
+        print url_title
66
+        sub["url"] = url_sub
67
+        sub["lang"] = m.group(1)
68
+        sub["name"] = m.group(1)
69
+        sub["type"] = "srt"
70
+
71
+    # Stream URL
72
+    m = re.search(r"tracks\|(\w+)\|(\w+)\|(\w+)\|files\|(\w+)\|(\w+)\|(\w+)", p0)
73
+    if not m:
74
+        raise Exception("Can not find stream url")
75
+    #https://dl4.sanii.co/files/8/80mbh8zjyuh61n/video.mp4
76
+    # 0://1v.1u.1t/1s/2/1r/1q.1p
77
+    num = re.search(r"0://1\w\.1\w\.1\w/1\w/(\d+)", r).group(1)
78
+    url = "https://%s.%s.%s/files/%s/%s/%s.%s" % (
79
+        m.group(6), m.group(5), m.group(4), num, m.group(3), m.group(2), m.group(1))
80
+    print url
81
+
82
+    s = util.item()
83
+    s["url"] = url
84
+    s["type"] = util.stream_type(s["url"])
85
+    s["resolver"] = __name__
86
+    #s["lang"] = lang
87
+    s["subs"] = [sub]
88
+    s["name"] = url
89
+    return [s]
90
+
91
+
92
+if __name__ == "__main__":
93
+
94
+    from subprocess import call
95
+    url = "https://cloudsany.com/i/b4kt66gm2sw4"
96
+    url = "https://cloudsany.com/i/jqfm2sqwar22"  # teorija par visu/SUB
97
+    streams = resolve(url)
98
+    if not streams:
99
+        print "No streams found"
100
+        sys.exit()
101
+
102
+    for s in streams:
103
+        print s
104
+    from run import player
105
+    player(streams[0]["url"])
106
+    #print streams[0]["url"]
107
+    #call([r"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe",streams[0]["url"]])
108
+    pass

+ 1
- 2
resolvers/hqqresolver.py Näytä tiedosto

@@ -31,8 +31,7 @@ except:
31 31
     pass
32 32
 
33 33
 __author__ = 'ivars777'
34
-if __name__ <> "__main__":
35
-    __name__ = 'hqq'
34
+__name__ = 'hqq' if __name__ <> "__main__" else __name__
36 35
 
37 36
 
38 37
 def supports(url):

+ 52
- 44
run.py Näytä tiedosto

@@ -17,6 +17,8 @@ from ContentSources import ContentSources
17 17
 from sources.SourceBase import stream_type
18 18
 import util
19 19
 
20
+cunicode = lambda s: s.decode("utf8") if isinstance(s, str) else s
21
+cstr = lambda s: s.encode("utf8") if isinstance(s, unicode) else s
20 22
 
21 23
 class Main(Frame):
22 24
 
@@ -35,7 +37,7 @@ class Main(Frame):
35 37
         else:
36 38
             self.sources = ContentSources("sources", cfg_file)
37 39
         self.picons_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "picons")
38
-        self.tmp_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "tmp")
40
+        self.tmp_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "tmp")
39 41
         if not os.path.exists(self.tmp_path):
40 42
             os.mkdir(self.tmp_path)
41 43
         self.history = []
@@ -251,31 +253,7 @@ class Main(Frame):
251 253
                 stream = streams[a]
252 254
             else:
253 255
                 stream = streams[0]
254
-            stream = util.stream_change(stream)
255
-            title = stream["name"] if not "nfo" in stream or not stream["nfo"] else util.nfo2title(stream["nfo"])
256
-            desc = stream["desc"] if not "nfo" in stream or not stream["nfo"] else util.nfo2desc(stream["nfo"])
257
-            img = stream["img"]
258
-            url = stream["url"]
259
-            suburl = ""
260
-            print url
261
-            if "subs" in stream and stream["subs"]:
262
-                suburl = stream["subs"][0]["url"]
263
-                print "\n**Download subtitles %s - %s"%(title,suburl)
264
-                subs = urllib2.urlopen(suburl).read()
265
-                if subs:
266
-                    fname0 = re.sub("[/\n\r\t,:\?]","_",title)
267
-                    subext = ".srt"
268
-                    subfile = os.path.join(self.tmp_path,fname0+subext)
269
-                    if ".xml" in suburl:
270
-                        subs = util.ttaf2srt(subs)
271
-                    with open(subfile,"w") as f:
272
-                        f.write(subs)
273
-                else:
274
-                    print "\n Error downloading subtitle %s"%suburl
275
-            print "\n**Play stream %s\n%s" % (title, url.encode("utf8"))
276
-            player(url,title,suburl,stream["headers"])
277
-
278
-
256
+            play_stream(stream, self.tmp_path)
279 257
 
280 258
     def start(self):
281 259
         self.root.mainloop()
@@ -492,48 +470,78 @@ def play_video(streams, select=False):
492 470
             stream = streams[n]
493 471
     else:
494 472
         stream = streams[0]
473
+    play_stream(stream)
495 474
 
475
+
476
+def play_stream(stream, tmp_path=""):
477
+    if not tmp_path:
478
+        tmp_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "tmp")
496 479
     stream = util.stream_change(stream)
497 480
     title = stream["name"] if not "nfo" in stream or not stream["nfo"] else util.nfo2title(stream["nfo"])
498 481
     desc = stream["desc"] if not "nfo" in stream or not stream["nfo"] else util.nfo2desc(stream["nfo"])
499 482
     img = stream["img"]
500 483
     url = stream["url"]
501 484
     suburl = ""
485
+    subfile = ""
502 486
     print url
503
-    if "subs" in stream and stream["subs"]:
487
+    if "subs" in stream and len(stream["subs"]) > 0 and stream["subs"][0]:
504 488
         suburl = stream["subs"][0]["url"]
489
+        subfile = ""
505 490
         print "\n**Download subtitles %s - %s"%(title,suburl)
506
-        subs = urllib2.urlopen(suburl).read()
491
+        try:
492
+            subs = urllib2.urlopen(suburl).read()
493
+        except:
494
+            subs = None
507 495
         if subs:
508
-            fname0 = re.sub("[/\n\r\t,:\?]","_",title)
509
-            subext = ".srt"
510
-            subfile = os.path.join("",fname0+subext)
496
+            fname0 = re.sub("[/\n\r\t,:\?\|'~\.]","_",title)
511 497
             if ".xml" in suburl:
512
-                subs = ttaf2srt(subs)
513
-            with open(subfile,"w") as f:
514
-                f.write(subs)
498
+                subs = util.ttaf2srt(subs)
499
+                subext = ".srt"
500
+            elif ".vtt" in suburl:
501
+                subext = ".vtt"
502
+            elif ".srt" in suburl:
503
+                subext = ".srt"
504
+            else:
505
+                subext = ""
506
+            if subext:
507
+                subfile = cunicode(os.path.join(tmp_path,fname0+subext))
508
+                with open(subfile,"w") as f:
509
+                    f.write(subs)
515 510
         else:
516 511
             print "\n Error downloading subtitle %s"%suburl
517 512
     print "\n**Play stream %s\n%s" % (title, url.encode("utf8"))
518
-    return player(url,title,suburl,stream["headers"])
513
+    player(url,title,subfile,stream["headers"])
519 514
 
520
-def player(url, title = "", suburl= "",headers={}):
515
+def player(url, title = "", subfile = "",headers={}, player="ffplay"):
521 516
     from subprocess import call
517
+    title = cunicode(title).encode(sys.getfilesystemencoding())
518
+    # encode(sys.getfilesystemencoding())
519
+    subfile = unicode(subfile).encode(sys.getfilesystemencoding())
522 520
     cmd1 = [r"c:\Program Files\VideoLAN\VLC\vlc.exe",url,
523
-           "--meta-title",title.decode("utf8").encode(sys.getfilesystemencoding()),
521
+           "--meta-title",title,
524 522
            "--http-user-agent","Enigma2"
525 523
     ]
526 524
     # gst-launch-1.0 -v souphttpsrc ssl-strict=false proxy=127.0.0.1:8888 extra-headers="Origin:adadadasd"  location="http://bitdash-a.akamaihd.net/content/sintel/sintel.mpd" ! decodebin! autovideosink
527 525
     cmd2 = [
528 526
         r"C:\gstreamer\1.0\x86_64\bin\gst-launch-1.0","-v",
529
-        "playbin", 'uri="%s"'%url,
530
-        #"souphttpsrc", "ssl-strict=false",
531
-        #"proxy=127.0.0.1:8888",
532
-        #'location="%s"'%url,
533
-        #'!decodebin!autovideosink'
527
+        #"playbin", 'uri="%s"'%url,
528
+        "souphttpsrc", "ssl-strict=false",
529
+        "proxy=127.0.0.1:8888",
530
+        'location="%s"'%url,
531
+        '!decodebin!autovideosink'
534 532
     ]
535
-    cmd3 = ["ffplay.exe",url]
536
-    cmd = cmd3 if url.startswith("https") else cmd2
533
+
534
+    vf = r"drawtext=text='%{pts\:hms}':box=1:x=w-tw-10:y=h-th-10:boxcolor=black@0.5:fontsize=20:fontcolor=white"
535
+    if subfile and os.path.exists(subfile):
536
+        subfile = subfile.replace("\\", "\\\\\\\\")
537
+        subfile = re.sub("\w:", "", subfile)
538
+        vf = 'subtitles=%s,' % subfile + vf
539
+    cmd3 = ["ffplay.exe",url, "-window_title", title, "-vf", vf]
540
+    if not player:
541
+        cmd = cmd3 if url.startswith("https") else cmd2
542
+    else:
543
+        cmd = cmd3 if player == "ffplay" else cmd2
544
+    #cmd = cmd2  # visu spēlē ar gst
537 545
     ret = call(cmd)
538 546
     #if ret:
539 547
         #a = raw_input("*** Error, continue")

+ 11
- 31
sources/cinemalive.py Näytä tiedosto

@@ -185,37 +185,17 @@ Accept-Language: en-US,en;q=0.8
185 185
         if not m:
186 186
             raise Exception("Can not find stream")
187 187
         url = m.group(1)
188
-        r = self._http_request(url)
189
-        m = re.search(r"'(https\|.+?jwplayer)'", r)
190
-        if not m:
191
-            raise Exception("Can not find stream")
192
-        p = m.group(1).split("|")
193
-        p0 = m.group(1)
194
-        m = re.search(r"(Latvian)\|label\|(srt)\|(jqfm2sqwar22)\|subtitles", p0)
195
-        if m:
196
-            url_sub = "https://cloudsany.com/subtitles/%s.%s" % (m.group(3), m.group(2))
197
-            url_title = m.group(1)
198
-            print url_title
199
-        m = re.search(r"tracks\|(\w+)\|(\w+)\|(\w+)\|files\|(\w+)\|(\w+)\|(\w+)", p0)
200
-        if m:
201
-            #https://dl4.sanii.co/files/8/80mbh8zjyuh61n/video.mp4
202
-            # 0://1v.1u.1t/1s/2/1r/1q.1p
203
-            num = re.search(r"0://1\w\.1\w\.1\w/1\w/(\d+)", r).group(1)
204
-            url = "https://%s.%s.%s/files/%s/%s/%s.%s" % (
205
-                m.group(6), m.group(5), m.group(4), num, m.group(3), m.group(2), m.group(1))
206
-            print url
207
-            x = 1
208
-
209
-        s = util.item()
210
-        s["url"] = url
211
-        s["name"] = util.unescape(title)
212
-        s["desc"] = util.unescape(desc)
213
-        s["img"] = img
214
-        s["type"] = self.stream_type(s["url"])
215
-        s["lang"] = lang
216
-        return [s]
217
-
218
-
188
+        if "openload" in url:
189
+            s = resolve(url)
190
+            return s
191
+        elif "cloudsany" in url:
192
+            s = resolve(url)
193
+            for s2 in s:
194
+                s2["name"] = util.unescape(title)
195
+                s2["desc"] = util.unescape(desc)
196
+                s2["img"] = img
197
+                s2["lang"] = lang
198
+            return s
219 199
 
220 200
 if __name__ == "__main__":
221 201
 

+ 7
- 6
sources/ltc.py Näytä tiedosto

@@ -7,7 +7,7 @@
7 7
 #
8 8
 import sys, os, os.path, re, sys
9 9
 import urllib,urllib2,urlparse
10
-from xml.sax.saxutils import unescape,escape
10
+#from xml.sax.saxutils import unescape,escape
11 11
 from urllib import quote, unquote
12 12
 import datetime
13 13
 import HTMLParser
@@ -15,6 +15,7 @@ import json
15 15
 import datetime
16 16
 from SourceBase import SourceBase, stream_type
17 17
 import util
18
+from util import unescape
18 19
 from collections import OrderedDict
19 20
 import ssl
20 21
 if "_create_unverified_context" in dir(ssl):
@@ -764,11 +765,11 @@ Host: manstv.lattelecom.tv
764 765
         r = self.call2(data)
765 766
         m = re.search(r'"movie_titles" data-movieid=(\d+)><div class="en">([^<]+)</div><div class="lv translated">([^<]+)</div>', r)
766 767
         if m:
767
-            title1 = m.group(2)
768
-            title2 = m.group(3)
768
+            title1 = unescape(m.group(2))
769
+            title2 = unescape(m.group(3))
769 770
         else:
770 771
             m = re.search('<meta name="dr:say:title" content="([^"]+)">', r, re.IGNORECASE)
771
-            title1 = title2 = m.group(1) if m else "Video"
772
+            title1 = title2 = unescape(m.group(1)) if m else "Video"
772 773
         nfo["title"] = title2
773 774
         nfo["originaltitle"] = title1
774 775
         if nfo["originaltitle"] and not nfo["title"]:
@@ -855,8 +856,8 @@ Host: manstv.lattelecom.tv
855 856
                 stream["url"]=url
856 857
                 stream["lang"]=s[1]
857 858
                 stream["quality"]=s[2]
858
-                stream["name"]=title
859
-                stream["desc"]=desc
859
+                stream["name"]= unescape(title)
860
+                stream["desc"]= unescape(desc)
860 861
                 stream["img"] = img
861 862
                 stream["nfo"] = {"movie":nfo}
862 863
                 stream["type"]="hls" #stream_type(url)