Home of the Squeezebox™ & Transporter® network music players.
Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 37
  1. #11
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    780
    Quote Originally Posted by sodface View Post
    GraphicsMagick webpage make it seem like GhostScript is an optional component
    It definitely is, it's a hard dependency only if you enable Display Postscript support.
    Normally, a ./configure script will detect what's available and simply disable optional stuff anyway (or fail with an error if a required package is unavailable)

    I tried to compile without GS loaded and also with a couple of different configure options, like --with-GhostScript=no
    --without-dps (which is the default if GhostScript isn't detected)

    On my setup, this works as expected, there are no errors / warnings.

    For reference, here's all the junk that gets pulled in with the GraphicsMagick.tcz from the official repo:
    One of the reason I prefer using Gentoo Linux - when installing a package, I can selectively enable / disable features (e.g. postscript support in this case), which means the package manager will only pull in the required packages:

    Code:
    * dependency graph for media-gfx/graphicsmagick-1.3.31
     `--  media-gfx/graphicsmagick-1.3.31  amd64 
       `--  dev-libs/libltdl-2.4.6  (dev-libs/libltdl) amd64 
       `--  media-libs/libpng-1.6.35-r1  (media-libs/libpng) ~amd64 
       `--  sys-libs/zlib-1.2.11-r2  (sys-libs/zlib) ~amd64 
       `--  media-libs/freetype-2.9.1-r4  (>=media-libs/freetype-2) ~amd64
    I compiled netpbm and have been testing with that over the last several days. It's mostly working. I figured I could just pick out the few tools I needed from it which would keep the footprint down. It's just a bit slow at the moment, like 4.5 seconds to wget, copy, blur, resize and composite into a single semi-transparent full screen image.
    netpbm is really old, haven't used it for decades...

    I think my wife's about to strangle me.

  2. #12
    Roland0, thanks again for the feedback, not sure how I missed the --without-dps, though I'm looking at my text editor where I'd pasted the output of ./configure --help and I don't see the option in there? I'll have to look at GM again. If I can get it down to as few dependencies as you show above then it's worth another look.

    Code:
    Optional Packages:
      --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
      --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
      --with-dmalloc          use dmalloc, as in http://www.dmalloc.com
      --with-pic[=PKGS]       try to use only PIC/non-PIC objects [default=use
                              both]
      --with-aix-soname=aix|svr4|both
                              shared library versioning (aka "SONAME") variant to
                              provide on AIX, [default=aix].
      --with-gnu-ld           assume the C compiler uses GNU ld [default=no]
      --with-sysroot[=DIR]    Search for dependent libraries within DIR (or the
                              compiler's sysroot if not specified).
      --with-html-dir=PATH    path to installed docs
      --with-expat=PREFIX     Use system Expat library
      --without-gsf           build without libgsf-1 (default: test)
      --without-fftw          build without fftw (default: test)
      --without-magick        build without libMagic (default: test)
      --with-magickpackage    magickpackage to use (default: MagickCore; try
                              GraphicsMagick to build against gm instead)
      --without-orc           build without orc (default: test)
      --without-lcms          build without lcms (default: test)
      --without-OpenEXR       build without OpenEXR (default: test)
      --without-nifti         build without nifti (default: test)
      --with-x                use the X Window System
      --with-nifti-includes=DIR
                              libniftiio includes are in DIR
      --with-nifti-libraries=DIR
                              libniftiio libraries are in DIR
      --without-pdfium        build without pdfium (default: test)
      --with-pdfium-includes=DIR
                              pdfium includes are in DIR
      --with-pdfium-libraries=DIR
                              pdfium libraries are in DIR
      --without-poppler       build without poppler (default: test)
      --without-rsvg          build without rsvg (default: test)
      --without-zlib          build without zlib (default: test)
      --with-zlib-includes=DIR
                              libz includes are in DIR
      --with-zlib-libraries=DIR
                              libz libraries are in DIR
      --without-openslide     build without OpenSlide (default: test)
    
      --without-matio         build without matio (default: test)
      --without-ppm           build without ppm (default: with)
      --without-analyze       build without analyze (default: with)
      --without-radiance      build without radiance (default: with)
      --without-cfitsio       build without cfitsio (default: test)
      --without-libwebp       build without libwebp (default: test)
      --with-libwebp-includes=DIR
                              libwebp includes are in DIR
      --with-libwebp-libraries=DIR
                              libwebp libraries are in DIR
      --without-pangoft2      build without pangoft2 (default: test)
      --without-tiff          build without libtiff (default: test)
      --with-tiff-includes=DIR
                              libtiff includes are in DIR
      --with-tiff-libraries=DIR
                              libtiff libraries are in DIR
      --without-giflib        build without giflib (default: test)
      --with-giflib-includes=DIR
                              giflib includes are in DIR
      --with-giflib-libraries=DIR
                              giflib libraries are in DIR
      --without-png           build without libpng (default: test)
      --with-png-includes=DIR libpng includes are in DIR
      --with-png-libraries=DIR
                              libpng libraries are in DIR
      --without-imagequant    build without imagequant (default: test)
      --without-jpeg          build without libjpeg (default: test)
      --with-jpeg-includes=DIR
                              libjpeg includes are in DIR
      --with-jpeg-libraries=DIR
                              libjpeg libraries are in DIR
      --without-libexif       build without libexif (default: test)
    I like the look of the blurred full screen background with cover art overlay, however, it looks terrible when the cover image is an odd sized png with transparency, which seems to be common with the internet radio stations. I'm thinking about treating pngs differently than jpegs, maybe something like below?? Still gotta work the song info text out! It's only been a month...
    Attached Images Attached Images  

  3. #13
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    780
    Quote Originally Posted by sodface View Post
    Roland0, thanks again for the feedback, not sure how I missed the --without-dps, though I'm looking at my text editor where I'd pasted the output of ./configure --help and I don't see the option in there? I'll have to look at GM again. If I can get it down to as few dependencies as you show above then it's worth another look.
    This doesn't seem to be GM's configure, maybe it's gmic's ?


    I like the look of the blurred full screen background with cover art overlay, however, it looks terrible when the cover image is an odd sized png with transparency, which seems to be common with the internet radio stations. I'm thinking about treating pngs differently than jpegs, maybe something like below?? Still gotta work the song info text out! It's only been a month...
    Here's a simple script including text.
    Needs jq, curl, imagemagick.
    Adjust hostname (raspi3-64:9000), player MAC (aa:bb:cc:dd:ee:ff), image size
    Code:
    #!/bin/bash
    
    function get_catt {
    	echo $CURR|jq .$1|sed -e "s#'#┬┤#g"|sed -e 's#"\(.*\)"#\1#g'
    }
    
    STATUS=$(curl -s -H "Content-Type: application/json" -X POST -d '{"id":1,"method":"slim.request","params":["aa:bb:cc:dd:ee:ff", ["status",0,999,"tags:acgltys"]]}' "http://raspi3-64:9000/jsonrpc.js")
    CI=$(echo ${STATUS}|jq '.result.playlist_cur_index | tonumber') 
    CURR=$(echo ${STATUS}|jq ".result.playlist_loop[$CI]")
    CTID=$(get_catt id)
    CAID=$(get_catt artist_id)
    
    curl -s -o - "http://raspi3-64:9000/music/current/cover_850x850_o"|convert -resize "x850" -background black -stroke blue -fill white -font DejaVu-Sans -pointsize 48 -gravity SouthEast -extent 1280x1080 -draw "gravity NorthWest text 10,10 '$(get_catt title) ($(get_catt year))' text 10,80 '$(get_catt album)' text 10,150 '$(get_catt artist)'"  - /tmp/lmsscreen.jpg
    If you install the Music and Artist Info plugin, you can get the artist picture like this:
    Code:
    curl -s -o /tmp/lmss-artist.jpg "http://raspi3-64:9000/imageproxy/mai/artist/$CAID/image_300x300_m"

    Name:  lss.jpg
Views: 94
Size:  23.1 KB
    Last edited by Roland0; 2018-11-30 at 14:50. Reason: added artist pic

  4. #14
    Quote Originally Posted by Roland0 View Post
    This doesn't seem to be GM's configure, maybe it's gmic's ?
    Shoot, no I think it was vips, sorry about that. I've compiled several versions each of IM, GM, NetPBM, Vips - I'm getting confused.



    Here's a simple script including text.
    Thanks, will review.

    If you install the Music and Artist Info plugin, you can get the artist picture like this:

    Is that for internet streams, local music or both?

    //oh, and regarding netpbm being old, while true, many of the tools have been updated very recently. The newer pam tools support transparency also which is a relatively recent addition apparently. I think I might stick with it a bit longer as I'm getting the hang of piecing the various tools together and ultimately I think it 'll be the most light weight solution. I'm probably needlessly hung up on that but that's what I liked about piCore to begin with.
    Last edited by sodface; 2018-11-30 at 16:59.

  5. #15
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    780
    Quote Originally Posted by sodface View Post
    Is that for internet streams, local music or both?
    local music yes, haven't tested streams

    //oh, and regarding netpbm being old, while true, many of the tools have been updated very recently. The newer pam tools support transparency also which is a relatively recent addition apparently. I think I might stick with it a bit longer as I'm getting the hang of piecing the various tools together and ultimately I think it 'll be the most light weight solution.
    iirc netpbm won't do text, so you'll need another package in any case. I'd assume GraphicsMagick will be the fastest / most light-weight solution (single call / one package for doing everything).

    Updated version (artist pic incl. caching - if you want to persist over reboots, change /dev/shm to something on SD card)
    Code:
    #!/bin/bash
    
    function get_catt {
    	echo $CURR|jq .$1|sed -e "s#'#┤#g"|sed -e 's#"\(.*\)"#\1#g'
    }
    
    STATUS=$(curl -s -H "Content-Type: application/json" -X POST -d '{"id":1,"method":"slim.request","params":["aa:bb:cc:dd:ee:ff", ["status",0,999,"tags:acgltys"]]}' "http://raspi3-64:9000/jsonrpc.js")
    CI=$(echo ${STATUS}|jq '.result.playlist_cur_index | tonumber') 
    CURR=$(echo ${STATUS}|jq ".result.playlist_loop[$CI]")
    CTID=$(get_catt id)
    CAID=$(get_catt artist_id)
    
    [ -f /dev/shm/lmss-artist.$CAID.png ] || curl -s -o /dev/shm/lmss-artist.$CAID.png "http://raspi3-64:9000/imageproxy/mai/artist/$CAID/image_300x300_m"
    
    curl -s -o - "http://raspi3-64:9000/music/current/cover_850x850_o"|convert -resize "x850" -antialias -background grey15 -stroke grey50 -fill white  -font Dosis-Medium -pointsize 48 -gravity SouthEast -extent 1600x1040 -gravity NorthWest -draw "text 10,10 '$(get_catt tracknum). $(get_catt title) ($(get_catt year))' text 10,80 '$(get_catt album)' text 10,150 '$(get_catt artist)'" -draw "image over 0,740 0,0 '/dev/shm/lmss-artist.$CAID.png'"  - '/dev/shm/lmsscreen.jpg'
    Name:  lmsscreen.jpg
Views: 72
Size:  19.4 KB

  6. #16
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    780
    cava is rather neat, but I think the ALSA contortions needed to get it to work with squeezelite are less than elegant. Since squeezelite can export visualization data, I've added native support for it in cava.
    Sources for an initial version are available here, the build process is the same except you have to pass --enable-shmem to configure.
    In your cava config, use
    Code:
    method = shmem
    source = /squeezelite-XX:XX:XX:XX:XX:XX
    and replace XX:XX:XX:XX:XX:XX with your player's MAC.
    Note you'll have to run squeezelite with the -v option.
    If you try it, I'd be interested to know if there are any differences to the ALSA version.

  7. #17
    Quote Originally Posted by Roland0
    iirc netpbm won't do text, so you'll need another package in any case.
    See screenshot below, text generated with netpbm tool "pbmtext".

    I'd assume GraphicsMagick will be the fastest / most light-weight solution (single call / one package for doing everything).
    I'm sure you are right about this but I'm invested in the netpbm solution and after much hair pulling have it working satisfactorily, albeit a little slow at generating the background @ 4 secs.

    Updated version (artist pic incl. caching - if you want to persist over reboots, change /dev/shm to something on SD card)
    How are you checking for song changes, or did I miss that? Are you polling for changes every few seconds?

    Since squeezelite can export visualization data, I've added native support for it in cava.
    Cool! I'll give it a shot!

    //edit - I have it built, will test, I like the idea - should make for a cleaner mod!
    Last edited by sodface; 2018-12-03 at 05:18.

  8. #18
    After many hours of beating my head against the wall about how to deal with png cover art, possibly with transparency, I backtracked and came up with a workaround. The problem I was having was that I was making the entire background semi-transparent so the linux console where cava was running could show through. That worked fine for cava but since the background had an alpha channel (transparency info) I had issues with trying to overlay a cover file (or internet radio station icon) that also was a png with an alpha channel - the netpbm pamcomp overlay tool has several options for dealing with transparency but I couldn't get the combination right no matter what I tried. I'd either get solid black in areas that were supposed to be transparent or I'd get the transparency areas correct but the overlay image would be subject to the background's semi-transparency making the cover overly dim also - not what I wanted!

    It occurred to me that I didn't really need the entire background to be transparent, only the lower third or so where cava is running. So that's how I'm dealing with it in the below screenshots. I start with a full screen background, cut the top two thirds off and dim it, overlay the cover art (full brightness), then put the bottom and top back together along with a transparency mask that leaves the top portion fully opaque and the lower third semi-transparent. The transparency level can be set in the config file.

    For the text, I'm copying the portion of the background image starting at the right edge of the cover and extending to the edge of the screen. Text is then composited over that and then the copied portion of the background with text is displayed over the background in the same position where it was copied from. That allows me to change just that area when a song changes and I can leave the background alone if it doesn't need to be changed.

    The expect script is updating the display on a song change event. Still have to do more work on the text portion.

    The first screen below shows my plan for dealing with a cover that is a png. I'm going to assume that it contains transparency and use a default background with the png scaled as required to the configured cover art dimensions. Basically, if I get anything other than a png, I'll do the blurred background version, and if it's a png I'll use a default background.

    The second screen shows some sample text. I think white will work for everything. Netpbm had a tool where I could sample the background image and determine whether it was lighter or darker. I thought it would be cool to detect that and then use either black or white text as necessary. Don't think I'll bother as dimming the background makes even white covers dark enough for white overlay text.

    The rest are just to show that you get a nice variety of backgrounds and colors as the covers change.
    Attached Images Attached Images     

  9. #19
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    780
    Quote Originally Posted by sodface View Post
    How are you checking for song changes, or did I miss that? Are you polling for changes every few seconds?
    Updated version
    - event-driven and caches screens
    - needs sexpect and netcat (I use netcat6 (nc6), others should work as well)
    - adjust the player MAC in the curl and in the two sexpect lines (the XXes)

    Code:
    #!/bin/bash
    
    CACHEDIR=/dev/shm
    
    function sighandler {
    	sexpect -sock $SEXPECT_SOCKFILE c
    	sexpect -sock $SEXPECT_SOCKFILE w > /dev/null
    	exit 0
    }
    
    function get_catt {
    	echo $CURR|jq .$1|sed -e "s#'#┤#g"|sed -e 's#"\(.*\)"#\1#g'
    }
    
    export SEXPECT_SOCKFILE=/tmp/sx-lms.sock
    trap "sighandler" 2
    sexpect sp bash -c 'echo "XX%3AXX%3AXX%3AXX%3AXX%3AXX subscribe playlist newsong"|nc6 raspi3-64 9090'
    [[ $? -ne 0 ]] && { echo "sexpect error"; sighandler; }
    
    echo "0" > $CACHEDIR/TID-CURR.txt
    
    while true; do
    	[[ "$(<$CACHEDIR/TID-CURR.txt)" -eq "0" ]] || sexpect x -re ".*XX playlist newsong.*" > /dev/null
    	STATUS=$(curl -s -H "Content-Type: application/json" -X POST -d '{"id":1,"method":"slim.request","params":["XX:XX:XX:XX:XX:XX", ["status",0,999,"tags:acgltys"]]}' "http://raspi3-64:9000/jsonrpc.js")
    	CI=$(echo ${STATUS}|jq '.result.playlist_cur_index | tonumber') 
    	CURR=$(echo ${STATUS}|jq ".result.playlist_loop[$CI]")
    	CTID=$(get_catt id)
    	[[ -z "$CTID" || "$(<$CACHEDIR/TID-CURR.txt)" -eq "$CTID" ]] && continue
    	if [ ! -f $CACHEDIR/screen.$CTID.png ]; then
    		CAID=$(get_catt artist_id)
    		[ -f $CACHEDIR/artist.$CAID.png ] || curl -s -o $CACHEDIR/artist.$CAID.png "http://raspi3-64:9000/imageproxy/mai/artist/$CAID/image_300x300_m"
    	
    		curl -s -o - "http://raspi3-64:9000/music/current/cover_850x850_o"|convert -resize "x850" -antialias -background grey15 -stroke grey50 -fill white  -font Dosis-Medium -pointsize 48 -gravity SouthEast -extent 1600x1040 -gravity NorthWest -draw "text 10,10 '$(get_catt tracknum). $(get_catt title) ($(get_catt year))' text 10,80 '$(get_catt album)' text 10,150 '$(get_catt artist)'" -draw "image over 0,740 0,0 '$CACHEDIR/artist.$CAID.png'"  - "$CACHEDIR/screen.$CTID.png"
    	fi
    	echo "$CTID" > $CACHEDIR/TID-CURR.txt
    	display "$CACHEDIR/screen.$CTID.png" &
    done

  10. #20
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    1,505
    Can't tell you how many times I wanted to use something like expect, but never wanted the baggage of other languages. Thanks for that link.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •