Browse Source

izlabots context_menu

Ivars 7 years ago
parent
commit
cc74a1290e
9 changed files with 98 additions and 50 deletions
  1. 11
    2
      addon.py
  2. 1
    1
      addon.xml
  3. 5
    2
      changelog.md
  4. 34
    0
      context_menu.py
  5. 27
    28
      project.wpr
  6. 15
    14
      readme.md
  7. BIN
      release/plugin.video.playstream-0.1.26.zip
  8. 4
    2
      resources/lib/sources/config.py
  9. 1
    1
      version.txt

+ 11
- 2
addon.py View File

20
     sources.plugins[source].options_write(options)
20
     sources.plugins[source].options_write(options)
21
 prefix = ""
21
 prefix = ""
22
 
22
 
23
+
23
 @plugin.route(".+" )
24
 @plugin.route(".+" )
24
 def main():
25
 def main():
25
     global prefix
26
     global prefix
27
     plugin.set_content("movies")
28
     plugin.set_content("movies")
28
     data = plugin.request.url.replace(prefix,"")
29
     data = plugin.request.url.replace(prefix,"")
29
     data = urllib.unquote(data)
30
     data = urllib.unquote(data)
31
+    sources.plugins["config"].read_streams()
30
     if not data:
32
     if not data:
31
         data = "config::home"
33
         data = "config::home"
32
     if sources.is_video(data):
34
     if sources.is_video(data):
66
         is_playable = True if  sources.is_video(item[1]) else False
68
         is_playable = True if  sources.is_video(item[1]) else False
67
         img = item[2]
69
         img = item[2]
68
         desc = item[3].decode("utf8")
70
         desc = item[3].decode("utf8")
69
-        context_menu = [("Add to PlayStream favorites",
70
-                         'RunScript(special://home/addons/%s/context_menu.py,"add","%s","%s","%s","%s")'%(plugin.id, title,  data2,img, desc))]
71
+        context_menu = [
72
+            ("Add to PlayStream favorites", 'RunScript(special://home/addons/%s/context_menu.py,"add","%s","%s","%s","%s")'%(plugin.id, title,  item[1],img, desc)),
73
+            ("Delete from PlayStream favorites",
74
+                 'RunScript(special://home/addons/%s/context_menu.py,"delete","%s","%s","%s","%s")' % (
75
+                 plugin.id, title, item[1], img, desc)),
76
+            ("Download",
77
+             'RunScript(special://home/addons/%s/context_menu.py,"download","%s","%s","%s","%s")' % (
78
+                 plugin.id, title, item[1], img, desc)),
79
+        ]
71
         items.append({
80
         items.append({
72
             "label": title,
81
             "label": title,
73
             "path": data2,
82
             "path": data2,

+ 1
- 1
addon.xml View File

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

+ 5
- 2
changelog.md View File

1
-**0.1.2** (12.02.2016):
2
-- initial exprerimental version
1
+**0.1.24** (23.03.2016):
2
+- subtitles, context menu etc added
3
 
3
 
4
 **0.1.5** (14.02.2016):
4
 **0.1.5** (14.02.2016):
5
 - addon settings added
5
 - addon settings added
6
+
7
+**0.1.2** (12.02.2016):
8
+- initial exprerimental version

+ 34
- 0
context_menu.py View File

1
+import sys, os, os.path
2
+from kodiswift import xbmc, xbmcgui, CLI_MODE
3
+from  resources.lib.sources.config import Source
4
+
5
+cfg = Source()
6
+lists = cfg.get_lists()
7
+titles = [cfg.get_title(name) for name in lists]
8
+cmd = sys.argv[1]
9
+
10
+if cmd == "add":
11
+    if not CLI_MODE:
12
+        ret = xbmcgui.Dialog().select("Select menu",titles)
13
+    else:
14
+        ret = 3
15
+    title = sys.argv[2]
16
+    img = sys.argv[3]
17
+    desc = sys.argv[4]
18
+    cfg.add_item(lists[ret],sys.argv[2:])
19
+    cfg.write_streams()
20
+
21
+elif cmd == "delete":
22
+    xbmcgui.Dialog().ok("Info","Not yet implemented!")
23
+
24
+elif cmd == "download":
25
+    xbmcgui.Dialog().ok("Info","Not yet implemented!")
26
+
27
+else:
28
+    xbmcgui.Dialog().ok("Error","Wrong command")
29
+
30
+
31
+
32
+#mode = "a" if os.path.exists("context_menu.log") else "w"
33
+#with open("context_menu.log", mode) as f:
34
+#    f.write("%s %s %s %s", sys.argv[1], sys.argv[2], sys.argv[3], sys.argv[4])

+ 27
- 28
project.wpr View File

221
                                {'tree-state': {'file-sort-method': 'by name',
221
                                {'tree-state': {'file-sort-method': 'by name',
222
         'list-files-first': 0,
222
         'list-files-first': 0,
223
         'tree-states': {'deep': {'expanded-nodes': [],
223
         'tree-states': {'deep': {'expanded-nodes': [],
224
-                                 'selected-nodes': [(13,)],
224
+                                 'selected-nodes': [(11,)],
225
                                  'top-node': (0,)}},
225
                                  'top-node': (0,)}},
226
         'tree-style': 'deep'}}),
226
         'tree-style': 'deep'}}),
227
                               ('snippets',
227
                               ('snippets',
665
                                None)],
665
                                None)],
