Ivars 6 years ago
parent
commit
a29f8cce86
10 changed files with 552 additions and 507 deletions
  1. 32
    4
      addon.py
  2. 1
    1
      addon.xml
  3. 6
    0
      changelog.md
  4. 36
    7
      context_menu.py
  5. 0
    1
      kmake.bat
  6. 1
    1
      kodiswift/plugin.py
  7. 469
    492
      project.wpr
  8. 3
    0
      resources/language/English/strings.xml
  9. 3
    0
      resources/settings.xml
  10. 1
    1
      version.txt

+ 32
- 4
addon.py View File

@@ -28,6 +28,9 @@ proxy_url = plugin.get_setting("general_proxy_url",str)
28 28
 playlist = plugin.get_setting("general_playlist",str)
29 29
 download_dir = plugin.get_setting("general_download_dir",str)
30 30
 view_mode = plugin.get_setting("general_view_mode",str)
31
+streams_file = plugin.get_setting("general_streams_file",str)
32
+streams_file_remote = plugin.get_setting("general_streams_file_remote",str)
33
+use_streams_file_remote = plugin.get_setting("general_use_streams_file_remote",bool)
31 34
 
32 35
 #storage_path = os.path.join(plugin.storage_path,"sources.p")
33 36
 if use_storage:
@@ -60,7 +63,20 @@ if use_storage and storage is not None and "sources" in storage:
60 63
     #sources = pickle.load(open(storage_path,"rb"))
61 64
 else:
62 65
     print "[playstream] Create sources objects"
63
-    sources = ContentSources.ContentSources(sources_directory)
66
+    if use_streams_file_remote:
67
+        try:
68
+            sources = ContentSources.ContentSources(sources_directory, streams_file_remote)
69
+        except Exception as e:
70
+            try:
71
+                sources = ContentSources.ContentSources(sources_directory, streams_file)
72
+                plugin.notify("Remote streams file is not available, fallback to local")
73
+            except Exception as e:
74
+                plugin.notify(e.message)
75
+    else:
76
+        try:
77
+            sources = ContentSources.ContentSources(sources_directory, streams_file)
78
+        except Exception as e:
79
+            plugin.notify(e.message)
64 80
 
65 81
 for source in sources.plugins:
66 82
     if not ("options" in dir(sources.plugins[source]) and sources.plugins[source].options): continue
@@ -125,6 +141,7 @@ def get_list(data):
125 141
     content = sources.get_content(data)
126 142
     print "[playstream] %s items returned"%len(content)
127 143
     items = []
144
+    i = 1
128 145
     for item in content:
129 146
         if item[1] == "back": continue
130 147
         title = item[0].decode("utf8") if isinstance(item[0],str) else item[0]
@@ -140,13 +157,23 @@ def get_list(data):
140 157
             ("Add to PlayStream favorites",
141 158
                 u'RunScript(special://home/addons/%s/context_menu.py,"add","%s","%s","%s","%s")'%(
142 159
                 plugin.id, title,  data2 ,img, desc)),
