mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-10-04 18:13:02 +02:00
more fixes related to deployment
This commit is contained in:
@@ -6,10 +6,12 @@ import ffmpegio
|
||||
from decord import AudioReader, cpu
|
||||
import requests
|
||||
from nostr_dvm.utils.nostr_utils import get_event_by_id
|
||||
from nostr_dvm.utils.scrapper.media_scrapper import OvercastDownload, XitterDownload, TiktokDownloadAll, \
|
||||
InstagramDownload, YouTubeDownload
|
||||
|
||||
|
||||
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..")
|
||||
input_value = ""
|
||||
input_type = ""
|
||||
for tag in event.tags():
|
||||
@@ -18,7 +20,7 @@ def input_data_file_duration(event, dvm_config, client, start=0, end=0):
|
||||
input_type = tag.as_vec()[2]
|
||||
|
||||
if input_type == "text":
|
||||
#For now, ingore length of any text, just return 1.
|
||||
# For now, ingore length of any text, just return 1.
|
||||
return 1
|
||||
|
||||
if input_type == "event": # NIP94 event
|
||||
@@ -52,7 +54,8 @@ def input_data_file_duration(event, dvm_config, client, start=0, end=0):
|
||||
return 1
|
||||
|
||||
|
||||
def organize_input_media_data(input_value, input_type, start, end, dvm_config, client, process=True, media_format="audio/mp3") -> str:
|
||||
def organize_input_media_data(input_value, input_type, start, end, dvm_config, client, process=True,
|
||||
media_format="audio/mp3") -> str:
|
||||
if input_type == "event": # NIP94 event
|
||||
evt = get_event_by_id(input_value, client=client, config=dvm_config)
|
||||
if evt is not None:
|
||||
@@ -209,7 +212,7 @@ def get_overcast(input_value, start, end):
|
||||
print("Found overcast.fm Link.. downloading")
|
||||
start_time = start
|
||||
end_time = end
|
||||
downloadOvercast(input_value, filename)
|
||||
download_overcast(input_value, filename)
|
||||
finaltag = str(input_value).replace("https://overcast.fm/", "").split('/')
|
||||
if start == 0.0:
|
||||
if len(finaltag) > 1:
|
||||
@@ -227,7 +230,7 @@ def get_overcast(input_value, start, end):
|
||||
def get_TikTok(input_value, start, end):
|
||||
filepath = os.path.abspath(os.curdir + r'/outputs/')
|
||||
try:
|
||||
filename = downloadTikTok(input_value, filepath)
|
||||
filename = download_tik_tok(input_value, filepath)
|
||||
print(filename)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
@@ -238,7 +241,7 @@ def get_TikTok(input_value, start, end):
|
||||
def get_Instagram(input_value, start, end):
|
||||
filepath = os.path.abspath(os.curdir + r'/outputs/')
|
||||
try:
|
||||
filename = downloadInstagram(input_value, filepath)
|
||||
filename = download_instagram(input_value, filepath)
|
||||
print(filename)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
@@ -250,7 +253,7 @@ def get_Twitter(input_value, start, end):
|
||||
filepath = os.path.abspath(os.curdir) + r'/outputs/'
|
||||
cleanlink = str(input_value).replace("twitter.com", "x.com")
|
||||
try:
|
||||
filename = downloadTwitter(cleanlink, filepath)
|
||||
filename = download_twitter(cleanlink, filepath)
|
||||
except Exception as e:
|
||||
print(e)
|
||||
return "", start, end
|
||||
@@ -259,9 +262,10 @@ def get_Twitter(input_value, start, end):
|
||||
|
||||
def get_youtube(input_value, start, end, audioonly=True):
|
||||
filepath = os.path.abspath(os.curdir) + r'/outputs/'
|
||||
print(filepath)
|
||||
filename = ""
|
||||
try:
|
||||
filename = downloadYouTube(input_value, filepath, audioonly)
|
||||
filename = download_youtube(input_value, filepath, audioonly)
|
||||
|
||||
except Exception as e:
|
||||
print("Youtube " + str(e))
|
||||
@@ -331,31 +335,25 @@ def get_media_link(url) -> (str, str):
|
||||
return None, None
|
||||
|
||||
|
||||
def downloadOvercast(source_url, target_location):
|
||||
from nostr_dvm.utils.scrapper.media_scrapper import OvercastDownload
|
||||
def download_overcast(source_url, target_location):
|
||||
result = OvercastDownload(source_url, target_location)
|
||||
return result
|
||||
|
||||
|
||||
def downloadTwitter(videourl, path):
|
||||
from nostr_dvm.utils.scrapper.media_scrapper import XitterDownload
|
||||
def download_twitter(videourl, path):
|
||||
result = XitterDownload(videourl, path + "x.mp4")
|
||||
return result
|
||||
|
||||
|
||||
def downloadTikTok(videourl, path):
|
||||
from nostr_dvm.utils.scrapper.media_scrapper import TiktokDownloadAll
|
||||
def download_tik_tok(videourl, path):
|
||||
result = TiktokDownloadAll([videourl], path)
|
||||
return result
|
||||
|
||||
|
||||
def downloadInstagram(videourl, path):
|
||||
from nostr_dvm.utils.scrapper.media_scrapper import InstagramDownload
|
||||
def download_instagram(videourl, path):
|
||||
result = InstagramDownload(videourl, "insta", path)
|
||||
return result
|
||||
|
||||
|
||||
def downloadYouTube(link, path, audioonly=True):
|
||||
from nostr_dvm.utils.scrapper.media_scrapper import YouTubeDownload
|
||||
result = YouTubeDownload(link, path, audio_only=audioonly)
|
||||
return result
|
||||
def download_youtube(link, path, audioonly=True):
|
||||
return YouTubeDownload(link, path, audio_only=audioonly)
|
||||
|
@@ -1 +0,0 @@
|
||||
from dvm import DVM
|
6
setup.py
6
setup.py
@@ -1,6 +1,6 @@
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
VERSION = '0.0.6'
|
||||
VERSION = '0.0.7'
|
||||
DESCRIPTION = 'A framework to build and run Nostr NIP90 Data Vending Machines'
|
||||
LONG_DESCRIPTION = ('A framework to build and run Nostr NIP90 Data Vending Machines. '
|
||||
'This is an early stage release. Interfaces might change/brick')
|
||||
@@ -30,7 +30,9 @@ setup(
|
||||
"instaloader==4.10.1",
|
||||
"pytube==15.0.0",
|
||||
"moviepy==2.0.0.dev2",
|
||||
"zipp==3.17.0"
|
||||
"zipp==3.17.0",
|
||||
"urllib3==2.1.0",
|
||||
"typing_extensions==4.8.0"
|
||||
],
|
||||
keywords=['nostr', 'nip90', 'dvm', 'data vending machine'],
|
||||
url="https://github.com/believethehype/nostrdvm",
|
||||
|
Reference in New Issue
Block a user