mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-10-10 06:03:59 +02:00
fixes
This commit is contained in:
@@ -4,7 +4,6 @@ from datetime import time
|
|||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
import ffmpegio
|
import ffmpegio
|
||||||
|
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from nostr_dvm.utils.nostr_utils import get_event_by_id
|
from nostr_dvm.utils.nostr_utils import get_event_by_id
|
||||||
from nostr_dvm.utils.scrapper.media_scrapper import YTDownload, get_media_duration
|
from nostr_dvm.utils.scrapper.media_scrapper import YTDownload, get_media_duration
|
||||||
@@ -13,8 +12,7 @@ from nostr_dvm.utils.scrapper.media_scrapper import YTDownload, get_media_durati
|
|||||||
async def input_data_file_duration(event, dvm_config, client, start=0, end=0):
|
async def input_data_file_duration(event, dvm_config, client, start=0, end=0):
|
||||||
# print("[" + dvm_config.NIP89.NAME + "] Getting Duration of the Media file..")
|
# print("[" + dvm_config.NIP89.NAME + "] Getting Duration of the Media file..")
|
||||||
if end != 0:
|
if end != 0:
|
||||||
return end-start
|
return end - start
|
||||||
|
|
||||||
|
|
||||||
input_value = ""
|
input_value = ""
|
||||||
input_type = ""
|
input_type = ""
|
||||||
@@ -62,7 +60,7 @@ async def input_data_file_duration(event, dvm_config, client, start=0, end=0):
|
|||||||
|
|
||||||
|
|
||||||
async def organize_input_media_data(input_value, input_type, start, end, dvm_config, client, process=True,
|
async def organize_input_media_data(input_value, input_type, start, end, dvm_config, client, process=True,
|
||||||
media_format="audio/mp3") -> str:
|
media_format="audio/mp3") -> str:
|
||||||
if input_type == "event": # NIP94 event
|
if input_type == "event": # NIP94 event
|
||||||
evt = await get_event_by_id(input_value, client=client, config=dvm_config)
|
evt = await get_event_by_id(input_value, client=client, config=dvm_config)
|
||||||
if evt is not None:
|
if evt is not None:
|
||||||
@@ -76,15 +74,13 @@ async def organize_input_media_data(input_value, input_type, start, end, dvm_con
|
|||||||
|
|
||||||
filename, start, end, type = get_file_start_end_type(input_value, source_type, start, end, audio_only)
|
filename, start, end, type = get_file_start_end_type(input_value, source_type, start, end, audio_only)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if filename == "" or filename is None:
|
if filename == "" or filename is None:
|
||||||
return ""
|
return ""
|
||||||
if type != "audio" and type != "video":
|
if type != "audio" and type != "video":
|
||||||
return filename
|
return filename
|
||||||
try:
|
try:
|
||||||
#file_reader = AudioReader(filename, ctx=cpu(0), mono=False)
|
# file_reader = AudioReader(filename, ctx=cpu(0), mono=False)
|
||||||
# duration = float(file_reader.duration())
|
# duration = float(file_reader.duration())
|
||||||
duration = ffmpegio.probe.format_basic(filename)['duration']
|
duration = ffmpegio.probe.format_basic(filename)['duration']
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@@ -347,5 +343,5 @@ def get_media_link(url) -> (str, str):
|
|||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
|
|
||||||
def download(videourl, path, audioonly=False):
|
def download(videourl, path, audio_only=False):
|
||||||
return YTDownload(videourl, path, audio_only=False)
|
return YTDownload(videourl, path, audio_only=audio_only)
|
||||||
|
@@ -261,7 +261,6 @@ def zaprequest(lud16: str, amount: int, content, zapped_event, zapped_user, keys
|
|||||||
print(lud16)
|
print(lud16)
|
||||||
print(str(amount))
|
print(str(amount))
|
||||||
print(content)
|
print(content)
|
||||||
print(zapped_user.to_hex())
|
|
||||||
if lud16.startswith("LNURL") or lud16.startswith("lnurl"):
|
if lud16.startswith("LNURL") or lud16.startswith("lnurl"):
|
||||||
url = decode_bech32(lud16)
|
url = decode_bech32(lud16)
|
||||||
elif '@' in lud16: # LNaddress
|
elif '@' in lud16: # LNaddress
|
||||||
|
Reference in New Issue
Block a user