Quellcode durchsuchen

COnfig logs ar parametriem

Ivars vor 8 Jahren
Ursprung
Commit
78be38616d
7 geänderte Dateien mit 445 neuen und 343 gelöschten Zeilen
  1. 123
    23
      PlayStream.py
  2. 260
    260
      PlayStream.wpr
  3. 8
    3
      changelog.md
  4. 0
    3
      resolver.py
  5. 2
    3
      sources/SourceBase.py
  6. 1
    1
      sources/ltc.py
  7. 51
    50
      sources/replay.py

+ 123
- 23
PlayStream.py Datei anzeigen

@@ -42,15 +42,107 @@ from Components.config import config, ConfigSubsection, ConfigText, ConfigIntege
42 42
 
43 43
 import ContentSources
44 44
 import util
45
-from sources.SourceBase import stream0
46 45
 from VideoDownload import downloadJob, HLSDownloadJob,VideoDownloadList
47 46
 #import enigma2_api
48
-
49
-TMPDIR = "/tmp/playstream/"
50 47
 e2 = None
51
-config.playstream = ConfigSubsection()
52
-config.playstream.locations = ConfigLocations(default=["/media/hdd/movie/"])
53
-config.playstream.download_dir = ConfigText(default="/media/hdd/movie/")
48
+
49
+##########################################################################
50
+from Components.config import config, ConfigSubsection, ConfigYesNo, getConfigListEntry, \
51
+     ConfigSelection, ConfigNumber, ConfigDirectory,ConfigText
52
+from Components.ConfigList import ConfigListScreen
53
+from Screens.LocationBox import LocationBox
54
+
55
+config.plugins.playstream = ConfigSubsection()
56
+config.plugins.playstream.locations = ConfigLocations(default=["/media/hdd/movie/"])
57
+config.plugins.playstream.download_dir = ConfigDirectory(default="/media/hdd/movie/")
58
+config.plugins.playstream.tmp_dir = ConfigDirectory(default="/tmp/playstream/")
59
+config.plugins.playstream.streamproxy_start = ConfigYesNo(default = True)
60
+#config.plugins.playstream.size = ConfigSelection({"400x240":"400x240","220x132":"220x132","100x60":"100x60"}, default="220x132")
61
+config.plugins.playstream.clear_tmp = ConfigYesNo(default = True)
62
+
63
+class ConfigScreen(ConfigListScreen,Screen):
64
+    skin = """
65
+<screen position="center,center" size="560,400" title="PlayStream Configuration" >
66
+	<ePixmap name="red"    position="0,0"   zPosition="2" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
67
+	<ePixmap name="green"  position="140,0" zPosition="2" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
68
+	<ePixmap name="yellow" position="280,0" zPosition="2" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
69
+	<ePixmap name="blue"   position="420,0" zPosition="2" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
70
+
71
+	<widget name="key_red" position="0,0" size="140,40" valign="center" halign="center" zPosition="4"  foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
72
+	<widget name="key_green" position="140,0" size="140,40" valign="center" halign="center" zPosition="4"  foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
73
+	<widget name="key_yellow" position="280,0" size="140,40" valign="center" halign="center" zPosition="4"  foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
74
+	<widget name="key_blue" position="420,0" size="140,40" valign="center" halign="center" zPosition="4"  foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
75
+
76
+	<widget name="config" position="10,40" size="540,340" scrollbarMode="showOnDemand" />
77
+</screen>"""
78
+
79
+    def __init__(self, session, args = 0):
80
+        self.session = session
81
+        #self.setup_title = "Options"
82
+        Screen.__init__(self, session)
83
+        cfg = config.plugins.playstream
84
+        self.list = [
85
+            getConfigListEntry(_("Download folder"), cfg.download_dir),
86
+            getConfigListEntry(_("TMP folder"), cfg.tmp_dir),
87
+            getConfigListEntry(_("Clear tmp folder on exit"), cfg.clear_tmp),
88
+            getConfigListEntry(_("Start playstreamproxy"), cfg.streamproxy_start),
89
+        ]
90
+        ConfigListScreen.__init__(self, self.list, session = self.session)
91
+        self["key_red"] = Button(_("Cancel"))
92
+        self["key_green"] = Button(_("Save"))
93
+        self["key_yellow"] = Button("")
94
+        self["key_blue"] = Button("")
95
+        self["setupActions"] = ActionMap(["SetupActions", "ColorActions"],
96
+                                         {
97
+                                             "red": self.cancel,
98
+                                             "green": self.save,
99
+                                             "save": self.save,
100
+                                             "cancel": self.cancel,
101
+                                             "ok": self.ok,
102
+                                             }, -2)
103
+
104
+    def getCurrentEntry(self):
105
+        return self["config"].getCurrent()[0]
106
+
107
+    def getCurrentValue(self):
108
+        return str(self["config"].getCurrent()[1].getText())
109
+
110
+    def ok(self):
111
+        if self["config"].getCurrent()[1] == config.plugins.playstream.download_dir:
112
+            folder = config.plugins.playstream.download_dir.value
113
+            #self.session.openWithCallback(self.select_download_dir, LocationBox,"Select Folder")
114
+            self.session.openWithCallback(self.select_download_dir, LocationBox,"Select download folder","",config.plugins.playstream.download_dir.value,config.plugins.playstream.locations,False,"Select folder",None,True,True)
115
+        elif self["config"].getCurrent()[1] == config.plugins.playstream.tmp_dir:
116
+            self.session.openWithCallback(self.select_tmp_dir, LocationBox,"Select tmp folder","",config.plugins.playstream.download_dir.value,config.plugins.playstream.locations,False,"Select folder",None,True,True)
117
+        else:
118
+            self.save()
119
+
120
+    def select_download_dir(self, folder, select=None):
121
+        if not folder:
122
+            return
123
+        print "Folder selected - %s"%folder
124
+        config.plugins.playstream.download_dir.setValue(folder)
125
+        config.plugins.playstream.download_dir.save()
126
+        config.plugins.playstream.locations.save()
127
+        config.save()
128
+
129
+    def select_tmp_dir(self, folder, select=None):
130
+        if not folder:
131
+            return
132
+        print "Folder selected - %s"%folder
133
+        config.plugins.playstream.tmp_dir.setValue(folder)
134
+        config.plugins.playstream.tmp_dir.save()
135
+        config.plugins.playstream.locations.save()
136
+        config.save()
137
+
138
+    def save(self):
139
+        print "saving"
140
+        self.saveAll()
141
+        self.close(True,self.session)
142
+
143
+    def cancel(self):
144
+        #print "cancel"
145
+        self.close(False,self.session)
54 146
 
55 147
 def make_service(stream):
56 148
     url = stream["url"]
@@ -356,8 +448,10 @@ class MainScreen(Screen):
356 448
     <widget name="key_green" position="290,535" size="140,40" valign="center" halign="center" zPosition="4"  foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
357 449
     <ePixmap name="yellow" position="430,535" zPosition="2" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
358 450
     <widget name="key_yellow" position="430,535" size="140,40" valign="center" halign="center" zPosition="4"  foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
359
-    <ePixmap name="menu"   position="610,540" zPosition="2" size="140,40"  pixmap="skin_default/buttons/key_menu.png" transparent="1" alphatest="on" />
360
-    <widget name="key_menu" position="610,535" size="140,40" valign="center" halign="center" zPosition="4"  backgroundColor="blue" foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
451
+    <ePixmap name="blue" position="570,535" zPosition="2" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
452
+    <widget name="key_blue" position="570,535" size="140,40" valign="center" halign="center" zPosition="4"  foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
453
+    <ePixmap name="menu"   position="750,540" zPosition="2" size="140,40"  pixmap="skin_default/buttons/key_menu.png" transparent="1" alphatest="on" />
454
+    <widget name="key_menu" position="750,535" size="140,40" valign="center" halign="center" zPosition="4"  backgroundColor="blue" foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
361 455
 
362 456
 </screen>"""
363 457
 
@@ -369,6 +463,7 @@ class MainScreen(Screen):
369 463
         self["key_red"] = Button(_("Exit"))
370 464
         self["key_green"] = Button(_("Select"))
371 465
         self["key_yellow"] = Button(_("Options"))
466
+        self["key_blue"] = Button(_("Config"))
372 467
         self["key_menu"] = Button("Menu")
373 468
         self["key_exit"] = Button("Back")
374 469
 
@@ -379,7 +474,7 @@ class MainScreen(Screen):
379 474
                                         "green": self.Ok,
380 475
                                         "red": self.Cancel,
381 476
                                         "yellow": self.options_screen,
382
-                                        "blue": self.download_list,
477
+                                        "blue": self.config_screen,
383 478
                                         "menu": self.item_menu,
384 479
                                         "cancel": self.Back,
385 480
                                     })
@@ -390,8 +485,8 @@ class MainScreen(Screen):
390 485
         self["title"] = Label()
391 486
         self.downloading = 0
392 487
         self.activeDownloads = 0
393
-        if not os.path.exists(TMPDIR):
394
-            os.mkdir(TMPDIR)
488
+        if not os.path.exists(config.plugins.playstream.tmp_dir.value):
489
+            os.mkdir(config.plugins.playstream.tmp_dir.value)
395 490
         self.onLayoutFinish.append(self.LayoutFinish)
396 491
 
397 492
     def LayoutFinish(self):
@@ -455,7 +550,7 @@ class MainScreen(Screen):
455 550
         else:
456 551
             if image_url.startswith("http"):
457 552
                 fname = image_url.replace(":","-").replace("/","_")
458
-                image_path = os.path.join(TMPDIR, fname)
553
+                image_path = os.path.join(config.plugins.playstream.tmp_dir.value, fname)
459 554
                 self.download_image(image_path, image_url)
460 555
             else: # local file
461 556
                 image_path = os.path.join(self.cur_directory,image_url)
@@ -596,10 +691,12 @@ class MainScreen(Screen):
596 691
         self.SelectionChanged()
597 692
 
598 693
     def Cancel(self):
599
-        #if os.path.exists(TMPDIR):
600
-            #for name in os.listdir(TMPDIR):
601
-                #os.remove(os.path.join(TMPDIR, name))
602
-            #os.rmdir(TMPDIR)
694
+        print "Exiting PlayStream"
695
+        if config.plugins.playstream.clear_tmp.value and os.path.exists(config.plugins.playstream.tmp_dir.value):
696
+            for name in os.listdir(config.plugins.playstream.tmp_dir.value):
697
+                #print "remove "+os.path.join(config.plugins.playstream.tmp_dir.value, name)
698
+                os.remove(os.path.join(config.plugins.playstream.tmp_dir.value, name))
699
+            #os.rmdir(config.plugins.playstream.tmp_dir.value)
603 700
         self.close()
604 701
 
605 702
 
@@ -678,7 +775,7 @@ class MainScreen(Screen):
678 775
 
679 776
         elif answer[1] == 'download_folder':
680 777
             #downloadDir = "/media/hdd/movie" #config.plugins.playstream.downloadDir.value TODO
681
-            self.session.openWithCallback(self.select_download_dir, LocationBox,"Select download folder","",config.playstream.download_dir.value,config.playstream.locations,False,"Select folder",None,True,True)
778
+            self.session.openWithCallback(self.select_download_dir, LocationBox,"Select download folder","",config.plugins.playstream.download_dir.value,config.plugins.playstream.locations,False,"Select folder",None,True,True)
682 779
 
683 780
         elif answer[1] == "delete":
684 781
             lst = self.cur_menu[1].replace("config::","")
@@ -701,9 +798,9 @@ class MainScreen(Screen):
701 798
         if not downloadDir:
702 799
             return
703 800
         print "Folder selected - %s"%downloadDir
704
-        config.playstream.download_dir.setValue(downloadDir)
705
-        config.playstream.download_dir.save()
706
-        config.playstream.locations.save()
801
+        config.plugins.playstream.download_dir.setValue(downloadDir)
802
+        config.plugins.playstream.download_dir.save()
803
+        config.plugins.playstream.locations.save()
707 804
         config.save()
708 805
 
709 806
     def download_list(self):
@@ -750,7 +847,7 @@ class MainScreen(Screen):
750 847
         title = self.stream["name"].strip()
751 848
         url = self.stream["url"]
752 849
         stream_type = self.stream["type"] #self.sources.stream_type(stream["url"])
753
-        downloadDir = config.playstream.download_dir.value
850
+        downloadDir = config.plugins.playstream.download_dir.value
754 851
         if not os.path.exists(downloadDir):
755 852
             print 'Sorry, download directory "%s" not exist!\nPlease specify in the settings existing directory'%downloadDir
756 853
             self.msg0(_('Sorry, download directory "%s" not exist!\nPlease specify in the settings existing directory'%downloadDir))
@@ -831,6 +928,9 @@ class MainScreen(Screen):
831 928
         self.session.open(MessageBox, txt, MessageBox.TYPE_INFO,timeout=3)
832 929
         #self.session.openWithCallback(self.callMyMsg, MessageBox, _("Do you want to exit the plugin?"), MessageBox.TYPE_INFO)
833 930
 
931
+    def config_screen(self):
932
+        self.session.open(ConfigScreen,self)
933
+
834 934
     def options_screen(self):
835 935
         source = self.cur_menu[1].split("::")[0]
836 936
         options = self.sources.options_read(source)
@@ -857,7 +957,7 @@ from Components.config import config, ConfigSubsection, ConfigYesNo,\
857 957
 from Components.ConfigList import ConfigListScreen
858 958
 #from Screens.LocationBox import LocationBox
859 959
 
860
-config.plugins.playstream = ConfigSubDict()
960
+#config.plugins.playstream = ConfigSubDict()
861 961
 
862 962
 class OptionsScreen(ConfigListScreen,Screen):
863 963
     skin = """
@@ -880,7 +980,7 @@ class OptionsScreen(ConfigListScreen,Screen):
880 980
         self.main = args[0]
881 981
         self.setTitle(self.main.cur_menu[0]+" options")
882 982
         self.source = self.main.cur_menu[1].split("::")[0]
883
-        self.cfg = config.plugins.playstream
983
+        self.cfg = ConfigSubDict() #config.plugins.playstream
884 984
         self.list = []
885 985
         self.options = self.main.sources.options_read(self.source)
886 986
         if not self.options:

+ 260
- 260
PlayStream.wpr Datei anzeigen

@@ -5054,21 +5054,21 @@ edit.bookmarks = {'Ok': (loc('PlayStream.py'),
5054 5054
         ('MainScreen.Ok',
5055 5055
          243)],
5056 5056
                           'first-line': 237,
5057
-                          'sel-line': 498L}),
5057
+                          'sel-line': 594L}),
5058 5058
                   'cb_item_menu': (loc('PlayStream.py'),
5059 5059
                                    {'attrib-starts': [('MainScreen',
5060 5060
         72),
5061 5061
         ('MainScreen.cb_item_menu',
5062 5062
          349)],
5063 5063
                                     'first-line': 364,
5064
-                                    'sel-line': 635L}),
5064
+                                    'sel-line': 733L}),
5065 5065
                   'item_menu': (loc('PlayStream.py'),
5066 5066
                                 {'attrib-starts': [('MainScreen',
5067 5067
         69),
5068 5068
         ('MainScreen.item_menu',
5069 5069
          320)],
5070 5070
                                  'first-line': 312,
5071
-                                 'sel-line': 613L})}
5071
+                                 'sel-line': 711L})}
5072 5072
 edit.file-encoding = {loc('streams.cfg'): 'utf_8'}
5073 5073
 guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
