RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Music, Video, Photo & Comic Support (Submission)

    Scheduled Pinned Locked Moved Ideas and Development
    musicmusic playervideosrun commandessystems.cfg
    6 Posts 3 Posters 1.2k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      Rydo
      last edited by Rydo

      Updated to v2.0 adding photo and comic support

      This is a working setup to allow music and video supported by omxplayer and images supported by fbi to be selected and played, along with runcommand and joy2key integration. Note that this is not like other scripts I've seen that are designed to loop music in the background of emulation station.

      Directions:
      create folder "/home/pi/RetroPie/roms/music" and put .mp3 or .flac files there or in a subsequent subdirectory

      create folder "/home/pi/RetroPie/roms/video" and put .mkv .mp4 or .m4v files there or in a subsequent subdirectory

      create folder "/home/pi/RetroPie/roms/photos" and put .PhotoCD .jpeg .jpg .ppm .gif .tiff .xwd .bmp .png .webp files there or in a subsequent subdirectory

      create folder "/home/pi/RetroPie/roms/comics" and put .zip .cbr .cbz .cb7 .cbt .cba archives that contain .PhotoCD .jpeg .jpg .ppm .gif .tiff .xwd .bmp .png .webp ​files there or in a subsequent subdirectory

      add code to /etc/emulationstation/es_systems.cfg

        <system>
          <name> music</name>
          <fullname>Music</fullname>
          <path>/home/pi/RetroPie/roms/music</path>
          <extension>.sh .mp3 .flac</extension>
          <command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ music %ROM%</command>
          <platform>ignore</platform>
          <theme>music</theme>
        </system>
        <system>
          <name> video</name>
          <fullname>Video</fullname>
          <path>/home/pi/RetroPie/roms/video</path>
          <extension>.sh .mkv .mp4 .m4v</extension>
          <command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ video %ROM%</command>
          <platform>ignore</platform>
          <theme>video</theme>
        </system>
        <system> 
          <name> photos</name>
          <fullname>Photos</fullname>
          <path>/home/pi/RetroPie/roms/photos</path>
          <extension>.sh .PhotoCD .jpeg .jpg .ppm .gif .tiff .xwd .bmp .png .webp</extension>       
          <command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ photos %ROM%</command>
          <platform>ignore</platform>
          <theme>photos</theme>
        </system>
        <system>
          <name> comics</name>
          <fullname>Comics</fullname>
          <path>/home/pi/RetroPie/roms/comics</path>
          <extension>.sh .zip .cbr .cbz .cb7 .cbt .cba</extension> 
          <command>/opt/retropie/supplementary/runcommand/runcommand.sh 0 _SYS_ comics %ROM%</command>
          <platform>ignore</platform
          <theme>comics</theme>
        </system>
      

      create folder /opt/retropie/configs/music
      create folder /opt/retropie/configs/video
      create folder /opt/retropie/configs/photos
      create folder /opt/retropie/configs/comics

      create file with linux executable permission (sudo chmod +x) /opt/retropie/configs/music/background.sh

      sudo killall omxplayer.bin
      /usr/bin/omxplayer "$1" &
      

      create file with linux executable permission (sudo chmod +x) /opt/retropie/configs/music/foreground.sh

      sudo killall omxplayer.bin
      /opt/retropie/configs/music/joy2key.sh &
      /usr/bin/omxplayer -r "$1"
      sudo killall joy2key.py
      

      create file with linux executable permission (sudo chmod +x) /opt/retropie/configs/music/joy2key.sh

      /opt/retropie/supplementary/runcommand/joy2key.py /dev/input/jsX 0x3C 0x3E 0x2B 0x2D 0x70 0x71 0x69 0x6F
      

      create file with /opt/retropie/configs/music/emulators.cfg

      default = "background"
      background = "/opt/retropie/configs/music/background.sh %ROM%"
      foreground = "/opt/retropie/configs/music/foreground.sh %ROM%"
      

      create file with /opt/retropie/configs/video/emulators.cfg

      default = "foreground"
      background = "/opt/retropie/configs/music/background.sh %ROM%"
      foreground = "/opt/retropie/configs/music/foreground.sh %ROM%"
      

      create file with linux executable permission (sudo chmod +x) /opt/retropie/configs/photos/foreground.sh

      /opt/retropie/configs/photos/joy2key.sh &
      /usr/bin/fbi -a --noverbose "$1"
      sudo killall joy2key.py
      

      create file with linux executable permission (sudo chmod +x) /opt/retropie/configs/photos/joy2key.sh

      /opt/retropie/supplementary/runcommand/joy2key.py /dev/input/jsX 0x4A 0x20 0x2B 0x2D 0x50 0x51 0x48 0x49
      

      create file with /opt/retropie/configs/photos/emulators.cfg

      default = "foreground"
      foreground = "/opt/retropie/configs/photos/foreground.sh %ROM%"
      

      create file with linux executable permission (sudo chmod +x) /opt/retropie/configs/photos/foreground.sh

      /opt/retropie/configs/photos/joy2key.sh &
      base=/tmp/comics
      mkdir $base
      /bin/tar -xf "$1" -C $base
      find $base -iname *.PhotoCD -or -iname *.jpeg -or -iname *.jpg -or -iname *.ppm -or -iname *.gif -or -iname *.tiff -or -iname *.xwd -or -iname *.bmp -or -iname *.png -or -iname *.webp > $base/Slideshow.list
      /usr/bin/fbi -a -P --noverbose --fitwidth -l $base/Slideshow.list
      rm -r $base
      sudo killall joy2key.py
      

      create file with /opt/retropie/configs/comics/emulators.cfg

      default = "foreground"
      foreground = "/opt/retropie/configs/comics/foreground.sh %ROM%"
      

      create file with linux executable permission (sudo chmod +x) /home/pi/RetroPie/roms/photos/+Start Random Slideshow.sh

      /opt/retropie/configs/photos/joy2key.sh &
      base=/home/pi/RetroPie/roms/photos
      if [ ! -f $base/Slideshow.list ]; then
        find $base -iname *.PhotoCD -or -iname *.jpeg -or -iname *.jpg -or -iname *.ppm -or -iname *.gif -or -iname *.tiff -or -iname *.xwd -or -iname *.bmp -or -iname *.png -or -iname *.webp > $base/Slideshow.list
      fi
      /usr/bin/fbi -a -t 5 -u --noverbose -l $base/Slideshow.list
      sudo killall joy2key.py
      

      ##Same as above except an removed '-u' random switch##
      create file with linux executable permission (sudo chmod +x) /home/pi/RetroPie/roms/photos/+Start Slideshow.sh

      /opt/retropie/configs/photos/joy2key.sh &
      base=/home/pi/RetroPie/roms/photos
      if [ ! -f $base/Slideshow.list ]; then
        find $base -iname *.PhotoCD -or -iname *.jpeg -or -iname *.jpg -or -iname *.ppm -or -iname *.gif -or -iname *.tiff -or -iname *.xwd -or -iname *.bmp -or -iname *.png -or -iname *.webp > $base/Slideshow.list
      fi
      /usr/bin/fbi -a -t 5 --noverbose -l $base/Slideshow.list
      sudo killall joy2key.py
      

      ##same as the 2 above except removed "if" statement##

      create file with linux executable permission (sudo chmod +x) /home/pi/RetroPie/roms/photos/+Start New Random Slideshow.sh

      /opt/retropie/configs/photos/joy2key.sh &
      base=/home/pi/RetroPie/roms/photos
      find $base -iname *.PhotoCD -or -iname *.jpeg -or -iname *.jpg -or -iname *.ppm -or -iname *.gif -or -iname *.tiff -or -iname *.xwd -or -iname *.bmp -or -iname *.png -or -iname *.webp > $base/Slideshow.list
      /usr/bin/fbi -a -t 5 -u --noverbose -l $base/Slideshow.list
      sudo killall joy2key.py
      

      ##Same as above except an removed '-u' random switch##
      create file with linux executable permission (sudo chmod +x) /home/pi/RetroPie/roms/photos/+Start New Slideshow.sh

      /opt/retropie/configs/photos/joy2key.sh &
      base=/home/pi/RetroPie/roms/photos
      find $base -iname *.PhotoCD -or -iname *.jpeg -or -iname *.jpg -or -iname *.ppm -or -iname *.gif -or -iname *.tiff -or -iname *.xwd -or -iname *.bmp -or -iname *.png -or -iname *.webp > $base/Slideshow.list
      /usr/bin/fbi -a -t 5 --noverbose -l $base/Slideshow.list
      sudo killall joy2key.py
      

      That's it restart emulation station with some music, videos, photos or comics and it should work.

      Notes:
      If something is played in the background there is no way to stop it (I tried several solutions to make a way to no avail for example fg, killall and echo "" > /dev/proc/1234/fd/0"

      You can change "-t 5" to a different number to change the slideshow delay.

      I can't figure out how how to get joy2key to map to the arrow control keys which would allow scrolling in fbi.

      This establishes music, video, photos and comics as theme categories which just show up as text; future themes could define specific images to use.

      For music and video the the controller keymap is:
      Up: Volume Up
      Down: Volume Down
      Left: Rewind
      Right: Fast Forward
      South Button: Pause/Unpause
      East Button: Quit
      North Button: Chapter Skip Forward
      West Button: Chapter Skip Back

      For photos and comics the the controller keymap is:
      Up: Zoom In
      Down: Zoom Out
      Left: Previous Image
      Right: Pan Down/Next Image
      South Button: Pause/Unpause
      East Button: Quit
      North Button: Display Photo Metadata
      West Button: Display Help

      (I would submit this to the github but the process of the setup script converting to the file image is too obtuse for me)

      UnknownU 1 Reply Last reply Reply Quote 1
      • UnknownU
        Unknown @Rydo
        last edited by

        @rydo you should try submitting this on GitHub. That is where posts like this are considered for adding.

        You can't beat the classics(unless you copy them).

        R 1 Reply Last reply Reply Quote 0
        • R
          Rydo @Unknown
          last edited by

          @unknown Do you know how/the link? Because I looked to do that but it seems like the image releases are built with a super complicated script system instead of just having the individual files hosted in a github project and I couldn't figure it out.

          UnknownU 1 Reply Last reply Reply Quote 1
          • UnknownU
            Unknown @Rydo
            last edited by

            @rydo I’m afraid not but I’m pretty sure YouTube would have a tutorial how to do it.

            You can't beat the classics(unless you copy them).

            D 1 Reply Last reply Reply Quote 0
            • D
              dmmarti @Unknown
              last edited by

              @Rydo

              Can I ask how you determined the following values?

              /dev/input/jsX 0x3C 0x3E 0x2B 0x2D 0x70 0x71 0x69 0x6F

              On a fresh RetroPie image using a wired Nintendo Switch controller, my button assignments do not match up to yours.

              My device name is:

              deviceName="BDA NSW wired controller"

              So I'm curious how you determined those hex values.

              Thanks,

              David

              R 1 Reply Last reply Reply Quote 1
              • R
                Rydo @dmmarti
                last edited by

                @dmmarti said in Music, Video, Photo & Comic Support (Submission):

                @Rydo

                Can I ask how you determined the following values?

                /dev/input/jsX 0x3C 0x3E 0x2B 0x2D 0x70 0x71 0x69 0x6F

                On a fresh RetroPie image using a wired Nintendo Switch controller, my button assignments do not match up to yours.

                My device name is:

                deviceName="BDA NSW wired controller"

                So I'm curious how you determined those hex values.

                Thanks,

                David

                The joy2key program is hard programed.
                /dev/input/jsX means it is applied to all Linux joystick.
                The hex escape codes are ansi keyboard codes for keypresses that overlay buttons in the order of 'left', 'right', 'up', 'down', 'a', 'b', 'x', 'y'

                0x3C 0x3E 0x2B 0x2D 0x70 0x71 0x69 0x6F

                I would suspect your buttons are backwards (Japanese style) so I would move the value around like this.

                0x3C 0x3E 0x2B 0x2D 0x71 0x70 0x6F 0x69

                1 Reply Last reply Reply Quote 1
                • ExarKunIvE ExarKunIv referenced this topic on
                • ExarKunIvE ExarKunIv referenced this topic on
                • ExarKunIvE ExarKunIv referenced this topic on
                • ExarKunIvE ExarKunIv referenced this topic on
                • ExarKunIvE ExarKunIv referenced this topic on
                • ExarKunIvE ExarKunIv referenced this topic on
                • ExarKunIvE ExarKunIv referenced this topic on
                • First post
                  Last post

                Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.