Ivars 7 years ago
parent
commit
82fe45bad1

+ 21
- 6
ContentSources.py View File

@@ -6,10 +6,10 @@
6 6
 # Distributed under the GNU GPL v3. For full terms see http://www.gnu.org/licenses/gpl-3.0.en.html
7 7
 #
8 8
 
9
-import sys,os,re
9
+import sys, os, re
10 10
 import glob, traceback
11
-sys.path.insert(0,os.path.dirname(os.path.abspath(__file__)))
12
-from  sources.SourceBase import stream_type
11
+sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
12
+from sources.SourceBase import stream_type
13 13
 import util
14 14
 
15 15
 
@@ -24,7 +24,7 @@ class ContentSources(object):
24 24
         #for f in os.listdir(plugin_path):
25 25
         #for f in next(os.walk(plugin_path))[2]:
26 26
         print "ContentSources: Importing sources from "+plugin_path
27
-        files = glob.glob(os.path.join(plugin_path,"*.py"))
27
+        files = glob.glob(os.path.join(plugin_path, "*.py"))
28 28
         for f in files:
29 29
             fname, ext = os.path.splitext(f)
30 30
             fname = os.path.split(fname)[1]
@@ -106,15 +106,30 @@ class ContentSources(object):
106 106
                     if isinstance(s[k],unicode):
107 107
                         s[k] = s[k].encode("utf8")
108 108
                 if not "resolver" in s:
109
-                    s["resolver"] = stream
109
+                    s["resolver"] = source
110 110
                 if not "surl" in s or not s["surl"]:
111 111
                     s["surl"] = data
112 112
                 if not "nfo" in s:
113
-                    s["nfo"]={"tvshow":{"title":s["title"],"thumb":s["img"],"plot":s["desc"]}}
113
+                    s["nfo"]={"movie":{"title":s["name"],"thumb":s["img"],"plot":s["desc"]}}
114 114
             return streams
115 115
         else:
116 116
             return []
117 117
 
118
+    def get_info(self,data):
119
+        nfo = {}
120
+        if self.is_video(data):
121
+            source = data.split("::")[0]
122
+            if source in self.plugins:
123
+                if "get_info" in dir(self.plugins[source]):
124
+                    streams = self.get_streams(data)
125
+                    nfo = streams[0]["nfo"] if streams and "nfo" in streams[0] else {}
126
+                else:
127
+                    nfo = self.plugins[source].get_info(data)
128
+        else:
129
+            pass    # TODO create nfo for listing
130
+        return nfo
131
+
132
+
118 133
     def stream_type(self,data):
119 134
         return stream_type(data)
120 135
 

+ 941
- 844
PlayStream.py
File diff suppressed because it is too large
View File


+ 462
- 387
PlayStream.wpr
File diff suppressed because it is too large
View File


+ 0
- 20
__init__.py View File

@@ -1,20 +0,0 @@
1
-from os import environ
2
-from gettext import bindtextdomain, dgettext, gettext
3
-
4
-from Components.Language import language
5
-from Tools.Directories import resolveFilename, SCOPE_PLUGINS
6
-
7
-
8
-def localeInit():
9
-    environ["LANGUAGE"] = language.getLanguage()[:2]
10
-    bindtextdomain("PlayStream", resolveFilename(SCOPE_PLUGINS, "Extensions/PlayStream/locale"))
11
-
12
-def _(txt):
13
-    t = dgettext("PlayStream", txt)
14
-    if t == txt:
15
-        t = gettext(txt)
16
-    return t
17
-
18
-localeInit()
19
-language.addCallback(localeInit)
20
-

+ 14
- 1
changelog.md View File

@@ -1,5 +1,18 @@
1
+**0.6h** (19.03.2017):
2
+- update pārbaude uzsākot darbu
3
+- versijas numura  iekļaušana kodā, parādīsana Config logā
4
+- logu redizains (pogas apakšā konfig logos u.c.)
5
+- info loga izsaukšana no menu
6
+- koda safrizēšana/refaktorings (pep8, locale u.c.)
7
+
8
+**0.6d** (18.03.2017):
9
+- Strīma info logs izsaucams no playera (ar bildi un nfo  info)
10
+- skini iznesti ārā xml failā
11
+- citi labojumi
12
+
1 13
 **0.6b** (05.03.2017)
