Pārlūkot izejas kodu

salabots lmt (delfi video)

Ivars 6 gadus atpakaļ
vecāks
revīzija
bb1cffd038
2 mainītis faili ar 238 papildinājumiem un 182 dzēšanām
  1. 220
    181
      project.wpr
  2. 18
    1
      sources/lmt.py

+ 220
- 181
project.wpr Parādīt failu

@@ -32,9 +32,6 @@ proj.launch-config = {loc('ContentSources.py'): ('project',
32 32
                       loc('kivy_test.py'): ('project',
33 33
         (u'https://walterebert.com/playground/video/hls/sintel-trailer.m3u8',
34 34
          '')),
35
-                      loc('run.py'): ('project',
36
-                                      (u'config::home  ftp://user:Kaskade7@home.blue.lv/hdd/streams.cfg',
37
-                                       '')),
38 35
                       loc('sources/lmt.py'): ('project',
39 36
         (u'home',
40 37
          ''))}
@@ -95,7 +92,11 @@ debug.breakpoints = {loc('Downloader.py'): {94: (0,
95 92
                None,
96 93
                1,
97 94
                0)},
98
-                     loc('run.py'): {277L: (0,
95
+                     loc('run.py'): {198L: (0,
96
+        None,
97
+        1,
98
+        0),
99
+                                     277L: (0,
99 100
         None,
100 101
         1,
101 102
         0),
@@ -138,6 +139,10 @@ debug.breakpoints = {loc('Downloader.py'): {94: (0,
138 139
                      loc('sources/filmon.py'): {49L: (0,
139 140
         None,
140 141
         1,
142
+        0)},
143
+                     loc('sources/lmt.py'): {221L: (0,
144
+        None,
145
+        1,
141 146
         0)},
142 147
                      loc('sources/ltc.py'): {568L: (0,
143 148
         None,
@@ -199,11 +204,11 @@ debug.breakpoints = {loc('Downloader.py'): {94: (0,
199 204
             None,
200 205
             1,
201 206
             0)},
202
-                     loc('unknown:<untitled> #2'): {2: (0,
207
+                     loc('unknown:<untitled> #1'): {2: (0,
203 208
         None,
204 209
         1,
205 210
         0)},
206
-                     loc('unknown:<untitled> #1'): {10: (0,
211
+                     loc('unknown:<untitled> #2'): {10: (0,
207 212
         None,
208 213
         1,
209 214
         0)}}
@@ -602,9 +607,9 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
602 607
         'BeautifulSOAP')]},
603 608
         loc('ContentSources.py'): {'expanded-nodes': [],
604 609
                                    'selected-nodes': [],
605
-                                   'top-node': [('class def',
610
+                                   'top-node': [('generic attribute',
606 611
         loc('ContentSources.py'),
607
-        'ContentSources')]},
612
+        'cfg_file')]},
608 613
         loc('config.py'): {'expanded-nodes': [],
609 614
                            'selected-nodes': [],
610 615
                            'top-node': [('generic attribute',
@@ -848,21 +853,19 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
848 853
         loc('../../../../../Python27/Lib/site-packages/PIL/Image.py'): {'exp'\
849 854
         'anded-nodes': [],
850 855
         'selected-nodes': [],
851
-        'top-node': [('generic attribute',
852
-                      loc('../../../../../Python27/Lib/site-packages/PIL/Image.py'),
853
-                      'ADAPTIVE')]},
854
-        loc('unknown:<untitled> #4'): {'expanded-nodes': [],
856
+        'top-node': None},
857
+        loc('unknown:<untitled> #3'): {'expanded-nodes': [],
855 858
                                        'selected-nodes': [],
856 859
                                        'top-node': None},
857
-        loc('unknown:<untitled> #5'): {'expanded-nodes': [],
860
+        loc('unknown:<untitled> #6'): {'column-widths': [1.0],
861
+                                       'expanded-nodes': [],
858 862
                                        'selected-nodes': [],
859 863
                                        'top-node': None},
860
-        loc('unknown:<untitled> #3'): {'column-widths': [1.0],
864
+        loc('unknown:<untitled> #5'): {'column-widths': [1.0],
861 865
                                        'expanded-nodes': [],
862 866
                                        'selected-nodes': [],
863 867
                                        'top-node': None},
864
-        loc('unknown:<untitled> #6'): {'column-widths': [1.0],
865
-                                       'expanded-nodes': [],
868
+        loc('unknown:<untitled> #4'): {'expanded-nodes': [],
866 869
                                        'selected-nodes': [],
867 870
                                        'top-node': None}},
868 871
                                 'browse_mode': u'Current Module',
@@ -999,20 +1002,39 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
999 1002
         -1,
1000 1003
         -1),
1001 1004
                        'attrib-starts': [],
1002
-                       'first-line': 4L,
1005
+                       'first-line': 266L,
1003 1006
                        'folded-linenos': [],
1004
-                       'history': {u'file:C:/Data/Programming/enigma2/PlayStream2/content/sources/replay.py': ['u'\
1005
-        'rl2\n',
1006
-        'print r3\n',
1007
-        "re.search(r\"src: '([^']+)',\\s+?type: 'application/x-mpegurl'\", r"\
1008
-        "3, re.DOTALL|re.IGNORECASE)\n",
1009
-        'print data2\n',
1010
-        'print url2\n']},
1007
+                       'history': {u'file:C:/Data/Programming/enigma2/PlayStream2/content/sources/lmt.py': [" "\
1008
+        "re.search('embed.php?salt=([^\"]+)\"', r, re.DOTALL)\n",
1009
+        " re.search('embed.php?salt=([^\"]+)\"', r)\n",
1010
+        " re.search('embed.php?salt=', r)\n",
1011
+        " re.search('embed\\.php\\?salt=([^\"]+)\"', r)\n",
1012
+        'js\n',
1013
+        'js["title"]\n',
1014
+        'js["data"]["title"]\n',
1015
+        'js["data"]["poster"]\n',
1016
+        'js["data"]["versions"]\n',
1017
+        'js["data"]["versions"].keys()\n',
1018
+        'for v in  js["data"]["versions"].keys(): print vars\n',
1019
+        'for v in  js["data"]["versions"].keys(): print v\n',
1020
+        'js["data"]["versions"][ver]\n',
1021
+        'js["data"]["versions"]["HD"]\n',
1022
+        'data = js["data"]["versions"]["HD"]\n',
1023
+        'sdata = js["data"]["versions"]["HD"]\n',
1024
+        'sdata\n',
1025
+        'sdata[0]\n',
1026
+        'sdata[2]\n',
1027
+        'sdata[1]["scr"]\n',
1028
+        'sdata[1]\n',
1029
+        'sdata[1].keys()\n',
1030
+        'sdata[1]["src"]\n',
1031
+        '    s\n',
1032
+        's["desc"]\n']},
1011 1033
                        'launch-id': None,
1012
-                       'sel-line': 7L,
1013
-                       'sel-line-start': 449L,
1014
-                       'selection_end': 581L,
1015
-                       'selection_start': 449L,
1034
+                       'sel-line': 267L,
1035
+                       'sel-line-start': 14574L,
1036
+                       'selection_end': 14574L,
1037
+                       'selection_start': 14574L,
1016 1038
                        'zoom': 0L}),
1017 1039
                      ('debug-watch',
1018 1040
                       'wide',
@@ -1060,148 +1082,19 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1060 1082
                        'selection_end': 163L,
1061 1083
                        'selection_start': 163L,
1062 1084
                        'zoom': 0L})],
1063
-        'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('sources/ltc.py'),
1064
-        {'attrib-starts': [('Source',
1065
-                            26),
1066
-                           ('Source.get_stream_url2',
1067
-                            978)],
1068
-         'first-line': 989L,
1069
-         'folded-linenos': [132L,
1070
-                            161L,
1071
-                            221L,
1072
-                            232L,
1073
-                            258L,
1074
-                            277L,
1075
-                            296L,
1076
-                            320L,
1077
-                            350L,
1078
-                            351L,
1079
-                            399L,
1080
-                            412L,
1081
-                            532L],
1082
-         'sel-line': 998L,
1083
-         'sel-line-start': 51732L,
1084
-         'selection_end': 51782L,
1085
-         'selection_start': 51782L,
1085
+        'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('run.py'),
1086
+        {'attrib-starts': [('Main',
1087
+                            22),
1088
+                           ('Main.list_action',
1089
+                            106)],
1090
+         'first-line': 94L,
1091
+         'folded-linenos': [],
1092
+         'sel-line': 110L,
1093
+         'sel-line-start': 4515L,
1094
+         'selection_end': 4515L,
1095
+         'selection_start': 4515L,
1086 1096
          'zoom': 0L},
1087
-        1539297256.427],
1088
-        [loc('sources/replay.py'),
1089
-         {'attrib-starts': [],
1090
-          'first-line': 4L,
1091
-          'folded-linenos': [70L,
1092
-                             89L,
1093
-                             143L,
1094
-                             166L,
1095
-                             284L],
1096
-          'sel-line': 12L,
1097
-          'sel-line-start': 356L,
1098
-          'selection_end': 356L,
1099
-          'selection_start': 356L,
1100
-          'zoom': 0L},
1101
-         1539297285.235],
1102
-        [loc('../../../../../Python27/Lib/site-packages/PIL/Image.py'),
1103
-         {'attrib-starts': [],
1104
-          'first-line': 40L,
1105
-          'folded-linenos': [],
1106
-          'sel-line': 54L,
1107
-          'sel-line-start': 1389L,
1108
-          'selection_end': 1434L,
1109
-          'selection_start': 1434L,
1110
-          'zoom': 0L},
1111
-         1539297508.406],
1112
-        [loc('sources/replay.py'),
1113
-         {'attrib-starts': [],
1114
-          'first-line': 4L,
1115
-          'folded-linenos': [70L,
1116
-                             89L,
1117
-                             143L,
1118
-                             166L,
1119
-                             284L],
1120
-          'sel-line': 12L,
1121
-          'sel-line-start': 356L,
1122
-          'selection_end': 356L,
1123
-          'selection_start': 356L,
1124
-          'zoom': 0L},
1125
-         1539297655.692],
1126
-        [loc('../../../../../Python27/Lib/site-packages/PIL/Image.py'),
1127
-         {'attrib-starts': [],
1128
-          'first-line': 40L,
1129
-          'folded-linenos': [],
1130
-          'sel-line': 57L,
1131
-          'sel-line-start': 1583L,
1132
-          'selection_end': 1583L,
1133
-          'selection_start': 1583L,
1134
-          'zoom': 0L},
1135
-         1539297662.222],
1136
-        [loc('run.py'),
1137
-         {'attrib-starts': [],
1138
-          'first-line': 7L,
1139
-          'folded-linenos': [],
1140
-          'sel-line': 12L,
1141
-          'sel-line-start': 232L,
1142
-          'selection_end': 232L,
1143
-          'selection_start': 232L,
1144
-          'zoom': 0L},
1145
-         1539297770.425],
1146
-        [loc('sources/replay.py'),
1147
-         {'attrib-starts': [],
1148
-          'first-line': 104L,
1149
-          'folded-linenos': [70L,
1150
-                             89L,
1151
-                             143L,
1152
-                             166L,
1153
-                             284L],
1154
-          'sel-line': 12L,
1155
-          'sel-line-start': 356L,
1156
-          'selection_end': 356L,
1157
-          'selection_start': 356L,
1158
-          'zoom': 0L},
1159
-         1539297799.369],
1160
-        [loc('sources/replay.py'),
1161
-         {'attrib-starts': [('Source',
1162
-                             31)],
1163
-          'first-line': 21L,
1164
-          'folded-linenos': [70L,
1165
-                             89L,
1166
-                             143L,
1167
-                             166L,
1168
-                             284L],
1169
-          'sel-line': 31L,
1170
-          'sel-line-start': 1008L,
1171
-          'selection_end': 1020L,
1172
-          'selection_start': 1014L,
1173
-          'zoom': 0L},
1174
-         1539297803.694],
1175
-        [loc('sources/replay.py'),
1176
-         {'attrib-starts': [('Source',
1177
-                             31),
1178
-                            ('Source.get_streams',
1179
-                             220)],
1180
-          'first-line': 165L,
1181
-          'folded-linenos': [70L,
1182
-                             89L,
1183
-                             143L,
1184
-                             166L,
1185
-                             284L],
1186
-          'sel-line': 221L,
1187
-          'sel-line-start': 11331L,
1188
-          'selection_end': 11331L,
1189
-          'selection_start': 11331L,
1190
-          'zoom': 0L},
1191
-         1539298415.885],
1192
-        [loc('run.py'),
1193
-         {'attrib-starts': [('Main',
1194
-                             22),
1195
-                            ('Main.list_action',
1196
-                             106)],
1197
-          'first-line': 94L,
1198
-          'folded-linenos': [],
1199
-          'sel-line': 110L,
1200
-          'sel-line-start': 4515L,
1201
-          'selection_end': 4515L,
1202
-          'selection_start': 4515L,
1203
-          'zoom': 0L},
1204
-         1539298436.081],
1097
+        1539298436.081],
1205 1098
         [loc('sources/replay.py'),
1206 1099
          {'attrib-starts': [('Source',
1207 1100
                              31),
@@ -1351,20 +1244,137 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1351 1244
           'selection_end': 11331L,
1352 1245
           'selection_start': 11331L,
1353 1246
           'zoom': 0L},
1354
-         1539298837.49]],
1247
+         1539298837.49],
1248
+        [loc('run.py'),
1249
+         {'attrib-starts': [('Main',
1250
+                             22),
1251
+                            ('Main.list_action',
1252
+                             106)],
1253
+          'first-line': 105L,
1254
+          'folded-linenos': [],
1255
+          'sel-line': 110L,
1256
+          'sel-line-start': 4515L,
1257
+          'selection_end': 4527L,
1258
+          'selection_start': 4527L,
1259
+          'zoom': 0L},
1260
+         1541625173.974],
1261
+        [loc('sources/lmt.py'),
1262
+         {'attrib-starts': [('Source',
1263
+                             32),
1264
+                            ('Source.get_content',
1265
+                             52)],
1266
+          'first-line': 64L,
1267
+          'folded-linenos': [],
1268
+          'sel-line': 60L,
1269
+          'sel-line-start': 1987L,
1270
+          'selection_end': 2043L,
1271
+          'selection_start': 2043L,
1272
+          'zoom': 0L},
1273
+         1541625181.585],
1274
+        [loc('sources/lmt.py'),
1275
+         {'attrib-starts': [('Source',
1276
+                             32),
1277
+                            ('Source.get_streams',
1278
+                             134)],
1279
+          'first-line': 201L,
1280
+          'folded-linenos': [],
1281
+          'sel-line': 211L,
1282
+          'sel-line-start': 9396L,
1283
+          'selection_end': 9396L,
1284
+          'selection_start': 9396L,
1285
+          'zoom': 0L},
1286
+         1541629753.532],
1287
+        [loc('run.py'),
1288
+         {'attrib-starts': [('Main',
1289
+                             22),
1290
+                            ('Main.play_video',
1291
+                             242)],
1292
+          'first-line': 238L,
1293
+          'folded-linenos': [],
1294
+          'sel-line': 254L,
1295
+          'sel-line-start': 9998L,
1296
+          'selection_end': 10010L,
1297
+          'selection_start': 10010L,
1298
+          'zoom': 0L},
1299
+         1541629764.649],
1300
+        [loc('sources/lmt.py'),
1301
+         {'attrib-starts': [('Source',
1302
+                             32),
1303
+                            ('Source.get_streams',
1304
+                             134)],
1305
+          'first-line': 210L,
1306
+          'folded-linenos': [],
1307
+          'sel-line': 220L,
1308
+          'sel-line-start': 9851L,
1309
+          'selection_end': 9863L,
1310
+          'selection_start': 9863L,
1311
+          'zoom': 0L},
1312
+         1541630517.409],
1313
+        [loc('run.py'),
1314
+         {'attrib-starts': [('Main',
1315
+                             22),
1316
+                            ('Main.play_video',
1317
+                             242)],
1318
+          'first-line': 238L,
1319
+          'folded-linenos': [],
1320
+          'sel-line': 254L,
1321
+          'sel-line-start': 9998L,
1322
+          'selection_end': 10010L,
1323
+          'selection_start': 10010L,
1324
+          'zoom': 0L},
1325
+         1541630539.167],
1326
+        [loc('sources/lmt.py'),
1327
+         {'attrib-starts': [('Source',
1328
+                             32),
1329
+                            ('Source.get_streams',
1330
+                             134)],
1331
+          'first-line': 210L,
1332
+          'folded-linenos': [],
1333
+          'sel-line': 220L,
1334
+          'sel-line-start': 9851L,
1335
+          'selection_end': 9851L,
1336
+          'selection_start': 9851L,
1337
+          'zoom': 0L},
1338
+         1541630562.637],
1339
+        [loc('ContentSources.py'),
1340
+         {'attrib-starts': [('ContentSources',
1341
+                             16),
1342
+                            ('ContentSources.get_streams',
1343
+                             96)],
1344
+          'first-line': 104L,
1345
+          'folded-linenos': [],
1346
+          'sel-line': 115L,
1347
+          'sel-line-start': 4877L,
1348
+          'selection_end': 4877L,
1349
+          'selection_start': 4877L,
1350
+          'zoom': 0L},
1351
+         1541630579.16],
1352
+        [loc('run.py'),
1353
+         {'attrib-starts': [('Main',
1354
+                             22),
1355
+                            ('Main.play_video',
1356
+                             242)],
1357
+          'first-line': 248L,
1358
+          'folded-linenos': [],
1359
+          'sel-line': 260L,
1360
+          'sel-line-start': 10228L,
1361
+          'selection_end': 10262L,
1362
+          'selection_start': 10262L,
1363
+          'zoom': 0L},
1364
+         1541630605.709]],
1355 1365
         20),
1356 1366
         'current-loc': loc('run.py'),
1357 1367
         'editor-state-list': [(loc('run.py'),
1358 1368
                                {'attrib-starts': [('Main',
1359 1369
         22),
1360
-        ('Main.list_action',
1361
-         106)],
1362
-                                'first-line': 105L,
1370
+        ('Main.show_desc',
1371
+         196)],
1372
+                                'first-line': 186L,
1363 1373
                                 'folded-linenos': [],
1364
-                                'sel-line': 110L,
1365
-                                'sel-line-start': 4515L,
1366
-                                'selection_end': 4527L,
1367
-                                'selection_start': 4527L,
1374
+                                'sel-line': 197L,
1375
+                                'sel-line-start': 7793L,
1376
+                                'selection_end': 7793L,
1377
+                                'selection_start': 7793L,
1368 1378
                                 'zoom': 0L}),
1369 1379
                               (loc('util.py'),
1370 1380
                                {'attrib-starts': [('unescape',
@@ -1493,6 +1503,30 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1493 1503
                                 'sel-line-start': 1578L,
1494 1504
                                 'selection_end': 1583L,
1495 1505
                                 'selection_start': 1583L,
1506
+                                'zoom': 0L}),
1507
+                              (loc('sources/lmt.py'),
1508
+                               {'attrib-starts': [('Source',
1509
+        32),
1510
+        ('Source.get_streams',
1511
+         134)],
1512
+                                'first-line': 210L,
1513
+                                'folded-linenos': [],
1514
+                                'sel-line': 220L,
1515
+                                'sel-line-start': 9851L,
1516
+                                'selection_end': 9851L,
1517
+                                'selection_start': 9851L,
1518
+                                'zoom': 0L}),
1519
+                              (loc('ContentSources.py'),
1520
+                               {'attrib-starts': [('ContentSources',
1521
+        16),
1522
+        ('ContentSources.get_streams',
1523
+         96)],
1524
+                                'first-line': 104L,
1525
+                                'folded-linenos': [],
1526
+                                'sel-line': 115L,
1527
+                                'sel-line-start': 4877L,
1528
+                                'selection_end': 4877L,
1529
+                                'selection_start': 4877L,
1496 1530
                                 'zoom': 0L})],
1497 1531
         'has-focus': True,
1498 1532
         'locked': False},
@@ -1506,17 +1540,20 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1506 1540
          loc('changelog.md'),
1507 1541
          loc('sources/filmix.py'),
1508 1542
          loc('sources/filmas.py'),
1509
-         loc('../../../../../Python27/Lib/site-packages/PIL/Image.py')]),
1543
+         loc('../../../../../Python27/Lib/site-packages/PIL/Image.py'),
1544
+         loc('sources/lmt.py'),
1545
+         loc('ContentSources.py')]),
1510 1546
                                'open_files': [u'changelog.md',
1511 1547
         u'sources/config.py',
1512 1548
         u'sources/euronews.py',
1513 1549
         u'sources/filmas.py',
1514 1550
         u'sources/filmix.py',
1551
+        u'sources/ltc.py',
1552
+        u'sources/replay.py',
1515 1553
         u'sources/tvplay.py',
1516 1554
         u'util.py',
1517
-        u'sources/ltc.py',
1518 1555
         u'../../../../../Python27/Lib/site-packages/PIL/Image.py',
1519
-        u'sources/replay.py',
1556
+        u'sources/lmt.py',
1520 1557
         u'run.py']},
1521 1558
         'saved_notebook_display': None,
1522 1559
         'split_percents': {0: 0.5388225255972696},
@@ -1533,8 +1570,10 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
1533 1570
                          2393,
1534 1571
                          1440)}]}
