Recherche avancée

Médias (1)

Mot : - Tags -/belgique

Autres articles (54)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (5686)

  • Discord music bot doesn't play songs

    9 octobre 2023, par Gam3rsCZ

    I have made myself a discord bot that also plays music(it's only for my server so strings with messages are in Czech, but code is in English).
Bot worked a while ago but now it stopped, and I don't know where the problem is

    


    I'm getting these errors : HTTP error 403 Forbidden Server returned 403 Forbidden (access denied) and
C :\Users\Me\AppData\Local\Programs\Python\Python311\Lib\site-packages\discord\player.py:711 : RuntimeWarning : coroutine 'music_cog.play_next' was never awaited
self.after(error)
RuntimeWarning : Enable tracemalloc to get the object allocation traceback
[2023-10-09 16:23:47] [INFO ] discord.player : ffmpeg process 17496 successfully terminated with return code of 1.
INFO : ffmpeg process 17496 successfully terminated with return code of 1.

    


    My code is :

    


    import discord
from discord.ext import commands
from yt_dlp import YoutubeDL

class music_cog(commands.Cog):
    def __init__(self, bot):
        self.bot = bot

        self.is_playing = False
        self.is_paused = False
        self.current = ""

        self.music_queue = []
        self.YDL_OPTIONS = {"format": "m4a/bestaudio/best", "noplaylist": "True"}
        self.FFMPEG_OPTIONS = {"before_options": "-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5", "options": "-vn"}

        self.vc = None

    def search_yt(self, item):
        with YoutubeDL(self.YDL_OPTIONS) as ydl:
            try:
                info = ydl.extract_info("ytsearch:%s" % item, download=False)["entries"][0]
            except Exception:
                return False
        info = ydl.sanitize_info(info)
        url = info['url']
        title = info['title']
        return {'title': title, 'source': url}

    async def play_next(self):
        if len(self.music_queue) > 0:
            self.is_playing = True
            self.current = self.music_queue[0][0]["title"]
            m_url = self.music_queue[0][0]["source"]

            self.music_queue.pop(0)

            await self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e:  self.play_next())
        else:
            self.is_playing = False

    async def play_music(self, ctx):
        try:
            if len(self.music_queue) > 0:
                self.is_playing = True
                m_url = self.music_queue[0][0]["source"]

                if self.vc == None or not self.vc.is_connected():
                    self.vc =  await self.music_queue[0][1].connect()

                    if self.vc == None:
                        await ctx.send("Nepodařilo se připojit do hlasového kanálu.")
                        return
                else:
                    await self.vc.move_to(self.music_queue[0][1])

                self.current = self.music_queue[0][0]["title"]
                self.music_queue.pop(0)

                self.vc.play(discord.FFmpegPCMAudio(m_url, **self.FFMPEG_OPTIONS), after=lambda e: self.play_next())
            else:
                self.is_playing = False

        except:
            print("Something went wrong")
            await ctx.send(content="Něco se pokazilo")

    @commands.command(name="play", help="Plays selected song from YouTube")
    async def play(self, ctx, *args):
        query = " ".join(args)

        voice_channel = ctx.author.voice.channel
        if voice_channel is None:
            await ctx.send("Připojte se do hlasového kanálu!")
        elif self.is_paused:
            self.vc.resume()
        else:
            song = self.search_yt(query)
            if type(song) == type(True):
                await ctx.send("Písničku se nepodařilo stáhnout. Špatný formát, možná jste se pokusili zadat playlist nebo livestream.")
            else:
                await ctx.send("Písnička přidána do řady.")
                self.music_queue.append([song, voice_channel])

                if self.is_playing == False:
                    await self.play_music(ctx)
                    self.is_playing = True

    @commands.command(name="pause", aliases=["p"], help="Pauses the BOT")
    async def pause(self, ctx, *args):
        if self.is_playing:
            self.is_playing = False
            self.is_paused = True
            self.vc.pause()
            await ctx.send(content="Písnička byla pozastavena.")
            
        elif self.is_paused:
            self.is_playing = True
            self.is_paused = False
            self.vc.resume()
            await ctx.send(content="Písnička byla obnovena.")

    @commands.command(name="resume", aliases=["r"], help="Resumes playing")
    async def resume(self, ctx, *args):
        if self.is_paused:
            self.is_paused = False
            self.is_playing = True
            self.vc.resume()
            await ctx.send(content="Písnička byla obnovena.")

    @commands.command(name="skip", aliases=["s"], help="Skips current song")
    async def skip(self, ctx, *args):
        if self.vc != None and self.vc:
            self.vc.stop()
        await self.play_next()
        await ctx.send(content="Písnička byla přeskočena.")

    @commands.command(name="queue", aliases=["q"], help="Displays song queue")
    async def queue(self, ctx, songs=5):
        retval = ""

        for i in range(0, len(self.music_queue)):
            if i > songs: break
            retval += "    " + self.music_queue[i][0]["title"] + "\n"

        if retval != "":
            retval += "```"
            await ctx.send(content=("```Aktuální fronta:\n" + retval))
        else:
            await ctx.send("Řada je prázdná.")

    @commands.command(name="clear", help="Clears the queue")
    async def clear(self, ctx):
        if self.vc != None and self.is_playing:
            self.vc.stop()
        self.music_queue = []
        await ctx.send("Řada byla vymazána.")

    @commands.command(name="leave", aliases=["dc", "disconnect"], help="Disconnects the BOT")
    async def leave(self, ctx):
        self.is_playing = False
        self.is_paused = False

        if self.vc != None:
            return await self.vc.disconnect(), await ctx.send(content="BOT byl odpojen.")

        else:
            return await ctx.send("BOT není nikde připojen.")
   
    @commands.command(name="current", help="Displays the current song")
    async def current(self, ctx):
        current = self.current
        retval = f"```Právě hraje:\n    {current}```"
        if current != "":
            await ctx.send(retval)
        else:
            await ctx.send("Aktuálně nic nehraje.")


    


    I already tried everything I can think of(which isn't a lot because I suck at programming), and also tried searching for some solution on the internet, but nothing worked.

    


  • Skipping extractors execution since zero extractors were registered (Use `node —trace-warnings ...` to show where the warning was created)

    28 septembre 2023, par Parkster00

    I'm following a Discord Music Bot tutorial that uses ffmpeg, here is index.js

    


    require("dotenv").config();

const { REST } = require("@discordjs/rest");
const { Routes } = require("discord-api-types/v9");
const { Client, Collection, Intents } = require('discord.js');
const { Player } = require("discord-player");

const fs = require("node:fs");
const path = require("node:path");

const client = new Client({
    intents: ["Guilds", "GuildMessages", "GuildVoiceStates"]
});

// Set up our commands into an array
const commands = [];
client.commands = new Collection();

const commandsPath = path.join(__dirname, "commands");
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith(".js"));

