
Recherche avancée
Autres articles (68)
-
Le profil des utilisateurs
12 avril 2011, parChaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...) -
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
XMP PHP
13 mai 2011, parDixit Wikipedia, XMP signifie :
Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)
Sur d’autres sites (5558)
-
Command raised an exception : NameError : name 'player' is not defined
20 mars 2023, par baartysI finally got myself a hosting for my project, but got into an error and I don't know how to resolve it.
I ran command !play to start streaming in vc, but I got this error :


2023-03-19 18:36:04 INFO discord.client logging in using static token
2023-03-19 18:36:04 INFO discord.gateway Shard ID None has connected to Gateway (Session ID: f983009c9f2881b87ee119278692efc9).
Eurobeat Radio is running!
2023-03-19 18:36:10 ERROR discord.ext.commands.bot Ignoring exception in command play
Traceback (most recent call last):
 File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 229, in wrapped
 ret = await coro(*args, **kwargs)
 File "/home/container/radio.py", line 44, in play
 player.play(FFmpegPCMAudio('http://stream.eurobeat.xyz'))
NameError: name 'player' is not defined
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
 File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
 await ctx.command.invoke(ctx)
 File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1023, in invoke
 await injected(*ctx.args, **ctx.kwargs) # type: ignore
 File "/home/container/.local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 238, in wrapped
 raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: NameError: name 'player' is not defined



I tried running it on my pc and that was without error, but once it was on the hosting it ran in to the error up the page.


Here is the code :


import discord
import urllib.request, json 
from discord import FFmpegPCMAudio
from discord.ext import commands
from discord.ext import tasks
client= commands.Bot(command_prefix="er!", intents=discord.Intents.all(), help_command=None)

@tasks.loop(seconds=10.0)
async def my_background_task():
 """Will loop every 60 seconds and change the bots presence"""
 with urllib.request.urlopen('https://api.laut.fm/station/eurobeat/current_song') as url:
 data = json.load(url)
 global namestatus
 global artiststatus
 namestatus = data['title']
 artiststatus = data['artist']['name']
 await client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name="Eurobeat FM"))
 await client.change_presence(activity=discord.Game(name="Para para dancing ~"))
 await client.change_presence(activity=discord.Activity(type=discord.ActivityType.listening, name=f"{namestatus} by {artiststatus}"))


@client.event
async def on_ready():
 print('Eurobeat Radio is running!')
 await client.wait_until_ready()
 my_background_task.start()


@client.event
async def on_voice_state_update(member, prev, cur):
 if client.user in prev.channel.members and len([m for m in prev.channel.members if not m.bot]) == 0:
 channel = discord.utils.get(client.voice_clients, channel=prev.channel)
 await channel.disconnect()

@client.command(aliases=['p', 'pla', 'join', 'j'])
async def play(ctx, url: str = 'http://stream.eurobeat.xyz'): 
 channel = ctx.message.author.voice.channel
 global player
 try:
 player = await channel.connect()
 except:
 pass
 player.play(FFmpegPCMAudio('http://stream.eurobeat.xyz'))
 embedVar = discord.Embed(title="Started Playing!", color=discord.Color.random())
 await ctx.send(embed=embedVar)



Would be very grateful for your help !


-
AttributeError : 'FFmpegAudio' object has no attribute '_process' while trying to play audio from URL
13 août 2022, par jmcamacho7I can't find any solution online and I don't know what's wrong.


My code is : (Not pasting the URL getting since that works fine)


from urllib import parse, request
import re
import pafy
from discord import FFmpegPCMAudio, PCMVolumeTransformer

FFMPEG_OPTIONS = {
 'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'
}

@bot.command(pass_context=True)
async def play(ctx, * , search):
 query_string = parse.urlencode({'search_query': search})
 html_content = request.urlopen('http://www.youtube.com/results?' + query_string)
 search_results=re.findall('watch\?v=(.{11})',html_content.read().decode('utf-8'))
 print(search_results[0])
 
 if(ctx.author.voice):
 channel = ctx.message.author.voice.channel
 await ctx.send("https://www.youtube.com/watch?v="+search_results[0]) 
 url = "https://www.youtube.com/watch?v="+search_results[0]
 conn = await channel.connect()
 conn.play(discord.FFmpegAudio(url, **FFMPEG_OPTIONS))
 else:
 await ctx.send("Necesitas estar en un canal de audio para usar este comando")



It just gives me this error everytime I try it :


Traceback (most recent call last):
 File "/home/runner/HakuBot/venv/lib/python3.8/site-packages/discord/player.py", line 103, in __del__
 self.cleanup()
 File "/home/runner/HakuBot/venv/lib/python3.8/site-packages/discord/player.py", line 154, in cleanup
 proc = self._process
AttributeError: 'FFmpegAudio' object has no attribute '_process'



Anyway to solve this ?