5074 5074
                             'windows': [{'name': 'CLLIF0zyp30ULG6MKhIRp1Beg6'\
@@ -5165,9 +5165,9 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
5165 5165
                                        'fMatchCase': False,
5166 5166
                                        'fOmitBinary': True,
5167 5167
                                        'fRegexFlags': 46,
5168
-                                       'fReplaceText': u'movieplace',
5168
+                                       'fReplaceText': u'config.plugins.playstream.',
5169 5169
                                        'fReverse': False,
5170
-                                       'fSearchText': u'urlp',
5170
+                                       'fSearchText': u'yesno',
5171 5171
                                        'fStartPos': 0,
5172 5172
                                        'fStyle': 'text',
5173 5173
                                        'fWholeWords': False,
@@ -5252,221 +5252,218 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
5252 5252
                       'wide',
5253 5253
                       1,
5254 5254
                       {})],
5255
-        'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('sources/viaplay.py'),
5256
-        {'attrib-starts': [('Source',
5257
-                            26),
5258
-                           ('Source.get_streams',
5259
-                            308)],
5260
-         'first-line': 359L,
5261
-         'folded-linenos': [],
5262
-         'sel-line': 363L,
5263
-         'sel-line-start': 17585L,
5264
-         'selection_end': 17617L,
5265
-         'selection_start': 17617L},
5266
-        1484608183.824],
5267
-        [loc('sources/viaplay.py'),
5268
-         {'attrib-starts': [('Source',
5269
-                             26),
5270
-                            ('Source.get_streams',
5271
-                             308)],
5272
-          'first-line': 359L,
5273
-          'folded-linenos': [],
5274
-          'sel-line': 383L,
5275
-          'sel-line-start': 18370L,
5276
-          'selection_end': 18391L,
5277
-          'selection_start': 18391L},
5278
-         1484608191.386],
5279
-        [loc('sources/viaplay.py'),
5255
+        'primary_view_state': {'editor_states': ({'bookmarks': ([[loc('PlayStream.py'),
5256
+        {'attrib-starts': [('ConfigScreen',
5257
+                            63),
5258
+                           ('ConfigScreen.cancel',
5259
+                            143)],
5260
+         'first-line': 122L,
5261
+         'folded-linenos': [191L],
5262
+         'sel-line': 143L,
5263
+         'sel-line-start': 7502L,
5264
+         'selection_end': 7513L,
5265
+         'selection_start': 7506L},
5266
+        1484780355.806],
5267
+        [loc('PlayStream.py'),
5268
+         {'attrib-starts': [('ConfigScreen',
5269
+                             63),
5270
+                            ('ConfigScreen.cancel',
5271
+                             143)],
5272
+          'first-line': 122L,
5273
+          'folded-linenos': [191L],
5274
+          'sel-line': 143L,
5275
+          'sel-line-start': 7502L,
5276
+          'selection_end': 7514L,
5277
+          'selection_start': 7506L},
5278
+         1484780356.592],
5279
+        [loc('PlayStream.py'),
5280
+         {'attrib-starts': [('MainScreen',
5281
+                             424),
5282
+                            ('MainScreen.Cancel',
5283
+                             690)],
5284
+          'first-line': 479L,
5285
+          'folded-linenos': [191L],
5286
+          'sel-line': 694L,
5287
+          'sel-line-start': 30920L,
5288
+          'selection_end': 30937L,
5289
+          'selection_start': 30937L},
5290
+         1484780625.051],
5291
+        [loc('PlayStream.py'),
5280 5292
          {'attrib-starts': [],
5281
-          'first-line': 428L,
5282
-          'folded-linenos': [],
5283
-          'sel-line': 449L,
5284
-          'sel-line-start': 21214L,
5285
-          'selection_end': 21230L,
5286
-          'selection_start': 21226L},
5287
-         1484608209.637],
5288
-        [loc('sources/viaplay.py'),
5293
+          'first-line': 27L,
5294
+          'folded-linenos': [191L],
5295
+          'sel-line': 47L,
5296
+          'sel-line-start': 1907L,
5297
+          'selection_end': 1913L,
5298
+          'selection_start': 1907L},
5299
+         1484780642.887],
5300
+        [loc('PlayStream.py'),
5301
+         {'attrib-starts': [('ConfigScreen',
5302
+                             62),
5303
+                            ('ConfigScreen.ok',
5304
+                             109)],
5305
+          'first-line': 108L,
5306
+          'folded-linenos': [190L],
5307
+          'sel-line': 115L,
5308
+          'sel-line-start': 6460L,
5309
+          'selection_end': 6534L,
5310
+          'selection_start': 6523L},
5311
+         1484780727.258],
5312
+        [loc('PlayStream.py'),
5289 5313
          {'attrib-starts': [],
5290
-          'first-line': 427L,
5291
-          'folded-linenos': [],
5292
-          'sel-line': 450L,
5293
-          'sel-line-start': 21262L,
5294
-          'selection_end': 21290L,
5295
-          'selection_start': 21286L},
5296
-         1484608219.88],
5297
-        [loc('sources/viaplay.py'),
5314
+          'first-line': 47L,
5315
+          'folded-linenos': [190L],
5316
+          'sel-line': 52L,
5317
+          'sel-line-start': 2197L,
5318
+          'selection_end': 2221L,
5319
+          'selection_start': 2210L},
5320
+         1484780729.99],
5321
+        [loc('PlayStream.py'),
5298 5322
          {'attrib-starts': [],
5299
-          'first-line': 7L,
5300
-          'folded-linenos': [],
5301
-          'sel-line': 12L,
5302
-          'sel-line-start': 344L,
5303
-          'selection_end': 365L,
5304
-          'selection_start': 361L},
5305
-         1484608221.118],
5306
-        [loc('sources/viaplay.py'),
5307
-         {'attrib-starts': [('Source',
5308
-                             26),
5309
-                            ('Source.get_streams',
5310
-                             308)],
5311
-          'first-line': 351L,
5312
-          'folded-linenos': [],
5313
-          'sel-line': 372L,
5314
-          'sel-line-start': 17955L,
5315
-          'selection_end': 17972L,
5316
-          'selection_start': 17968L},
5317
-         1484608222.226],
5318
-        [loc('sources/viaplay.py'),
5323
+          'first-line': 47L,
5324
+          'folded-linenos': [190L],
5325
+          'sel-line': 52L,
5326
+          'sel-line-start': 2197L,
5327
+          'selection_end': 2240L,
5328
+          'selection_start': 2229L},
5329
+         1484780731.293],
5330
+        [loc('PlayStream.py'),
5331
+         {'attrib-starts': [('ConfigScreen',
5332
+                             62),
5333
+                            ('ConfigScreen.ok',
5334
+                             109)],
5335
+          'first-line': 91L,
5336
+          'folded-linenos': [190L],
5337
+          'sel-line': 112L,
5338
+          'sel-line-start': 6053L,
5339
+          'selection_end': 6133L,
5340
+          'selection_start': 6122L},
5341
+         1484780742.038],
5342
+        [loc('PlayStream.py'),
5343
+         {'attrib-starts': [('ConfigScreen',
5344
+                             62),
5345
+                            ('ConfigScreen.ok',
5346
+                             109)],
5347
+          'first-line': 100L,
5348
+          'folded-linenos': [190L],
5349
+          'sel-line': 113L,
5350
+          'sel-line-start': 6151L,
5351
+          'selection_end': 6230L,
5352
+          'selection_start': 6219L},
5353
+         1484780744.713],
5354
+        [loc('PlayStream.py'),
5355
+         {'attrib-starts': [('ConfigScreen',
5356
+                             62),
5357
+                            ('ConfigScreen.ok',
5358
+                             109)],
5359
+          'first-line': 100L,
5360
+          'folded-linenos': [190L],
5361
+          'sel-line': 115L,
5362
+          'sel-line-start': 6460L,
5363
+          'selection_end': 6534L,
5364
+          'selection_start': 6523L},
5365
+         1484780745.163],
5366
+        [loc('PlayStream.py'),
5367
+         {'attrib-starts': [('MainScreen',
5368
+                             423),
5369
+                            ('MainScreen.cb_item_menu',
5370
+                             731)],
5371
+          'first-line': 753L,
5372
+          'folded-linenos': [190L],
5373
+          'sel-line': 774L,
5374
+          'sel-line-start': 34465L,
5375
+          'selection_end': 34544L,
5376
+          'selection_start': 34533L},
5377
+         1484780760.773],
5378
+        [loc('PlayStream.py'),
5319 5379
          {'attrib-starts': [],
5320
-          'first-line': 428L,
5321
-          'folded-linenos': [],
5322
-          'sel-line': 449L,
5323
-          'sel-line-start': 21214L,
5324
-          'selection_end': 21230L,
5325
-          'selection_start': 21226L},
5326
-         1484608613.773],
5380
+          'first-line': 933L,
5381
+          'folded-linenos': [190L],
5382
+          'sel-line': 954L,
5383
+          'sel-line-start': 42167L,
5384
+          'selection_end': 42192L,
5385
+          'selection_start': 42181L},
5386
+         1484780762.115],
5327 5387
         [loc('PlayStream.py'),
5328
-         {'attrib-starts': [('make_service',
5329
-                             54)],
5330
-          'first-line': 53L,
5331
-          'folded-linenos': [],
5332
-          'sel-line': 73L,
5333
-          'sel-line-start': 2951L,
5334
-          'selection_end': 2982L,
5335
-          'selection_start': 2982L},
5336
-         1484608795.724],
5337
-        [loc('sources/movieplace.py'),
5338
-         {'attrib-starts': [('Source',
5339
-                             23),
5340
-                            ('Source.__init__',
5341
-                             25)],
5342
-          'first-line': 6L,
5343
-          'folded-linenos': [],
5388
+         {'attrib-starts': [],
5389
+          'first-line': 933L,
5390
+          'folded-linenos': [190L],
5391
+          'sel-line': 954L,
5392
+          'sel-line-start': 42167L,
5393
+          'selection_end': 42211L,
5394
+          'selection_start': 42200L},
5395
+         1484780762.57],
5396
+        [loc('PlayStream.py'),
5397
+         {'attrib-starts': [('OptionsScreen',
5398
+                             958),
5399
+                            ('OptionsScreen.ok',
5400
+                             1009)],
5401
+          'first-line': 992L,
5402
+          'folded-linenos': [190L],
5403
+          'sel-line': 1013L,
5404
+          'sel-line-start': 45763L,
5405
+          'selection_end': 45834L,
5406
+          'selection_start': 45823L},
5407
+         1484780763.064],
5408
+        [loc('PlayStream.py'),
5409
+         {'attrib-starts': [],
5410
+          'first-line': 23L,
5411
+          'folded-linenos': [190L],
5344 5412
           'sel-line': 28L,
5345
-          'sel-line-start': 808L,
5346
-          'selection_end': 864L,
5347
-          'selection_start': 864L},
5348
-         1484645225.827],
5349
-        [loc('ContentSources.py'),
5350
-         {'attrib-starts': [('ContentSources',
5351
-                             15),
5352
-                            ('ContentSources.get_content',
5353
-                             48)],
5354
-          'first-line': 47L,
5355
-          'folded-linenos': [],
5356
-          'sel-line': 60L,
5357
-          'sel-line-start': 2605L,
5358
-          'selection_end': 2626L,
5359
-          'selection_start': 2626L},
5360
-         1484645249.28],
5361
-        [loc('sources/filmix.py'),
5362
-         {'attrib-starts': [('Source',
5363
-                             24),
5364
-                            ('Source.get_content',
5365
-                             49)],
5366
-          'first-line': 97L,
5367
-          'folded-linenos': [],
5368
-          'sel-line': 119L,
5369
-          'sel-line-start': 4772L,
5370
-          'selection_end': 4772L,
5371
-          'selection_start': 4772L},
5372
-         1484645274.974],
5373
-        [loc('util.py'),
5374
-         {'attrib-starts': [('play_video',
5375
-                             49)],
5376
-          'first-line': 58L,
5377
-          'folded-linenos': [],
5378
-          'sel-line': 71L,
5379
-          'sel-line-start': 1951L,
5380
-          'selection_end': 1951L,
5381
-          'selection_start': 1951L},
5382
-         1484645288.691],
5383
-        [loc('sources/filmix.py'),
5384
-         {'attrib-starts': [('Source',
5385
-                             24),
5386
-                            ('Source.get_content',
5387
-                             49)],
5388
-          'first-line': 70L,
5389
-          'folded-linenos': [],
5390
-          'sel-line': 75L,
5391
-          'sel-line-start': 2549L,
5392
-          'selection_end': 2549L,
5393
-          'selection_start': 2549L},
5394
-         1484681063.486],
5395
-        [loc('ContentSources.py'),
5396
-         {'attrib-starts': [('ContentSources',
5397
-                             14),
5398
-                            ('ContentSources.get_content',
5399
-                             47)],
5400
-          'first-line': 0L,
5401
-          'folded-linenos': [],
5402
-          'sel-line': 59L,
5403
-          'sel-line-start': 2432L,
5404
-          'selection_end': 2453L,
5405
-          'selection_start': 2453L},
5406
-         1484681485.732],
5407
-        [loc('sources/filmix.py'),
5408
-         {'attrib-starts': [('Source',
5409
-                             24),
5410
-                            ('Source.get_content',
5411
-                             49)],
5412
-          'first-line': 0L,
5413
-          'folded-linenos': [],
5414
-          'sel-line': 75L,
5415
-          'sel-line-start': 2549L,
5416
-          'selection_end': 2549L,
5417
-          'selection_start': 2549L},
5418
-         1484681490.881],
5419
-        [loc('ContentSources.py'),
5413
+          'sel-line-start': 1089L,
5414
+          'selection_end': 1113L,
5415
+          'selection_start': 1102L},
5416
+         1484780764.532],
5417
+        [loc('PlayStream.py'),
5418
+         {'attrib-starts': [],
5419
+          'first-line': 23L,
5420
+          'folded-linenos': [190L],
5421
+          'sel-line': 28L,
5422
+          'sel-line-start': 1089L,
5423
+          'selection_end': 1132L,
5424
+          'selection_start': 1121L},
5425
+         1484780765.415],
5426
+        [loc('PlayStream.py'),
5420 5427
          {'attrib-starts': [],
5421
-          'first-line': 154L,
5422
-          'folded-linenos': [],
5423
-          'sel-line': 179L,
5424
-          'sel-line-start': 6128L,
5425
-          'selection_end': 6163L,
5426
-          'selection_start': 6163L},
5427
-         1484682345.643],
5428
-        [loc('sources/serialguru.py'),
5429
-         {'attrib-starts': [('Source',
5430
-                             21),
5431
-                            ('Source.get_content',
5432
-                             45)],
5433
-          'first-line': 151L,
5434
-          'folded-linenos': [],
5435
-          'sel-line': 165L,
5436
-          'sel-line-start': 9363L,
5437
-          'selection_end': 9363L,
5438
-          'selection_start': 9363L},
5439
-         1484682357.737],
5440
-        [loc('ContentSources.py'),
5428
+          'first-line': 31L,
5429
+          'folded-linenos': [190L],
5430
+          'sel-line': 52L,
5431
+          'sel-line-start': 2197L,
5432
+          'selection_end': 2221L,
5433
+          'selection_start': 2210L},
5434
+         1484780766.662],
5435
+        [loc('PlayStream.py'),
5441 5436
          {'attrib-starts': [],
5442
-          'first-line': 176L,
5443
-          'folded-linenos': [],
5444
-          'sel-line': 198L,
5445
-          'sel-line-start': 6811L,
5446
-          'selection_end': 6811L,
5447
-          'selection_start': 6811L},
5448
-         1484683092.344],
5449
-        [loc('util.py'),
5450
-         {'attrib-starts': [('play_video',
5451
-                             49)],
5452
-          'first-line': 57L,
5453
-          'folded-linenos': [],
5454
-          'sel-line': 71L,
5455
-          'sel-line-start': 1951L,
5456
-          'selection_end': 1951L,
5457
-          'selection_start': 1951L},
5458
-         1484683112.755],
5459
-        [loc('ContentSources.py'),
5437
+          'first-line': 31L,
5438
+          'folded-linenos': [190L],
5439
+          'sel-line': 52L,
5440
+          'sel-line-start': 2197L,
5441
+          'selection_end': 2240L,
5442
+          'selection_start': 2229L},
5443
+         1484780767.334],
5444
+        [loc('PlayStream.py'),
5445
+         {'attrib-starts': [('ConfigScreen',
5446
+                             62),
5447
+                            ('ConfigScreen.ok',
5448
+                             109)],
5449
+          'first-line': 0L,
5450
+          'folded-linenos': [190L],
5451
+          'sel-line': 113L,
5452
+          'sel-line-start': 6151L,
5453
+          'selection_end': 6230L,
5454
+          'selection_start': 6219L},
5455
+         1484780976.305],
5456
+        [loc('PlayStream.py'),
5460 5457
          {'attrib-starts': [],
5461
-          'first-line': 176L,
5462
-          'folded-linenos': [],
5463
-          'sel-line': 198L,
5464
-          'sel-line-start': 6811L,
5465
-          'selection_end': 6812L,
5466
-          'selection_start': 6812L},
5467
-         1484683129.526]],
5458
+          'first-line': 930L,
5459
+          'folded-linenos': [190L],
5460
+          'sel-line': 952L,
5461
+          'sel-line-start': 42018L,
5462
+          'selection_end': 42089L,
5463
+          'selection_start': 42074L},
5464
+         1484781120.258]],
5468 5465
         20),
