Posts by Richter
-
-
Just for your information from someone who doesn't know how to write code. I tried everything with no success until I asked ChatGPT: "what is the autoexec.py's content when I want to play a whole folder of mp3s?"
It gave me this with is the solution I've been looking for since the update:
If you want to play a whole folder of MP3 files using an
autoexec.py
script in Kodi, you can use the following example as a starting point:Code
Display MorepythonCopy code import xbmc import xbmcgui import os # Path to the folder containing MP3 files folder_path = "/storage/.kodi/media/MyMusicFolder" # Get a list of all files in the folder mp3_files = [f for f in os.listdir(folder_path) if f.endswith(".mp3")] # Create a playlist playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC) # Add each MP3 file to the playlist for mp3_file in mp3_files: media_path = os.path.join(folder_path, mp3_file) playlist.add(media_path) # Play the playlist xbmc.Player().play(playlist)
In this example:
- Replace
"/storage/.kodi/media/MyMusicFolder"
with the actual path to the folder containing your MP3 files. - The script uses the
os.listdir
function to get a list of all files in the specified folder that have the.mp3
extension. - It then creates a playlist using
xbmc.PlayList(xbmc.PLAYLIST_MUSIC)
and adds each MP3 file to the playlist using theadd
method. - Finally, it uses
xbmc.Player().play(playlist)
to play the playlist.
- Replace
-
Thank you, Mario77. Service.autoexec works fine, indeed. The problem is that all of the sudden, the ,isdir parameter isn't recognized anymore, I can only address files, no folders anymore. Anyone knows about a syntax change? Thanks!
-
Hello everyone.
It is very important to me that my three Libreelec machines start playing music upon startup. With an earlier version, this worked with an autoexec.py located in /storage/.kodi/userdata.
When immigrating to Matrix, I had to install an addon called "service.autoexec" with an autoexec.py in its folder. So far, so unnecessarily complicated.
Yes, I have been warned that some things won't work when automatically upgrading to Nexus, but that doesn't help much right now as there seem to be no viable solution to simply start playing some MP3 folder upon startup?
Does anyone know how I can do this in Nexus? That would be very, very much appreciated.
-
Thank you very much for the command and the explanation. Since there are no AFP services running on the Synology box, it might be more tricky. I think I'm going to try UPNP before I dive into why Synology is creating these folders.
-
Hello everyone! Maybe someone can help me with this apparently paradox situation:
2 identical 4GB Pis running the latest Matrix to play MP3s from a Synology NAS via NFS
Random play from the start via autoexec.py in the autoexec service
Identical source file, identical command in the keymap file gen.xml:
<key id="200">PlayMedia(nfs://192.168.178.50/volumeUSB1/usbshare/Musik/!Mix,isdir,1)</key>
Synology creates “@eadir” entries in each folder, visible when accessing with NFS.
When I hit the id=200 key, one of my Pis begins playing a random MP3 from the !Mix folder, as it should, the other complains that the first entry in the folder, @eadir cannot be played.
Thank you for your time reading this – any help will be appreciated!