fixing python 3.12 compatibility

This commit is contained in:
Believethehype
2024-06-14 10:34:59 +02:00
parent d77d4c6f8b
commit b21a5a1055
5 changed files with 16 additions and 11 deletions

3
.idea/dvm.iml generated
View File

@@ -6,8 +6,9 @@
<excludeFolder url="file://$MODULE_DIR$/venv" /> <excludeFolder url="file://$MODULE_DIR$/venv" />
<excludeFolder url="file://$MODULE_DIR$/venv_package_test" /> <excludeFolder url="file://$MODULE_DIR$/venv_package_test" />
<excludeFolder url="file://$MODULE_DIR$/venv_package_test2" /> <excludeFolder url="file://$MODULE_DIR$/venv_package_test2" />
<excludeFolder url="file://$MODULE_DIR$/venv12" />
</content> </content>
<orderEntry type="jdk" jdkName="Python 3.11 (dvm)" jdkType="Python SDK" /> <orderEntry type="jdk" jdkName="Python 3.12 (dvm)" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
</component> </component>
</module> </module>

2
.idea/misc.xml generated
View File

@@ -3,5 +3,5 @@
<component name="Black"> <component name="Black">
<option name="sdkName" value="Python 3.10 (dvm)" /> <option name="sdkName" value="Python 3.10 (dvm)" />
</component> </component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11 (dvm)" project-jdk-type="Python SDK" /> <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (dvm)" project-jdk-type="Python SDK" />
</project> </project>

View File

@@ -3,7 +3,8 @@ import urllib
from datetime import time from datetime import time
from urllib.parse import urlparse from urllib.parse import urlparse
import ffmpegio import ffmpegio
from decord import AudioReader, cpu
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 OvercastDownload, XitterDownload, TiktokDownloadAll, \ from nostr_dvm.utils.scrapper.media_scrapper import OvercastDownload, XitterDownload, TiktokDownloadAll, \
@@ -43,8 +44,7 @@ def input_data_file_duration(event, dvm_config, client, start=0, end=0):
if filename == "" or filename is None: if filename == "" or filename is None:
return 0 return 0
try: try:
file_reader = AudioReader(filename, ctx=cpu(0), mono=False) duration = ffmpegio.probe.format_basic(filename)['duration']
duration = float(file_reader.duration())
except Exception as e: except Exception as e:
print(e) print(e)
return 0 return 0
@@ -76,8 +76,10 @@ def organize_input_media_data(input_value, input_type, start, end, dvm_config, c
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']
except Exception as e: except Exception as e:
print(e) print(e)
try: try:

View File

@@ -22,8 +22,7 @@ setup(
"pycryptodome==3.20.0", "pycryptodome==3.20.0",
"python-dotenv==1.0.0", "python-dotenv==1.0.0",
"emoji==2.8.0", "emoji==2.8.0",
"eva-decord==0.6.1", "ffmpegio==0.9.1",
"ffmpegio==0.8.5",
"lnurl", "lnurl",
"pandas==2.1.3", "pandas==2.1.3",
"Pillow==10.1.0", "Pillow==10.1.0",
@@ -34,7 +33,6 @@ setup(
"moviepy==2.0.0.dev2", "moviepy==2.0.0.dev2",
"zipp==3.17.0", "zipp==3.17.0",
"urllib3==2.1.0", "urllib3==2.1.0",
"typing_extensions>=4.9.0"
], ],
keywords=['nostr', 'nip90', 'dvm', 'data vending machine'], keywords=['nostr', 'nip90', 'dvm', 'data vending machine'],
url="https://github.com/believethehype/nostrdvm", url="https://github.com/believethehype/nostrdvm",

View File

@@ -18,6 +18,7 @@ from nostr_dvm.tasks.content_discovery_currently_popular_topic import DicoverCon
from nostr_dvm.tasks.discovery_trending_notes_nostrband import TrendingNotesNostrBand from nostr_dvm.tasks.discovery_trending_notes_nostrband import TrendingNotesNostrBand
from nostr_dvm.utils.admin_utils import AdminConfig from nostr_dvm.utils.admin_utils import AdminConfig
from nostr_dvm.utils.dvmconfig import build_default_config, DVMConfig from nostr_dvm.utils.dvmconfig import build_default_config, DVMConfig
from nostr_dvm.utils.mediasource_utils import organize_input_media_data
from nostr_dvm.utils.nip89_utils import create_amount_tag, NIP89Config, check_and_set_d_tag from nostr_dvm.utils.nip89_utils import create_amount_tag, NIP89Config, check_and_set_d_tag
from nostr_dvm.utils.nostr_utils import check_and_set_private_key from nostr_dvm.utils.nostr_utils import check_and_set_private_key
from nostr_dvm.utils.zap_utils import check_and_set_ln_bits_keys from nostr_dvm.utils.zap_utils import check_and_set_ln_bits_keys
@@ -46,7 +47,8 @@ AVOID_PAID_OUTBOX_RELAY_LIST = ["wss://nostrelay.yeghro.site", "wss://nostr.wine
"wss://relay.nostriches.org", "wss://happytavern.co", "wss://onlynotes.lol", "wss://offchain.pub", "wss://purplepag.es", "wss://relay.plebstr.com", "wss://relay.nostriches.org", "wss://happytavern.co", "wss://onlynotes.lol", "wss://offchain.pub", "wss://purplepag.es", "wss://relay.plebstr.com",
"wss://poster.place/relay", "wss://relayable.org", "wss://bbb.santos.lol", "wss://relay.bitheaven.social", "wss://theforest.nostr1.com", "wss://poster.place/relay", "wss://relayable.org", "wss://bbb.santos.lol", "wss://relay.bitheaven.social", "wss://theforest.nostr1.com",
"wss://relay.nostrati.com", "wss://purplerelay.com", "wss://hist.nostr.land", "wss://creatr.nostr.wine", "ws://localhost:4869", "wss://relay.nostrati.com", "wss://purplerelay.com", "wss://hist.nostr.land", "wss://creatr.nostr.wine", "ws://localhost:4869",
"wss://pyramid.fiatjaf.com", "wss://relay.nos.social", "wss://nostr.thank.eu", "wss://inbox.nostr.wine" "wss://pyramid.fiatjaf.com", "wss://relay.nos.social", "wss://nostr.thank.eu", "wss://inbox.nostr.wine", "wss://relay.pleb.to", "wss://welcome.nostr.wine",
"wss://relay.nostrview.com", "wss://nostr.land", "wss://eu.purplerelay.com", "wss://xmr.usenostr.org", "wss://relay.pleb.to", "wss://nostr-relay.app"
] ]
RECONCILE_DB_RELAY_LIST = ["wss://relay.damus.io", RECONCILE_DB_RELAY_LIST = ["wss://relay.damus.io",
@@ -366,6 +368,8 @@ def build_example_top_zapped(name, identifier, admin_config, options, image, cos
def playground(): def playground():
#DB Scheduler, do not announce, just use it to update the DB for the other DVMs. #DB Scheduler, do not announce, just use it to update the DB for the other DVMs.
admin_config_db_scheduler= AdminConfig() admin_config_db_scheduler= AdminConfig()
options_animal = { options_animal = {