
Recherche avancée
Médias (2)
-
SPIP - plugins - embed code - Exemple
2 septembre 2013, par
Mis à jour : Septembre 2013
Langue : français
Type : Image
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (111)
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...)
Sur d’autres sites (5317)
-
avcodec/indeo3data : fix undefined left shift of negative number
19 septembre 2015, par Ganesh Ajjanagaddeavcodec/indeo3data : fix undefined left shift of negative number
This fixes a whole sea of -Wshift-negative-value reported with clang 3.7+, e.g
http://fate.ffmpeg.org/log.cgi?time=20150918181527&log=compile&slot=x86_64-darwin-clang-polly-vectorize-stripmine-3.7.
Any half decent compiler should anyway optimize away the multiplication.Signed-off-by : Ganesh Ajjanagadde <gajjanagadde@gmail.com>
Signed-off-by : James Almer <jamrial@gmail.com> -
How to create a queue system with a discord.py bot
20 août 2024, par ZamvI'm trying to create a bot with discord.py.


Also, I'm a beginner, so I'll be interested in what I can improve and any errors there are.


I've been stuck on trying to create this queue system for songs, the bot was working perfectly fine and played some urls before I implemented the play_next function. Now it doesn't even play the first song, even if it sends confirmation messages both in the terminal that in the discord channel. I know that the code might be a little confusing.


I wrote two main functions : "play_next" to play the next song in the queue and "play", the main command. Here is my play_next function :


async def play_next(self,ctx):
 if not ctx.voice_client.is_playing: #(don't know if this is correct as I also check if the bot isn't playing anything in the play function)
 
 if self.song.queue: 
 next_song = self.song_queue.pop(0) #deleting the first element of the queue, so if we have (song_0, song_1 and song_2) the bot should delete (song_0) making in fact song_1 the "next" song_0
 try:
 ctx.voice_client.play(discord.FFmpegPCMAudio(next_song), 
 after=lambda e: self.bot.loop.create_task(self.play_next(ctx))) #Not gonna lie here, i asked chat gpt for this line, it should make the bot automatically play the next song one after another, correct me if I am wrong

#this is not important
 embed = discord.Embed(
 title="Song",
 description=f"Now playing {next_song}",
 color = 0x1DB954
 )
 await ctx.send(embed=embed)
 except Exception as e:
 print(f"Error playing the next song: {e}")

 else:
 await ctx.voice_client.disconnect() # disconnecting from the voice channel if the queue is empty
 print("Disconnected from the voice channel as the queue is empty.")



I think that the main problem of my bot is the play_next function, but here it is my "play" function :


@commands.command(pass_context=True)
 async def play(self, ctx, url: str): 
 if ctx.author.voice: # first checking if the user is in a voice channel
 if not ctx.voice_client: #then checking if the bot is already connected to a voice channel
 channel = ctx.message.author.voice.channel 
 try:
 await channel.connect() #then joining
 print("I joined the voice channel!")
 except Exception as e:
 print(f"Failed to connect to the voice channel: {e}")
 return

 song_path = f"song_{self.song_index}.mp3" #note, im using cogs, i declared self.song_index with the value of 0 
 self.song_index += 1 #i thought that this was the easiest way of creating a new file for each song

 ydl_opts = {
 'format': 'bestaudio/best',
 'postprocesors': [{
 'key': 'FFmpegExtractAudio',
 'preferredcodec': 'mp3',
 'preferredquality': '192',
 }],
 'outtmpl': song_path
 }
 try:
 with youtube_dl.YoutubeDL(ydl_opts) as ydl:
 print("Starting download...")
 ydl.download([url]) #this is where it should download the song provided by the url
 print("Download finished.")
 except Exception as e:
 await ctx.send(f"Failed to download the song: {e}")
 return

#i think that the next two if statements are the main threats
 if os.path.exists(song_path): #if there is atleast 1 song in the queue
 self.song_queue.append(song_path) #append the next one
 embed = discord.Embed(
 title="Added to Queue!",
 description = f"{url} has been added to the queue.",
 color=0x33ff33
 )
 await ctx.send(embed=embed)


 if not ctx.voice_client.is_playing(): #checking if the bot is already playing something, don't know if i should put this if statement here
 print("Starting playback...")
 await self.play_next(ctx) #if nothing is playing, then the bot should play the next song



 else:
 await ctx.send("Failed to download or find the audio file.")

 else:
 embed = discord.Embed(
 title="❌You must be in a voice channel",
 color=0xff6666
 )
 await ctx.send(embed=embed)



