Ivars пре 5 година
родитељ
комит
0d69a412a5
6 измењених фајлова са 594 додато и 523 уклоњено
  1. 10
    13
      addon.py
  2. 1
    1
      addon.xml
  3. 14
    1
      changelog.md
  4. 36
    9
      context_download.py
  5. 1
    1
      kmake.bat
  6. 532
    498
      project.wpr

+ 10
- 13
addon.py Прегледај датотеку

@@ -41,7 +41,6 @@ streams_file_remote = plugin.get_setting("general_streams_file_remote",str)
41 41
 use_streams_file_remote = plugin.get_setting("general_use_streams_file_remote",bool)
42 42
 download_overwrite = plugin.get_setting("general_download_overwrite",bool)
43 43
 
44
-
45 44
 #storage_path = os.path.join(plugin.storage_path,"sources.p")
46 45
 if use_storage:
47 46
     try:
@@ -74,19 +73,17 @@ if use_storage and storage is not None and "sources" in storage:
74 73
 else:
75 74
     print "[playstream] Create sources objects"
76 75
     if use_streams_file_remote:
77
-        try:
78
-            sources = ContentSources.ContentSources(sources_directory, streams_file_remote)
79
-        except Exception as e:
80
-            try:
81
-                sources = ContentSources.ContentSources(sources_directory, streams_file)
82
-                plugin.notify("Remote streams file is not available, fallback to local")
83
-            except Exception as e:
84
-                plugin.notify(e.message)
76
+        cfg_file = streams_file_remote
77
+        cfg_file2 = streams_file
85 78
     else:
86
-        try:
87
-            sources = ContentSources.ContentSources(sources_directory, streams_file)
88
-        except Exception as e:
89
-            plugin.notify(e.message)
79
+        cfg_file = streams_file
80
+        cfg_file2 = None
81
+    try:
82
+        sources = ContentSources.ContentSources(sources_directory, cfg_file, cfg_file2)
83
+    except Exception as e:
84
+        xbmc.executebuiltin("Notification(Error,%s" % e.message)
85
+        xbmc.executebuiltin("XBMC.ActivateWindow(Home)")
86
+    #plugin.notify("Using streams file '%s'" % sources.plugins["config"].streams_file)
90 87
 
91 88
 for source in sources.plugins:
92 89
     if not ("options" in dir(sources.plugins[source]) and sources.plugins[source].options): continue

+ 1
- 1
addon.xml Прегледај датотеку

@@ -1,5 +1,5 @@
1 1
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
-<addon version="0.1.95" id="plugin.video.playstream" name="PlayStream" provider-name="ivars777"  >
2
+<addon version="0.1.99" id="plugin.video.playstream" name="PlayStream" provider-name="ivars777"  >
3 3
   <requires>
4 4
     <import addon="xbmc.python" version="2.1.0"/>
5 5
     <import addon="script.module.requests" />

+ 14
- 1
changelog.md Прегледај датотеку

@@ -1,4 +1,17 @@
1
-**0.1.94** (12.10.2018):
1
+**0.1.98** (26.01.2019):
2
+- [feature] pielikts klāt XTV.lv
3
+
4
+**0.1.98** (23.12.2018):
5
+- [fix] salabots filmix, tvplay
6
+
7
+**0.1.97** (05.12.2018):
8
+- [fix] pielabots ltc arhīvs (bildes, kārtība nfo)
9
+- [fix] download pielabots
10
+
11
+**0.1.96** (02.11.2018):
12
+- [fix] papildināts lmt (delfi video)
13
+
14
+**0.1.94** (12.10   .2018):
2 15
 - [fix] salabots replay
3 16
 
4 17
 **0.1.94** (04.09.2018):

+ 36
- 9
context_download.py Прегледај датотеку

@@ -18,9 +18,20 @@ import traceback
18 18
 #from twisted.internet import reactor, defer
19 19
 
20 20
 plugin = Plugin(addon_id="plugin.video.playstream")
21
+prefix = "plugin://%s/" % plugin.id
21 22
 #plugin.load_addon_settings()
22 23
 use_storage = plugin.get_setting("general_use_storage",bool) # TODO vajag nočekot vai nav labāk lietot pickle
24
+storage_ttl = plugin.get_setting("general_ttl",int)
25
+use_proxy = plugin.get_setting("general_proxy_use",bool)
26
+proxy_url = plugin.get_setting("general_proxy_url",str)
27
+playlist = plugin.get_setting("general_playlist",str)
28
+#download_dir = plugin.get_setting("general_download_dir",str)
29
+view_mode = plugin.get_setting("general_view_mode",str)
30
+streams_file = plugin.get_setting("general_streams_file",str)
31
+streams_file_remote = plugin.get_setting("general_streams_file_remote",str)
32
+use_streams_file_remote = plugin.get_setting("general_use_streams_file_remote",bool)
23 33
 overwrite = plugin.get_setting("general_download_overwrite",bool)