1535 1572
 guimgr.recent-documents = [loc('run.py'),
1536
-                           loc('sources/replay.py'),
1573
+                           loc('ContentSources.py'),
1574
+                           loc('sources/lmt.py'),
1537 1575
                            loc('../../../../../Python27/Lib/site-packages/PIL/Image.py'),
1576
+                           loc('sources/replay.py'),
1538 1577
                            loc('sources/ltc.py'),
1539 1578
                            loc('util.py'),
1540 1579
                            loc('sources/tvplay.py'),

+ 18
- 1
sources/lmt.py Parādīt failu

@@ -189,7 +189,6 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
189 189
             return [s]
190 190
         elif "//live.tiesraides.lv/lmtstraume.lv" in r:
191 191
             m = re.search('<div class="single-video-item video-picture">.+?src="([^"]+)"', r, re.DOTALL)
192
-
193 192
             url = "http:" + m.group(1)
194 193
             # src="http://cdn.tiesraides.lv/lmtstraume.lv/live-record2-ip/40?c=614127284dcd58d8a84afcf498a3ac7a&v=1405"
195 194
             r = self._http_request(url)
@@ -203,6 +202,24 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
203 202
             s["img"] = img
204 203
             s["resolver"] = "lmt"
205 204
             return [s]
205
+        elif "embed.php?salt=" in r:
206
+            m = re.search('embed\.php\?salt=([^"]+)"', r)
207
+            url = "http://g1.delphi.lv/vfe/data.php?video_id=%s" % m.group(1)
208
+            r2 = self._http_request(url)
209
+            js = json.loads(r2)
210
+            s = util.item()
211
+            s["name"] = js["data"]["title"]
212
+            s["desc"] = re.sub("<.+?>", "", js["data"]["description"])
213
+            s["img"] = js["data"]["poster"]
214
+            s["resolver"] = "lmt"
215
+            vers =  js["data"]["versions"].keys()
216
+            ver = "HD" if "HD" in vers else "SD" if "SD" in vers else None
217
+            if not ver:
218
+                raise Exception("No stream found")
219
+            sdata = js["data"]["versions"][ver]
220
+            s["url"] = "http:" + sdata[1]["src"]
221
+            return [s]
222
+
206 223
         else:
207 224
             raise Exception("No stream found")
208 225