Browse Source

trūkstošie faili

Ivars 7 years ago
parent
commit
e11505b21b
8 changed files with 2108 additions and 0 deletions
  1. 2
    0
      changelog.md
  2. 23
    0
      deploy.bat
  3. 2
    0
      get_version.py
  4. 84
    0
      pmake.bat
  5. 1819
    0
      project.wpr
  6. 33
    0
      readme.md
  7. 2
    0
      restart.ps1
  8. 143
    0
      test.py

+ 2
- 0
changelog.md View File

@@ -0,0 +1,2 @@
1
+**0.1.1** (16.09.2017):
2
+- initial exprerimental version

+ 23
- 0
deploy.bat View File

@@ -0,0 +1,23 @@
1
+@echo off
2
+if (nas3)==(%1%) (
3
+	set TARGET=Q:\Plex\Library\Application Support\Plex Media Server\Plug-ins\PlayStream.bundle\
4
+) else (
5
+    set TARGET=c:\Users\user\AppData\Local\Plex Media Server\Plug-ins\PlayStream.bundle\
6
+)
7
+
8
+for %%f in (
9
+readme.md
10
+changelog.md
11
+Contents\*.*
12
+Contents\Resources\*.*
13
+Contents\Code\*.py
14
+Contents\Libraries\Shared\*.py
15
+Contents\Libraries\Shared\content\*.py
16
+Contents\Libraries\Shared\content\sources\*.py
17
+Contents\Libraries\Shared\content\sources\*.cfg
18
+Contents\Libraries\Shared\content\resolvers\*.py
19
+) do echo f | xcopy /y   %%f "%TARGET%%%f"
20
+
21
+
22
+rem "%ProgramFiles%\WinRAR\winrar.exe" x -ibck requests.zip *.* "%TARGET%\Contents\Libraries\Shared"
23
+pause

+ 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)

+ 84
- 0
pmake.bat View File

@@ -0,0 +1,84 @@
1
+@echo off
2
+:=== Parameters ===
3
+
4
+python get_version.py Contents\Code\__init__.py >Contents\VERSION
5
+set /p ver=<Contents\VERSION
6
+echo VERSION = %ver%
7
+
8
+set prog=PlayStream
9
+set pack_name=PlayStream.bundle
10
+set desc=Play online streams from various sources, mostly Latvian
11
+
12
+set release_dir=release\
13
+set feed_dir=q:\web\files\
14
+
15
+rem set ZIP=\Program Files (x86)\Gow\bin\zip.exe
16
+set ZIP="C:\Program Files\WinRAR\winrar.exe"
17
+:=== data files ===
18
+if exist "%pack_name%" rm -r -f "%pack_name%"
19
+mkdir "%pack_name%""
20
+if not exist %release_dir% mkdir %release_dir%
21
+if not exist %feed_dir% mkdir %feed_dir%
22
+
23
+for %%f in (
24
+readme.md
25
+changelog.md
26
+Contents\*.*
27
+Contents\Resources\*.*
28
+Contents\Code\*.py
29
+Contents\Libraries\Shared\*.py
30
+Contents\Libraries\Shared\content\__init__.py
31
+Contents\Libraries\Shared\content\ContentSources.py
32
+Contents\Libraries\Shared\content\playstreamproxy.py
33
+Contents\Libraries\Shared\content\Downloader.py
34
+Contents\Libraries\Shared\content\resolver.py
35
+Contents\Libraries\Shared\content\util.py
36
+Contents\Libraries\Shared\content\demjson.py
37
+Contents\Libraries\Shared\content\ordereddict.py
38
+Contents\Libraries\Shared\content\sources\__init__.py
39
+Contents\Libraries\Shared\content\sources\SourceBase.py
40
+Contents\Libraries\Shared\content\sources\cinemalive.py
41
+Contents\Libraries\Shared\content\sources\config.py
42
+Contents\Libraries\Shared\content\sources\euronews.py
43
+Contents\Libraries\Shared\content\sources\filmix.py
44
+Contents\Libraries\Shared\content\sources\filmon.py
45
+Contents\Libraries\Shared\content\sources\iplayer.py
46
+Contents\Libraries\Shared\content\sources\movieplace.py
47
+Contents\Libraries\Shared\content\sources\ltc.py
48
+Contents\Libraries\Shared\content\sources\mtgplay.py
49
+Contents\Libraries\Shared\content\sources\play24.py
50
+Contents\Libraries\Shared\content\sources\replay.py
51
+Contents\Libraries\Shared\content\sources\lmt.py
52
+Contents\Libraries\Shared\content\sources\serialguru.py
53
+Contents\Libraries\Shared\content\sources\tvdom.py
54
+Contents\Libraries\Shared\content\sources\ustvnow.py
55
+Contents\Libraries\Shared\content\sources\viaplay.py
56
+Contents\Libraries\Shared\content\sources\YouTubeVideoUrl.py
57
+Contents\Libraries\Shared\content\sources\jsinterp.py
58
+Contents\Libraries\Shared\content\sources\swfinterp.py
59
+Contents\Libraries\Shared\content\sources\streams.cfg
60
+Contents\Libraries\Shared\content\resolvers\__init__.py
61
+Contents\Libraries\Shared\content\resolvers\aadecode.py
62
+Contents\Libraries\Shared\content\resolvers\hqqresolver.py
63
+Contents\Libraries\Shared\content\resolvers\openload3.py
64
+Contents\Libraries\Shared\content\resolvers\hdgo.py
65
+Contents\Libraries\Shared\content\resolvers\kapnob.py
66
+Contents\Libraries\Shared\content\resolvers\kodik.py
67
+Contents\Libraries\Shared\content\resolvers\youtuberesolver.py
68
+) do echo f| xcopy %%f %pack_name%\%%f
69
+
70
+"%ProgramFiles%\WinRAR\winrar.exe" x -ibck requests.zip *.* %pack_name%\Contents\Libraries\Shared
71
+
72
+if exist  %release_dir%%pack_name%-%ver%.zip rm %release_dir%%pack_name%-%ver%.zip
73
+rem zip  -r %release_dir%%pack_name%-%ver%.zip %pack_name%
74
+"%ProgramFiles%\WinRAR\winrar.exe" a -afzip -r %release_dir%%pack_name%-%ver%.zip %pack_name%
75
+
76
+git add %release_dir%%pack_name%-%ver%.zip
77
+if not ()==(%1%) (
78
+git commit -m %ver%
79
+git tag %ver%
80
+git push
81
+)
82
+
83
+copy  %release_dir%%pack_name%-%ver%.zip  %feed_dir%%pack_name%\%pack_name%-%ver%.zip /Y
84
+pause

