mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-10-10 19:12:39 +02:00
Update mediasource_utils.py
This commit is contained in:
@@ -7,7 +7,7 @@ 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
|
from nostr_dvm.utils.scrapper.media_scrapper import YTDownload, get_media_duration
|
||||||
|
|
||||||
|
|
||||||
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):
|
||||||
@@ -39,6 +39,8 @@ async def input_data_file_duration(event, dvm_config, client, start=0, end=0):
|
|||||||
return len(input_value)
|
return len(input_value)
|
||||||
|
|
||||||
if input_type == "url":
|
if input_type == "url":
|
||||||
|
duration = get_media_duration(input_value)
|
||||||
|
if duration is None:
|
||||||
source_type = check_source_type(input_value)
|
source_type = check_source_type(input_value)
|
||||||
filename, start, end, type = get_file_start_end_type(input_value, source_type, start, end, True)
|
filename, start, end, type = get_file_start_end_type(input_value, source_type, start, end, True)
|
||||||
if type != "audio" and type != "video":
|
if type != "audio" and type != "video":
|
||||||
@@ -71,8 +73,11 @@ async def organize_input_media_data(input_value, input_type, start, end, dvm_con
|
|||||||
audio_only = True
|
audio_only = True
|
||||||
if media_format.split('/')[0] == "video":
|
if media_format.split('/')[0] == "video":
|
||||||
audio_only = False
|
audio_only = False
|
||||||
|
|
||||||
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":
|
||||||
|
Reference in New Issue
Block a user