-
Flutter : Failed assertion : 'file.absolute.existsSync()' : is not true
11 août 2022, par whatwhatwhatIn my app, a user can send a file to others in a group chat. First, the user records some audio using their mic. The file is then touched up using FFMPEG. Then, the file is uploaded to Firebase Cloud Storage and if this is successful, a record is written in Firebase Realtime Database.


I'm getting the error below when the user records a long audio file and then presses submit. It almost seems as though FFMPEG hasn't finished processing the file...but I thought I used my async/await correctly to make sure that this processing is finished before moving on ?




##MyAppFile## saveMyAppFileToCloudStorage Error : 'package:firebase_storage/src/reference.dart' : Failed assertion : line 127 pos 12 : 'file.absolute.existsSync()' : is not true.




Psuedo-code :


- 

- User records audio
- Audio file is processed using FFMPEG and the new processed file is created on the user's phone
- User hits submit, uploading the file to Cloud Storage and, if successful, writing a record to Realtime Database








Order of Functions After User Hits Submit :


- 

- msgInput.dart -> sendMyAppFile()
- msgInput.dart -> prepareMyAppFileForSending()
- msgInput.dart -> runFFMPEGHighLow()
- message_dao.dart -> sendMyAppFile()
- message_dao.dart -> saveMyAppFileToCloudStorage() //ERROR COMES FROM THIS FUNCTION












The Code :


//msgInput.dart
Future<void> sendMyAppFile() async {
 if (sendableMyAppFileExists == 1) {
 final MyAppFileReadyToBeSent = await prepareMyAppFileForSending();

 if (MyAppFileReadyToBeSent == '1') {
 messageDao.sendMyAppFile(MyAppFile, filepath, filename); 
 } else {
 
 }
 }

 setState(() {
 sendableMyAppFileExists = 0;
 });
 }
 
 Future<string> prepareMyAppFileForSending() async {
 if (sendableMyAppFileExists == 1) {
 if (recordedMyAppFileFilterID == '1') {

 await runFFMPEGHighLow('1'); 

 return '1';
 }

 if (recordedMyAppFileFilterID == '2') {

 await runFFMPEGHighLow('2'); 

 return '1';
 }
 }

 return '0';
 }
 
 Future<void> runFFMPEGHighLow(String filterID) async { 
 if (filterID != '1' && filterID != '2') {
 return;
 }

 if (sendableMyAppFileExists == 1) {
 if (filterID == '1') {

 await FFmpegKit.executeAsync(/*...parms...*/);
 setState(() {
 currentMyAppFileFilename = currentMyAppFileFilename + '1.mp3'; 
 });

 }

 if (filterID == '2') {

 await FFmpegKit.executeAsync(/*...parms...*/);
 setState(() {
 currentMyAppFileFilename = currentMyAppFileFilename + '2.mp3';
 });

 }
 }
 }
 
//message_dao.dart
void sendMyAppFile(ChatData MyAppFile, String filepath, String filename) {
 saveMyAppFileToCloudStorage(filepath, filename).then((value) {
 if (value == true) {
 saveMyAppFileToRTDB(MyAppFile);
 }
 });
 }
 
Future<bool> saveMyAppFileToCloudStorage(String filepath, String filename) async {
 //filepath: /data/user/0/com.example.MyApp/app_flutter/MyApp/MyAppAudioFiles/MyAppFiles/2d7af6ae-6361-4be5-8209-8498dd17d77d1.mp3
 //filename: 2d7af6ae-6361-4be5-8209-8498dd17d77d1.mp3

 _firebaseStoragePath = MyAppFileStorageDir + filename;
 
 File file = File(filepath);

 try {
 await _firebaseStorage
 .ref(_firebaseStoragePath)
 .putFile(file);
 return true;
 } catch (e) {
 print('##MyAppFile## saveMyAppFileToCloudStorage Error: ' + e.toString()); //ERROR COMES FROM THIS LINE
 return false;
 }
 return true;
 }
</bool></void></string></void>