for (const file of commandFiles) {
    console.log(`${file}`)
    console.log(`${commandsPath}`)
    const filePath = path.join(commandsPath, file);
    console.log(`${filePath}`)
    const command = require(filePath);

    client.commands.set(command.data.name, command);
    commands.push(command.data.toJSON());
}

// Create the player, highest quality audio
client.player = new Player(client, {
    ytdlOptions: {
        quality: "highestaudio",
        highWaterMark: 1 << 25
    }
});

// Commands are registered
client.on("ready", () => {
    const guild_ids = client.guilds.cache.map(guild => guild.id);

    const rest = new REST({ version: "9" }).setToken(process.env.TOKEN);
    for (const guildId of guild_ids) {
        rest.put(Routes.applicationGuildCommands(process.env.CLIENT_ID, guildId), {
            body: commands
        })
            .then(() => console.log(`Added commands to ${guildId}`))
            .catch(console.error);
    }

});

client.on("interactionCreate", async interaction => {
    if (!interaction.isCommand()) return;

    const command = client.commands.get(interaction.commandName);
    if (!command) return;

    try {
        await command.execute({ client, interaction });
    }
    catch (err) {
        console.error(err);
        await interaction.reply("An error occured while executing that command.");
    }
});

console.log(process.env.TOKEN);
client.login(process.env.TOKEN);


    


    And here is play.js where I think the error originates :

    


    const { SlashCommandBuilder } = require("@discordjs/builders");
const { EmbedBuilder } = require("discord.js");
const { QueryType } = require('discord-player');