160
+            ]
161
+        if data.startswith("config::"):
162
+            lst = data.split("::")[1]
163
+            context_menu.extend([
143 164
             ("Delete from PlayStream favorites",
144
-                u'RunScript(special://home/addons/%s/context_menu.py,"delete","%s","%s","%s","%s")' % (
145
-                plugin.id, title, data2, img, desc)),
165
+                u'RunScript(special://home/addons/%s/context_menu.py,"delete","%s","%s")' % (
166
+                plugin.id, lst, i)),
167
+            ("Move in PlayStream favorites",
168
+                u'RunScript(special://home/addons/%s/context_menu.py,"move","%s","%s")' % (
169
+                plugin.id, lst, i)),
170
+            ])
171
+        if True:
172
+            context_menu.extend([
146 173
             ("Download",
147 174
              u'RunScript(special://home/addons/%s/context_download.py,"download","%s","%s","%s")' % (
148 175
                 plugin.id, title, data2, download_dir)),
149
-        ]
176
+            ])
150 177
         item = {
151 178
             "label": title,
152 179
             "path": prefix+data2,
@@ -160,6 +187,7 @@ def get_list(data):
160 187
         if view_mode == "Poster":
161 188
             item["poster"] = thumb_data(img, is_playable)
162 189
         items.append(item)
190
+        i += 1
163 191
     return items
164 192
 
165 193
 def play_video(streams):

+ 1
- 1
addon.xml View File

@@ -1,5 +1,5 @@
1 1
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
-<addon version="0.1.55" id="plugin.video.playstream" name="PlayStream" provider-name="ivars777"  >
2
+<addon version="0.1.56" 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" />

+ 6
- 0
changelog.md View File

@@ -1,3 +1,9 @@
1
+**0.1.56** (10.03.2018)
2
+- [feature] PlayStream favoritiem sataisits Deleta un Move
3
+- [change] uzlabota ltc informācija
4
+- [feature] iespēja opcijās norādīt streams.cfg faila atrašanos/nosaukumu gan lokālā failu sistēmā gan remote (ftp://user:password@host/path/too/streams.cfg), gan http (rakstīšana netiek atbalstīta)
5
+- [change] filmix rādā visus tulkojumus/strīmus (agrak tikai pirmo)
6
+
1 7
 **0.1.55** (18.02.2018)
2 8
 - [bugfix] salabots ltc (arhīvs, epg u.c.)
3 9
 - [bugfix] salabots filmix search

+ 36
- 7
context_menu.py View File

@@ -2,12 +2,19 @@ import sys, os, os.path
2 2
 from kodiswift import xbmc, xbmcgui, CLI_MODE
3 3
 from kodiswift import Plugin, storage
4 4
 from resources.lib.content import util
5
+try:
6
+    import wingdbstub
7
+except:
8
+    pass
5 9
 
6 10
 
7
-#plugin = Plugin()
11
+plugin = Plugin(addon_id="plugin.video.playstream")
8 12
 #plugin.load_addon_settings()
9 13
 #playlist = plugin.get_setting("general_playlist",str)
10 14
 #proxy_url = plugin.get_setting("general_proxy_url",str)
15
+streams_file = plugin.get_setting("general_streams_file",str)
16
+streams_file_remote = plugin.get_setting("general_streams_file_remote",str)
17
+use_streams_file_remote = plugin.get_setting("general_use_streams_file_remote",bool)
11 18
 
12 19
 cmd = sys.argv[1]
13 20
 #title = sys.argv[2]
@@ -15,23 +22,45 @@ cmd = sys.argv[1]
15 22
 #img = sys.argv[4]
16 23
 #desc = sys.argv[5]
17 24
 
18
-if cmd in ("add", "delete"):
25
+if cmd in ("add", "delete", "move"):
19 26
     from resources.lib.content.sources.config import Source
20
-    cfg = Source()
27
+    fname = streams_file_remote if use_streams_file_remote else streams_file
28
+    try:
29
+        cfg = Source(cfg_file=fname)
30
+    except Exception as e:
31
+        plugin.notify("Cannot open content config file %s" % fname)
21 32
     lists = cfg.get_lists()
22 33
     titles = [cfg.get_title(name) for name in lists]
23 34
 
24
-
25 35
 if cmd == "add":
26 36
     if not CLI_MODE:
27 37
         ret = xbmcgui.Dialog().select("Select menu",titles)
28 38
     else:
29 39
         ret = 3
30
-    cfg.add_item(lists[ret],sys.argv[2:])
31
-    cfg.write_streams()
40
+    if ret > 0:
41
+        cfg.add_item(lists[ret],sys.argv[2:])
42
+        cfg.write_streams()
32 43
 
33 44
 elif cmd == "delete":
34
-    xbmcgui.Dialog().ok("Info","Not yet implemented!")
45
+    cfg.del_item(sys.argv[2], int(sys.argv[3]))
46
+    cfg.write_streams()
47
+    xbmc.executebuiltin("Container.Refresh")
48
+
49
+elif cmd == "move":
50
+    name = sys.argv[2]
51
+    pos = int(sys.argv[3])
52
+    item = cfg.get_list_items(name)[pos]
53
+    cfg.del_item(name, pos)
54
+    ret = xbmcgui.Dialog().select("Select menu",titles)
55
+    if ret > 0:
56
+        name2 = lists[ret]
57
+        items2 = cfg.get_list_items(name)
58
+        items2 = [it[0] for it in items2]
59
+        ret = xbmcgui.Dialog().select("Select position before item will be insert",items2)
60
+        if ret > 0:
61
+            cfg.add_item(name2, item, ret)
62
+            cfg.write_streams()
63
+            xbmc.executebuiltin("Container.Refresh")
35 64
 
36 65
 elif cmd == "playlist":
37 66
     title = sys.argv[2]

+ 0
- 1
kmake.bat View File

@@ -75,7 +75,6 @@ resources\lib\content\sources\serialguru.py
75 75
 resources\lib\content\sources\tvdom.py
76 76
 resources\lib\content\sources\ustvnow.py
77 77
 resources\lib\content\sources\viaplay.py
78
-resources\lib\content\sources\viaplay.py
79 78
 resources\lib\content\sources\YouTubeVideoUrl.py
80 79
 resources\lib\content\sources\jsinterp.py
81 80
 resources\lib\content\sources\swfinterp.py

+ 1
- 1
kodiswift/plugin.py View File

@@ -58,7 +58,7 @@ class Plugin(XBMCMixin):
58 58
         self._name = name
59 59
         self._routes = []
60 60
         self._view_functions = {}
61
-        self._addon = xbmcaddon.Addon()
61
+        self._addon = xbmcaddon.Addon(addon_id) if addon_id else xbmcaddon.Addon()
62 62
 
63 63
         self._addon_id = addon_id or self._addon.getAddonInfo('id')
64 64
         self._name = name or self._addon.getAddonInfo('name')

+ 469
- 492
project.wpr
File diff suppressed because it is too large
View File


+ 3
- 0
resources/language/English/strings.xml View File

@@ -35,5 +35,8 @@
35 35
   <string id="50016">Playlist file (m3u)</string>
36 36
   <string id="50020">Autostart PlayStream</string>
37 37
   <string id="50021">View Mode</string>
38
+  <string id="50022">Local content config file location/name</string>
39
+  <string id="50023">Remote content config file location/name (ftp or http)</string>
40
+  <string id="50024">Use remote content config file</string>
38 41
 
39 42
 </strings>

+ 3
- 0
resources/settings.xml View File

@@ -12,6 +12,9 @@
12 12
         <setting id="general_port" label="50014" type="number" default="8880" />
13 13
         <setting id="general_proxy_use" label="50017" type="bool" default="false" />
14 14
         <setting id="general_proxy_url" label="50015" type="text" default="http://localhost:8880/" />
15
+        <setting id="general_streams_file" label="50022" type="file" default="streams.cfg" />
16
+        <setting id="general_streams_file_remote" label="50023" type="text" default="ftp://user:password@hostname/hdd/streams.cfg" />
17
+        <setting id="general_use_streams_file_remote" label="50024" type="bool" default="false" />
15 18
     </category>
16 19
 
17 20
     <category label="40003">

+ 1
- 1
version.txt View File

@@ -1 +1 @@
1
-0.1.55
1
+0.1.56