5469
-        'current-loc': loc('ContentSources.py'),
5466
+        'current-loc': loc('PlayStream.py'),
5470 5467
         'editor-state-list': [(loc('plugin.py'),
5471 5468
                                {'attrib-starts': [('main',
5472 5469
         4)],
@@ -5477,14 +5474,16 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
5477 5474
                                 'selection_end': 118L,
5478 5475
                                 'selection_start': 112L}),
5479 5476
                               (loc('PlayStream.py'),
5480
-                               {'attrib-starts': [('make_service',
5481
-        54)],
5482
-                                'first-line': 53L,
5483
-                                'folded-linenos': [],
5484
-                                'sel-line': 73L,
5485
-                                'sel-line-start': 2951L,
5486
-                                'selection_end': 2982L,
5487
-                                'selection_start': 2982L}),
5477
+                               {'attrib-starts': [('MainScreen',
5478
+        423),
5479
+        ('MainScreen.__init__',
5480
+         457)],
5481
+                                'first-line': 457L,
5482
+                                'folded-linenos': [190L],
5483
+                                'sel-line': 465L,
5484
+                                'sel-line-start': 21582L,
5485
+                                'selection_end': 21625L,
5486
+                                'selection_start': 21625L}),
5488 5487
                               (loc('ContentSources.py'),
5489 5488
                                {'attrib-starts': [],
5490 5489
                                 'first-line': 0L,
@@ -5591,7 +5590,7 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
5591 5590
                                 'sel-line-start': 21214L,
5592 5591
                                 'selection_end': 21230L,
5593 5592
                                 'selection_start': 21226L})],
