vidformer 0.5.3__tar.gz → 0.5.4__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
|
|
1
1
|
"""A Python library for creating and viewing videos with vidformer."""
|
2
2
|
|
3
|
-
__version__ = "0.5.
|
3
|
+
__version__ = "0.5.4"
|
4
4
|
|
5
5
|
import subprocess
|
6
6
|
from fractions import Fraction
|
@@ -15,6 +15,7 @@ import uuid
|
|
15
15
|
import threading
|
16
16
|
import gzip
|
17
17
|
import base64
|
18
|
+
import re
|
18
19
|
|
19
20
|
import requests
|
20
21
|
import msgpack
|
@@ -507,6 +508,21 @@ class Source:
|
|
507
508
|
def __init__(
|
508
509
|
self, server: YrdenServer, name: str, path: str, stream: int, service=None
|
509
510
|
):
|
511
|
+
if service is None:
|
512
|
+
# check if path is a http URL and, if so, automatically set the service
|
513
|
+
# for example, the following code should work with just vf.Source(server, "tos_720p", "https://f.dominik.win/data/dve2/tos_720p.mp4")
|
514
|
+
# this creates a storage service with endpoint "https://f.dominik.win/" and path "data/dve2/tos_720p.mp4"
|
515
|
+
# don't use the root parameter in this case
|
516
|
+
|
517
|
+
match = re.match(r"(http|https)://([^/]+)(.*)", path)
|
518
|
+
if match is not None:
|
519
|
+
endpoint = f"{match.group(1)}://{match.group(2)}"
|
520
|
+
path = match.group(3)
|
521
|
+
# remove leading slash
|
522
|
+
if path.startswith("/"):
|
523
|
+
path = path[1:]
|
524
|
+
service = StorageService("http", endpoint=endpoint)
|
525
|
+
|
510
526
|
self._server = server
|
511
527
|
self._name = name
|
512
528
|
self._path = path
|
File without changes
|
File without changes
|