666
                  'primary_view_state': {'area': 'wide',
666
                  'primary_view_state': {'area': 'wide',
667
         'constraint': None,
667
         'constraint': None,
668
-        'current_pages': [2,
668
+        'current_pages': [1,
669
                           1],
669
                           1],
670
         'notebook_display': 'normal',
670
         'notebook_display': 'normal',
671
         'notebook_percent': 0.45990566037735847,
671
         'notebook_percent': 0.45990566037735847,
1040
                                   'selection_end': 655L,
1040
                                   'selection_end': 655L,
1041
                                   'selection_start': 655L}),
1041
                                   'selection_start': 655L}),
1042
                                 (loc('addon.py'),
1042
                                 (loc('addon.py'),
1043
-                                 {'attrib-starts': [('get_list',
1044
-        58)],
1045
-                                  'first-line': 100L,
1043
+                                 {'attrib-starts': [],
1044
+                                  'first-line': 4L,
1046
                                   'folded-linenos': [],
1045
                                   'folded-linenos': [],
1047
-                                  'sel-line': 69L,
1048
-                                  'sel-line-start': 2614L,
1049
-                                  'selection_end': 2720L,
1050
-                                  'selection_start': 2720L}),
1046
+                                  'sel-line': 9L,
1047
+                                  'sel-line-start': 276L,
1048
+                                  'selection_end': 276L,
1049
+                                  'selection_start': 276L}),
1051
                                 (loc('changelog.md'),
1050
                                 (loc('changelog.md'),
1052
                                  {'attrib-starts': [],
1051
                                  {'attrib-starts': [],
1053
                                   'first-line': 0L,
1052
                                   'first-line': 0L,
1447
         u'resources/lib/sources/ustvnow.py',
1446
         u'resources/lib/sources/ustvnow.py',
1448
         u'addon.py']},
1447
         u'addon.py']},
1449
         'saved_notebook_display': None,
1448
         'saved_notebook_display': None,
1450
-        'split_percents': {0: 0.4442211055276382},
1449
+        'split_percents': {0: 0.7909547738693468},
1451
         'splits': 2,
1450
         'splits': 2,
1452
         'tab_location': 'top',
1451
         'tab_location': 'top',
1453
         'user_data': {}},
1452
         'user_data': {}},
1868
         'sel-line-start': 12403,
1867
         'sel-line-start': 12403,
1869
         'selection_end': 12403,
1868
         'selection_end': 12403,
1870
         'selection_start': 12403},
1869
         'selection_start': 12403},
1870
+                       loc('../../../../Python27/Lib/genericpath.py'): {'att'\
1871
+        'rib-starts': [('_splitext',
1872
+                        92)],
1873
+        'first-line': 99L,
1874
+        'folded-linenos': [],
1875
+        'sel-line': 109L,
1876
+        'sel-line-start': 3211L,
1877
+        'selection_end': 3211L,
1878
+        'selection_start': 3211L},
1879
+                       loc('../../../../Python27/Lib/ntpath.py'): {'attrib-s'\
1880
+        'tarts': [('splitext',
1881
+                   198)],
1882
+        'first-line': 182L,
1883
+        'folded-linenos': [],
1884
+        'sel-line': 199L,
1885
+        'sel-line-start': 7089L,
1886
+        'selection_end': 7089L,
1887
+        'selection_start': 7089L},
1871
                        loc('../../../../Python27/Lib/site-packages/xbmcswift2/cli/app.py'): {'a'\
1888
                        loc('../../../../Python27/Lib/site-packages/xbmcswift2/cli/app.py'): {'a'\
1872
         'ttrib-starts': [('once',
1889
         'ttrib-starts': [('once',
1873
                           146)],
1890
                           146)],
1893
         'sel-line-start': 29,
1910
         'sel-line-start': 29,
1894
         'selection_end': 36,
1911
         'selection_end': 36,
1895
         'selection_start': 36},
1912
         'selection_start': 36},