34
+
24 35
 sleep_time = 5  # TODO jāliek iekš parametriem
25 36
 
26 37
 cunicode = lambda s: s.decode("utf8") if isinstance(s, str) else s
@@ -28,9 +39,9 @@ cstr = lambda s: s.encode("utf8") if isinstance(s, unicode) else s
28 39
 
29 40
 #print "argv=",sys.argv
30 41
 cmd = sys.argv[1]
31
-title = sys.argv[2]
32
-data = sys.argv[3]
33
-download_dir = sys.argv[4]
42
+title = urllib.unquote(sys.argv[2])
43
+data = urllib.unquote(sys.argv[3])
44
+download_dir = urllib.unquote(sys.argv[4])
34 45
 #overwrite = sys.argv[5] if len(sys.argv)>5 else False
35 46
 
36 47
 queue_dir = os.path.join(xbmc.translatePath("special://temp"), "download_queue") if not CLI_MODE else "download_queue"
@@ -54,8 +65,20 @@ if cmd in ["download2", "download3"] and not CLI_MODE:
54 65
 
55 66
 cur_directory = os.path.dirname(__file__)
56 67
 sources_directory = os.path.join(cur_directory,"resources","lib", "content", "sources")
57
-sources = ContentSources.ContentSources(sources_directory)
58
-
68
+#sources = ContentSources.ContentSources(sources_directory)
69
+#print "[playstream] Create sources objects"
70
+if use_streams_file_remote:
71
+    cfg_file = streams_file_remote
72
+    cfg_file2 = streams_file
73
+else:
74
+    cfg_file = streams_file
75
+    cfg_file2 = None
76
+try:
77
+    sources = ContentSources.ContentSources(sources_directory, cfg_file, cfg_file2)
78
+except Exception as e:
79
+    #xbmc.executebuiltin("Notification(Error,%s" % e.message)
80
+    #xbmc.executebuiltin("XBMC.ActivateWindow(Home)")
81
+    plugin.notify(e.message)
59 82
 
60 83
 def main():
61 84
     if not sources.is_video(data):  # Folderis
@@ -96,8 +119,10 @@ def download_video(title, data, download_dir, overwrite, cb_notify=None, num=Non
96 119
         stream = streams[res]
97 120
     else:
98 121
         stream = streams[0]
99
-
100
-    download_stream(stream, download_dir, overwrite, notify, num=num)
122
+    try:
123
+        download_stream(stream, download_dir, overwrite, notify, num=num)
124
+    except Exception as e:
125
+        notify(e.message, title="Error")
101 126
 
102 127
     #d = Downloader.download_video(stream["url"], os.path.join(download_dir, output), stream["headers"])
103 128
     #reactor.run()
@@ -123,12 +148,14 @@ def notify(text, title="Info", time=10000):
123 148
 ####################################################################################################
124 149
 
125 150
 def download_stream(stream, download_dir, overwrite=True, cb_notify=None, num=False):
151
+    UA = "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0"
152
+
126 153
     #output =  stream["name"].replace("\\"," ").replace(":"," ").replace("|"," ")
127 154
     url = stream["url"]
128 155
     title = stream["name"].strip()
129 156
     output = file.make_fname(title)
130 157
 
131
-    headers = stream["headers"] if "headers" in stream and stream["headers"] else {"user-agent":"Enigma2"}
158
+    headers = stream["headers"] if "headers" in stream and stream["headers"] else {"user-agent":UA}
132 159
     try:
133 160
         h = get_header(url,headers=headers)
134 161
         mtype = h.get("content-type")
@@ -327,7 +354,7 @@ def download_hls(url, outputfile, headers=None, overwrite=True, limit=None, cb_n
327 354
         progress = float(currentbytes)/float(totalbytes)*100
328 355
         msg = "%.1f%% (%iMB/%iMB)"%(progress,currentbytes / 1024 / 1024,totalbytes / 1024 / 1024)
329 356
         #print msg
330
-        #notify(msg)
357
+        notify(msg)
331 358
 
332 359
         if type == "vod":
333 360
             if ts_num >= len(ts_list) or (limit and currenttime>limit):

+ 1
- 1
kmake.bat Прегледај датотеку

@@ -112,7 +112,7 @@ rm -r -f "%pack_name%"
112 112
 
113 113
 if not ()==(%1%) (
114 114
     git commit -m %ver%
115
-    git tag -d "%ver%"
115
+    git tag -d %ver%
116 116
     git tag %ver%
117 117
     git push
118 118
 

+ 532
- 498
project.wpr
Разлика између датотеке није приказан због своје велике величине
Прегледај датотеку