Ivars 6 роки тому
джерело
коміт
03824bf162
4 змінених файлів з 24 додано та 10 видалено
  1. 1
    1
      ContentSources.py
  2. 3
    0
      changelog.md
  3. 12
    7
      sources/config.py
  4. 8
    2
      sources/ltc.py

+ 1
- 1
ContentSources.py Переглянути файл

@@ -18,7 +18,7 @@ class ContentSources(object):
18 18
     """Wrapper for content sources plugin"""
19 19
 
20 20
     #----------------------------------------------------------------------
21
-    def __init__(self, plugin_path, cfg_file="streams.cfg"):
21
+    def __init__(self, plugin_path, cfg_file="streams.cfg", cfg_file2=None):
22 22
         self.plugins = {}
23 23
         self.error_content = [("..atpakaļ", "back", "back.png", "Kļūda, atgriezties atpakaļ")]
24 24
         sys.path.insert(0, plugin_path)

+ 3
- 0
changelog.md Переглянути файл

@@ -1,3 +1,6 @@
1
+**05.12.2018**
2
+- pielabots ltc (arhīvu bildes, kārtība u.c.)
3
+
1 4
 **29.09.2018**
2 5
 - salabots TVPlay (raidījumi pa ketogorijām)
3 6
 

+ 12
- 7
sources/config.py Переглянути файл

@@ -12,18 +12,23 @@ from SourceBase import SourceBase
12 12
 os.path.dirname(os.path.abspath(__file__))
13 13
 class Source(SourceBase):
14 14
 
15
-    def __init__(self,country="lv",cfg_path=None, cfg_file=""):
15
+    def __init__(self, cfg_file="streams.cfg", cfg_file2=None):
16 16
         self.name = "config"
17
-        self.country=country
18 17
         self.lists = collections.OrderedDict()
19 18
         self.titles = {}
20
-        if not cfg_file: cfg_file = "streams.cfg"
21
-        cur_directory = os.path.dirname(os.path.abspath(__file__))
22
-        if not cfg_path: cfg_path = cur_directory
23
-        self.cfg_path = cfg_path
19
+        cur_directory = os.path.dirname(__file__)
20
+        self.cfg_path = cur_directory
24 21
         self.set_streams_file(cfg_file)
25 22
         print "streams_file=", self.streams_file
26
-        self.read_streams()
23
+        try:
24
+            self.read_streams()
25
+        except Exception as e:
26
+            if cfg_file2:
27
+                # Try fallback
28
+                self.set_streams_file(cfg_file2)
29
+                self.read_streams()
30
+            else:
31
+                raise Exception(e.message)
27 32
 
28 33
     def set_streams_file(self, cfg_file):
29 34
         if not ("/" in cfg_file or "\\" in cfg_file):  # ja tikai faila nosaukums, tad meklē to source folderi

+ 8
- 2
sources/ltc.py Переглянути файл

@@ -608,6 +608,7 @@ X-Requested-With: XMLHttpRequest
608 608
                 else:
609 609
                     title = ch["name"]
610 610
                     desc = title
611
+                    img = ""
611 612
             elif vtype == "record-streams":
612 613
                 epg = self.get_epg_id(vid)
613 614
                 if epg:
@@ -615,10 +616,12 @@ X-Requested-With: XMLHttpRequest
615 616
                     t1 = datetime.datetime.fromtimestamp(int(epg["unix_start"])).strftime('%H:%M')
616 617
                     t2 = datetime.datetime.fromtimestamp(int(epg["unix_stop"])).strftime('%H:%M')
617 618
                     date = epg["date"]
618
-                    title = "%s (%s %s-%s)"%(title,date,t1,t2)
619
-                    desc = epg["description"]
619
+                    #title = "%s [%s %s-%s]"%(title,date,t1,t2)
620
+                    desc = title + "\n" + epg["description"].encode("utf8")
621
+                    img = epg["img"].encode("utf8") if "img" in epg else ""
620 622
                 else:
621 623
                     title = desc = data
624
+                    img = ""
622 625
 
623 626
             streams = []
624 627
             for s in r["data"]:
@@ -626,6 +629,7 @@ X-Requested-With: XMLHttpRequest
626 629
                 stream["url"]=(s["attributes"]["stream-url"]+token.encode("utf8")).encode("utf8")
627 630
                 stream["name"]=title
628 631
                 stream["desc"]=desc
632
+                stream["img"] = img
629 633
                 stream["type"]="hls"
630 634
                 m=re.search(".+_(\w\w)_(\w\w)\.\w+",s["id"])
631 635
                 if m:
@@ -763,6 +767,7 @@ X-Requested-With: XMLHttpRequest
763 767
             item["time_start2"] = datetime.datetime.fromtimestamp(int(item["unix_start"]))
764 768
             item["time_stop2"] = datetime.datetime.fromtimestamp(int(item["unix_stop"]))
765 769
             item["date"]=item["time_start2"].strftime("%Y-%m-%d")
770
+            item["img"] = "https://manstv.lattelecom.tv/" + item["url"]
766 771
             return item
767 772
 
768 773
     def get_epg_date(self,date,chid):
@@ -774,6 +779,7 @@ X-Requested-With: XMLHttpRequest
774 779
             item = self.epg[it]
775 780
             if item["channel_id"]==ch["xprs_id"]:
776 781
                 items.append(item)
782
+        items.reverse()
777 783
         return items
778 784
 
779 785