2
-- uzlabota lejupielāde (foldera paprasišana, lejupielāde apakšfolderi u.c.)
14
+- Config logā pievienota iespēja atjaunināt pluginu (izsauc attiecigas opkg komandas)
15
+- uzlabota lejupielāde (foldera paprasišana, lejupielāde apakšfolderi, aktivās lejupielādes no Config loga u.c.)
3 16
 - .nfo un .jpg failu veidošana pie lejupielādes (jēdzigs .nfo pagaidam tikai iPlayer)
4 17
 
5 18
 **0.6a** (12.02.2017):

+ 2
- 1
deploy.bat View File

@@ -14,11 +14,12 @@ if (dm800se)==(%1%) (
14 14
 for %%f in (
15 15
 __init__.py
16 16
 plugin.py
17
+plugin_locale.py
17 18
 plugin.png
19
+skin.xml
18 20
 PlayStream.py
19 21
 PlayStream.png
20 22
 ContentSources.py
21
-ChoiceBox.py
22 23
 VideoDownload.py
23 24
 enigma2_api.py
24 25
 resolver.py

+ 2
- 0
get_version.py View File

@@ -0,0 +1,2 @@
1
+import re,sys
2
+print re.search('__version__ = "(.+?)"',open(sys.argv[1]).read()).group(1)

+ 7
- 6
imake.bat View File

@@ -2,14 +2,13 @@
2 2
 :=== Parameters ===
3 3
 
4 4
 if ()==(%1%) (
5
-    set ver=0.6b
6
-	rem echo Please provide version
7
-	rem pause
8
-	rem GOTO:EOF
5
+    python get_version.py PlayStream.py >version.txt
6
+    set /p ver=<version.txt
7
+    echo Version: %ver%
9 8
 ) else (
10 9
     set ver=%1
11 10
 )
12
-
11
+pause
13 12
 set prog=PlayStream
14 13
 set pack_name=enigma2-plugin-extensions-playstream
15 14
 set desc=Play online streams from various sources, mostly Latvian
@@ -32,7 +31,9 @@ readme.md
32 31
 changelog.md
33 32
 __init__.py
34 33
 plugin.py
34
+plugin_locale.py
35 35
 plugin.png
36
+skin.xml
36 37
 %prog%.py
37 38
 %prog%.png
38 39
 ContentSources.py
@@ -163,6 +164,6 @@ copy %release_dir%%pack_name%_%ver%.ipk %feed_dir%%pack_name%_%ver%.ipk
163 164
 pushd  %feed_dir%
164 165
 python c:\Python27\Scripts\opkg-make-index . >Packages
165 166
 dos2unix Packages
166
-gzip Packages
167
+gzip -f -k Packages
167 168
 popd
168 169
 

+ 0
- 29
locale/PlayStream.pot View File

@@ -1,29 +0,0 @@
1
-# SOME DESCRIPTIVE TITLE.
2
-# Copyright (C) YEAR ORGANIZATION
3
-# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
4
-#
5
-msgid ""
6
-msgstr ""
7
-"Project-Id-Version: PACKAGE VERSION\n"
8
-"POT-Creation-Date: 2016-04-24 16:41+FLE Daylight Time\n"
9
-"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
-"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
-"Language-Team: LANGUAGE <LL@li.org>\n"
12
-"MIME-Version: 1.0\n"
13
-"Content-Type: text/plain; charset=CHARSET\n"
14
-"Content-Transfer-Encoding: ENCODING\n"
15
-"Generated-By: pygettext.py 1.5\n"
16
-
17
-
18
-#: PlayStream.py:83
19
-msgid "Back"
20
-msgstr ""
21
-
22
-#: PlayStream.py:84
23
-msgid "Select"
24
-msgstr ""
25
-
26
-#: plugin.py:16 plugin.py:17
27
-msgid "Play online streams from various sources"
28
-msgstr ""
29
-

+ 62
- 17
locale/lv.po View File

@@ -4,27 +4,72 @@
4 4
 #
5 5
 msgid ""
6 6
 msgstr ""
7
-"Project-Id-Version: \n"
8
-"POT-Creation-Date: 2016-04-24 16:43+0300\n"
9
-"PO-Revision-Date: 2016-04-24 16:45+0300\n"
10
-"Language-Team: \n"
7
+"Project-Id-Version: PACKAGE VERSION\n"
8
+"POT-Creation-Date: 2017-03-18 15:28+FLE Standard Time\n"
9
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
+"Language-Team: LANGUAGE <LL@li.org>\n"
11 12
 "MIME-Version: 1.0\n"
12
-"Content-Type: text/plain; charset=UTF-8\n"
13
-"Content-Transfer-Encoding: 8bit\n"
13
+"Content-Type: text/plain; charset=CHARSET\n"
14
+"Content-Transfer-Encoding: ENCODING\n"
14 15
 "Generated-By: pygettext.py 1.5\n"
15
-"X-Generator: Poedit 1.8.7\n"
16
-"Last-Translator: \n"
17
-"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2);\n"
18
-"Language: lv\n"
19 16
 
20
-#: PlayStream.py:83
21
-msgid "Back"
22
-msgstr "Atpakaļ"
23 17
 
24
-#: PlayStream.py:84
18
+#: PlayStream.py:104 PlayStream.py:1126
19
+msgid "Exit"
20
+msgstr "Beigt"
21
+
22
+#: PlayStream.py:105 PlayStream.py:1127
25 23
 msgid "Select"
26
-msgstr "Izvēlies"
24
+msgstr "Izvēle"
25
+
26
+#: PlayStream.py:106 PlayStream.py:1128
27
+msgid "Options"
28
+msgstr "Opcijas"
29
+
30
+#: PlayStream.py:107 PlayStream.py:1129
31
+msgid "Config"
32
+msgstr "Konfigurācija"
33
+
34
+#: PlayStream.py:555
35
+msgid ""
36
+"Sorry, this file already exists:\n"
37
+"%s"
38
+msgstr ""
27 39
 
28
-#: plugin.py:16 plugin.py:17
40
+#: PlayStream.py:933
41
+msgid "Download folder"
42
+msgstr ""
43
+
44
+#: PlayStream.py:934
45
+msgid "Overwrite download video"
46
+msgstr ""
47
+
48
+#: PlayStream.py:935
49
+msgid "TMP folder"
50
+msgstr ""
51
+
52
+#: PlayStream.py:936
53
+msgid "Clear tmp folder on exit"
54
+msgstr ""
55
+
56
+#: PlayStream.py:937
57
+msgid "Start playstreamproxy"
58
+msgstr ""
59
+
60
+#: PlayStream.py:941 PlayStream.py:1057
61
+msgid "Cancel"
62
+msgstr ""
63
+
64
+#: PlayStream.py:942
65
+msgid "Save"
66
+msgstr "Saglabāt"
67
+
68
+#: PlayStream.py:1016
69
+msgid "Restart Enigma2?"
70
+msgstr "Pārstartēt Enigma2"
71
+
72
+#: plugin.py:27 plugin.py:28
29 73
 msgid "Play online streams from various sources"
30
-msgstr "Dažādu online plūsmu spēlēšana no dažādiem avotiem"
74
+msgstr "Rāda interneta strīmus no dažādiem avotiem"
75
+

+ 75
- 0
locale/plugin.pot View File

@@ -0,0 +1,75 @@
1
+# SOME DESCRIPTIVE TITLE.
2
+# Copyright (C) YEAR ORGANIZATION
3
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
4
+#
5
+msgid ""
6
+msgstr ""
7
+"Project-Id-Version: PACKAGE VERSION\n"
8
+"POT-Creation-Date: 2017-03-18 15:28+FLE Standard Time\n"
9
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
+"Language-Team: LANGUAGE <LL@li.org>\n"
12
+"MIME-Version: 1.0\n"
13
+"Content-Type: text/plain; charset=CHARSET\n"
14
+"Content-Transfer-Encoding: ENCODING\n"
15
+"Generated-By: pygettext.py 1.5\n"
16
+
17
+
18
+#: PlayStream.py:104 PlayStream.py:1126
19
+msgid "Exit"
20
+msgstr ""
21
+
22
+#: PlayStream.py:105 PlayStream.py:1127
23
+msgid "Select"
24
+msgstr ""
25
+
26
+#: PlayStream.py:106 PlayStream.py:1128
27
+msgid "Options"
28
+msgstr ""
29
+
30
+#: PlayStream.py:107 PlayStream.py:1129
31
+msgid "Config"
32
+msgstr ""
33
+
34
+#: PlayStream.py:555
35
+msgid ""
36
+"Sorry, this file already exists:\n"
37
+"%s"
38
+msgstr ""
39
+
40
+#: PlayStream.py:933
41
+msgid "Download folder"
42
+msgstr ""
43
+
44
+#: PlayStream.py:934
45
+msgid "Overwrite download video"
46
+msgstr ""
47
+
48
+#: PlayStream.py:935
49
+msgid "TMP folder"
50
+msgstr ""
51
+
52
+#: PlayStream.py:936
53
+msgid "Clear tmp folder on exit"
54
+msgstr ""
55
+
56
+#: PlayStream.py:937
57
+msgid "Start playstreamproxy"
58
+msgstr ""
59
+
60
+#: PlayStream.py:941 PlayStream.py:1057
61
+msgid "Cancel"
62
+msgstr ""
63
+
64
+#: PlayStream.py:942
65
+msgid "Save"
66
+msgstr ""
67
+
68
+#: PlayStream.py:1016
69
+msgid "Restart Enigma2?"
70
+msgstr ""
71
+
72
+#: plugin.py:27 plugin.py:28
73
+msgid "Play online streams from various sources"
74
+msgstr ""
75
+

+ 1
- 1
messages.pot View File

@@ -5,7 +5,7 @@
5 5
 msgid ""
6 6
 msgstr ""
7 7
 "Project-Id-Version: PACKAGE VERSION\n"
8
-"POT-Creation-Date: 2016-04-24 15:59+FLE Daylight Time\n"
8
+"POT-Creation-Date: 2017-03-18 15:25+FLE Standard Time\n"
9 9
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
10 10
 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11 11
 "Language-Team: LANGUAGE <LL@li.org>\n"

+ 21
- 8
plugin.py View File

@@ -1,23 +1,36 @@
1
+#!/usr/bin/env python
2
+# coding=utf8
3
+# This file is part of PlayStream - enigma2 plugin to play video streams from various sources
4
+# Copyright (c) 2016 ivars777 (ivars777@gmail.com)
5
+
6
+import os, traceback
1 7
 from Plugins.Plugin import PluginDescriptor
2
-import PlayStream
3
-from . import _
4
-import traceback
8
+from Components.Language import language
9
+import PlayStream as plugin
10
+from plugin_locale import _, locale_init
11
+
12
+
13
+# lang = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country"
14
+# os.environ["LANGUAGE"] = lang # Enigma doesn't set this (or LC_ALL, LC_MESSAGES, LANG). gettext needs it!
15
+locale_init(plugin.__title__,"locale")
16
+language.addCallback(locale_init)
5 17
 
6 18
 def main(session, **kwargs):
7 19
     try:
8
-        reload(PlayStream)
9
-        session.open(PlayStream.MainScreen)
20
+        reload(plugin)
21
+        session.open(plugin.MainScreen)
10 22
     except Exception as e:
11 23
         print "Error loading PlayStream - "+ e.message
12 24
         traceback.print_exc()
13 25
 
14 26
 def menu(menuid, **kwargs):
15 27
     if menuid == "mainmenu":
16
-        return [("Play Stream", main, "playstream", 57)]
28
+        return [(plugin.__title__, main, plugin.__id__, 57)]
17 29
     return []
18 30
 
31
+
19 32
 def Plugins(**kwargs):
20 33
     return [
21
-        PluginDescriptor(name = "Play Stream",description = _("Play online streams from various sources"),where = [PluginDescriptor.WHERE_PLUGINMENU,PluginDescriptor.WHERE_EXTENSIONSMENU], icon = "plugin.png", fnc = main),
22
-        PluginDescriptor(name="Play Stream", description=_("Play online streams from various sources"), where = [PluginDescriptor.WHERE_MENU], fnc=menu)
34
+        PluginDescriptor(name = plugin.__title__, description = plugin.__desc__, where = [PluginDescriptor.WHERE_PLUGINMENU,PluginDescriptor.WHERE_EXTENSIONSMENU], icon = "plugin.png", fnc = main),
35
+        PluginDescriptor(name=plugin.__title__, description = plugin.__desc__, where = [PluginDescriptor.WHERE_MENU], fnc=menu)
23 36
     ]

+ 25
- 0
plugin_locale.py View File

@@ -0,0 +1,25 @@
1
+# -*- coding: utf-8 -*-
2
+import gettext, os.path
3
+domain = "Plugin"	# to be redefined
4
+localedir = "locale" # to be redefinded
5
+cur_directory = os.path.dirname(os.path.realpath(__file__))
6
+
7
+
8
+def locale_init(domain0=None,localedir0=None):
9
+    global domain,localedir
10
+    if domain0:
11
+        domain = domain0
12
+    if localedir0:
13
+        localedir = os.path.join(cur_directory,localedir0)
14
+    print "Set locale %s to %s"%(domain,localedir)
15
+    gettext.bindtextdomain(domain, localedir)
16
+
17
+
18
+def _(txt):
19
+    t = gettext.dgettext(domain, txt)
20
+    if t == txt:
21
+        t = gettext.gettext(txt)
22
+    return t
23
+
24
+
25
+

BIN
release/enigma2-plugin-extensions-playstream_0.6c.ipk View File


BIN
release/enigma2-plugin-extensions-playstream_0.6d.ipk View File


BIN
release/enigma2-plugin-extensions-playstream_0.6e.ipk View File


BIN
release/enigma2-plugin-extensions-playstream_0.6f.ipk View File


BIN
release/enigma2-plugin-extensions-playstream_0.6g.ipk View File


BIN
release/enigma2-plugin-extensions-playstream_0.6h.ipk View File


+ 59
- 0
skin.xml View File

@@ -0,0 +1,59 @@
1
+<skin>
2
+  <screen name="PSMain" position="center,center" size="1015,570" title="Play Stream">
3
+    <eLabel position="5,0" size="1000,2" backgroundColor="unaaaaaa" />
4
+    <widget name="title" position="10,2" size="1000,38" font="Regular;30" />
5
+    <widget source="list" render="Listbox" position="10,55" size="580,470" scrollbarMode="showOnDemand">
6
+      <convert type="TemplatedMultiContent">
7
+                { "template": [MultiContentEntryText(pos=(10, 1), size=(560, 30), font=0, flags=RT_HALIGN_LEFT,
8
+                text=0)],
9
+                "fonts": [gFont("Regular", 20)],
10
+                "itemHeight": 30 }
11
+            </convert>
12
+    </widget>
13
+    <widget name="pic" position="646,55" size="327,250" alphatest="on" />
14
+    <widget name="cur" position="610,300" size="400,250" halign="center" font="Regular;20" />
15
+    <ePixmap name="exit" position="10,540" zPosition="2" size="140,40" pixmap="skin_default/buttons/key_exit.png" transparent="1" alphatest="on" />
16
+    <widget name="key_exit" position="10,535" size="140,40" valign="center" halign="center" zPosition="4" backgroundColor="blue" foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
17
+    <ePixmap name="red" position="150,535" zPosition="2" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
18
+    <widget name="key_red" position="150,535" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
19
+    <ePixmap name="green" position="290,535" zPosition="2" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
20
+    <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" />
21
+    <ePixmap name="yellow" position="430,535" zPosition="2" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
22
+    <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" />
23
+    <ePixmap name="blue" position="570,535" zPosition="2" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
24
+    <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" />
25
+    <ePixmap name="menu" position="750,540" zPosition="2" size="140,40" pixmap="skin_default/buttons/key_menu.png" transparent="1" alphatest="on" />
26
+    <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" />
27
+  </screen>
28
+  <screen name="PSStreamInfo" position="center,center" size="1015,570" title="Stream information">
29
+    <widget name="title" position="10,10" size="990,50" font="Regular;30" />
30
+    <widget name="pic" position="10,70" size="330,430" alphatest="on" transparent="1" halign="center" />
31
+    <widget name="info" position="360,70" size="640,430" halign="left" font="Regular;20" valign="top" />
32
+    <ePixmap name="red" position="150,510" zPosition="2" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
33
+    <widget name="key_red" position="150,510" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
34
+  </screen>
35
+  <screen name="PSOptions" position="center,center" size="580,450" title="PlayStream Configuration">
36
+    <widget name="title" position="10,2" size="560,38" font="Regular;24" />
37
+    <ePixmap name="red" position="10,400" zPosition="2" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
38
+    <ePixmap name="green" position="150,400" zPosition="2" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
39
+    <ePixmap name="yellow" position="290,400" zPosition="2" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
40
+    <ePixmap name="blue" position="430,400" zPosition="2" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
41
+    <widget name="key_red" position="10,400" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
42
+    <widget name="key_green" position="150,400" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
43
+    <widget name="key_yellow" position="290,400" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
44
+    <widget name="key_blue" position="430,400" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
45
+    <widget name="config" position="10,50" size="560,340" scrollbarMode="showOnDemand" />
46
+</screen>
47
+  <screen name="PSConfig" position="center,center" size="580,450" title="PlayStream Configuration">
48
+    <widget name="title" position="10,2" size="560,38" font="Regular;24" />
49
+    <ePixmap name="red" position="10,400" zPosition="2" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
50
+    <ePixmap name="green" position="150,400" zPosition="2" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
51
+    <ePixmap name="yellow" position="290,400" zPosition="2" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
52
+    <ePixmap name="blue" position="430,400" zPosition="2" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
53
+    <widget name="key_red" position="10,400" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
54
+    <widget name="key_green" position="150,400" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
55
+    <widget name="key_yellow" position="290,400" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
56
+    <widget name="key_blue" position="430,400" size="140,40" valign="center" halign="center" zPosition="4" foregroundColor="white" font="Regular;20" transparent="1" shadowColor="background" shadowOffset="-2,-2" />
57
+    <widget name="config" position="10,50" size="560,340" scrollbarMode="showOnDemand" />
58
+</screen>
59
+</skin>

+ 0
- 4
sources/SourceBase.py View File

@@ -70,10 +70,6 @@ User-Agent: Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWeb
70 70
         ### Normally to be overrided in child class
71 71
         return [self.get_info(data)]
72 72
 
73
-    def get_info(self,data):
74
-        streams = self.get_streams(data)
75
-        return streams[0] if streams else {}
76
-
77 73
     def options_read(self):
78 74
         if not ("options" in dir(self) and self.options): # process options only if self.options defined, self.config_file should be defined too
79 75
             return None

+ 1
- 1
sources/cinemalive.py View File

@@ -162,7 +162,7 @@ Accept-Language: en-US,en;q=0.8
162 162
         
163 163
         #m = re.search('<div class="viboom-overroll"><iframe src="([^"]+)"', r)
164 164
         #if m:
165
-        result = re.findall('<div id="video_container"><iframe src="(.+?)"', r)
165
+        result = re.findall('<div id="video_container"><iframe.+?src="(.+?)"', r)
166 166
         if result:
167 167
             streams = resolve(result[0])
168 168
             for s in streams:

+ 1
- 1
sources/filmix.py View File

@@ -144,7 +144,7 @@ Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
144 144
                 if m:
145 145
                     title = title + "/"+m.group(1)
146 146
                 m = re.search('<img src="([^"]+.jpg)"', r2, re.DOTALL)
147
-                img = "http://filmix.me"+m.group(1) if m else self.img
147
+                img = m.group(1) if m else self.img
148 148
                 m = re.search(r'<a itemprop="copyrightYear".+?>(\d+)<', r2, re.DOTALL)
149 149
                 if m:
150 150
                     year = m.group(1) if m else ""

+ 1
- 2
sources/iplayer.py View File

@@ -382,7 +382,7 @@ Connection: Keep-Alive
382 382
 
383 383
             #Create nfo dictionary
384 384
             tt = lambda dd,k,d: dd[k] if k in dd else d
385
-            nfo_type = "tvshow" if True else "movie"
385
+            nfo_type = "movie" if True else "tvswhow" # TODO
386 386
             t = OrderedDict()
387 387
             t["title"] = title
388 388
             t["originaltitle"] = tt(ep,"original_title","")
@@ -395,7 +395,6 @@ Connection: Keep-Alive
395 395
             t["premiered"] = tt(ep,"release_date","")
396 396
             t["aired"] = ver["availability"]["start"].split("T")[0] if "start" in ver["availability"] else ""
397 397
             if "parent_position" in ep: t["episode"] = ep["parent_position"]
398
-
399 398
             nfo[nfo_type] = t
400 399
 
401 400
             return title.encode("utf8"),img.encode("utf8"),desc.encode("utf8"),vid.encode("utf8"),nfo

+ 51
- 7
sources/ltc.py View File

@@ -750,20 +750,62 @@ Host: manstv.lattelecom.tv
750 750
             #data2 = self.get_noma_url(video_id)
751 751
         r = self.call2(data)
752 752
         m = re.search('<meta name="dr:say:title" content="([^"]+)">', r, re.IGNORECASE)
753
-        if m:
754
-            title = m.group(1)
755
-        else:
756
-            title = ""
757
-        desc = title
753
+        nfo = {}
754
+        tt = lambda p,r,d: re.search(p,r).group(1) if re.search(p,r) else d
755
+        tt2 = lambda p,r,d: (re.sub("<.+?>","",re.search(p,r).group(1))).split(",") if re.search(p,r) else d
756
+        r2 = r[r.find('<div class="movie_details">'):]
757
+        nfo["title"] = tt('<div class="lv">([^<]+)</div>', r2,"")
758
+        nfo["originaltitle"] = tt('<div class="en">([^<]+)</div>', r2,"")
759
+        if nfo["originaltitle"] and not nfo["title"]:
760
+                nfo["title"] = nfo["originaltitle"]
761
+                #nfo["originaltitle"] = ""
762
+        if "raidijumi" in data:
763
+            nfo["set"] = nfo["title"]
764
+            m = re.search('class="movie_informatio">(.+?)<br>(.+?)<br>', r)
765
+            ep2,ep1 = m.groups()
766
+            #nfo["title"]
767
+            s_nr = tt('<span id="current_season_nr">(\d+)</span>',r,"")
768
+            for it in  re.findall(r'<span class="epizode_number">(\d+)</span>.+?<span class="titlez">(.+?)</span>', r):
769
+                if it[1] == ep1:
770
+                    ep_nr = it[0]
771
+                    break
772
+            else:
773
+                ep_nr=""
774
+            if s_nr:
775
+                nfo["season"] = s_nr
776
+            if ep_nr:
777
+                nfo["eposode"] = ep_nr
778
+            se = "S%02i"%int(s_nr) if s_nr else ""
779
+            se += "E%02i"%int(ep_nr) if ep_nr else ""
780
+            nfo["title"] += " - %s"%ep1 if ep1 else ""
781
+            nfo["originaltitle"] += " - %s"%ep2 if ep2 else ""
782
+            nfo["title"] += "(%s)"%se if se else ""
783
+            nfo["originaltitle"] += "(%s)"%se if se else ""
784
+
785
+
786
+        nfo["thumb"] = tt('<meta name="og:image" content="([^"]+)"', r,"")
787
+        nfo["year"] = tt("Gads: ([^<]+)<", r2, "")
788
+        nfo["runtime"] = tt("Garums: ([^<]+)<", r2, "")
789
+        nfo["quality"] = tt("Kvalitāte: ([^<]+)<", r2, "")
790
+        nfo["genre"]=tt2("Žanr.: (.+?)<br", r2, "")
791
+        nfo["director"] = tt("Režisors: ([^<]+)<", r2, "")
792
+        nfo["actor"] = tt2("Lomās: ([^<]+)<", r2, "")
793
+        nfo["language"] = tt2("Valodas: ([^<]+)<", r2, "")
794
+        nfo["subtitles"] = tt2("Subtitri: ([^<]+)<", r2, "")
795
+        nfo["plot"] = tt('"introduction">(.+?)<', r2,"")
796
+        nfo["tagline"] = nfo["plot"]
797
+        title = util.nfo2title(nfo)
798
+        desc = util.nfo2desc(nfo)
799
+        img = nfo["thumb"]
800
+        #xml = util.nfo2xml(nfo)
758 801
 
759 802
         url = "https://www.lattelecom.tv/xmls/%s.xml"%video_id
760 803
         headers = self.headers2
761 804
         headers["Cookie"] = self.session_id
762 805
         response = urllib2.urlopen(urllib2.Request(url, headers=headers))
763
-
764 806
         r = response.read()
765 807
         servers = re.findall("(?s)<origin>([^<]+)</origin>", r)
766
-        streams_xml = re.findall('<stream quality="\w+">(mp4:\w+_(\w\w)_(\w\w).mp4)</stream>',r)
808
+        streams_xml = re.findall('<stream quality="\w+">(mp4:\w+(\w\w)_(\w\w).mp4)</stream>',r)
767 809
         resource_id = re.search("(?s)<resource_id>([^<]+)</resource_id>", r).group(1)
768 810
         token = re.search("(?s)<auth_token>([^<]+)</auth_token>", r).group(1)
769 811
         streams=[]
@@ -788,6 +830,8 @@ Host: manstv.lattelecom.tv
788 830
                 stream["quality"]=s[2]
789 831
                 stream["name"]=title
790 832
                 stream["desc"]=desc
833
+                stream["img"] = img
834
+                stream["nfo"] = {"movie":nfo}
791 835
                 stream["type"]="hls" #stream_type(url)
792 836
                 stream["subs"] = []
793 837
                 for c in captions:

+ 72
- 4
util.py View File

@@ -57,6 +57,62 @@ def system():
57 57
     else:
58 58
         return "unknown"
59 59
 
60
+def nfo2xml(nfo_dict):
61
+    nfo_type,nfo = next(nfo_dict.iteritems())
62
+    s= "<%s>\n"%nfo_type.encode("utf8")
63
+    for k,v in nfo.iteritems():
64
+        if isinstance(v,list):
65
+            for v2 in v:
66
+                if isinstance(v2,unicode): v2 = v2.encode("utf8")
67
+                s += "    <%s>%s</%s>\n"%(k.encode("utf8"), v2, k.encode("utf8"))
68
+        else:
69
+            if isinstance(v,unicode): v = v.encode("utf8")
70
+            s += "    <%s>%s</%s>\n"%(k.encode("utf8"), v, k.encode("utf8"))
71
+    s += "</%s>\n"%nfo_type.encode("utf8")
72
+    return s
73
+
74
+def nfo2desc(nfo):
75
+
76
+    if not "title" in nfo:
77
+        nfo_type, nfo = next(nfo.iteritems())
78
+    desc = nfo2title(nfo)
79
+    dd = lambda t: "\n" + nfo[t] if t in nfo and nfo[t] else ""
80
+    dd2 = lambda t: "\n" + ",".join(nfo[t]) if t in nfo and nfo[t] else ""
81
+
82
+    def ddd(t,title=""):
83
+        if title:
84
+            title = title + ": "
85
+        if t in nfo and nfo[t]:
86
+            if isinstance(nfo[t],list):
87
+                return "\n" + title + ",".join(nfo[t])
88
+            else:
89
+                return "\n" + title + nfo[t]
90
+        else:
91
+            return ""
92
+
93
+    desc += ddd("tagline")
94
+    if "plot" in nfo and "tagline" in nfo and nfo["tagline"] <> nfo["plot"]:
95
+        desc += ddd("plot")
96
+    elif "plot" in nfo and not "tagline" in nfo:
97
+        desc += ddd("plot")
98
+    desc += ddd("genre","Genre")
99
+    desc += ddd("runtime","Length")
100
+    desc += ddd("director","Director")
101
+    desc += ddd("actor","Actors")
102
+    desc += ddd("language","Languages")
103
+    desc += ddd("quality","Quality")
104
+    return desc.encode("utf8")
105
+
106
+def nfo2title(nfo):
107
+    if not "title" in nfo:
108
+        nfo_type, nfo = next(nfo.iteritems())
109
+    title = nfo["title"]
110
+    if "originaltitle" in nfo and nfo["originaltitle"] and nfo["originaltitle"]<>nfo["title"]:
111
+        title +=" ~ "+nfo["originaltitle"]
112
+    if "year" in nfo and nfo["year"]:
113
+        title += " (%s)"%nfo["year"]
114
+    return title.encode("utf8")
115
+
60 116
 def play_video(streams):
61 117
     if len(streams)>1:
62 118
         for i,s in enumerate(streams):
@@ -75,7 +131,9 @@ def play_video(streams):
75 131
         stream = streams[0]
76 132
 
77 133
     stream = stream_change(stream)
78
-    title = stream["name"]
134
+    title = stream["name"] if not "nfo" in stream else nfo2title(stream["nfo"])
135
+    desc = stream["desc"] if not "nfo" in stream else nfo2desc(stream["nfo"])
136
+    img = stream["img"]
79 137
     url = stream["url"]
80 138
     suburl = ""
81 139
     print url
@@ -93,11 +151,11 @@ def play_video(streams):
93 151
                 f.write(subs)
94 152
         else:
95 153
             print "\n Error downloading subtitle %s"%suburl
96
-    return player(url,stream["name"],suburl,stream["headers"])
154
+    print "\n**Play stream %s\n%s" % (title, url.encode("utf8"))
155
+    return player(url,title,suburl,stream["headers"])
97 156
 
98
-def player(url,title="",suburl="",headers={}):
157
+def player(url, title = "", suburl= "",headers={}):
99 158
     from subprocess import call
100
-    print "\n**Play stream %s\n%s"%(title,url.encode("utf8"))
101 159
     cmd1 = [r"c:\Program Files\VideoLAN\VLC\vlc.exe",url,
102 160
            "--meta-title",title.decode("utf8").encode(sys.getfilesystemencoding()),
103 161
            "--http-user-agent","Enigma2"
@@ -118,6 +176,16 @@ def player(url,title="",suburl="",headers={}):
118 176
         #a = raw_input("*** Error, continue")
119 177
     return
120 178
 
179
+def check_version(package,url="http://feed.blue.lv/Packages"):
180
+    "Return current package version from OPKG feed"
181
+    url = "http://feed.blue.lv/Packages"
182
+    r = requests.get(url)
183
+    if not r.ok:
184
+        return ""
185
+    m = re.search("Package: %s\nVersion: (.+?)\n"%package, r.content)
186
+    if not m:
187
+        return ""
188
+    return m.group(1)
121 189
 
122 190
 SPLIT_CHAR = "~"
123 191
 SPLIT_CODE = urllib.quote(SPLIT_CHAR)

+ 2
- 1
xgetttext.bat View File

@@ -1,2 +1,3 @@
1 1
 set program=PlayStream
2
-pygettext.py -p locale -o %program%.pot -p locale %program%.py plugin.py
2
+set pygettext=c:\Python27\Tools\i18n\pygettext.py
3
+python %pygettext% -p locale -o plugin.pot plugin.py %program%.py