1896
-                       loc('../../../../Python27/lib/genericpath.py'): {'att'\
1897
-        'rib-starts': [('_splitext',
1898
-                        92)],
1899
-        'first-line': 99L,
1900
-        'folded-linenos': [],
1901
-        'sel-line': 109L,
1902
-        'sel-line-start': 3211L,
1903
-        'selection_end': 3211L,
1904
-        'selection_start': 3211L},
1905
-                       loc('../../../../Python27/lib/ntpath.py'): {'attrib-s'\
1906
-        'tarts': [('splitext',
1907
-                   198)],
1908
-        'first-line': 182L,
1909
-        'folded-linenos': [],
1910
-        'sel-line': 199L,
1911
-        'sel-line-start': 7089L,
1912
-        'selection_end': 7089L,
1913
-        'selection_start': 7089L},
1914
                        loc('../../../../Python27/lib/site-packages/kodiswift/listitem.py'): {'a'\
1913
                        loc('../../../../Python27/lib/site-packages/kodiswift/listitem.py'): {'a'\
1915
         'ttrib-starts': [('ListItem',
1914
         'ttrib-starts': [('ListItem',
1916
                           20),
1915
                           20),

+ 15
- 14
readme.md View File

5
 Stream sources are in  subfolder "resources/lib/sources", and can be added/customized
5
 Stream sources are in  subfolder "resources/lib/sources", and can be added/customized
6
 Currently implemented:
6
 Currently implemented:
7
 - Main menu and manual stream definition in sources/streams.cfg file
7
 - Main menu and manual stream definition in sources/streams.cfg file
8
-- **replay.lsm.lv** media portal content (Latvian TV)
9
-- **skaties.lv** media portal content (MTG media portal Latvian version), other countries MTG contents are available through customizing main menu (country=xx)
10
-- **lattelecom.tv(shortcut.lv)** media portal content
11
-- **play24.lv** media portal content
12
-- **viaplay.lv**
13
-- **cinemalive.tv**
14
-- **movieplace.lv**
15
-- **dom.tv**
16
-- **BBC iPlayer**
17
-- **Euronews**
18
-- **filmon.tv** media portal content
19
-- **ustvnow.tv**
20
-- **serialguru.ru**
21
-- **filmix.net**
8
+- **replay.lsm.lv** - Latvian TV live streams and archive (Latvian)
9
+- **skaties.lv** - skaties.lv streams (Latvian LNT, TV3, TV3+, TV6, TV2)
10
+- **lattelecom.tv(shortcut.lv)** - live, archive and video (Latvian, English, Russian), account required
11
+- **play24.lv** - RigaTV24 live and archive (Latvian)
12
+- **viaplay.lv** - video streams (partly working, only non-DRM - Latvian, Russian)
13
+- **cinemalive.tv** - movies and series in Latvian (partly working)
14
+- **movieplace.lv** - movies and series in Latvian (partly working)
15
+- **dom.tv** - live and archive of Latvian and Russion TV channels, registration required
16
+- **BBC iPlayer** - BBC live and archive, UK IP address (VPN) required
17
+- **Euronews** - Euronews live and archive
18
+- **filmon.tv** - media portal content
19
+- **ustvnow.tv** - USA live TV (only SD), registration required
20
+- **filmix.net** - movies and series in Russian
21
+- **serialguru.ru** - movies and series in Russian (partly working)
22
+
22
 
23
 
23
 ---
24
 ---
24
 Copyright (c) 2016 ivars777 (ivars777@gmail.com)
25
 Copyright (c) 2016 ivars777 (ivars777@gmail.com)

BIN
release/plugin.video.playstream-0.1.26.zip View File


+ 4
- 2
resources/lib/sources/config.py View File

40
                 self.lists[name] = []
40
                 self.lists[name] = []
41
             else:
41
             else:
42
                 if line[0] in ("#"): continue
42
                 if line[0] in ("#"): continue
43
-                items = tuple(line.strip().split("|"))
43
+                items = line.strip().split("|")
44
                 if not items[0]: continue
44
                 if not items[0]: continue
45
                 if len(items)==1:
45
                 if len(items)==1:
46
                     self.titles[name] = items[0]
46
                     self.titles[name] = items[0]
47
                 else:
47
                 else:
48
+                    if len(items) == 4:
49
+                        items[3] = items[3].replace("\\n","\n")
48
                     self.lists[name].append(items)
50
                     self.lists[name].append(items)
49
 
51
 
50
     def write_streams(self):
52
     def write_streams(self):
52
         for l in self.lists.keys():
54
         for l in self.lists.keys():
53
             f.write("[%s]\n"%l)
55
             f.write("[%s]\n"%l)
54
             for item in self.lists[l]:
56
             for item in self.lists[l]:
55
-                f.write("%s|%s|%s|%s\n"%(item[0],item[1],item[2],item[3]))
57
+                f.write("%s|%s|%s|%s\n"%(item[0].replace("\n",""),item[1],item[2],item[3].replace("\n","\\n")))
56
             f.write("\n")
58
             f.write("\n")
57
         f.close()
59
         f.close()
58
 
60
 

+ 1
- 1
version.txt View File

1
-0.1.25
1
+0.1.26