+ 1819
- 0
project.wpr
File diff suppressed because it is too large
View File


+ 33
- 0
readme.md View File

@@ -0,0 +1,33 @@
1
+PlayStream
2
+==========
3
+
4
+Plex plugin to to play various online streams (mostly Latvian).
5
+Stream sources are in  subfolder "Libraries/Shared/content/sources" and can be added/customized
6
+Currently implemented:
7
+- Main menu and manual stream definition in sources/streams.cfg file
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
+- **LMT straume** - LMT video streams (Latvian)
14
+- **cinemalive.tv** - 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
+
22
+---
23
+Copyright (c) 2016 ivars777 (ivars777@gmail.com)
24
+Distributed under the GNU GPL v3. For full terms see http://www.gnu.org/licenses/gpl-3.0.en.html
25
+Used fragments of code from
26
+- enigma2-plugin-tv3play by Taapat (https://github.com/Taapat/enigma2-plugin-tv3play)
27
+- Kodi plugin script.module.stream.resolver (https://github.com/kodi-czsk/script.module.stream.resolver)
28
+- enigma2-plugin-youtube by Taapat (https://github.com/Taapat/enigma2-plugin-youtube), originally from https://github.com/rg3/youtube-dl/blob/master/youtube_dl
29
+
30
+
31
+
32
+
33
+

+ 2
- 0
restart.ps1 View File

@@ -0,0 +1,2 @@
1
+Stop-Process -force -processname "Plex*"
2
+Start-Process -FilePath "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe"

+ 143
- 0
test.py View File

@@ -0,0 +1,143 @@
1
+import os, re, sys, traceback, urllib
2
+
3
+from plex_test_case import PlexTestCase, PlexCall
4
+from Framework.api.objectkit import ObjectContainer
5
+from content.util import stream_type
6
+import syspath
7
+#for f in syspath.folders:
8
+
9
+def get_content(data, title="Title"):
10
+    if not data.startswith("search"):
11
+        data = data.replace("/", "%2F")
12
+        data = urllib.quote(data)
13
+        status, headers, body = t.request(u'/video/playstream/%s?title=%s' % (data, title))
14
+    else:  # Search object
15
+        query = raw_input("Search: ")
16
+        data = data.format(query)
17
+        status, headers, body = t.request(u'/video/playstream/%s&query=%s' % (data, query))
18
+    #print body
19
+    #result = re.findall('title="([^"]+)"\s+thumb="([^"]+)"\s+key="([^"]+)"\s+summary="([^"]+)"', body)
20
+    result =  re.findall('<(\w+)\s(.+?)/>', body)
21
+    result2 = []
22
+    for item0 in result:
23
+        item_type = item0[0]
24
+        data2 = re.search('key="(.+?)"', item0[1]).group(1) if re.search('key="(.+?)"',item0[1]) else ""
25
+        data2 = data2.replace("/video/playstream/", "")
26
+        if not data2.startswith("search"):
27
+            data2 = data2.split("?")[0]
28
+            data2 = urllib.unquote(data2)
29
+            data2 = data2.replace("%2F", "/")
30
+        title = re.search('title="(.+?)"', item0[1]).group(1) if re.search('title="(.+?)"',item0[1]) else ""
31
+        desc = re.search('summary="(.+?)"', item0[1]).group(1) if re.search('summary="(.+?)"',item0[1]) else ""
32
+        result2.append((title, data2, "", desc, item_type))
33
+    return result2
34
+
35
+def get_streams(data, title="Title"):
36
+    data = data.replace("/", "%2F")
37
+    data = urllib.quote(data)
38
+    status, headers, body = t.request(u'/video/playstream/%s?title=%s' % (data, title))
39
+    print body
40
+    #TODO
41
+    return []
42
+
43
+
44
+# os.environ["PLEXBUNDLEDPLUGINSPATH"] = r"C:\Data\Programming\Plex"
45
+os.environ["PLEXLOCALAPPDATA"] = r"C:\Data\Programming\Plex"
46
+t = PlexCall()
47
+#for item in get_content("config::home", "Home"):
48
+#    print item
49
+
50
+
51
+if len(sys.argv)>1:
52
+    data= sys.argv[1]
53
+else:
54
+    data = "config::home"
55
+
56
+#options = sources.options_read("ltc")
57
+#print options
58
+history = []
59
+cur = ("Home",data,None,None)
60
+content = get_content(cur[1])
61
+
62
+exit_loop = False
63
+while True:
64
+    print "\n======================================================="
65
+    print "data= ", cur[1]
66
+    print "======================================================="
67
+    for i,item in enumerate(content):
68
+        s = "%i: %s - %s %s"%(i,item[0],item[1],item[2])
69
+        print s #.encode(sys.stdout.encoding,"replace")
70
+
71
+    while True:
72
+        a = raw_input("Enter number, (-) for download, q for exit: ")
73
+        if a in ("q","Q","x","X"):
74
+            exit_loop = True
75
+            print "Exiting"
76
+            break
77
+        try:
78
+            n = int(a)
79
+            break
80
+        except:
81
+            print "Not number!"
82
+    if exit_loop: break
83
+    download = False
84
+    if n<0:
85
+        n = abs(n)
86
+        download = True
87
+    cur2 = content[n]
88
+    data0 = cur2[1].split("::")[1] if "::" in cur2[1] else cur2[1]
89
+    if not data0:
90
+        pass
91
+#    elif cur2[1] == "back":
92
+#        cur = history.pop()
93
+    elif cur2[4] == "Video":  #is_video(cur2[1]):
94
+        if stream_type(cur2[1]):
95
+            stream = util.item()
96
+            stream["url"] = cur2[1]
97
+            stream["name"] = cur2[0]
98
+            streams = [stream]
99
+        else:
100
+            try:
101
+                if not download:
102
+                    streams = get_streams(cur2[1])
103
+                else:
104
+                    stream = util.item()
105
+                    stream["url"] = cur2[1]
106
+                    stream["name"] = cur2[0]
107
+                    stream["url"] = util.streamproxy_encode2(stream["url"])
108
+                    print stream["url"]
109
+                    streams = [stream]
110
+            except Exception as e:
111
+                print unicode(e)
112
+                traceback.print_exc()
113
+                streams = []
114
+        if streams:
115
+            if not download:
116
+                util.play_video(streams)
117
+            else:
118
+                #urlp = util.streamproxy_encode2(streams[0]["url"])
119
+                #print urlp
120
+                #util.player(urlp)
121
+                #Downloader.download_video(streams)
122
+                pass
123
+        else:
124
+            print "**No stream to play - %s "%(
125
+                cur2[1])
126
+            raw_input("Press any key")
127
+        #import os
128
+        #os.system('"c:\Program Files (x86)\VideoLAN\VLC\vlc.exe" "%s"'%cur2[1])
129
+
130
+    else:
131
+        if "{0}" in cur2[1]:
132
+            a = raw_input("Enter value:")
133
+            cur2 = (cur2[0],cur2[1].format(a),cur2[2],cur2[3])
134
+        history.append(cur)
135
+        cur = cur2
136
+    try:
137
+        # Regular item
138
+        content = get_content(cur[1])
139
+    except Exception as e:
140
+        print unicode(e)
141
+        traceback.print_exc()
142
+        raw_input("Continue?")
143
+