5594
-        'has-focus': False,
5593
+        'has-focus': True,
5595 5594
         'locked': False},
5596 5595
         [loc('plugin.py'),
5597 5596
          loc('PlayStream.py'),
@@ -5606,19 +5605,19 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
5606 5605
          loc('sources/SourceBase.py'),
5607 5606
          loc('util.py'),
5608 5607
          loc('sources/viaplay.py')]),
5609
-                               'open_files': [u'PlayStream.py',
5610
-        u'playstreamproxy.py',
5608
+                               'open_files': [u'playstreamproxy.py',
5611 5609
         u'plugin.py',
5612 5610
         u'resolver.py',
5613 5611
         u'resolvers/hqqresolver.py',
5614 5612
         u'sources/SourceBase.py',
5613
+        u'sources/filmix.py',
5615 5614
         u'sources/iplayer.py',
5616 5615
         u'sources/movieplace.py',
5617 5616
         u'sources/replay.py',
5618 5617
         u'sources/viaplay.py',
5619
-        u'sources/filmix.py',
5620 5618
         u'util.py',
5621
-        u'ContentSources.py']},
5619
+        u'ContentSources.py',
5620
+        u'PlayStream.py']},
5622 5621
         'saved_notebook_display': None,
5623 5622
         'split_percents': {0: 0.3093198992443325},
5624 5623
         'splits': 2,
@@ -5633,11 +5632,11 @@ guimgr.overall-gui-state = {'windowing-policy': 'combined-window',
5633 5632
                          52,
5634 5633
                          2408,
5635 5634
                          1390)}]}