module.exports = {
    data: new SlashCommandBuilder()
        .setName("play")
        .setDescription("Plays a song.")
        .addSubcommand(subcommand => {
            return subcommand
                .setName("search")
                .setDescription("Searches for a song.")
                .addStringOption(option => {
                    return option
                        .setName("searchterms")
                        .setDescription("search keywords")
                        .setRequired(true);
                })
        })
        .addSubcommand(subcommand => {
            return subcommand
                .setName("playlist")
                .setDescription("Plays playlist from YT")
                .addStringOption(option => {
                    return option
                        .setName("url")
                        .setDescription("playlist url")
                        .setRequired(true);

                })
        })
        .addSubcommand(subcommand => {
            return subcommand
                .setName("song")
                .setDescription("Plays song from YT")
                .addStringOption(option => {
                    return option
                        .setName("url")
                        .setDescription("url of song")
                        .setRequired(true);

                })
        }),
    execute: async ({ client, interaction }) => {

        if (!interaction.member.voice.channel) {
            await interaction.reply("You must be in a voice channel to use this command.");
            return;
        }

        const queue = await client.player.nodes.create(interaction.guild);

        if (!queue.connection) await queue.connect(interaction.member.voice.channel)

        let embed = new EmbedBuilder();
        if (interaction.options.getSubcommand() === "song") {
            let url = interaction.options.getString('url');

            const result = await client.player.search(url, {
                requestedBy: interaction.user,
                searchEngine: QueryType.YOUTUBE_VIDEO
            });

            console.log(result.tracks);

            if (result.tracks.length === 0) {
                await interaction.reply("no results found");
                return
            }

            const song = result.tracks[0];
            await queue.addTrack(song);

            embed
                .setDescription(`Added **[${song.title}](${song.url})** to the queue.`)
                .setThumbnail(song.thumbnail)
                .setFooter({ text: `Duration: ${song.duration}` });
        }

        else if (interaction.options.getSubcommand() === "playlist") {
            let url = interaction.options.getString('url');

            const result = await client.player.search(url, {
                requestedBy: interaction.SlashCommandBuilder,
                searchEngine: QueryType.YOUTUBE_PLAYLIST,
            });

            if (result.tracks.length === 0) {
                await interaction.reply("no playlist found");
                return
            }

            const playlist = result.playlist;
            await queue.addTracks(playlist);

            embed
                .setDescription(`Added **[${playlist.title}](${playlist.url})** to the queue.`)
                .setThumbnail(playlist.thumbnail)
                .setFooter({ text: `Duration: ${playlist.duration}` });
        }

        else if (interaction.options.getSubcommand() === "search") {
            let url = interaction.options.getString('searchterms');

            const result = await client.player.search(url, {
                requestedBy: interaction.SlashCommandBuilder,
                searchEngine: QueryType.AUTO,
            });

            if (result.tracks.length === 0) {
                await interaction.reply("no results found");
                return
            }

            const song = result.tracks[0]
            await queue.addTrack(song);

            embed
                .setDescription(`Added **[${song.title}](${song.url})** to the queue.`)
                .setThumbnail(song.thumbnail)
                .setFooter({ text: `Duration: ${song.duration}` });
        }

        if (!queue.playing) await queue.play();

        await interaction.reply({
            embeds: [embed]
        })
    }
}


    


    Is ffmpeg called differently now ? Am I doing something wrong ?

    


    I've tried different installs of Ffmpeg and none seem to work, so I'd imagine it originates somewhere in my code.

    


  • Distribute app with Developer ID with Hardened Runtime and 3rd party CLI-executable - Code sign Error

    22 août 2023, par soundflix

    While I tried to distribute my app with Developer ID from Xcode Organizer, I got this error :

    


    


    Hardened Runtime is not enabled.

    


    "ffmpeg" must be rebuilt with support for the Hardened Runtime. Enable the Hardened Runtime capability in the project editor, test your app, rebuild your archive, and upload again.

    


    


    enter image description here

    


    Hardened Runtime is enabled in Project > Signing & Capabilites.

    


    My app has the FFmpeg CLI tool in its Resources folder.

    


    Since FFmpeg is a compiled binary, I have no option to enable Hardened Runtime.

    


    How can I solve this and have my app properly code signed ?