vidformer 0.5.3__py3-none-any.whl → 0.5.4__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vidformer
3
- Version: 0.5.3
3
+ Version: 0.5.4
4
4
  Summary: A Python library for creating and viewing videos with vidformer.
5
5
  Author-email: Dominik Winecki <dominikwinecki@gmail.com>
6
6
  Requires-Python: >=3.8
@@ -0,0 +1,4 @@
1
+ vidformer.py,sha256=11H5DONF82OWWdd4DxE30u9puuT_Y3sy3bFEhvKZs54,28821
2
+ vidformer-0.5.4.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
3
+ vidformer-0.5.4.dist-info/METADATA,sha256=Sn-s_MobObWQkbOiqDqeKNB69Td5kjM79TdXN-YXgHs,643
4
+ vidformer-0.5.4.dist-info/RECORD,,
vidformer.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """A Python library for creating and viewing videos with vidformer."""
2
2
 
3
- __version__ = "0.5.3"
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
@@ -1,4 +0,0 @@
1
- vidformer.py,sha256=nlgIXey_gOWnsQPtJ3cuhq0WqENVyQNJ5tslwFSnPR4,27989
2
- vidformer-0.5.3.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
3
- vidformer-0.5.3.dist-info/METADATA,sha256=tpzhQ8QKqulcUoSBSmb-zGJRye3lCCucqfJzOSWp2FA,643
4
- vidformer-0.5.3.dist-info/RECORD,,