5636
-guimgr.recent-documents = [loc('ContentSources.py'),
5635
+guimgr.recent-documents = [loc('PlayStream.py'),
5636
+                           loc('ContentSources.py'),
5637 5637
                            loc('util.py'),
5638 5638
                            loc('sources/filmix.py'),
5639 5639
                            loc('sources/movieplace.py'),
5640
-                           loc('PlayStream.py'),
5641 5640
                            loc('sources/viaplay.py'),
5642 5641
                            loc('resolver.py'),
5643 5642
                            loc('resolvers/hqqresolver.py'),
@@ -6395,7 +6394,7 @@ guimgr.visual-state = {loc('../../Kodi/test2/plugin.video.aaa/addon.py'): {'a'\
6395 6394
         'sel-line-start': 0L,
6396 6395
         'selection_end': 0L,
6397 6396
         'selection_start': 0L},
6398
-                       loc('../../../../Python27/Lib/BaseHTTPServer.py'): {'a'\
6397
+                       loc('../../../../Python27/lib/BaseHTTPServer.py'): {'a'\
6399 6398
         'ttrib-starts': [('BaseHTTPRequestHandler',
6400 6399
                           113),
6401 6400
                          ('BaseHTTPRequestHandler.handle_one_request',
@@ -6406,7 +6405,7 @@ guimgr.visual-state = {loc('../../Kodi/test2/plugin.video.aaa/addon.py'): {'a'\
6406 6405
         'sel-line-start': 12434,
6407 6406
         'selection_end': 12434,
6408 6407
         'selection_start': 12434},
6409
-                       loc('../../../../Python27/Lib/base64.py'): {'attrib-s'\
6408
+                       loc('../../../../Python27/lib/base64.py'): {'attrib-s'\
6410 6409
         'tarts': [('b64decode',
6411 6410
                    58)],
6412 6411
         'first-line': 54,
@@ -6415,7 +6414,7 @@ guimgr.visual-state = {loc('../../Kodi/test2/plugin.video.aaa/addon.py'): {'a'\
6415 6414
         'sel-line-start': 2478,
6416 6415
         'selection_end': 2478,
6417 6416
         'selection_start': 2478},
6418
-                       loc('../../../../Python27/Lib/re.py'): {'attrib-start'\
6417
+                       loc('../../../../Python27/lib/re.py'): {'attrib-start'\
6419 6418
         's': [('findall',
6420 6419
                172)],
6421 6420
         'first-line': 162,
@@ -6424,19 +6423,6 @@ guimgr.visual-state = {loc('../../Kodi/test2/plugin.video.aaa/addon.py'): {'a'\
6424 6423
         'sel-line-start': 8708,
6425 6424
         'selection_end': 8708,
6426 6425
         'selection_start': 8708},
6427
-                       loc('../../../../Python27/Lib/site.py'): {'attrib-sta'\
6428
-        'rts': [('setquit',
6429
-                 333),
6430
-                ('setquit.Quitter',
6431
-                 347),
6432
-                ('setquit.Quitter.__call__',
6433
-                 352)],
6434
-        'first-line': 342,
6435
-        'folded-linenos': [],
6436
-        'sel-line': 359,
6437
-        'sel-line-start': 12399,
6438
-        'selection_end': 12399,
6439
-        'selection_start': 12399},
6440 6426
                        loc('../../../../Python27/lib/site-packages/gi/__init__.py'): {'a'\
6441 6427
         'ttrib-starts': [],
6442 6428
         'first-line': 24,
@@ -6475,7 +6461,20 @@ guimgr.visual-state = {loc('../../Kodi/test2/plugin.video.aaa/addon.py'): {'a'\
6475 6461
         'sel-line': 55,
6476 6462
         'sel-line-start': 2762,
6477 6463
         'selection_end': 2762,
6478
-        'selection_start': 2762}}
6464
+        'selection_start': 2762},
6465
+                       loc('../../../../Python27/lib/site.py'): {'attrib-sta'\
6466
+        'rts': [('setquit',
6467
+                 333),
6468
+                ('setquit.Quitter',
6469
+                 347),
6470
+                ('setquit.Quitter.__call__',
6471
+                 352)],
6472
+        'first-line': 342,
6473
+        'folded-linenos': [],
6474
+        'sel-line': 359,
6475
+        'sel-line-start': 12399,
6476
+        'selection_end': 12399,
6477
+        'selection_start': 12399}}
6479 6478
 proj.build-cmd = {None: ('default',
6480 6479
                          None)}
6481 6480
 proj.default-encoding = 'utf_8'
@@ -6486,32 +6485,33 @@ proj.pyexec = {None: ('custom',
6486 6485
 proj.pypath = {None: ('custom',
6487 6486
                       [u'c:\\Data\\Programming\\enigma2\\python',
6488 6487
                        u''])}
6489
-search.replace-history = [u'movieplace',
6488
+search.replace-history = [u'config.pluginss.playstream.',
6489
+                          u'movieplace',
6490 6490
                           u'https://filmix\\.me',
6491 6491
                           u'https://filmix.me/',
6492 6492
                           u'filmix.me',
6493 6493
                           u'self',
6494 6494
                           u'current']
6495
-search.search-history = [u'urlp',
6495
+search.search-history = [u'yesno',
6496
+                         u'LocationBox',
6497
+                         u'TMPDIR',
6498
+                         u'def Canc',
6499
+                         u'ConfigSubDict',
6500
+                         u'config.plugins.playstream.',
6501
+                         u'config.pluginss.playstream.',
6502
+                         u'config.playstream.',
6503
+                         u'config.',
6504
+                         u'select_download_dir',
6505
+                         u'playstream',
6506
+                         u'tmpdir',
6507
+                         u'exit',
6508
+                         u'config.playstream.download_dir',
6509
+                         u'tmp',
6510
+                         u'urlp',
6496 6511
                          u'88',
6497 6512
                          u'localhost',
6498 6513
                          u'stream = ',
6499
-                         u'get_streams',
6500
-                         u'resolve',
6501
-                         u'util',
6502
-                         u'streamproxy_encode',
6503
-                         u'proxy',
6504
-                         u'make_service',
6505
-                         u'surl',
6506
-                         u'options_',
6507
-                         u'options_read',
6508
-                         u'options_screen',
6509
-                         u'options',
6510
-                         u'?',
6511
-                         u'play',
6512
-                         u'eServiceReference',
6513
-                         u'kinofilmnet',
6514
-                         u'_substi']
6514
+                         u'get_streams']
6515 6515
 testing.stored-results = (1,
6516 6516
                           [],
6517 6517
                           {})

+ 8
- 3
changelog.md Datei anzeigen

@@ -1,12 +1,17 @@
1
+
2
+**0.5t** (19.01.2016):
3
+- Konfigurācijas logs, tmp folder uzdošana, opcija notīrīt tmp folderi pie iziešanas
4
+- Sīki labojumi
5
+
6
+**0.5s** (17.01.2016):
7
+- koda refaktorings/houskeepings
8
+
1 9
 **0.5p** (15.01.2016):
2 10
 - movieplace.lv saturs (daļēji, nav meklēšanas, seariālu, ne visi video hostingi,)
3 11
 - hqq hostētus strīmus spēlē ar stream_type=5002 (ja ir exteplayer3) + proxy, jo gstreamrim ir problēmas
4 12
 - kodik, kapnob resolveri priekš movieplace.lv
5 13
 - u.c. labojumi
6 14
 
7
-**0.5s** (17.01.2016):
8
-- koda refaktorings/houskeepings
9
-
10 15
 **0.5n** (15.01.2016):
11 16
 - salabots filmix (tagad filmix.me)
12 17
 - .ts strīmus spēlē ar service_type = 1 (nevis 4097)

+ 0
- 3
resolver.py Datei anzeigen

@@ -52,9 +52,6 @@ for module in os.listdir(os.path.join(os.path.dirname(__file__), server_path)):
52 52
     del module
53 53
 RESOLVERS = sorted(RESOLVERS, key=lambda m: -m.__priority__)
54 54
 
55
-def item():
56
-    stream0 = {'name': '', 'url': '', 'quality': '???', 'surl': '', 'subs': '', 'headers': {},"desc":"","img":"","lang":"","type":"","order":0}
57
-    return stream0
58 55
 
59 56
 def resolve(url):
60 57
     """

+ 2
- 3
sources/SourceBase.py Datei anzeigen

@@ -11,10 +11,9 @@ import datetime, re, sys,os
11 11
 import requests
12 12
 from collections import OrderedDict
13 13
 import ConfigParser
14
+import util
14 15
 
15 16
 headers2dict = lambda  h: dict([l.strip().split(": ") for l in h.strip().splitlines()])
16
-stream0 = {'name': '', 'url': '', 'quality': '???', 'surl': '', 'subs': '', 'headers': {},"desc":"","img":"","lang":"","type":"","order":0}
17
-
18 17
 
19 18
 class SourceBase(object):
20 19
     """Stream source base class"""
@@ -51,7 +50,7 @@ User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWeb
51 50
         if not self.is_video(data):
52 51
             return []
53 52
         content = self.get_content(data)
54
-        stream = stream0
53
+        stream = util.item()
55 54
         stream["name"] = content[0].encode("utf8") if isinstance(content[0],unicode) else content[0]
56 55
         stream["url"] = content[1].encode("utf8") if isinstance(content[1],unicode) else content[1]
57 56
         stream["img"] = content[2].encode("utf8") if isinstance(content[2],unicode) else content[2]

+ 1
- 1
sources/ltc.py Datei anzeigen

@@ -13,7 +13,7 @@ import datetime
13 13
 import HTMLParser
14 14
 import json
15 15
 import datetime
16
-from SourceBase import SourceBase, stream_type, stream0
16
+from SourceBase import SourceBase, stream_type
17 17
 import util
18 18
 from collections import OrderedDict
19 19
 

+ 51
- 50
sources/replay.py Datei anzeigen

@@ -13,6 +13,7 @@ except:
13 13
 import urllib2, urllib
14 14
 import datetime, re, sys
15 15
 from SourceBase import SourceBase
16
+import util
16 17
 
17 18
 API_URL = 'http://replay.lsm.lv/%s/'
18 19
 headers2dict = lambda  h: dict([l.strip().split(": ") for l in h.strip().splitlines()])
@@ -22,53 +23,53 @@ User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWeb
22 23
 import HTMLParser
23 24
 h = HTMLParser.HTMLParser()
24 25
 from YouTubeVideoUrl import YouTubeVideoUrl
25
-    
26
+
26 27
 class Source(SourceBase):
27
-    
28
+
28 29
     def __init__(self,country="lv"):
29 30
         self.name = "replay"
30 31
         self.title = "Replay.lv (LTV)"
31 32
         self.img = "http://replay.lsm.lv/apple-touch-icon.png"
32 33
         self.desc = "LSM replay.lv satura skatīšanās"
33
-        
34
+
34 35
         self.country=country
35 36
         self.pic_size = "327x250" #"1000x765"
36
-        
37
+
37 38
     def get_content(self, data):
38 39
         print "[replay] get_content:", data
39 40
         if "::" in data:
40
-            data = data.split("::")[1] 
41
+            data = data.split("::")[1]
41 42
         path = data.split("?")[0]
42 43
         clist = path.split("/")[0]
43 44
         params = data[data.find("?"):] if "?" in data else ""
44 45
         qs = dict(map(lambda x:x.split("="),re.findall("\w+=\w+",params)))
45 46
         lang = qs["lang"] if "lang" in qs else self.country
46
-    
47
+
47 48
         content=[]
48 49
         content.append(("..return", "back","","Return back"))
49
-        
50
+
50 51
         if clist=="home":
51 52
             content.extend([
52 53
                 ("Live streams", "replay::tiesraide","","TV live streams"),
53
-                ("Search LV", "replay::search/?term={0}&lang=lv","","Search content LV"),                
54
+                ("Search LV", "replay::search/?term={0}&lang=lv","","Search content LV"),
54 55
                 ("Last videos LV", "replay::visi/jaunakie/?source=ltv&lang=lv","","Last aired videos LV"),
55
-                ("Last videos by categories LV", "replay::kategorijas/?lang=lv","","Last videos by categories LV"),                
56
+                ("Last videos by categories LV", "replay::kategorijas/?lang=lv","","Last videos by categories LV"),
56 57
                 ("All programs LV", "replay::raidijumi/?type=video","","All programs by name LV"),
57 58
                 ("Programs by categories LV", "replay::categories?lang=lv","","All programs by categories LV"),
58 59
                 #("Channels", "replay::channels?language=%s"%self.country,"","TV channels"),
59
-                ("Videos by popularity LV", "replay::visi/popularie/?source=ltv&lang=lv","","Programs by popularity"), 
60
-                
61
-                ("Search RU", "replay::search/?term={0}&lang=ru","","Search content RU"),                
60
+                ("Videos by popularity LV", "replay::visi/popularie/?source=ltv&lang=lv","","Programs by popularity"),
61
+
62
+                ("Search RU", "replay::search/?term={0}&lang=ru","","Search content RU"),
62 63
                 ("Last videos RU", "replay::vse/novie/?source=ltv&lang=ru","","Last aired videos RU"),
63
-                ("Last videos by categories RU", "replay::kategorijas/?lang=ru","","Last videos by categories RU"),                                
64
-                ("All programs RU", "replay::peredachi/?lang=ru&type=video","","All programs by name"),         
64
+                ("Last videos by categories RU", "replay::kategorijas/?lang=ru","","Last videos by categories RU"),
65
+                ("All programs RU", "replay::peredachi/?lang=ru&type=video","","All programs by name"),
65 66
                 ("Programs by categories RU", "replay::categories?lang=ru","","Programs by categories RU")
66 67
             ])
67 68
             return content
68
-        
69
+
69 70
         ### programmu kategorijas ###
70 71
         elif clist=="categories":
71
-            url = "http://replay.lsm.lv/lv/raidijumi/?lang=lv&type=video" if lang =="lv" else "http://replay.lsm.lv/ru/peredachi/?lang=ru&type=video"        
72
+            url = "http://replay.lsm.lv/lv/raidijumi/?lang=lv&type=video" if lang =="lv" else "http://replay.lsm.lv/ru/peredachi/?lang=ru&type=video"
72 73
             r = self._http_request(url)
73 74
             for item in re.findall(r'<a .+href="(\?lang=\w+&type=video&theme=\d+)">([^<]+)</a>\t', r):
74 75
                 title = item[1]
@@ -78,10 +79,10 @@ class Source(SourceBase):
78 79
                 desc = title
79 80
                 content.append((title,self.name+"::"+data2,img,desc))
80 81
             return content
81
-        
82
+
82 83
         ### jaunāko raidijumu kategorijas ###
83 84
         elif clist=="kategorijas":
84
-            url = "http://replay.lsm.lv/lv/" if lang =="lv" else "http://replay.lsm.lv/ru/"        
85
+            url = "http://replay.lsm.lv/lv/" if lang =="lv" else "http://replay.lsm.lv/ru/"
85 86
             r = self._http_request(url)
86 87
             for item in re.findall(r'<a href="/(lv|ru)/kategorija/(\w+)/">.+?<i class="[^"]+"></i>.+?<span>([^<]+)</span>', r, re.DOTALL):
87 88
                 title = item[2]
@@ -90,7 +91,7 @@ class Source(SourceBase):
90 91
                 desc = title
91 92
                 content.append((title,self.name+"::"+data2,img,desc))
92 93
             return content
93
-        
94
+
94 95
         ### Tiešraides kanānālu saraksts
95 96
         elif path=="tiesraide":
96 97
             url = "http://replay.lsm.lv/styles/main.css"
@@ -104,15 +105,15 @@ class Source(SourceBase):
104 105
                 desc = title+" tiesraide (%s)"%veids
105 106
                 content.append((title,self.name+"::"+data2,img,desc))
106 107
             return content
107
-        
108
+
108 109
         ### Kanāla tiesraide
109 110
         elif clist == "tiesraide" and "/" in data:
110 111
             ch = data.split('/')[1]
111
-            veids = "video" if "tv" in ch else "audio"           
112
+            veids = "video" if "tv" in ch else "audio"
112 113
             #url = "http://replay.lsm.lv/lv/tiesraide/ltv7/"
113 114
             url = "http://replay.lsm.lv/lv/tiesraide/%s/"%ch
114 115
             r= self._http_request(url)
115
-            
116
+
116 117
             m = re.search('%s/">.+?<h5>([^<]+)+</h5>.*?<time>([^<]+)</time>'%ch, r, re.DOTALL)
117 118
             tagad = m.group(1).strip() if m else ""
118 119
             laiks = m.group(2).strip() if m else ""
@@ -120,32 +121,32 @@ class Source(SourceBase):
120 121
             m = re.search("<h1>([^<]+)</h1>", r)
121 122
             title = m.group(1).strip() if m else path.split("/")[1].upper()
122 123
             title = "%s - %s (%s)"%(title,tagad,laiks)
123
-            
124
+
124 125
             if veids == "video":
125 126
                 m = re.search('<div class="video"><iframe.+src="([^"]+)"', r)
126
-                if not m: 
127
+                if not m:
127 128
                     content=("No stream found %s"%data,"","","No stream found")
128
-                    return content           
129
+                    return content
129 130
                 url = m.group(1)
130 131
                 headers = headers2dict("""
131 132
             User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
132 133
             Referer: http://replay.lsm.lv/lv/ieraksts/ltv/70398/tiesa-runa.-lielbritanija-gatavojas-referendumam-par-tu/
133 134
                     """)
134 135
                 r = self._http_request(url,headers=headers)
135
-            
136
+
136 137
                 m = re.search('<div class="video-player"><iframe.+src="([^"]+)"', r)
137 138
                 if not m:
138 139
                     content=("No stream found %s"%data,"","","No stream found")
139 140
                     return content
140 141
                 url = m.group(1)
141
-                            
142
+
142 143
                 r = self._http_request(url,headers=headers)
143 144
                 m = re.search('"([^"]+m3u8[^"]+)"', r)
144 145
                 if not m:
145 146
                     content=("No stream found %s"%data,"","","No stream found")
146
-                    return content           
147
+                    return content
147 148
                 data2 = m.group(1).replace("\\","")
148
-                
149
+
149 150
             else: # audio
150 151
                 lrn = ch.replace("lr","")
151 152
                 url = "http://www.latvijasradio.lsm.lv/lv/tiesraide/?channel=%s"%lrn
@@ -153,24 +154,24 @@ class Source(SourceBase):
153 154
                 m = re.search('"file":"([^"]+?m3u8.*?)"', r)
154 155
                 if not m:
155 156
                     content=("No stream found %s"%data,"","","No stream found")
156
-                    return content           
157
+                    return content
157 158
                 data2 = m.group(1).replace("\\","")
158
-                
159
+
159 160
             img = ""
160 161
             desc = ""
161 162
             content =(title,data2,img,desc)
162
-            return content           
163
-                       
163
+            return content
164
+
164 165
         #m = re.search(r'(\?page=\d+)" class=" paging__prev', r, re.IGNORECASE)
165 166
         #if m:
166 167
         #    data = re.sub("\?page=\d+", "", data)
167 168
         #    data2 = data+m.group(1)
168
-        #    content.append(("Previous page",self.name+"::"+data2,"","Previous page"))                            
169
-        
169
+        #    content.append(("Previous page",self.name+"::"+data2,"","Previous page"))
170
+
170 171
         r = self.call(data, lang=lang)
171 172
         if not r:
172 173
             return content
173
-        
174
+
174 175
         if clist == "search":
175 176
             #for r2 in re.findall('<article itemtype="http://schema.org/Article" itemscope class="thumbnail thumbnail--default ">(.+?)</article>', r2, re.DOTALL):
176 177
             for item in re.findall('itemprop="image" data-image="([^"]+)".+?<figcaption><h5 itemprop="name"><a itemprop="url" href="([^<]+)">([^<]+)</a></h5></figcaption>', r):
@@ -179,16 +180,16 @@ class Source(SourceBase):
179 180
                 img = "http://replay.lsm.lv" + item[0]
180 181
                 desc  = title
181 182
                 content.append((title,self.name+"::"+data2,img,desc))
182
-                
183
+
183 184
             #for item in re.findall('itemprop="image" data-image="([^"]+)".+?<figcaption><h4 itemprop="about"><a href="([^"]+)">([^<]+)</a></h4>.*?<h5 itemprop="name"><a itemprop="url" href="([^"]+)">([^<]+)</a></h5>.+?datetime="([^"]+)" class="thumbnail__date ">([^<]+)</time>', r2):
184
-            for item in re.findall('itemprop="image" data-image="([^"]+)".+? class="icon-(ltv|lr).+?<figcaption><h4 itemprop="about"><a href="([^"]+)">([^<]+)</a></h4>.*?<h5 itemprop="name"><a itemprop="url" href="([^"]+)">([^<]+)</a></h5>.+?datetime="([^"]+)" class="thumbnail__date ">([^<]+)</time>', r):  
185
+            for item in re.findall('itemprop="image" data-image="([^"]+)".+? class="icon-(ltv|lr).+?<figcaption><h4 itemprop="about"><a href="([^"]+)">([^<]+)</a></h4>.*?<h5 itemprop="name"><a itemprop="url" href="([^"]+)">([^<]+)</a></h5>.+?datetime="([^"]+)" class="thumbnail__date ">([^<]+)</time>', r):
185 186
                 if item[1]=="lr":continue
186 187
                 title = "%s - %s (%s)"%(item[3],item[5],item[7])
187 188
                 data2 = item[4].replace("/%s/"%lang,"")+"?lang=%s"%lang
188 189
                 img = item[0].replace("https:","http:")
189 190
                 desc = title
190 191
                 content.append((title,self.name+"::"+data2,img,desc))
191
-    
192
+
192 193
         ### Raidijumi (programmas) ###
193 194
         elif clist in ( "raidijumi","peredachi"):
194 195
             for item in re.findall('<li itemprop="name"><a href="([^"]+)" itemprop="url">([^<]+)', r):
@@ -198,7 +199,7 @@ class Source(SourceBase):
198 199
                 img = ""
199 200
                 desc  = ""
200 201
                 content.append((title,self.name+"::"+data2,img,desc))
201
-                 
202
+
202 203
         ### Raidijuma ieraksti speciālie###
203 204
         elif clist in ( "visi","vse",):
204 205
             for item in re.findall('(?i)<figure><a href="([^"]+)" itemprop="image" data-image="([^"]+)".+class="thumbnail__duration">([^<]+)</time></figure><figcaption><h4 itemprop="about"><a href="[^"]+">([^<]+)</a></h4>.+>([^<]+).*</h5>.+>([^<]+)</time></figcaption>', r):
@@ -207,16 +208,16 @@ class Source(SourceBase):
207 208
                 img = item[1].replace("https:","http:")
208 209
                 desc  = "%s - %s\n%s"%(item[5],item[2],item[4])
209 210
                 content.append((title,self.name+"::"+data2,img,desc))
210
-                
211
+
211 212
         ### Raidijuma ieraksti (videos)
212
-        elif clist in ("raidijums","peredacha","kategorija"): 
213
+        elif clist in ("raidijums","peredacha","kategorija"):
213 214
             for item in re.findall('<article .+ href="([^"]+)".+image="([^"]+)".+class="thumbnail__duration">([^<]+).+">([^<]+).+class="thumbnail__date ">([^"]+)</time></figcaption></article>', r):
214 215
                 title = item[3]
215 216
                 data2 = item[0].replace("/%s/"%lang,"")+"?lang=%s"%lang
216 217
                 img = item[1].replace("https:","http:")
217 218
                 desc = "%s - %s"%(item[4],item[2])
218 219
                 content.append((title,self.name+"::"+data2,img,desc))
219
-        
220
+
220 221
         ### Ieraksts (video) ###
221 222
         elif clist in ("ieraksts","statja"):
222 223
             m = re.search('src="([^"]+)"></iframe>', r)
@@ -230,7 +231,7 @@ Referer: http://replay.lsm.lv/lv/ieraksts/ltv/70398/tiesa-runa.-lielbritanija-ga
230 231
                 m = re.search('"file":"([^"]+)', r2)
231 232
                 if m:
232 233
                     data2 = m.group(1).replace("\\","")
233
-                    m = re.search('"idstring":"([^"]+)', r2)                    
234
+                    m = re.search('"idstring":"([^"]+)', r2)
234 235
                     title = m.group(1) if m else ""
235 236
                     title = title.decode("unicode-escape").encode("utf8")
236 237
                     title = title.replace("\n","")
@@ -241,12 +242,12 @@ Referer: http://replay.lsm.lv/lv/ieraksts/ltv/70398/tiesa-runa.-lielbritanija-ga
241 242
                         data2 = YouTubeVideoUrl().extract(video_id)
242 243
                         if not data2:
243 244
                             content=("No stream found %s"%data,"","","No stream found")
244
-                            return content                           
245
+                            return content
245 246
                     content =(title,data2,img,desc)
246 247
                     return content
247 248
             content=("No stream found %s"%data,"","","No stream found")
248 249
             return content
249
-                
250
+
250 251
         m = re.search(r'href="\?([^"]+)" class=" paging__next', r)
251 252
         if m:
252 253
             page = int(re.search("page=(\d+)",m.group(1)).group(1))
@@ -257,10 +258,10 @@ Referer: http://replay.lsm.lv/lv/ieraksts/ltv/70398/tiesa-runa.-lielbritanija-ga
257 258
                     data2 =data+"&page=%i"%page
258 259
                 else:
259 260
                     data2 =data+"?page=%i"%page
260
-            content.append(("Next page",self.name+"::"+data2,"","Next page"))                            
261
-                
261
+            content.append(("Next page",self.name+"::"+data2,"","Next page"))
262
+
262 263
         return content
263
-    
264
+
264 265
     def is_video(self,data):
265 266
         if "::" in data:
266 267
             data = data.split("::")[1]
@@ -271,7 +272,7 @@ Referer: http://replay.lsm.lv/lv/ieraksts/ltv/70398/tiesa-runa.-lielbritanija-ga
271 272
             return True
272 273
         else:
273 274
             return False
274
-    
275
+
275 276
     def call(self, data,headers=headers0,lang=""):
276 277
         if not lang: lang = self.country
277 278
         url = API_URL%lang + data