-
Anomalie #4831 (Nouveau) : URLs arbo non mise à jour au changement de rubrique
23 juin 2021, par Julien TessierEtapes pour reproduire :¶
- Utiliser les URL arbos
- Créer un article "Lorem ipsum" dans la rubrique 1
- Publier l’article, son URL est /rubrique-1/lorem-ipsum
- Créer un article "Lorem ipsum" dans la rubrique 2
- Proposer l’article à la publication, son URL est /rubrique-2/lorem-ipsum
- Déplacer l’article dans la rubrique 1
- SPIP génère une erreur dans les logs :
2021-06-23 11:32:54 127.0.0.1 (pid 498) :Pri:ERREUR : Erreur 1062 de mysql : Duplicate entry ’1-lorem-ipsum’ for key ’PRIMARY’ in .../plugins-dist/urls_etendues/action/editer_url.php L155 [sql_insertq(),url_insert(),declarer_url_arbo(),_generer_url_arbo(),urls_arbo_dist(),generer_url_entite(),html_af5c93b1e9d12543df40c819344ffc73(),public_parametrer_dist(),public_produire_page_dist(),inclure_page(),evaluer_fond(),recuperer_fond(),urls_afficher_fiche_objet(),minipipe(),execute_pipeline_afficher_fiche_objet(),pipeline(),f_afficher_blocs_ecrire(),f_recuperer_fond(),minipipe(),execute_pipeline_recuperer_fond(),pipeline(),recuperer_fond(),traiter_appels_inclusions_ajax()]
- Publier l’article
- L’URL du nouvel article est inchangée donc il est inaccessible (= son URL a déjà été "prise" par un autre)
Comportement attendu¶
Au changement de rubrique, URL arbos regénère une URL unique (avec l’ID donc).
Résolution temporaire¶
J’ai réglé ça de la manière suivante, via un plugin et la pipeline post_edition :
- <span class="CodeRay"><span class="keyword">function</span> <span class="function">plugin_post_edition</span>(<span class="local-variable">$e</span>) {
- <span class="keyword">switch</span> (objet_type(<span class="local-variable">$e</span>[<span class="string"><span class="delimiter">'</span><span class="content">args</span><span class="delimiter">'</span></span>][<span class="string"><span class="delimiter">'</span><span class="content">table</span><span class="delimiter">'</span></span>])) {
- <span class="keyword">case</span> <span class="string"><span class="delimiter">'</span><span class="content">article</span><span class="delimiter">'</span></span>;
- <span class="keyword">if</span> (!<span class="predefined">empty</span>(<span class="local-variable">$e</span>[<span class="string"><span class="delimiter">'</span><span class="content">data</span><span class="delimiter">'</span></span>][<span class="string"><span class="delimiter">'</span><span class="content">id_rubrique</span><span class="delimiter">'</span></span>])) {
- <span class="local-variable">$id_rubrique</span> = <span class="predefined">intval</span>(<span class="local-variable">$e</span>[<span class="string"><span class="delimiter">'</span><span class="content">data</span><span class="delimiter">'</span></span>][<span class="string"><span class="delimiter">'</span><span class="content">id_rubrique</span><span class="delimiter">'</span></span>]);
- <span class="local-variable">$id_article</span> = <span class="predefined">intval</span>(<span class="local-variable">$e</span>[<span class="string"><span class="delimiter">'</span><span class="content">args</span><span class="delimiter">'</span></span>][<span class="string"><span class="delimiter">'</span><span class="content">id_objet</span><span class="delimiter">'</span></span>]);
- <span class="keyword">if</span> (<span class="local-variable">$url</span> = sql_fetsel(<span class="string"><span class="delimiter">'</span><span class="content">url</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">spip_urls</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">"</span><span class="content">type = 'article' AND id_objet = </span><span class="local-variable">$id_article</span><span class="delimiter">"</span></span>, <span class="string"><span class="delimiter">'</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">perma DESC, date DESC</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">'</span><span class="content">1</span><span class="delimiter">'</span></span>)) {
- <span class="local-variable">$url</span> = <span class="local-variable">$url</span>[<span class="string"><span class="delimiter">'</span><span class="content">url</span><span class="delimiter">'</span></span>];
- <span class="keyword">if</span> (sql_countsel(<span class="string"><span class="delimiter">'</span><span class="content">spip_urls</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">"</span><span class="content">url = </span><span class="delimiter">"</span></span>.sql_quote(<span class="local-variable">$url</span>).<span class="string"><span class="delimiter">"</span><span class="content"> AND type = 'article' AND id_parent = </span><span class="local-variable">$id_rubrique</span><span class="content"> AND id_objet != </span><span class="local-variable">$id_article</span><span class="delimiter">"</span></span>)) {
- sql_delete(<span class="string"><span class="delimiter">'</span><span class="content">spip_urls</span><span class="delimiter">'</span></span>, <span class="string"><span class="delimiter">"</span><span class="content">type = 'article' AND id_objet = </span><span class="local-variable">$id_article</span><span class="content"> AND url = </span><span class="delimiter">"</span></span>.sql_quote(<span class="local-variable">$url</span>));
- }
- }
- }
- <span class="keyword">break</span>;
- <span class="keyword">default</span>:
- <span class="keyword">break</span>;
- }
- <span class="keyword">return</span> <span class="local-variable">$e</span>;
- }
- </span>
Ce n’est peut être pas élégant mais ça marche en attendant un fix :)